Hi I would have a QLabel ( to show text in a status bar )
containing a small icon ( on the left size ) and some text on the right side.
Is possible ? Or should I create a new widget?
Best Regards,
Franco
Hi I would have a QLabel ( to show text in a status bar )
containing a small icon ( on the left size ) and some text on the right side.
Is possible ? Or should I create a new widget?
Best Regards,
Franco
Franco Amato
Which part of the StatusBar documentation was not clear, that I should explain here?Is possible ? Or should I create a new widget?
Last edited by high_flyer; 26th January 2011 at 19:13. Reason: fixed link to correct class
==========================signature=============== ==================
S.O.L.I.D principles (use them!):
https://en.wikipedia.org/wiki/SOLID_...iented_design)
Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.
Sorry I meant StatusBar of course.
Last edited by franco.amato; 26th January 2011 at 21:13.
Franco Amato
QLabel displays either an icon or text. You could:
- Use rich text for the label, e.g: label->setText("<img src=':/icon.png' /> Text of label"), and put the icon into the program resources.
- Create a QWidget subclass that contains two QLabels in a horizontal layout and exposes a setIcon() and setText() method.
- Create a custom widget with just-the-way-you-like-it paint() method.
franco.amato (26th January 2011)
Create a smaller icon
You can also set a height and/or width attribute on the img tag in the rich text option, but you get a scaled image which is often unsatisfying.
franco.amato (27th January 2011)
Bookmarks