From 1bcfada9f04bd20a7a64d448fbf60c0f0820ed09 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Wed, 30 Dec 2020 13:55:27 +0100 Subject: QStyle: add name() to return the name of the style Currently there is no way to get the name of the current style to e.g. create a QProxyStyle for a specific widget only. Therefore add QStyle::name() so QProxyStyle(const QString &) can be called without hard-coding the style name. Remove an unused doc snippet as drive-by. Fixes: QTBUG-8004 Change-Id: I466c5e870a5392b238365bdc930f6a2ecee50cdb Reviewed-by: Richard Moe Gustavsen --- src/widgets/styles/qstyle.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'src/widgets/styles/qstyle.cpp') diff --git a/src/widgets/styles/qstyle.cpp b/src/widgets/styles/qstyle.cpp index 239d873649..9f49a55386 100644 --- a/src/widgets/styles/qstyle.cpp +++ b/src/widgets/styles/qstyle.cpp @@ -421,6 +421,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. -- cgit v1.2.3