summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication.cpp21
-rw-r--r--src/widgets/kernel/qapplication_p.h7
-rw-r--r--src/widgets/kernel/qstandardgestures.cpp2
-rw-r--r--src/widgets/kernel/qwidget.cpp8
-rw-r--r--src/widgets/kernel/qwidget_p.h2
-rw-r--r--src/widgets/kernel/qwidgetbackingstore.cpp3
6 files changed, 37 insertions, 6 deletions
diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp
index edb9e9036c..94fcee4553 100644
--- a/src/widgets/kernel/qapplication.cpp
+++ b/src/widgets/kernel/qapplication.cpp
@@ -152,6 +152,20 @@ 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;
+}
+
#ifdef Q_OS_WINCE
int QApplicationPrivate::autoMaximizeThreshold = -1;
bool QApplicationPrivate::autoSipEnabled = false;
@@ -392,6 +406,8 @@ 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
QString QApplicationPrivate::styleOverride; // style override
#ifndef QT_NO_STYLE_STYLESHEET
@@ -1153,6 +1169,8 @@ 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);
@@ -1217,6 +1235,9 @@ 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
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 0284a613d4..d5efb62dda 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -150,6 +150,12 @@ public:
bool canQuit();
#endif
+ //style
+ static bool usesNativeStyle()
+ {
+ return !overrides_native_style;
+ }
+
bool notify_helper(QObject *receiver, QEvent * e);
void construct(
@@ -184,6 +190,7 @@ public:
static QSize app_strut;
static QWidgetList *popupWidgets;
static QStyle *app_style;
+ static bool overrides_native_style;
static int app_cspec;
static QPalette *sys_pal;
static QPalette *set_pal;
diff --git a/src/widgets/kernel/qstandardgestures.cpp b/src/widgets/kernel/qstandardgestures.cpp
index 64ab68257a..e57c3285d2 100644
--- a/src/widgets/kernel/qstandardgestures.cpp
+++ b/src/widgets/kernel/qstandardgestures.cpp
@@ -331,7 +331,7 @@ QGestureRecognizer::Result QSwipeGestureRecognizer::recognize(QGesture *state,
int elapsedTime = d->time.restart();
if (!elapsedTime)
elapsedTime = 1;
- d->velocityValue = 0.9 * d->velocityValue + distance / elapsedTime;
+ d->velocityValue = 0.9 * d->velocityValue + (qreal) distance / elapsedTime;
d->swipeAngle = QLineF(p1.startScreenPos(), p1.screenPos()).angle();
static const int MoveThreshold = 50;
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp
index 7c5def5bd6..3f915264c8 100644
--- a/src/widgets/kernel/qwidget.cpp
+++ b/src/widgets/kernel/qwidget.cpp
@@ -357,11 +357,11 @@ void QWidgetPrivate::scrollChildren(int dx, int dy)
}
}
-void QWidgetPrivate::setWSGeometry(bool dontShow, const QRect &oldRect)
+void QWidgetPrivate::setWSGeometry()
{
- Q_UNUSED(dontShow);
- Q_UNUSED(oldRect);
- // XXX
+ Q_Q(QWidget);
+ if (QWindow *window = q->windowHandle())
+ window->setGeometry(data.crect);
}
void QWidgetPrivate::updateWidgetTransform(QEvent *event)
diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h
index e7ffb75891..14831efca8 100644
--- a/src/widgets/kernel/qwidget_p.h
+++ b/src/widgets/kernel/qwidget_p.h
@@ -609,7 +609,7 @@ public:
}
}
- void setWSGeometry(bool dontShow=false, const QRect &oldRect = QRect());
+ void setWSGeometry();
inline QPoint mapToWS(const QPoint &p) const
{ return p - data.wrect.topLeft(); }
diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetbackingstore.cpp
index 221e6825ed..9d024fd359 100644
--- a/src/widgets/kernel/qwidgetbackingstore.cpp
+++ b/src/widgets/kernel/qwidgetbackingstore.cpp
@@ -168,6 +168,9 @@ static void showYellowThing_win(QWidget *widget, const QRegion &region, int msec
void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped)
{
+#ifdef Q_OS_WINRT
+ Q_UNUSED(msec)
+#endif
QRegion paintRegion = toBePainted;
QRect widgetRect = widget->rect();