pythonpyqtqcomboboxqpushbuttonqdate

PyQt: display QPushButton that looks like the down-arrow button in QComboBox


In PyQt4, I want to present a QPushButton that looks like the down-arrow button in QComboBox. Feasible, and if so, how?

I don't need help getting my new widget-combination acting like a QComboBox (see below). I only want the QPushButton display/graphic to look like the down-arrow button in a QComboBox - and tips/code on how to overlay that graphic (especially if said graphic comes via a file) onto my own QPushButton.

More details, context:

I'm seeking to replace a QComboBox widget with a QLineEdit + QCalendarWidget, because QDateEdit isn't as customizable as I need (I think...). The thought is to place a QPushButton immediately adjacent (on the right-side) of the QLineEdit to make it things look like regular QComboBox as much as possible. Then said button will .exec_() the QCalendarWidget (which is technically wrapped by a QDialog).

Let me know if this doesn't make sense, and I can provide further or clarified context.


Solution

  • You can try a QToolButton with no text and the arrowType property set to Qt.DownArrow. eg: myqtoolbutton.setArrowType(Qt.DownArrow).