summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qstyle.cpp')
-rw-r--r--src/widgets/styles/qstyle.cpp226
1 files changed, 97 insertions, 129 deletions
diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp
index ec5b6df6b3..60b2f51e95 100644
--- a/src/widgets/styles/qstyle.cpp
+++ b/src/widgets/styles/qstyle.cpp
@@ -1,41 +1,5 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtWidgets module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
+// Copyright (C) 2016 The Qt Company Ltd.
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qstyle.h"
#include "qapplication.h"
@@ -64,7 +28,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
return 0;
// optimization: exactly one bit is set
- if ((controls & (controls - 1)) == 0) {
+ if (qPopulationCount(uint(controls)) == 1) {
array[0] = QSizePolicy::ControlType(uint(controls));
return 1;
}
@@ -91,7 +55,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
look of the different platforms supported by Qt (QWindowsStyle,
QMacStyle, etc.). These styles are built into the
Qt GUI module, other styles can be made available using Qt's
- plugin mechansim.
+ plugin mechanism.
Most functions for drawing style elements take four arguments:
@@ -285,9 +249,6 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
widget is a QSpinBox just because the enum value is called
PE_IndicatorSpinUp or PE_IndicatorSpinDown.
- The documentation for the \l{widgets/styles}{Styles} example
- covers this topic in more detail.
-
\warning Qt style sheets are currently not supported for custom QStyle
subclasses. We plan to address this in some future release.
@@ -372,7 +333,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
We include a small example where we customize the drawing of item
backgrounds.
- \snippet customviewstyle.cpp 0
+ \snippet customviewstyle/customviewstyle.cpp 0
The primitive element PE_PanelItemViewItem is responsible for
painting the background of items, and is called from
@@ -388,7 +349,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
The drawing of item view headers is also done by the style, giving
control over size of header items and row and column sizes.
- \sa QStyleOption, QStylePainter, {Styles Example},
+ \sa QStyleOption, QStylePainter,
{Styles and Style Aware Widgets}, QStyledItemDelegate, {Styling}
*/
@@ -412,6 +373,9 @@ QStyle::QStyle(QStylePrivate &dd)
{
Q_D(QStyle);
d->proxyStyle = this;
+ Q_STATIC_ASSERT_X(int(StandardPixmap::NStandardPixmap) ==
+ int(QPlatformTheme::StandardPixmap::NStandardPixmap),
+ "StandardPixmap in QPlatformTheme and QStyle out of sync");
}
/*!
@@ -422,6 +386,30 @@ QStyle::~QStyle()
}
/*!
+ Returns the name of the style.
+
+ This value can be used to create a style with QStyleFactory::create().
+
+ \sa QStyleFactory::create()
+ \since 6.1
+*/
+QString QStyle::name() const
+{
+ Q_D(const QStyle);
+ return d->name;
+}
+
+/*!
+ \internal
+ Set the style name
+*/
+void QStyle::setName(const QString &name)
+{
+ Q_D(QStyle);
+ d->name = name;
+}
+
+/*!
Initializes the appearance of the given \a widget.
This function is called for every widget at some point after it
@@ -549,8 +537,9 @@ QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pi
int x, y, w, h;
rect.getRect(&x, &y, &w, &h);
- const int pixmapWidth = pixmap.width()/pixmap.devicePixelRatio();
- const int pixmapHeight = pixmap.height()/pixmap.devicePixelRatio();
+ QSizeF pixmapSize = pixmap.deviceIndependentSize();
+ const int pixmapWidth = pixmapSize.width();
+ const int pixmapHeight = pixmapSize.height();
if ((alignment & Qt::AlignVCenter) == Qt::AlignVCenter)
y += h/2 - pixmapHeight/2;
@@ -560,7 +549,7 @@ QRect QStyle::itemPixmapRect(const QRect &rect, int alignment, const QPixmap &pi
x += w - pixmapWidth;
else if ((alignment & Qt::AlignHCenter) == Qt::AlignHCenter)
x += w/2 - pixmapWidth/2;
- else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QApplication::isRightToLeft())
+ else if ((alignment & Qt::AlignLeft) != Qt::AlignLeft && QGuiApplication::isRightToLeft())
x += w - pixmapWidth;
result = QRect(x, y, pixmapWidth, pixmapHeight);
return result;
@@ -624,10 +613,10 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
const QPixmap &pixmap) const
{
qreal scale = pixmap.devicePixelRatio();
- QRect aligned = alignedRect(QApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect);
+ QRect aligned = alignedRect(QGuiApplication::layoutDirection(), QFlag(alignment), pixmap.size() / scale, rect);
QRect inter = aligned.intersected(rect);
- painter->drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.x(), inter.y() - aligned.y(), inter.width() * scale, inter.height() *scale);
+ painter->drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.x(), inter.y() - aligned.y(), qRound(inter.width() * scale), qRound(inter.height() *scale));
}
/*!
@@ -637,9 +626,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
primitive element is a common GUI element, such as a checkbox
indicator or button bevel.
- \omitvalue PE_IndicatorViewItemCheck
- \value PE_FrameStatusBar Obsolete. Use PE_FrameStatusBarItem instead.
-
\value PE_PanelButtonCommand Button used to initiate an action, for
example, a QPushButton.
@@ -697,7 +683,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PE_IndicatorToolBarSeparator The separator in a toolbar.
\value PE_PanelToolBar The panel for a toolbar.
\value PE_PanelTipLabel The panel for a tip label.
- \value PE_FrameTabBarBase The frame that is drawn for a tab bar, ususally drawn for a tab bar that isn't part of a tab widget.
+ \value PE_FrameTabBarBase The frame that is drawn for a tab bar, usually drawn for a tab bar that isn't part of a tab widget.
\value PE_IndicatorTabTear Deprecated. Use \l{PE_IndicatorTabTearLeft} instead.
\value PE_IndicatorTabTearLeft An indicator that a tab is partially scrolled out on the left side of the visible tab bar when there are many tabs.
\value PE_IndicatorTabTearRight An indicator that a tab is partially scrolled out on the right side of the visible tab bar when there are many tabs.
@@ -1012,6 +998,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SE_PushButtonFocusRect Area for the focus rect (usually
larger than the contents rect).
\value SE_PushButtonLayoutItem Area that counts for the parent layout.
+ \value SE_PushButtonBevel [since 5.15] Area used for the bevel of the button.
\value SE_CheckBoxIndicator Area for the state indicator (e.g., check mark).
\value SE_CheckBoxContents Area for the label (text or pixmap).
@@ -1039,8 +1026,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SE_ProgressBarLabel Area for the text label.
\value SE_ProgressBarLayoutItem Area that counts for the parent layout.
- \omitvalue SE_ViewItemCheckIndicator
-
\value SE_FrameContents Area for a frame's contents.
\value SE_ShapedFrameContents Area for a frame's contents using the shape in QStyleOptionFrame; see QFrame
\value SE_FrameLayoutItem Area that counts for the parent layout.
@@ -1074,8 +1059,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SE_TreeViewDisclosureItem Area for the actual disclosure item in a tree branch.
- \value SE_DialogButtonBoxLayoutItem Area that counts for the parent layout.
-
\value SE_GroupBoxLayoutItem Area that counts for the parent layout.
\value SE_CustomBase Base value for custom sub-elements.
@@ -1120,6 +1103,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\header \li Sub Element \li QStyleOption Subclass
\row \li \l SE_PushButtonContents \li \l QStyleOptionButton
\row \li \l SE_PushButtonFocusRect \li \l QStyleOptionButton
+ \row \li \l SE_PushButtonBevel \li \l QStyleOptionButton
\row \li \l SE_CheckBoxIndicator \li \l QStyleOptionButton
\row \li \l SE_CheckBoxContents \li \l QStyleOptionButton
\row \li \l SE_CheckBoxFocusRect \li \l QStyleOptionButton
@@ -1358,9 +1342,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_SpinBoxFrameWidth Frame width of a spin box, defaults to PM_DefaultFrameWidth.
\value PM_ComboBoxFrameWidth Frame width of a combo box, defaults to PM_DefaultFrameWidth.
- \value PM_MDIFrameWidth Obsolete. Use PM_MdiSubWindowFrameWidth instead.
\value PM_MdiSubWindowFrameWidth Frame width of an MDI window.
- \value PM_MDIMinimizedWidth Obsolete. Use PM_MdiSubWindowMinimizedWidth instead.
\value PM_MdiSubWindowMinimizedWidth Width of a minimized MDI window.
\value PM_LayoutLeftMargin Default \l{QLayout::setContentsMargins()}{left margin} for a
@@ -1486,36 +1468,22 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value PM_SubMenuOverlap The horizontal overlap between a submenu and its parent.
- \value PM_TreeViewIndentation The indentation of items in a tree view.
- This enum value has been introduced in Qt 5.4.
+ \value [since 5.4] PM_TreeViewIndentation The indentation of items in a tree view.
\value PM_HeaderDefaultSectionSizeHorizontal The default size of sections
in a horizontal header. This enum value has been introduced in Qt 5.5.
\value PM_HeaderDefaultSectionSizeVertical The default size of sections
in a vertical header. This enum value has been introduced in Qt 5.5.
- \value PM_TitleBarButtonIconSize The size of button icons on a title bar.
- This enum value has been introduced in Qt 5.8.
- \value PM_TitleBarButtonSize The size of buttons on a title bar.
- This enum value has been introduced in Qt 5.8.
-
- \value PM_CustomBase Base value for custom pixel metrics. Custom
- values must be greater than this value.
+ \value [since 5.8] PM_TitleBarButtonIconSize The size of button icons on a title bar.
+ \value [since 5.8] PM_TitleBarButtonSize The size of buttons on a title bar.
- The following values are obsolete:
+ \value [since 6.2] PM_LineEditIconSize The default size for icons in a line edit.
- \value PM_DefaultTopLevelMargin Use PM_LayoutLeftMargin,
- PM_LayoutTopMargin,
- PM_LayoutRightMargin, and
- PM_LayoutBottomMargin instead.
- \value PM_DefaultChildMargin Use PM_LayoutLeftMargin,
- PM_LayoutTopMargin,
- PM_LayoutRightMargin, and
- PM_LayoutBottomMargin instead.
- \value PM_DefaultLayoutSpacing Use PM_LayoutHorizontalSpacing
- and PM_LayoutVerticalSpacing
- instead.
+ \value [since 6.3] PM_LineEditIconMargin The margin around icons in a line edit.
+ \value PM_CustomBase Base value for custom pixel metrics. Custom
+ values must be greater than this value.
\sa pixelMetric()
*/
@@ -1526,8 +1494,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
Returns the value of the given pixel \a metric.
The specified \a option and \a widget can be used for calculating
- the metric. In general, the \a widget argument is not used. The \a
- option can be cast to the appropriate type using the
+ the metric. The \a option can be cast to the appropriate type using the
qstyleoption_cast() function. Note that the \a option may be zero
even for PixelMetrics that can make use of it. See the table below
for the appropriate \a option casts:
@@ -1716,7 +1683,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
the line edit receives focus, as done on Windows.
\value SH_Menu_KeyboardSearch Typing causes a menu to be search
- for relevant items, otherwise only mnemnonic is considered.
+ for relevant items, otherwise only mnemonic is considered.
\value SH_Menu_AllowActiveAndDisabled Allows disabled menu
items to be active.
@@ -1794,7 +1761,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
cause a list view expansion to be selected.
\value SH_TabBar_PreferNoArrows Whether a tab bar should suggest a size
- to prevent scoll arrows.
+ to prevent scroll arrows.
\value SH_ComboBox_Popup Allows popups as a combobox drop-down
menu.
@@ -1806,9 +1773,6 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_TitleBar_NoBorder The title bar has no border.
- \value SH_ScrollBar_StopMouseOverSlider Obsolete. Use
- SH_Slider_StopMouseOverSlider instead.
-
\value SH_Slider_StopMouseOverSlider Stops auto-repeat when
the slider reaches the mouse position.
@@ -1835,13 +1799,10 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_LineEdit_PasswordMaskDelay Determines the delay before visible character is masked
with password character, in milliseconds. This enum value was added in Qt 5.4.
- \value SH_Table_GridLineColor The RGB value of the grid for a table.
+ \value SH_Table_GridLineColor The RGBA value of the grid for a table.
\value SH_UnderlineShortcut Whether shortcuts are underlined.
- \value SH_SpellCheckUnderlineStyle Obsolete. Use SpellCheckUnderlineStyle
- hint in QPlatformTheme instead.
-
\value SH_SpinBox_AnimateButton Animate a click when up or down is
pressed in a spin box.
\value SH_SpinBox_KeyPressAutoRepeatRate Auto-repeat interval for
@@ -1850,6 +1811,9 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
spinbox mouse clicks.
\value SH_SpinBox_ClickAutoRepeatThreshold Auto-repeat threshold for
spinbox mouse clicks.
+ \value [since 6.3] SH_SpinBox_SelectOnStep Whether changing the value using
+ the buttons or up/down keys automatically selects the text.
+
\value SH_ToolTipLabel_Opacity An integer indicating the opacity for
the tip label, 0 is completely transparent, 255 is completely
opaque.
@@ -2009,6 +1973,16 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
disables this feature.
This enum value has been introduced in Qt 5.12.
+ \value SH_TabBar_AllowWheelScrolling
+ Determines if the mouse wheel can be used to cycle through the tabs
+ of a QTabBar.
+ This enum value has been introduced in Qt 6.1.
+
+ \value SH_Table_AlwaysDrawLeftTopGridLines
+ Determines if the far left and top grid lines are drawn in a table or
+ not when the header is hidden. Defaults to false.
+ This enum value has been introduced in Qt 6.3.
+
\sa styleHint()
*/
@@ -2100,7 +2074,16 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SP_MediaSeekBackward Icon indicating that media should seek backward.
\value SP_MediaVolume Icon indicating a volume control.
\value SP_MediaVolumeMuted Icon indicating a muted volume control.
- \value SP_LineEditClearButton Icon for a standard clear button in a QLineEdit. This enum value was added in Qt 5.2.
+ \value [since 5.2] SP_LineEditClearButton Icon for a standard clear button in a QLineEdit.
+ \value [since 5.14] SP_DialogYesToAllButton Icon for a standard YesToAll button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogNoToAllButton Icon for a standard NoToAll button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogSaveAllButton Icon for a standard SaveAll button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogAbortButton Icon for a standard Abort button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogRetryButton Icon for a standard Retry button in a QDialogButtonBox.
+ \value [since 5.14] SP_DialogIgnoreButton Icon for a standard Ignore button in a QDialogButtonBox.
+ \value [since 5.14] SP_RestoreDefaultsButton Icon for a standard RestoreDefaults button in a QDialogButtonBox.
+ \value [since 6.3] SP_TabCloseButton Icon for the close button in the tab of a QTabBar.
+ \omitvalue NStandardPixmap
\value SP_CustomBase Base value for custom standard pixmaps;
custom values must be greater than this value.
@@ -2127,7 +2110,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
/*!
\fn QPixmap QStyle::standardPixmap(StandardPixmap standardPixmap, const QStyleOption *option, const QWidget *widget) const
- \obsolete
+ \deprecated
Returns a pixmap for the given \a standardPixmap.
A standard pixmap is a pixmap that can follow some existing GUI
@@ -2238,13 +2221,15 @@ Qt::Alignment QStyle::visualAlignment(Qt::LayoutDirection direction, Qt::Alignme
int QStyle::sliderPositionFromValue(int min, int max, int logicalValue, int span, bool upsideDown)
{
- if (span <= 0 || logicalValue < min || max <= min)
+ if (span <= 0 || max <= min)
return 0;
+ if (logicalValue < min)
+ return upsideDown ? span : 0;
if (logicalValue > max)
- return upsideDown ? span : min;
+ return upsideDown ? 0 : span;
- uint range = max - min;
- uint p = upsideDown ? max - logicalValue : logicalValue - min;
+ const uint range = qint64(max) - min;
+ const uint p = upsideDown ? qint64(max) - logicalValue : qint64(logicalValue) - min;
if (range > (uint)INT_MAX/4096) {
double dpos = (double(p))/(double(range)/span);
@@ -2286,15 +2271,15 @@ int QStyle::sliderValueFromPosition(int min, int max, int pos, int span, bool up
if (pos >= span)
return upsideDown ? min : max;
- uint range = max - min;
+ const qint64 range = qint64(max) - min;
if ((uint)span > range) {
- int tmp = (2 * pos * range + span) / (2 * span);
+ const int tmp = (2 * range * pos + span) / (qint64(2) * span);
return upsideDown ? max - tmp : tmp + min;
} else {
- uint div = range / span;
- uint mod = range % span;
- int tmp = pos * div + (2 * pos * mod + span) / (2 * span);
+ const qint64 div = range / span;
+ const qint64 mod = range % span;
+ const int tmp = pos * div + (2 * mod * pos + span) / (qint64(2) * span);
return upsideDown ? max - tmp : tmp + min;
}
// equiv. to min + (pos*range)/span + 0.5
@@ -2331,8 +2316,8 @@ QPalette QStyle::standardPalette() const
/*!
\since 4.1
- \fn QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option = 0,
- const QWidget *widget = 0) const = 0;
+ \fn QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
+ const QWidget *widget = nullptr) const = 0;
Returns an icon for the given \a standardIcon.
@@ -2348,14 +2333,14 @@ QPalette QStyle::standardPalette() const
\fn int QStyle::layoutSpacing(QSizePolicy::ControlType control1,
QSizePolicy::ControlType control2, Qt::Orientation orientation,
- const QStyleOption *option = 0, const QWidget *widget = 0) const
+ const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const
Returns the spacing that should be used between \a control1 and
\a control2 in a layout. \a orientation specifies whether the
controls are laid out side by side or stacked vertically. The \a
option parameter can be used to pass extra information about the
parent widget. The \a widget parameter is optional and can also
- be used if \a option is 0.
+ be used if \a option is \nullptr.
This function is called by the layout system. It is used only if
PM_LayoutHorizontalSpacing or PM_LayoutVerticalSpacing returns a
@@ -2372,7 +2357,7 @@ QPalette QStyle::standardPalette() const
controls are laid out side by side or stacked vertically. The \a
option parameter can be used to pass extra information about the
parent widget. The \a widget parameter is optional and can also
- be used if \a option is 0.
+ be used if \a option is \nullptr.
\a controls1 and \a controls2 are OR-combination of zero or more
\l{QSizePolicy::ControlTypes}{control types}.
@@ -2402,25 +2387,6 @@ int QStyle::combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
return result;
}
-// ### Qt 6: Remove in favor of template<class T> QDebug operator<<(QDebug, const QFlags<T> &).
-#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
-QT_BEGIN_INCLUDE_NAMESPACE
-# include <QDebug>
-QT_END_INCLUDE_NAMESPACE
-
-# if !defined(QT_NO_DEBUG_STREAM)
-QDebug operator<<(QDebug debug, QStyle::State state)
-{
-# if !defined(QT_NO_DEBUG)
- return operator<< <QStyle::StateFlag>(debug, state);
-# else
- Q_UNUSED(state);
- return debug;
-# endif
-}
-# endif // !QT_NO_DEBUG_STREAM
-#endif // QT_VERSION < QT_VERSION_CHECK(6,0,0)
-
/*!
\since 4.6
@@ -2434,17 +2400,19 @@ QDebug operator<<(QDebug debug, QStyle::State state)
const QStyle * QStyle::proxy() const
{
Q_D(const QStyle);
- return d->proxyStyle;
+ return d->proxyStyle == this ? this : d->proxyStyle->proxy();
}
/* \internal
This function sets the base style that style calls will be
- redirected to. Note that ownership is not transferred.
+ redirected to. Note that ownership is not transferred. \a style
+ must be a valid pointer (not nullptr).
*/
void QStyle::setProxy(QStyle *style)
{
Q_D(QStyle);
+ Q_ASSERT(style);
d->proxyStyle = style;
}