[solved] Multiple Lines of text in QToolbox buttons
-
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
-
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);@
-
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.