QApplication: remove obsolete globalStrut functionality
Change-Id: If56873f86f5291264cac720f8db7dbd4db756f49 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
c0873b7832
commit
033d01bd6e
@ -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
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
};
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -350,7 +350,6 @@ QPointer<QWidget> 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;
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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<const QStyleOptionSlider *>(opt)) {
|
||||
int s = sb->orientation == Qt::Horizontal ?
|
||||
QApplication::globalStrut().height()
|
||||
: QApplication::globalStrut().width();
|
||||
ret = qMax(16, s);
|
||||
} else {
|
||||
if (qstyleoption_cast<const QStyleOptionSlider *>(opt))
|
||||
ret = 16;
|
||||
else
|
||||
ret = int(QStyleHelper::dpiScaled(16, opt));
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case PM_MaximumDragDistance:
|
||||
|
@ -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:
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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;
|
||||
|
@ -464,7 +464,7 @@ QSize QDial::minimumSizeHint() const
|
||||
|
||||
QSize QDial::sizeHint() const
|
||||
{
|
||||
return QSize(100, 100).expandedTo(QApplication::globalStrut());
|
||||
return QSize(100, 100);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -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);
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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();
|
||||
|
@ -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()
|
||||
|
@ -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());
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user