QToolButton icon scaled down on Windows - why?
-
As stated two times before, I am setting the icon sizes explicitly with setIconSize(QSize(32, 32)) ;-)
Edit: Setting the icon sizes after adding to the toolbar has no effect.
Also, this works ok on Mac OS. Only not on WIndows.
-
ah, ok ... I have thought you setIconSize by tool bar
but anyway I tested this and it works:
@
ui->setupUi(this);
QToolButton *button1 = new QToolButton;
QToolButton *button2 = new QToolButton;
QToolButton *button3 = new QToolButton;
QGroupBox *groupBox = new QGroupBox();
button1->setText("Button 1");
button1->setIconSize(QSize(32,32));
button1->setIcon(QIcon("test.ico"));
button2->setText("Button 2");
button3->setText("Button 3");
QHBoxLayout *hbox = new QHBoxLayout;
hbox->setContentsMargins(0, 0, 0, 0);
hbox ->addWidget(button1);
hbox ->addWidget(button2);
hbox ->addWidget(button3);
groupBox->setLayout(hbox);
ui->mainToolBar->addWidget(groupBox); @ -
NicuPopescu: And the icon is indeed shown as 32x32 and is not scaled down? What Qt version are you using? OS? I'm on 5.2 beta.
-
yes!
I tested with qt 5.1.1 mingw and qt 5.2.0 beta VS 2010 on Windows XP ... on both it's working fine -
Bingo - the QGroupBox did the trick. Thanks!
I'm not sure why it does a difference though. As you, I am adding the buttons to a QToolBar.
-
Sounds like it could be a Windows specific bug. Did you check on the "bug report system":http://bugreports.qt-project.org whether something like that was reported ?
-
I was not sure whether it was/is me that was on the wrong side of the street. A search for "windows qtoolbutton icon size" does not give any results.
-
Not necessarily, there can be regressions/subtle differences between platforms.
Then you can open a new report with a minimal compilable example that helps reproduce the behavior. Providing the link here would be a plus
-
Yes, a bug report seems appropriate. Looking closer, enclosing the QButtons in QGroupBox changes the look of the buttons. This is of course notable on the Mac as well.
-
-
Seems like it's a problem on Windows 7 as well. Added this to the bug report. I could sort of accept that this was a problem on XP only, but not across the whole Windows line as it seems. I'm wondering why no-one else notices things like this? Given the amount of bug reports from me alone regarding widgets (especially on the Mac), I'm gonna hit an email to Digia, having ranted basically everywhere else about the state of Widgets and desktop platforms to no avail. This is soooo frustrating!