Solved space around qbutton text
-
i create a custom qmsgbox like this:
QMessageBox msgBox; msgBox.setText("text"); msgBox.setWindowTitle("title"); const auto yesButton = msgBox.addButton(QObject::tr("Yes"), QMessageBox::YesRole); const auto noButton = msgBox.addButton(QObject::tr("No"), QMessageBox::NoRole);
the text of buttons, however, doesn't have left and right margins and i have to put spaces around Yes and No to make them look less ugly. any suggestions?
-
@user4592357
Button style like margins or whatever, instead of altering text? -
you cant setStyleSheet of the Buttons?
-
What OS ?
No such issue in Ubuntu and MacOS
Anyway, there's an extra margin around the box in OSX (in all Qt 5 versions as far as i know) -
Windows :D
-
@user4592357
Hi
what windows ?
This is win 10, Qt5.9(your code)
-
win10, qt5.6.2
hmm this is really weird. the actual text that i'm setting to the button is longer than the 'yes' and 'no' so that's the reason. i guess i need to set a width to the button
anyways, thanks for the help
-
@user4592357
Yep seems you are right if u use all space so buttons are expanded, then no extra space is added.