1

My Qt app, on OSX, has very weird QMessageBoxes.

All the messageboxes on OSX have very tiny fonts, compared to how they would look like in Windows. Also, the title does not show. Neither does the icon (in windows, the app icon is shown). The order of buttons and the default button is also different even though the order in which they were placed in the code is the same as in windows...

QMessageBox::critical(this, tr("Some Error"), tr("Cannot do what you want."));

if (QMessageBox::warning(this, tr("Some warning"),
    tr("I can't do what you ask, do %1 instead?").arg(alternative),
    QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{}

There are numerous such message boxes...

example

Oddly enough, the font in the second image was very small... but I clicked outside the program, and back in and the font refreshed to nice size...

example

is it possible to add a style sheet... and what to put in ? (I cannot place a fixed size since I think they should be able to resize)

Also rewriting each standard type message box, to create an object, set text, icons, fonts, sizes, will be a huge amount of work in a very large scale program... What about the title...

What are my options ? Is it possible perhaps to subclass somehow messageboxes in osx, so that I can define the desired behavior ? (And how would I deal with the very tiny font ?)

Under Windows and Linux I did not see this odd behavior. Using Qt 4.8, OSX 10.6-10.9

Thalia
  • 13,637
  • 22
  • 96
  • 190

1 Answers1

1

Asking questions is great, the suggested similar questions after posting are a wealth of information.

I found out how to fix the font from this answer. Oddly enough... the font size I used was the Application one: (my answer here for a related issue)

I still am trying to fix the missing title, though this answer helps me understand that the normal behavior in OS X is not to show a title... And this answer helps me figure what to do if I want to rewrite a few hundred message boxes to show their titles.

As for the default buttons... I would replace QMessageBox::Yes with

QMessageBox::Yes | QMessageBox::Default
Community
  • 1
  • 1
Thalia
  • 13,637
  • 22
  • 96
  • 190