Please nominate your Qt Champions for 2021! https://forum.qt.io/topic/132134/looking-for-the-2021-qt-champions
[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?
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
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);@
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.
Can you explain a bit more wat you want? Did you use a layout?
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.
Great you solved it!
Could you edit your title and add [solved] in front of it?