https://bugs.kde.org/show_bug.cgi?id=386076

            Bug ID: 386076
           Summary: QToolButton is drawn incorectly when there are extra
                    size constraints
           Product: Breeze
           Version: 5.10.4
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: QStyle
          Assignee: hugo.pereira.da.co...@gmail.com
          Reporter: emd...@gmail.com
  Target Milestone: ---

There exist drawing issues when QToolButton has size constraint that prevents
it from using preferred size. 
Fusion only applies clipping while Breeze and Oxygen also draw icon in wrong
place.

It could be also considered if the style should try to fit text (using at least
part of space wasted directly under icon) or maybe even skip it when available
space allows to fit less than half height (or other factor) of the text (it's
probably better than clipping it, since it's unreadable anyway).

Example code, compare results when running using Fusion style or Breeze or
Oxygen.

        #include <QtWidgets/QApplication>
        #include <QtWidgets/QBoxLayout>
        #include <QtWidgets/QToolButton>

        int main(int argc, char *argv[])
        {
                QApplication application(argc, argv);
                QWidget widget;
                QToolButton normalToolButton(&widget);
                normalToolButton.setIcon(QIcon::fromTheme("text-html"));
                normalToolButton.setIconSize({64, 64});
                normalToolButton.setText("Some Text");
               
normalToolButton.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);

                QToolButton constrainedToolButton(&widget);
                constrainedToolButton.setIcon(QIcon::fromTheme("text-html"));
                constrainedToolButton.setIconSize({64, 64});
                constrainedToolButton.setText("Some Text");
               
constrainedToolButton.setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
                constrainedToolButton.setFixedSize({64, 72});

                QBoxLayout layout(QBoxLayout::TopToBottom, &widget);
                layout.addWidget(&normalToolButton);
                layout.addWidget(&constrainedToolButton);

                widget.show();

                return application.exec();
        }

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to