QMessageBox buttons appearance
Hello,
I have a problem with button's appearance in QMessageBox class. When I run my app on Mac, all buttons on message box are higher (bigger vertically) than the buttons on all other applications on Mac. I understand that QPushButton has default maximum height and that max does not match the Mac's standard.
I would like to change the default maximum height in QMessageBox as well as in QProgressDialog. I tried to do that using style sheet, but it did not work. It works for my own forms though, but not for QMessageBox dialog.
Could somebody please give me some hints/suggestions which I can try to fix this problem.
Thanks in advance
Re: QMessageBox buttons appearance
How do you show the message box?
Re: QMessageBox buttons appearance
I just call static function like the following:
QMessageBox::warning(this, tr("My App"), tr("Please select files to copy."), MessageBox::Ok);
Re: QMessageBox buttons appearance
I see, what style sheet did you try?
Re: QMessageBox buttons appearance
QPushButton
{
max-height : 32px;
}
This supposed to set maximum height to all QPushButtons in my app and it did but only to buttons i use in my ui forms, but not to QMessageBox.
Re: QMessageBox buttons appearance
Could you check if this works on your system?
Code:
#include <QApplication>
#include <QMessageBox>
#include <QWidget>
#include <QTimer>
{
Q_OBJECT
public slots:
void test()
{
}
};
int main( int argc, char **argv )
{
app.setStyleSheet( "QPushButton { max-height: 8px; } " );
Test t;
t.show();
QTimer::singleShot( 1000,
&t,
SLOT(test
()) );
return app.exec();
}
#include "main.moc"
Re: QMessageBox buttons appearance
It did work. My problem was that I put the QPushButton style statement into the wrong place in my style sheet. Thanks you very much. Your example made me analyze what is wrong with my style sheet.:D Thanks A LOT.