Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to show full text of QComboBox without resizing
I've a QcomboBox which should display the full text of current item when mouse is hovered on it. This should happen without resizing the QComboBox.
The solution that i can think of is to have a QLabel which can show rich text on QCombobox when mouse is hovered on it. I tried tooltips and they weren't visually appealing, so i thought of using QLabel.
But how can i do this, i mean how can i capture mouse hover event and display QLabel exactly on top of QcomboBox?
I'm new to GUI programmig & to Qt. Please share your ideas.
Hi and welcome to devnet,
Are you looking for something like QToolTip ?
I tried tool tip but it din't look that good visually,
So i want to have something which can show rich text & QLabel is what i thought of using.
Btw does tooltip allow text fromating & changing background colors & stuff like that.
But still tooltip is for small text & some of my items are dynamically changing which can be of large length at times.
Yes you can use rich text in tool tip, there's a link in the detailed description of the class for that.
How big can your items be ?
thanks for the quick replies @SGaist & i'll check that link in class detailed description now,
Well, some items of combo boxes have several object names so i can't guess how big that item is gonna be. I just want the user to be able to see all those object names when they hover mouse on QComboBox.
This is the reason i want to use something else like QLabel but i donno how to show exactly on top of combobox and this should work cross platform too.
Well, I'm happy with QToolTip. That means that i'll have a tool tip which displays full text of combobox currently selected item which changes with the current item.
Thanks to @SGaist .
You're welcome !
Since you have it working now please mark the thread as solved with the "Topic Tool" button so other forum users may know a solution has been found :)