QMessegeBox detailedText() change button label
-
Hello,
How can I change label of button Show Details.../Hide Details..., after setting detailed text property in QMessageBox class? -
Hi, welcome to devnet.
Although it's somewhat nonstandard behavior, you can do something like this:
auto buttons = box.buttons(); auto it = std::find_if(buttons.begin(), buttons.end(), [&](QAbstractButton* btn){ return box.buttonRole(btn) == QMessageBox::ActionRole; }); if(it != buttons.end()) (*it)->setText("Foo bar");
Note though that the text is set every time the button is clicked, so you might want to connect to the
clicked
signal of that button and change your text there.