简体   繁体   中英

Qt's dialog box button size bug

In a QDialogButtonBox class object, its button sizes are reduced:

图片

While in other dialogs, the buttons look normal:

图片

Both dialogs were made through Qt's Designer Mode, with no additional code on my part concerning these QDialogButtonBox class objects.

Any ideas?

Unfortunately, I can't post the code to show it, however, all the QButtonDialogBox options and properties, regarding the size policy and everything else, were not changed in code, thus having default values from Qt Designer.

The end result is that, in some dialogues, it looks well, and, in others, it simply doesn't... (As images in the previous post show.)

Removing/adding/changing the layouts hasn't changed anything...

I tend to think that something is wrong in the application, but I cannot figure out what.

I solved this problem by:

  • Replacing QMessageBox::question call with QMessageBox object on stack.
  • Setting minumum size for the buttons in the QDialogButtonBox object in the code.

I've been setting stylesheets just a couple of times in the code, but it has nothing to do with QPushButton or QDialogButtonBox objects... mainly changing background-colors for QMenu objects etc.

If I figure out what was the issue, I'll be sure to post it here!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM