diff --git a/examples/network/torrent/mainwindow.cpp b/examples/network/torrent/mainwindow.cpp index c343ee81b9..9a322e53fc 100644 --- a/examples/network/torrent/mainwindow.cpp +++ b/examples/network/torrent/mainwindow.cpp @@ -224,8 +224,7 @@ QSize MainWindow::sizeHint() const for (int i = 0; i < header->count() - 1; ++i) width += header->sectionSize(i); - return QSize(width, QMainWindow::sizeHint().height()) - .expandedTo(QApplication::globalStrut()); + return QSize(width, QMainWindow::sizeHint().height()); } const TorrentClient *MainWindow::clientForRow(int row) const diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 3b52ba8992..488b1da405 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -2502,7 +2502,7 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW ret = 4; break; case PM_SplitterWidth: - ret = qMax(7, QApplication::globalStrut().width()); + ret = 7; break; case PM_LayoutLeftMargin: case PM_LayoutTopMargin: diff --git a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp index c7ed8909bc..67198e701c 100644 --- a/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp +++ b/src/plugins/styles/windowsvista/qwindowsxpstyle.cpp @@ -3255,8 +3255,7 @@ int QWindowsXPStyle::pixelMetric(PixelMetric pm, const QStyleOption *option, con break; case PM_SplitterWidth: - res = qMax(int(QStyleHelper::dpiScaled(5., option)), - QApplication::globalStrut().width()); + res = QStyleHelper::dpiScaled(5., option); break; case PM_MdiSubWindowMinimizedWidth: diff --git a/src/widgets/dialogs/qmessagebox.cpp b/src/widgets/dialogs/qmessagebox.cpp index 4e7a4a65e3..c24c553e23 100644 --- a/src/widgets/dialogs/qmessagebox.cpp +++ b/src/widgets/dialogs/qmessagebox.cpp @@ -182,12 +182,10 @@ public: const QFontMetrics fm = fontMetrics(); opt.text = label(ShowLabel); QSize sz = fm.size(Qt::TextShowMnemonic, opt.text); - QSize ret = style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). - expandedTo(QApplication::globalStrut()); + QSize ret = style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this); opt.text = label(HideLabel); sz = fm.size(Qt::TextShowMnemonic, opt.text); - ret = ret.expandedTo(style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this). - expandedTo(QApplication::globalStrut())); + ret = ret.expandedTo(style()->sizeFromContents(QStyle::CT_PushButton, &opt, sz, this)); return ret; } }; diff --git a/src/widgets/itemviews/qheaderview.cpp b/src/widgets/itemviews/qheaderview.cpp index 84e2fd72a9..bd79710b05 100644 --- a/src/widgets/itemviews/qheaderview.cpp +++ b/src/widgets/itemviews/qheaderview.cpp @@ -1570,8 +1570,7 @@ void QHeaderView::resetDefaultSectionSize() \brief the minimum size of the header sections. The minimum section size is the smallest section size allowed. If the - minimum section size is set to -1, QHeaderView will use the maximum of - the \l{QApplication::globalStrut()}{global strut} or the + minimum section size is set to -1, QHeaderView will use the \l{fontMetrics()}{font metrics} size. This property is honored by all \l{ResizeMode}{resize modes}. @@ -1582,11 +1581,10 @@ int QHeaderView::minimumSectionSize() const { Q_D(const QHeaderView); if (d->minimumSectionSize == -1) { - QSize strut = QApplication::globalStrut(); int margin = 2 * style()->pixelMetric(QStyle::PM_HeaderMargin, nullptr, this); if (d->orientation == Qt::Horizontal) - return qMax(strut.width(), (fontMetrics().maxWidth() + margin)); - return qMax(strut.height(), (fontMetrics().height() + margin)); + return fontMetrics().maxWidth() + margin; + return fontMetrics().height() + margin; } return d->minimumSectionSize; } diff --git a/src/widgets/itemviews/qitemeditorfactory.cpp b/src/widgets/itemviews/qitemeditorfactory.cpp index fe9b482122..b29fd373bc 100644 --- a/src/widgets/itemviews/qitemeditorfactory.cpp +++ b/src/widgets/itemviews/qitemeditorfactory.cpp @@ -577,8 +577,7 @@ void QExpandingLineEdit::updateMinimumWidth() QStyleOptionFrame opt; initStyleOption(&opt); - int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, 0). - expandedTo(QApplication::globalStrut()), this).width(); + int minWidth = style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(width, 0), this).width(); setMinimumWidth(minWidth); } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 3f2c15b739..029be25620 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -350,7 +350,6 @@ QPointer QApplicationPrivate::wheel_widget; #endif bool qt_in_tab_key_event = false; int qt_antialiasing_threshold = -1; -QSize QApplicationPrivate::app_strut = QSize(0,0); // no default application strut int QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect; bool QApplicationPrivate::widgetCount = false; #ifdef QT_KEYPAD_NAVIGATION @@ -741,7 +740,6 @@ QApplication::~QApplication() QApplicationPrivate::obey_desktop_settings = true; - QApplicationPrivate::app_strut = QSize(0, 0); QApplicationPrivate::enabledAnimations = QPlatformTheme::GeneralUiEffect; QApplicationPrivate::widgetCount = false; @@ -1101,32 +1099,6 @@ QStyle* QApplication::setStyle(const QString& style) return s; } -/*! - \property QApplication::globalStrut - \brief the minimum size that any GUI element that the user can interact - with should have - \deprecated - - For example, no button should be resized to be smaller than the global - strut size. The strut size should be considered when reimplementing GUI - controls that may be used on touch-screens or similar I/O devices. - - Example: - - \snippet code/src_gui_kernel_qapplication.cpp 3 - - By default, this property contains a QSize object with zero width and height. -*/ -QSize QApplication::globalStrut() -{ - return QApplicationPrivate::app_strut; -} - -void QApplication::setGlobalStrut(const QSize& strut) -{ - QApplicationPrivate::app_strut = strut; -} - // Widget specific palettes QApplicationPrivate::PaletteHash QApplicationPrivate::widgetPalettes; diff --git a/src/widgets/kernel/qapplication.h b/src/widgets/kernel/qapplication.h index 594c7bbead..974c789e08 100644 --- a/src/widgets/kernel/qapplication.h +++ b/src/widgets/kernel/qapplication.h @@ -76,9 +76,6 @@ class Q_WIDGETS_EXPORT QApplication : public QGuiApplication Q_PROPERTY(int keyboardInputInterval READ keyboardInputInterval WRITE setKeyboardInputInterval) #if QT_CONFIG(wheelevent) Q_PROPERTY(int wheelScrollLines READ wheelScrollLines WRITE setWheelScrollLines) -#endif -#if QT_DEPRECATED_SINCE(5, 15) - Q_PROPERTY(QSize globalStrut READ globalStrut WRITE setGlobalStrut) #endif Q_PROPERTY(int startDragTime READ startDragTime WRITE setStartDragTime) Q_PROPERTY(int startDragDistance READ startDragDistance WRITE setStartDragDistance) @@ -142,10 +139,6 @@ public: static void setWheelScrollLines(int); static int wheelScrollLines(); #endif -#if QT_DEPRECATED_SINCE(5, 15) - static void setGlobalStrut(const QSize &); - static QSize globalStrut(); -#endif static void setStartDragTime(int ms); static int startDragTime(); diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 45ac6712b4..cb2a620aa8 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -2938,7 +2938,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_TabBarScrollLeftButton: { const bool vertical = opt->rect.width() < opt->rect.height(); const Qt::LayoutDirection ld = widget->layoutDirection(); - const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget), QApplication::globalStrut().width()); + const int buttonWidth = proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget); const int buttonOverlap = proxy()->pixelMetric(QStyle::PM_TabBar_ScrollButtonOverlap, nullptr, widget); r = vertical ? QRect(0, opt->rect.height() - (buttonWidth * 2) + buttonOverlap, opt->rect.width(), buttonWidth) @@ -2947,7 +2947,7 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt, case SE_TabBarScrollRightButton: { const bool vertical = opt->rect.width() < opt->rect.height(); const Qt::LayoutDirection ld = widget->layoutDirection(); - const int buttonWidth = qMax(proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget), QApplication::globalStrut().width()); + const int buttonWidth = proxy()->pixelMetric(QStyle::PM_TabBarScrollButtonWidth, nullptr, widget); r = vertical ? QRect(0, opt->rect.height() - buttonWidth, opt->rect.width(), buttonWidth) : QStyle::visualRect(ld, opt->rect, QRect(opt->rect.width() - buttonWidth, 0, buttonWidth, opt->rect.height())); @@ -4192,7 +4192,6 @@ QRect QCommonStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex bs.setHeight(qMax(8, spinbox->rect.height()/2 - fw)); // 1.6 -approximate golden mean bs.setWidth(qMax(16, qMin(bs.height() * 8 / 5, spinbox->rect.width() / 4))); - bs = bs.expandedTo(QApplication::globalStrut()); int y = fw + spinbox->rect.y(); int x, lx, rx; x = spinbox->rect.x() + spinbox->rect.width() - fw - bs.width(); @@ -4589,14 +4588,10 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid #if QT_CONFIG(scrollbar) case PM_ScrollBarExtent: - if (const QStyleOptionSlider *sb = qstyleoption_cast(opt)) { - int s = sb->orientation == Qt::Horizontal ? - QApplication::globalStrut().height() - : QApplication::globalStrut().width(); - ret = qMax(16, s); - } else { + if (qstyleoption_cast(opt)) + ret = 16; + else ret = int(QStyleHelper::dpiScaled(16, opt)); - } break; #endif case PM_MaximumDragDistance: diff --git a/src/widgets/styles/qwindowsstyle.cpp b/src/widgets/styles/qwindowsstyle.cpp index e275e3a714..6c7ea3740e 100644 --- a/src/widgets/styles/qwindowsstyle.cpp +++ b/src/widgets/styles/qwindowsstyle.cpp @@ -481,7 +481,7 @@ int QWindowsStyle::pixelMetric(PixelMetric pm, const QStyleOption *opt, const QW break; case PM_SplitterWidth: - ret = qMax(int(QStyleHelper::dpiScaled(4, opt)), QApplication::globalStrut().width()); + ret = QStyleHelper::dpiScaled(4, opt); break; default: diff --git a/src/widgets/widgets/qabstractspinbox.cpp b/src/widgets/widgets/qabstractspinbox.cpp index 04176ab5e2..8f9e06eeb8 100644 --- a/src/widgets/widgets/qabstractspinbox.cpp +++ b/src/widgets/widgets/qabstractspinbox.cpp @@ -924,8 +924,7 @@ QSize QAbstractSpinBox::sizeHint() const QStyleOptionSpinBox opt; initStyleOption(&opt); QSize hint(w, h); - d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) - .expandedTo(QApplication::globalStrut()); + d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this); } return d->cachedSizeHint; } @@ -966,8 +965,7 @@ QSize QAbstractSpinBox::minimumSizeHint() const initStyleOption(&opt); QSize hint(w, h); - d->cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) - .expandedTo(QApplication::globalStrut()); + d->cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this); } return d->cachedMinimumSizeHint; } diff --git a/src/widgets/widgets/qcheckbox.cpp b/src/widgets/widgets/qcheckbox.cpp index 81bfd3af35..b06ae82249 100644 --- a/src/widgets/widgets/qcheckbox.cpp +++ b/src/widgets/widgets/qcheckbox.cpp @@ -292,8 +292,7 @@ QSize QCheckBox::sizeHint() const text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); - d->sizeHint = (style()->sizeFromContents(QStyle::CT_CheckBox, &opt, sz, this) - .expandedTo(QApplication::globalStrut())); + d->sizeHint = style()->sizeFromContents(QStyle::CT_CheckBox, &opt, sz, this); return d->sizeHint; } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 8f195381e4..a854ce2cb8 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -439,7 +439,7 @@ QSize QComboBoxPrivate::recomputeSizeHint(QSize &sh) const q->initStyleOption(&opt); sh = q->style()->sizeFromContents(QStyle::CT_ComboBox, &opt, sh, q); } - return sh.expandedTo(QApplication::globalStrut()); + return sh; } void QComboBoxPrivate::adjustComboBoxSize() diff --git a/src/widgets/widgets/qdatetimeedit.cpp b/src/widgets/widgets/qdatetimeedit.cpp index 16705be1ff..f1db87f414 100644 --- a/src/widgets/widgets/qdatetimeedit.cpp +++ b/src/widgets/widgets/qdatetimeedit.cpp @@ -1051,8 +1051,7 @@ QSize QDateTimeEdit::sizeHint() const { QStyleOptionSpinBox opt; initStyleOption(&opt); - d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this) - .expandedTo(QApplication::globalStrut()); + d->cachedSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this); } d->cachedMinimumSizeHint = d->cachedSizeHint; diff --git a/src/widgets/widgets/qdial.cpp b/src/widgets/widgets/qdial.cpp index 25d57970bf..7dd469faae 100644 --- a/src/widgets/widgets/qdial.cpp +++ b/src/widgets/widgets/qdial.cpp @@ -464,7 +464,7 @@ QSize QDial::minimumSizeHint() const QSize QDial::sizeHint() const { - return QSize(100, 100).expandedTo(QApplication::globalStrut()); + return QSize(100, 100); } /*! diff --git a/src/widgets/widgets/qlineedit.cpp b/src/widgets/widgets/qlineedit.cpp index 055412528f..8b8a6b3208 100644 --- a/src/widgets/widgets/qlineedit.cpp +++ b/src/widgets/widgets/qlineedit.cpp @@ -703,8 +703,7 @@ QSize QLineEdit::sizeHint() const + d->leftmargin + d->rightmargin; // "some" QStyleOptionFrame opt; initStyleOption(&opt); - return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). - expandedTo(QApplication::globalStrut()), this)); + return style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h), this); } @@ -728,8 +727,7 @@ QSize QLineEdit::minimumSizeHint() const + d->leftmargin + d->rightmargin; QStyleOptionFrame opt; initStyleOption(&opt); - return (style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h). - expandedTo(QApplication::globalStrut()), this)); + return style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(w, h), this); } diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index da6eb47372..713c5f3d75 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -1751,7 +1751,7 @@ QSize QMdiArea::sizeHint() const continue; size = size.expandedTo(child->sizeHint()); } - return size.expandedTo(QApplication::globalStrut()); + return size; } /*! @@ -1770,7 +1770,7 @@ QSize QMdiArea::minimumSizeHint() const size = size.expandedTo(child->minimumSizeHint()); } } - return size.expandedTo(QApplication::globalStrut()); + return size; } /*! diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index f8460a4718..f68f46a7f1 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -3516,7 +3516,7 @@ QSize QMdiSubWindow::minimumSizeHint() const minHeight = qMax(minHeight, decorationHeight + sizeGripHeight); #endif - return QSize(minWidth, minHeight).expandedTo(QApplication::globalStrut()); + return QSize(minWidth, minHeight); } QT_END_NAMESPACE diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 31a7ad8695..86bc3d69be 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -307,7 +307,7 @@ QPlatformMenuItem * QMenuPrivate::insertActionInPlatformMenu(const QAction *acti int QMenuPrivate::scrollerHeight() const { Q_Q(const QMenu); - return qMax(QApplication::globalStrut().height(), q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, q)); + return q->style()->pixelMetric(QStyle::PM_MenuScrollerHeight, nullptr, q); } // Windows and KDE allow menus to cover the taskbar, while GNOME and macOS @@ -476,7 +476,7 @@ void QMenuPrivate::updateActionRects(const QRect &screen) const max_column_width += tabWidth; //finally add in the tab width if (!tornoff || (tornoff && scroll)) { // exclude non-scrollable tear-off menu since the tear-off menu has a fixed size - const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QApplication::globalStrut(), q).width() - QApplication::globalStrut().width(); + const int sfcMargin = style->sizeFromContents(QStyle::CT_Menu, &opt, QSize(0, 0), q).width(); const int min_column_width = q->minimumWidth() - (sfcMargin + leftmargin + rightmargin + 2 * (fw + hmargin)); max_column_width = qMax(min_column_width, max_column_width); } @@ -2308,8 +2308,7 @@ QSize QMenu::sizeHint() const s.rwidth() += style()->pixelMetric(QStyle::PM_MenuHMargin, &opt, this) + fw + d->rightmargin; s.rheight() += style()->pixelMetric(QStyle::PM_MenuVMargin, &opt, this) + fw + d->bottommargin; - return style()->sizeFromContents(QStyle::CT_Menu, &opt, - s.expandedTo(QApplication::globalStrut()), this); + return style()->sizeFromContents(QStyle::CT_Menu, &opt, s, this); } /*! diff --git a/src/widgets/widgets/qmenubar.cpp b/src/widgets/widgets/qmenubar.cpp index c8124468df..9122273d0d 100644 --- a/src/widgets/widgets/qmenubar.cpp +++ b/src/widgets/widgets/qmenubar.cpp @@ -1654,9 +1654,7 @@ QSize QMenuBar::minimumSizeHint() const opt.menuItemType = QStyleOptionMenuItem::Normal; opt.checkType = QStyleOptionMenuItem::NotCheckable; opt.palette = palette(); - return (style()->sizeFromContents(QStyle::CT_MenuBar, &opt, - ret.expandedTo(QApplication::globalStrut()), - this)); + return style()->sizeFromContents(QStyle::CT_MenuBar, &opt, ret, this); } return ret; } @@ -1707,9 +1705,7 @@ QSize QMenuBar::sizeHint() const opt.menuItemType = QStyleOptionMenuItem::Normal; opt.checkType = QStyleOptionMenuItem::NotCheckable; opt.palette = palette(); - return (style()->sizeFromContents(QStyle::CT_MenuBar, &opt, - ret.expandedTo(QApplication::globalStrut()), - this)); + return style()->sizeFromContents(QStyle::CT_MenuBar, &opt, ret, this); } return ret; } diff --git a/src/widgets/widgets/qpushbutton.cpp b/src/widgets/widgets/qpushbutton.cpp index 3d075bf92f..bb2848aa43 100644 --- a/src/widgets/widgets/qpushbutton.cpp +++ b/src/widgets/widgets/qpushbutton.cpp @@ -427,8 +427,7 @@ QSize QPushButton::sizeHint() const if (menu()) w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this); #endif - d->sizeHint = (style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(w, h), this). - expandedTo(QApplication::globalStrut())); + d->sizeHint = style()->sizeFromContents(QStyle::CT_PushButton, &opt, QSize(w, h), this); return d->sizeHint; } diff --git a/src/widgets/widgets/qradiobutton.cpp b/src/widgets/widgets/qradiobutton.cpp index fd8922ed28..103f3ac441 100644 --- a/src/widgets/widgets/qradiobutton.cpp +++ b/src/widgets/widgets/qradiobutton.cpp @@ -195,8 +195,7 @@ QSize QRadioButton::sizeHint() const false, text()).size(); if (!opt.icon.isNull()) sz = QSize(sz.width() + opt.iconSize.width() + 4, qMax(sz.height(), opt.iconSize.height())); - d->sizeHint = (style()->sizeFromContents(QStyle::CT_RadioButton, &opt, sz, this). - expandedTo(QApplication::globalStrut())); + d->sizeHint = style()->sizeFromContents(QStyle::CT_RadioButton, &opt, sz, this); return d->sizeHint; } diff --git a/src/widgets/widgets/qscrollbar.cpp b/src/widgets/widgets/qscrollbar.cpp index 2ce1d50c86..188ee7c25c 100644 --- a/src/widgets/widgets/qscrollbar.cpp +++ b/src/widgets/widgets/qscrollbar.cpp @@ -448,8 +448,7 @@ QSize QScrollBar::sizeHint() const else size = QSize(scrollBarExtent, scrollBarExtent * 2 + scrollBarSliderMin); - return style()->sizeFromContents(QStyle::CT_ScrollBar, &opt, size, this) - .expandedTo(QApplication::globalStrut()); + return style()->sizeFromContents(QStyle::CT_ScrollBar, &opt, size, this); } /*!\reimp */ diff --git a/src/widgets/widgets/qsizegrip.cpp b/src/widgets/widgets/qsizegrip.cpp index 95a4beeb57..68fd3ddce1 100644 --- a/src/widgets/widgets/qsizegrip.cpp +++ b/src/widgets/widgets/qsizegrip.cpp @@ -230,8 +230,7 @@ QSize QSizeGrip::sizeHint() const { QStyleOption opt(0); opt.init(this); - return (style()->sizeFromContents(QStyle::CT_SizeGrip, &opt, QSize(13, 13), this). - expandedTo(QApplication::globalStrut())); + return style()->sizeFromContents(QStyle::CT_SizeGrip, &opt, QSize(13, 13), this); } /*! diff --git a/src/widgets/widgets/qslider.cpp b/src/widgets/widgets/qslider.cpp index 161e4ba27a..7008da32b5 100644 --- a/src/widgets/widgets/qslider.cpp +++ b/src/widgets/widgets/qslider.cpp @@ -472,7 +472,7 @@ QSize QSlider::sizeHint() const w = SliderLength; h = thick; } - return style()->sizeFromContents(QStyle::CT_Slider, &opt, QSize(w, h), this).expandedTo(QApplication::globalStrut()); + return style()->sizeFromContents(QStyle::CT_Slider, &opt, QSize(w, h), this); } /*! diff --git a/src/widgets/widgets/qsplitter.cpp b/src/widgets/widgets/qsplitter.cpp index 090aa5cc8b..f0ea068edd 100644 --- a/src/widgets/widgets/qsplitter.cpp +++ b/src/widgets/widgets/qsplitter.cpp @@ -230,8 +230,7 @@ QSize QSplitterHandle::sizeHint() const QStyleOption opt(0); opt.init(d->s); opt.state = QStyle::State_None; - return parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s) - .expandedTo(QApplication::globalStrut()); + return parentWidget()->style()->sizeFromContents(QStyle::CT_Splitter, &opt, QSize(hw, hw), d->s); } /*! diff --git a/src/widgets/widgets/qtabbar.cpp b/src/widgets/widgets/qtabbar.cpp index 2cfae39b2a..57339ebd74 100644 --- a/src/widgets/widgets/qtabbar.cpp +++ b/src/widgets/widgets/qtabbar.cpp @@ -1502,8 +1502,7 @@ QSize QTabBar::sizeHint() const if (d->tabList.at(i).visible) r = r.united(d->tabList.at(i).maxRect); } - QSize sz = QApplication::globalStrut(); - return r.size().expandedTo(sz); + return r.size(); } /*!\reimp @@ -1519,7 +1518,7 @@ QSize QTabBar::minimumSizeHint() const if (d->tabList.at(i).visible) r = r.united(d->tabList.at(i).minRect); } - return r.size().expandedTo(QApplication::globalStrut()); + return r.size(); } if (verticalTabs(d->shape)) return QSize(sizeHint().width(), d->rightB->sizeHint().height() * 2 + 75); diff --git a/src/widgets/widgets/qtabwidget.cpp b/src/widgets/widgets/qtabwidget.cpp index a19dacda52..8885610e26 100644 --- a/src/widgets/widgets/qtabwidget.cpp +++ b/src/widgets/widgets/qtabwidget.cpp @@ -904,8 +904,7 @@ QSize QTabWidget::sizeHint() const QSize sz = basicSize(d->pos == North || d->pos == South, lc, rc, s, t); - return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) - .expandedTo(QApplication::globalStrut()); + return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this); } @@ -938,8 +937,7 @@ QSize QTabWidget::minimumSizeHint() const initStyleOption(&opt); opt.palette = palette(); opt.state = QStyle::State_None; - return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this) - .expandedTo(QApplication::globalStrut()); + return style()->sizeFromContents(QStyle::CT_TabWidget, &opt, sz, this); } /*! @@ -953,8 +951,7 @@ int QTabWidget::heightForWidth(int width) const opt.state = QStyle::State_None; QSize zero(0,0); - const QSize padding = style()->sizeFromContents(QStyle::CT_TabWidget, &opt, zero, this) - .expandedTo(QApplication::globalStrut()); + const QSize padding = style()->sizeFromContents(QStyle::CT_TabWidget, &opt, zero, this); QSize lc(0, 0), rc(0, 0); if (d->leftCornerWidget) @@ -984,7 +981,7 @@ int QTabWidget::heightForWidth(int width) const QSize s(stackWidth, stackHeight); QSize contentSize = basicSize(tabIsHorizontal, lc, rc, s, t); - return (contentSize + padding).expandedTo(QApplication::globalStrut()).height(); + return (contentSize + padding).height(); } diff --git a/src/widgets/widgets/qtoolbox.cpp b/src/widgets/widgets/qtoolbox.cpp index 4767394842..5500104afb 100644 --- a/src/widgets/widgets/qtoolbox.cpp +++ b/src/widgets/widgets/qtoolbox.cpp @@ -189,8 +189,7 @@ QSize QToolBoxButton::sizeHint() const } QSize textSize = fontMetrics().size(Qt::TextShowMnemonic, text()) + QSize(0, 8); - QSize total(iconSize.width() + textSize.width(), qMax(iconSize.height(), textSize.height())); - return total.expandedTo(QApplication::globalStrut()); + return QSize(iconSize.width() + textSize.width(), qMax(iconSize.height(), textSize.height())); } QSize QToolBoxButton::minimumSizeHint() const diff --git a/src/widgets/widgets/qtoolbutton.cpp b/src/widgets/widgets/qtoolbutton.cpp index cfa4782d78..410c326d51 100644 --- a/src/widgets/widgets/qtoolbutton.cpp +++ b/src/widgets/widgets/qtoolbutton.cpp @@ -369,8 +369,7 @@ QSize QToolButton::sizeHint() const if (d->popupMode == MenuButtonPopup) w += style()->pixelMetric(QStyle::PM_MenuButtonIndicator, &opt, this); - d->sizeHint = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, QSize(w, h), this). - expandedTo(QApplication::globalStrut()); + d->sizeHint = style()->sizeFromContents(QStyle::CT_ToolButton, &opt, QSize(w, h), this); return d->sizeHint; } diff --git a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp index 7da56ab797..4556101a6f 100644 --- a/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp +++ b/tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp @@ -3337,8 +3337,8 @@ void tst_QTreeWidget::task239150_editorWidth() QStyleOptionFrame opt; opt.init(&tree); - const int minWidth = tree.style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(0, 0). - expandedTo(QApplication::globalStrut()), nullptr).width(); + const int minWidth = tree.style()->sizeFromContents(QStyle::CT_LineEdit, &opt, QSize(0, 0) + , nullptr).width(); { QTreeWidgetItem item; diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 9ab7e4e315..59ea12ce70 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -2207,8 +2207,6 @@ void tst_QApplication::staticFunctions() QApplication::setActiveWindow(nullptr); QApplication::widgetAt(QPoint(0, 0)); QApplication::topLevelAt(QPoint(0, 0)); - QApplication::setGlobalStrut(QSize(0, 0)); - QApplication::globalStrut(); QApplication::isEffectEnabled(Qt::UI_General); QApplication::setEffectEnabled(Qt::UI_General, false); } diff --git a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp index 352a6314f3..068742f33f 100644 --- a/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp +++ b/tests/auto/widgets/widgets/qmdiarea/tst_qmdiarea.cpp @@ -886,7 +886,7 @@ void tst_QMdiArea::minimumSizeHint() QAbstractScrollArea dummyScrollArea; dummyScrollArea.setFrameStyle(QFrame::NoFrame); expectedSize = expectedSize.expandedTo(dummyScrollArea.minimumSizeHint()); - QCOMPARE(workspace.minimumSizeHint(), expectedSize.expandedTo(qApp->globalStrut())); + QCOMPARE(workspace.minimumSizeHint(), expectedSize); QWidget *window = workspace.addSubWindow(new QWidget); qApp->processEvents(); @@ -908,7 +908,7 @@ void tst_QMdiArea::sizeHint() workspace.show(); QSize desktopSize = QApplication::desktop()->size(); QSize expectedSize(desktopSize.width() * 2/3, desktopSize.height() * 2/3); - QCOMPARE(workspace.sizeHint(), expectedSize.expandedTo(qApp->globalStrut())); + QCOMPARE(workspace.sizeHint(), expectedSize); QWidget *window = workspace.addSubWindow(new QWidget); qApp->processEvents(); diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 1c19bf96d6..dfba506cf9 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -255,25 +255,33 @@ void tst_QMdiSubWindow::sizeHint() void tst_QMdiSubWindow::minimumSizeHint() { - const auto globalStrut = QApplication::globalStrut(); + class Widget : public QWidget + { + public: + Widget() = default; + + QSize minimumSizeHint() const + { + return QSize(100, 100); + } + + }; QMdiSubWindow window; window.setWindowTitle(QLatin1String(QTest::currentTestFunction())); window.show(); - QCOMPARE(window.minimumSizeHint(), globalStrut); + QCOMPARE(window.minimumSizeHint(), QSize(0, 0)); window.setWidget(new QWidget); - QCOMPARE(window.minimumSizeHint(), window.layout()->minimumSize() - .expandedTo(globalStrut)); + QCOMPARE(window.minimumSizeHint(), window.layout()->minimumSize()); delete window.widget(); delete window.layout(); - window.setWidget(new QWidget); - QCOMPARE(window.minimumSizeHint(), globalStrut); + window.setWidget(new Widget); + QCOMPARE(window.minimumSizeHint(), QSize(0, 0)); window.widget()->show(); - QCOMPARE(window.minimumSizeHint(), window.widget()->minimumSizeHint() - .expandedTo(globalStrut)); + QCOMPARE(window.minimumSizeHint(), window.widget()->minimumSizeHint()); } void tst_QMdiSubWindow::minimumSize() diff --git a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp index c07961f867..9ee239aceb 100644 --- a/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp +++ b/tests/auto/widgets/widgets/qmenu/tst_qmenu.cpp @@ -974,8 +974,7 @@ void tst_QMenu::menuSizeHint() QSize resSize = QSize(result.x(), result.y()) + result.size() + QSize(hmargin + cm.right() + panelWidth, vmargin + cm.top() + panelWidth); - resSize = menu.style()->sizeFromContents(QStyle::CT_Menu, &opt, - resSize.expandedTo(QApplication::globalStrut()), &menu); + resSize = menu.style()->sizeFromContents(QStyle::CT_Menu, &opt, resSize, &menu); QCOMPARE(resSize, menu.sizeHint()); } diff --git a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp index 90e89ff1d5..1638ac846f 100644 --- a/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp +++ b/tests/auto/widgets/widgets/qmenubar/tst_qmenubar.cpp @@ -1416,10 +1416,7 @@ void tst_QMenuBar::menubarSizeHint() QSize resSize = QSize(result.x(), result.y()) + result.size() + QSize(panelWidth + hmargin, panelWidth + vmargin); - - resSize = style.sizeFromContents(QStyle::CT_MenuBar, &opt, - resSize.expandedTo(QApplication::globalStrut()), - &mb); + resSize = style.sizeFromContents(QStyle::CT_MenuBar, &opt, resSize, &mb); QCOMPARE(resSize, mb.sizeHint()); }