[solved] Multiple Lines of text in QToolbox buttons
-
wrote on 31 Jul 2011, 04:07 last edited by
I would like to create an "accordian" type of box for messages and it looks like a QToolbox would be perfect. When I have messages comming in the user, I plan on adding the brief message to the button and then the user can press on the tool box button to get the complete message as well as a "Action Button" for the job the user needs to do. So if no message are pending for the user to address, there are no buttons in the toolbox. If there is just one message, then just one button and so forth.
However, some of my "brief" messages may be several lines long. Is is possible to increase the height of the individual buttons to make them all, say 3 lines long, instead of the just one line long as the default?
ken
-
wrote on 31 Jul 2011, 07:13 last edited by
if you use a QPushButton like this, you should get what you want. I adapted the example from the QDialogButtonBox docs.
@findButton = new QPushButton(tr("Find\ntesting\ntesting")); //watch the newline \n
findButton->setDefault(true);moreButton = new QPushButton(tr("&More;")); moreButton->setCheckable(true); moreButton->setAutoDefault(false); buttonBox = new QDialogButtonBox(Qt::Vertical); buttonBox->addButton(findButton, QDialogButtonBox::ActionRole); buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);@
-
wrote on 11 Aug 2011, 01:52 last edited by
OK, this works great.
How do I "dock" the Button box? Conceptually I would like to just have a this button box in the middle of a form with or without a small border like GroupBox.
-
wrote on 11 Aug 2011, 05:36 last edited by
Can you explain a bit more wat you want? Did you use a layout?
-
wrote on 13 Aug 2011, 20:10 last edited by
Thanks! The layout hint is what I needed. I used a formlayout with two columns. I put a push button on the left with either a ">" or a "V" icon in it depending if the message box was expanded or not. Then when the push button was pressed the push button would toggle and the amount of data in the label would change. Since I was using a formlayout, the items below/above would automatically adjust and it works great. With rich text in the label, I get everything I wanted.
Thanks again.
-
wrote on 14 Aug 2011, 01:42 last edited by
Great you solved it!
Could you edit your title and add [solved] in front of it?
[done -mariusg]