summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-04-22 09:04:29 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-04-22 09:25:54 +0200
commitaed5a7168354c6ae47687d20b4bd3f0adcc14f8e (patch)
treed2060479a7c12fdba8c1955e5d363754feffabb8 /src/gui/kernel
parentd3d10cf23d61f4a011f1a7e9abdee1a92717e80f (diff)
parent628fa13ea4d6ff0e2e2ee76c9adfc78676de3c59 (diff)
Merge remote-tracking branch 'origin/5.5' into dev
Conflicts: src/corelib/statemachine/qstatemachine.cpp src/corelib/statemachine/qstatemachine_p.h src/gui/painting/qdrawhelper.cpp src/plugins/platforms/xcb/qxcbnativeinterface.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/plugins/platforms/xcb/qxcbwindow.h src/testlib/qtestblacklist.cpp src/tools/qdoc/node.cpp src/tools/qdoc/node.h tests/auto/gui/painting/qcolor/tst_qcolor.cpp Change-Id: I6c78b7b162001712d5774293f501b06b4ff32684
Diffstat (limited to 'src/gui/kernel')
-rw-r--r--src/gui/kernel/qclipboard.cpp4
-rw-r--r--src/gui/kernel/qguiapplication.cpp7
-rw-r--r--src/gui/kernel/qpaintdevicewindow.cpp22
-rw-r--r--src/gui/kernel/qplatformintegration.cpp16
-rw-r--r--src/gui/kernel/qplatformintegration.h8
-rw-r--r--src/gui/kernel/qplatformtheme.cpp2
-rw-r--r--src/gui/kernel/qstylehints.cpp12
-rw-r--r--src/gui/kernel/qstylehints.h2
-rw-r--r--src/gui/kernel/qwindow.cpp4
9 files changed, 68 insertions, 9 deletions
diff --git a/src/gui/kernel/qclipboard.cpp b/src/gui/kernel/qclipboard.cpp
index 35e74946ee..402f5005fd 100644
--- a/src/gui/kernel/qclipboard.cpp
+++ b/src/gui/kernel/qclipboard.cpp
@@ -584,6 +584,6 @@ void QClipboard::emitChanged(Mode mode)
emit changed(mode);
}
-#endif // QT_NO_CLIPBOARD
-
QT_END_NAMESPACE
+
+#endif // QT_NO_CLIPBOARD
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 9f73f019a3..926ec16f19 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -185,6 +185,7 @@ extern void qRegisterGuiVariant();
#ifndef QT_NO_ANIMATION
extern void qRegisterGuiGetInterpolator();
#endif
+extern void qInitBlendFunctions();
extern void qInitDrawhelperAsm();
extern void qInitImageConversions();
@@ -1279,6 +1280,8 @@ void QGuiApplicationPrivate::init()
if (platform_integration == 0)
createPlatformIntegration();
+ // Set up blend function tables.
+ qInitBlendFunctions();
// Set up which span functions should be used in raster engine...
qInitDrawhelperAsm();
// and QImage conversion functions
@@ -2754,6 +2757,7 @@ void QGuiApplication::setPalette(const QPalette &pal)
else
*QGuiApplicationPrivate::app_pal = pal;
applicationResourceFlags |= ApplicationPaletteExplicitlySet;
+ QCoreApplication::setAttribute(Qt::AA_SetPalette);
emit qGuiApp->paletteChanged(*QGuiApplicationPrivate::app_pal);
}
@@ -2837,6 +2841,9 @@ void QGuiApplication::setWindowIcon(const QIcon &icon)
if (!QGuiApplicationPrivate::app_icon)
QGuiApplicationPrivate::app_icon = new QIcon();
*QGuiApplicationPrivate::app_icon = icon;
+ if (QGuiApplicationPrivate::platform_integration
+ && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::ApplicationIcon))
+ QGuiApplicationPrivate::platform_integration->setApplicationIcon(icon);
if (QGuiApplicationPrivate::is_app_running && !QGuiApplicationPrivate::is_app_closing)
QGuiApplicationPrivate::self->notifyWindowIconChanged();
}
diff --git a/src/gui/kernel/qpaintdevicewindow.cpp b/src/gui/kernel/qpaintdevicewindow.cpp
index b32ab3b34d..ff661d017d 100644
--- a/src/gui/kernel/qpaintdevicewindow.cpp
+++ b/src/gui/kernel/qpaintdevicewindow.cpp
@@ -60,6 +60,9 @@ QT_BEGIN_NAMESPACE
\note Subsequent calls to this function before the next paint
event will get ignored.
+
+ \note For non-exposed windows the update is deferred until the
+ window becomes exposed again.
*/
void QPaintDeviceWindow::update()
{
@@ -70,26 +73,34 @@ void QPaintDeviceWindow::update()
Marks the \a rect of the window as dirty and schedules a repaint.
\note Subsequent calls to this function before the next paint
- event will get ignored.
+ event will get ignored, but \a rect is added to the region to update.
+
+ \note For non-exposed windows the update is deferred until the
+ window becomes exposed again.
*/
void QPaintDeviceWindow::update(const QRect &rect)
{
Q_D(QPaintDeviceWindow);
d->dirtyRegion += rect;
- requestUpdate();
+ if (isExposed())
+ requestUpdate();
}
/*!
Marks the \a region of the window as dirty and schedules a repaint.
\note Subsequent calls to this function before the next paint
- event will get ignored.
+ event will get ignored, but \a region is added to the region to update.
+
+ \note For non-exposed windows the update is deferred until the
+ window becomes exposed again.
*/
void QPaintDeviceWindow::update(const QRegion &region)
{
Q_D(QPaintDeviceWindow);
d->dirtyRegion += region;
- requestUpdate();
+ if (isExposed())
+ requestUpdate();
}
/*!
@@ -168,6 +179,9 @@ void QPaintDeviceWindow::exposeEvent(QExposeEvent *exposeEvent)
// sometimes relative to the parent, depending on the platform plugin.
// We require local coords here.
d->doFlush(QRect(QPoint(0, 0), size()));
+ } else if (!d->dirtyRegion.isEmpty()) {
+ // Updates while non-exposed were ignored. Schedule an update now.
+ requestUpdate();
}
}
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index f2a92e10df..4d973d47a5 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -231,6 +231,8 @@ QPlatformServices *QPlatformIntegration::services() const
implementation for QOpenGLContext::getProcAddress() and support returning a function
pointer also for the standard, non-extension functions. This capability is a
prerequisite for dynamic OpenGL loading.
+
+ \value ApplicationIcon The platform supports setting the application icon. (since 5.5)
*/
/*!
@@ -394,6 +396,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::TabFocusBehavior);
case ReplayMousePressOutsidePopup:
return true;
+ case ItemViewActivateItemOnSingleClick:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick);
}
return 0;
@@ -544,4 +548,16 @@ QOpenGLContext::OpenGLModuleType QPlatformIntegration::openGLModuleType()
}
#endif
+/*!
+ \since 5.5
+
+ Platform integration function for setting the application icon.
+
+ \sa QGuiApplication::setWindowIcon()
+*/
+void QPlatformIntegration::setApplicationIcon(const QIcon &icon) const
+{
+ Q_UNUSED(icon);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 34639e6929..2aa502b3d2 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -90,7 +90,8 @@ public:
WindowManagement,
SyncState,
RasterGLSurface,
- AllGLFunctionsQueryable
+ AllGLFunctionsQueryable,
+ ApplicationIcon
};
virtual ~QPlatformIntegration() { }
@@ -146,7 +147,8 @@ public:
ShowIsMaximized,
MousePressAndHoldInterval,
TabFocusBehavior,
- ReplayMousePressOutsidePopup
+ ReplayMousePressOutsidePopup,
+ ItemViewActivateItemOnSingleClick
};
virtual QVariant styleHint(StyleHint hint) const;
@@ -169,7 +171,7 @@ public:
#ifndef QT_NO_OPENGL
virtual QOpenGLContext::OpenGLModuleType openGLModuleType();
#endif
-
+ virtual void setApplicationIcon(const QIcon &icon) const;
protected:
void screenAdded(QPlatformScreen *screen, bool isPrimary = false);
void destroyScreen(QPlatformScreen *screen);
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index aa49d64309..36a71fe2da 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -434,6 +434,8 @@ QVariant QPlatformTheme::themeHint(ThemeHint hint) const
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::PasswordMaskCharacter);
case QPlatformTheme::MousePressAndHoldInterval:
return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::MousePressAndHoldInterval);
+ case QPlatformTheme::ItemViewActivateItemOnSingleClick:
+ return QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::ItemViewActivateItemOnSingleClick);
default:
return QPlatformTheme::defaultThemeHint(hint);
}
diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index b7af2e759f..7ff0f9f860 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -377,4 +377,16 @@ Qt::TabFocusBehavior QStyleHints::tabFocusBehavior() const
return Qt::TabFocusBehavior(themeableHint(QPlatformTheme::TabFocusBehavior, QPlatformIntegration::TabFocusBehavior).toInt());
}
+/*!
+ \property QStyleHints::singleClickActivation
+ \brief \c true if items should be activated by single click, \b false
+ if they should be activated by double click instead.
+
+ \since 5.5
+*/
+bool QStyleHints::singleClickActivation() const
+{
+ return themeableHint(QPlatformTheme::ItemViewActivateItemOnSingleClick, QPlatformIntegration::ItemViewActivateItemOnSingleClick).toBool();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index 5fbc851ee9..82eb8a6f7d 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -61,6 +61,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_PROPERTY(int startDragVelocity READ startDragVelocity STORED false CONSTANT FINAL)
Q_PROPERTY(bool useRtlExtensions READ useRtlExtensions STORED false CONSTANT FINAL)
Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior STORED false CONSTANT FINAL)
+ Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL)
public:
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
@@ -83,6 +84,7 @@ public:
bool useRtlExtensions() const;
bool setFocusOnTouchRelease() const;
Qt::TabFocusBehavior tabFocusBehavior() const;
+ bool singleClickActivation() const;
Q_SIGNALS:
void cursorFlashTimeChanged(int cursorFlashTime);
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 19f7cafbcb..e697efe31c 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -1075,6 +1075,10 @@ Qt::ScreenOrientation QWindow::contentOrientation() const
Common values are 1.0 on normal displays and 2.0 on Apple "retina" displays.
+ \note For windows not backed by a platform window, meaning that create() was not
+ called, the function will fall back to QGuiApplication::devicePixelRatio() which in
+ turn returns the highest screen device pixel ratio found on the system.
+
\sa QScreen::devicePixelRatio(), QGuiApplication::devicePixelRatio()
*/
qreal QWindow::devicePixelRatio() const