slobberchopz
24th December 2013, 07:41
For example, one widget I am trying to create is a mix of QToolButton and QLineEdit.
When leaveEvent() occurs, it appears like a QToolButton with the icon/text on the left & the menu-arrow on the right (QToolButton.MenuButtonPopup). When enterEvent() occurs, the left half of the button (icon/text) becomes a QLineEdit, while the right half is still a drop down menu.
I have been trawling through whatever forums google search brings up, and while I loosely understand how to paint it, how do I connect the events properly? If I paint the QLineEdit, how do I get that part of the custom widget to act and respond like a QLineEdit? (Python preferred, C++ is ok, also an example including the paint event would be even better ;)
[QComboBox will not work, and definitely the other widgets I'd like to create don't have any approximate equivalent. Also, I know I can build a widget with other simpler widgets, and then mess with the stylesheets to achieve something similar looking... but I know there is an answer to the above, because Qt does it, and it would have better cross-system styling then writing custom stylesheets and trying to figure out what to do to make it exactly the same..]
When leaveEvent() occurs, it appears like a QToolButton with the icon/text on the left & the menu-arrow on the right (QToolButton.MenuButtonPopup). When enterEvent() occurs, the left half of the button (icon/text) becomes a QLineEdit, while the right half is still a drop down menu.
I have been trawling through whatever forums google search brings up, and while I loosely understand how to paint it, how do I connect the events properly? If I paint the QLineEdit, how do I get that part of the custom widget to act and respond like a QLineEdit? (Python preferred, C++ is ok, also an example including the paint event would be even better ;)
[QComboBox will not work, and definitely the other widgets I'd like to create don't have any approximate equivalent. Also, I know I can build a widget with other simpler widgets, and then mess with the stylesheets to achieve something similar looking... but I know there is an answer to the above, because Qt does it, and it would have better cross-system styling then writing custom stylesheets and trying to figure out what to do to make it exactly the same..]