Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QToolButton icon scaled down on Windows - why?
Forum Updated to NodeBB v4.3 + New Features

QToolButton icon scaled down on Windows - why?

Scheduled Pinned Locked Moved General and Desktop
15 Posts 3 Posters 6.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    janfaroe
    wrote on last edited by
    #5

    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.

    1 Reply Last reply
    0
    • N Offline
      N Offline
      NicuPopescu
      wrote on last edited by
      #6

      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); @

      1 Reply Last reply
      0
      • J Offline
        J Offline
        janfaroe
        wrote on last edited by
        #7

        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.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          NicuPopescu
          wrote on last edited by
          #8

          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

          1 Reply Last reply
          0
          • J Offline
            J Offline
            janfaroe
            wrote on last edited by
            #9

            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.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #10

              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 ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • J Offline
                J Offline
                janfaroe
                wrote on last edited by
                #11

                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.

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #12

                  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

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    janfaroe
                    wrote on last edited by
                    #13

                    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.

                    1 Reply Last reply
                    0
                    • J Offline
                      J Offline
                      janfaroe
                      wrote on last edited by
                      #14

                      Done.

                      https://bugreports.qt-project.org/browse/QTBUG-35780

                      1 Reply Last reply
                      0
                      • J Offline
                        J Offline
                        janfaroe
                        wrote on last edited by
                        #15

                        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!

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved