Revert "QApp: Method to check for native style usage."

This reverts commit 958a4c9087.

QApplicationPrivate::usesNativeStyle() introduced by that commit
was never used. We have an untested method that is furthermore
may return wrong results because it relies on the comparison
'app_style->objectName() != QApplicationPrivate::desktopStyleKey()',
but not all styles set their object names.

Conflicts:
    src/widgets/kernel/qapplication.cpp
    src/widgets/kernel/qapplication_p.h

Change-Id: I48d221f9387381db9ed51a7a068bfd0a0c2ed58d
Reviewed-by: Christoph Schleifenbaum <christoph.schleifenbaum@kdab.com>
This commit is contained in:
Alexander Volkov 2017-11-17 14:36:39 +03:00
parent a6b7447058
commit 7c7a95cd09
2 changed files with 0 additions and 28 deletions

View File

@ -152,20 +152,6 @@ static void clearSystemPalette()
QApplicationPrivate::sys_pal = 0;
}
static QByteArray get_style_class_name()
{
QScopedPointer<QStyle> s(QStyleFactory::create(QApplicationPrivate::desktopStyleKey()));
if (!s.isNull())
return s->metaObject()->className();
return QByteArray();
}
static QByteArray nativeStyleClassName()
{
static QByteArray name = get_style_class_name();
return name;
}
bool QApplicationPrivate::autoSipEnabled = true;
QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, int flags)
@ -395,8 +381,6 @@ void qt_init_tooltip_palette();
void qt_cleanup();
QStyle *QApplicationPrivate::app_style = 0; // default application style
bool QApplicationPrivate::overrides_native_style = false; // whether native QApplication style is
// overridden, i.e. not native
#ifndef QT_NO_STYLE_STYLESHEET
QString QApplicationPrivate::styleSheet; // default application stylesheet
#endif
@ -1091,8 +1075,6 @@ QStyle *QApplication::style()
Q_ASSERT(!"No styles available!");
return 0;
}
QApplicationPrivate::overrides_native_style =
app_style->objectName() != QApplicationPrivate::desktopStyleKey();
}
// take ownership of the style
QApplicationPrivate::app_style->setParent(qApp);
@ -1157,9 +1139,6 @@ void QApplication::setStyle(QStyle *style)
QStyle *old = QApplicationPrivate::app_style; // save
QApplicationPrivate::overrides_native_style =
nativeStyleClassName() == QByteArray(style->metaObject()->className());
#ifndef QT_NO_STYLE_STYLESHEET
if (!QApplicationPrivate::styleSheet.isEmpty() && !qobject_cast<QStyleSheetStyle *>(style)) {
// we have a stylesheet already and a new style is being set

View File

@ -137,12 +137,6 @@ public:
bool canQuit();
#endif
//style
static bool usesNativeStyle()
{
return !overrides_native_style;
}
bool notify_helper(QObject *receiver, QEvent * e);
void init(
@ -178,7 +172,6 @@ public:
static QSize app_strut;
static QWidgetList *popupWidgets;
static QStyle *app_style;
static bool overrides_native_style;
static QPalette *sys_pal;
static QPalette *set_pal;