Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Solved] Compress QLabel
moravas last edited by
Solve: I put a button on the widget, which show or hides the labels. I needed a rapid solution: it seems to be enough fast and pretty.
I have an UI app with some widgets, and I would like to place into that an QLabel. The label will display some formatted text, which is wrapped into several line. I would like the following: normaly, the QLabel should display only the first line of text. When the mouse points to the label, it should expand itself, so the whole text will be visible.
How can I set the this behavioral for the QLabel?
primem0ver last edited by
I am not an expert in Qt. In fact I am a beginner myself. However I have done similar things using .NET. After looking at the QLabel documentation my guess would create your own class that inherits QLabel and overrides the mouseMoveEvent method. In your override you could change the size and contents of the label as needed for your program. The documentation also suggests that this will not work unless you enable mouse tracking. You would have to research how to accomplish that.
IamSumit last edited by
Find some clue from following lilnk
hope it helps.