aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-09-12 16:25:40 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-13 15:10:03 +0200
commitca2890537f6172bbc0d644bbedaeb5dca319c981 (patch)
treeaa190171e9d77f05a7a631afc5306392185d9786
parente6dd7437ba4148fefec15b1c2d277efb6e2acba7 (diff)
Revamp QQuickDwmFeatures
Add missing change notifiers, fix property names vs. isFoo() accessor names, remove unused member variables, fix the event filter and add missing updates... Change-Id: Ie86a89dc1415ad082ac5c2e839245d55a446a1d4 Reviewed-by: Ivan Vizir <define-true-false@yandex.com> Reviewed-by: Caroline Chao <caroline.chao@digia.com>
-rw-r--r--examples/winextras/quickdwm/quickdwm.qml22
-rw-r--r--src/imports/winextras/qquickdwmfeatures.cpp47
-rw-r--r--src/imports/winextras/qquickdwmfeatures_p.h34
-rw-r--r--src/imports/winextras/qquickdwmfeatures_p_p.h2
4 files changed, 67 insertions, 38 deletions
diff --git a/examples/winextras/quickdwm/quickdwm.qml b/examples/winextras/quickdwm/quickdwm.qml
index 54042b4..925e05b 100644
--- a/examples/winextras/quickdwm/quickdwm.qml
+++ b/examples/winextras/quickdwm/quickdwm.qml
@@ -48,11 +48,11 @@ Rectangle {
height: 130
color: "transparent"
- WinDwmFeatures {
+ DwmFeatures {
id: dwmfeatures
- bottomGlassMargin: isCompositionEnabled ? 30 : 0
+ bottomGlassMargin: compositionEnabled ? 30 : 0
excludedFromPeek: true
- flip3DPolicy: WinDwmFeatures.FlipExcludeAbove
+ flip3DPolicy: DwmFeatures.FlipExcludeAbove
}
Window {
@@ -65,8 +65,8 @@ Rectangle {
visible: true
title: "Sheet of glass"
- WinDwmFeatures {
- bottomGlassMargin: isCompositionEnabled ? -1 : 0
+ DwmFeatures {
+ bottomGlassMargin: compositionEnabled ? -1 : 0
}
}
@@ -77,7 +77,7 @@ Rectangle {
Rectangle {
id: rectColorization
- color: WinDwmFeatures.colorizationColor
+ color: DwmFeatures.colorizationColor
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
@@ -92,7 +92,7 @@ Rectangle {
Rectangle {
id: rectRealColorization
- color: WinDwmFeatures.realColorizationColor
+ color: DwmFeatures.realColorizationColor
anchors.top: rectColorization.bottom
anchors.left: parent.left
anchors.right: parent.right
@@ -122,7 +122,7 @@ Rectangle {
Text {
anchors.centerIn: parent
- text: "DWM composition is " + (WinDwmFeatures.isCompositionEnabled ? "enabled" : "disabled")
+ text: "DWM composition is " + (DwmFeatures.compositionEnabled ? "enabled" : "disabled")
font.pointSize: 12
}
@@ -130,14 +130,14 @@ Rectangle {
id: mouseComposition
anchors.fill: parent
hoverEnabled: true
- onClicked: WinDwmFeatures.isCompositionEnabled = !WinDwmFeatures.isCompositionEnabled
+ onClicked: DwmFeatures.compositionEnabled = !DwmFeatures.compositionEnabled
}
}
}
Rectangle {
id: transparentBottom
- color: WinDwmFeatures.isCompositionEnabled ? "transparent" : "#EEE"
+ color: DwmFeatures.compositionEnabled ? "transparent" : "#EEE"
height: dwmfeatures.bottomGlassMargin
anchors.bottom: parent.bottom
anchors.left: parent.left
@@ -146,7 +146,7 @@ Rectangle {
Text {
id: textOnGlass
anchors.centerIn: parent
- text: "Text on glass" + (WinDwmFeatures.isCompositionEnabled ? "" : " (potentially)")
+ text: "Text on glass" + (DwmFeatures.compositionEnabled ? "" : " (potentially)")
font.pointSize: 12
}
}
diff --git a/src/imports/winextras/qquickdwmfeatures.cpp b/src/imports/winextras/qquickdwmfeatures.cpp
index 5255b69..3fb77ea 100644
--- a/src/imports/winextras/qquickdwmfeatures.cpp
+++ b/src/imports/winextras/qquickdwmfeatures.cpp
@@ -112,8 +112,12 @@ bool QQuickDwmFeatures::colorizationOpaqueBlend() const
void QQuickDwmFeatures::setTopGlassMargin(int margin)
{
Q_D(QQuickDwmFeatures);
+ if (d->topMargin == margin)
+ return;
+
d->topMargin = margin;
d->update();
+ emit topGlassMarginChanged();
}
/*!
@@ -124,8 +128,12 @@ void QQuickDwmFeatures::setTopGlassMargin(int margin)
void QQuickDwmFeatures::setRightGlassMargin(int margin)
{
Q_D(QQuickDwmFeatures);
+ if (d->rightMargin == margin)
+ return;
+
d->rightMargin = margin;
d->update();
+ emit rightGlassMarginChanged();
}
/*!
@@ -136,8 +144,12 @@ void QQuickDwmFeatures::setRightGlassMargin(int margin)
void QQuickDwmFeatures::setBottomGlassMargin(int margin)
{
Q_D(QQuickDwmFeatures);
+ if (d->bottomMargin == margin)
+ return;
+
d->bottomMargin = margin;
d->update();
+ emit rightGlassMarginChanged();
}
/*!
@@ -148,8 +160,12 @@ void QQuickDwmFeatures::setBottomGlassMargin(int margin)
void QQuickDwmFeatures::setLeftGlassMargin(int margin)
{
Q_D(QQuickDwmFeatures);
+ if (d->leftMargin == margin)
+ return;
+
d->leftMargin = margin;
d->update();
+ emit leftGlassMarginChanged();
}
int QQuickDwmFeatures::topGlassMargin() const
@@ -182,7 +198,7 @@ int QQuickDwmFeatures::leftGlassMargin() const
Specifies whether the window is excluded from Aero Peek.
The default value is false.
*/
-bool QQuickDwmFeatures::excludedFromPeek() const
+bool QQuickDwmFeatures::isExcludedFromPeek() const
{
Q_D(const QQuickDwmFeatures);
if (window())
@@ -194,7 +210,12 @@ bool QQuickDwmFeatures::excludedFromPeek() const
void QQuickDwmFeatures::setExcludedFromPeek(bool exclude)
{
Q_D(QQuickDwmFeatures);
+ if (d->peekExcluded == exclude)
+ return;
+
d->peekExcluded = exclude;
+ d->update();
+ emit excludedFromPeekChanged();
}
/*!
@@ -203,7 +224,7 @@ void QQuickDwmFeatures::setExcludedFromPeek(bool exclude)
Set this value to true if you want to forbid Aero Peek when the user hovers
the mouse over the window thumbnail. The default value is false.
*/
-bool QQuickDwmFeatures::peekDisallowed() const
+bool QQuickDwmFeatures::isPeekDisallowed() const
{
Q_D(const QQuickDwmFeatures);
if (window())
@@ -215,7 +236,12 @@ bool QQuickDwmFeatures::peekDisallowed() const
void QQuickDwmFeatures::setPeekDisallowed(bool disallow)
{
Q_D(QQuickDwmFeatures);
+ if (d->peekDisallowed == disallow)
+ return;
+
d->peekDisallowed = disallow;
+ d->update();
+ emit peekDisallowedChanged();
}
/*!
@@ -241,27 +267,26 @@ QQuickDwmFeatures::Flip3DPolicy QQuickDwmFeatures::flip3DPolicy() const
void QQuickDwmFeatures::setFlip3DPolicy(QQuickDwmFeatures::Flip3DPolicy policy)
{
Q_D(QQuickDwmFeatures);
+ if (d->flipPolicy == policy)
+ return;
+
d->flipPolicy = policy;
+ d->update();
+ emit flip3DPolicyChanged();
}
bool QQuickDwmFeatures::eventFilter(QObject *object, QEvent *event)
{
- bool filterOut = false;
if (object == window()) {
if (event->type() == QWinEvent::CompositionChange) {
- emit isCompositionEnabledChanged();
- filterOut = true;
+ emit compositionEnabledChanged();
} else if (event->type() == QWinEvent::ColorizationChange) {
emit colorizationColorChanged();
emit realColorizationColorChanged();
emit colorizationOpaqueBlendChanged();
- filterOut = true;
}
}
- if (!filterOut)
- return QQuickItem::eventFilter(object, event);
- else
- return filterOut;
+ return QQuickItem::eventFilter(object, event);
}
QQuickDwmFeatures *QQuickDwmFeatures::qmlAttachedProperties(QObject *parentObject)
@@ -290,7 +315,7 @@ void QQuickDwmFeatures::itemChange(QQuickItem::ItemChange change, const QQuickIt
QQuickDwmFeaturesPrivate::QQuickDwmFeaturesPrivate(QQuickDwmFeatures *parent) :
topMargin(0), rightMargin(0), bottomMargin(0), leftMargin(0),
peekDisallowed(false), peekExcluded(false), flipPolicy(QQuickDwmFeatures::FlipDefault),
- q_ptr(parent), formatSet(false), frameUpdateScheduled(false), attributesUpdateScheduled(false)
+ q_ptr(parent), formatSet(false)
{
}
diff --git a/src/imports/winextras/qquickdwmfeatures_p.h b/src/imports/winextras/qquickdwmfeatures_p.h
index fb8d191..50403e6 100644
--- a/src/imports/winextras/qquickdwmfeatures_p.h
+++ b/src/imports/winextras/qquickdwmfeatures_p.h
@@ -53,28 +53,27 @@ class QQuickDwmFeaturesPrivate;
class QQuickDwmFeatures : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(bool isCompositionEnabled READ isCompositionEnabled WRITE setCompositionEnabled NOTIFY isCompositionEnabledChanged)
+ Q_PROPERTY(bool compositionEnabled READ isCompositionEnabled WRITE setCompositionEnabled NOTIFY compositionEnabledChanged)
Q_PROPERTY(QColor colorizationColor READ colorizationColor NOTIFY colorizationColorChanged)
Q_PROPERTY(QColor realColorizationColor READ realColorizationColor NOTIFY realColorizationColorChanged)
Q_PROPERTY(bool colorizationOpaqueBlend READ colorizationOpaqueBlend NOTIFY colorizationOpaqueBlendChanged)
- Q_PROPERTY(int topGlassMargin READ topGlassMargin WRITE setTopGlassMargin)
- Q_PROPERTY(int rightGlassMargin READ rightGlassMargin WRITE setRightGlassMargin)
- Q_PROPERTY(int bottomGlassMargin READ bottomGlassMargin WRITE setBottomGlassMargin)
- Q_PROPERTY(int leftGlassMargin READ leftGlassMargin WRITE setLeftGlassMargin)
- Q_PROPERTY(bool excludedFromPeek READ excludedFromPeek WRITE setExcludedFromPeek)
- Q_PROPERTY(bool peekDisallowed READ peekDisallowed WRITE setPeekDisallowed)
- Q_PROPERTY(Flip3DPolicy flip3DPolicy READ flip3DPolicy WRITE setFlip3DPolicy)
+ Q_PROPERTY(int topGlassMargin READ topGlassMargin WRITE setTopGlassMargin NOTIFY topGlassMarginChanged)
+ Q_PROPERTY(int rightGlassMargin READ rightGlassMargin WRITE setRightGlassMargin NOTIFY rightGlassMarginChanged)
+ Q_PROPERTY(int bottomGlassMargin READ bottomGlassMargin WRITE setBottomGlassMargin NOTIFY bottomGlassMarginChanged)
+ Q_PROPERTY(int leftGlassMargin READ leftGlassMargin WRITE setLeftGlassMargin NOTIFY leftGlassMarginChanged)
+ Q_PROPERTY(bool excludedFromPeek READ isExcludedFromPeek WRITE setExcludedFromPeek NOTIFY excludedFromPeekChanged)
+ Q_PROPERTY(bool peekDisallowed READ isPeekDisallowed WRITE setPeekDisallowed NOTIFY peekDisallowedChanged)
+ Q_PROPERTY(Flip3DPolicy flip3DPolicy READ flip3DPolicy WRITE setFlip3DPolicy NOTIFY flip3DPolicyChanged)
+ Q_ENUMS(Flip3DPolicy)
public:
- enum Flip3DPolicy // keep sync with Qt::WindowFlip3DPolicy
+ enum Flip3DPolicy // keep sync with QtWin::WindowFlip3DPolicy
{
FlipDefault,
FlipExcludeBelow,
FlipExcludeAbove
};
- Q_ENUMS(Flip3DPolicy)
-
explicit QQuickDwmFeatures(QQuickItem *parent = 0);
~QQuickDwmFeatures();
@@ -93,9 +92,9 @@ public:
int bottomGlassMargin() const;
int leftGlassMargin() const;
- bool excludedFromPeek() const;
+ bool isExcludedFromPeek() const;
void setExcludedFromPeek(bool exclude);
- bool peekDisallowed() const;
+ bool isPeekDisallowed() const;
void setPeekDisallowed(bool disallow);
Flip3DPolicy flip3DPolicy() const;
void setFlip3DPolicy(Flip3DPolicy policy);
@@ -107,8 +106,15 @@ public:
Q_SIGNALS:
void colorizationColorChanged();
void realColorizationColorChanged();
- void isCompositionEnabledChanged();
+ void compositionEnabledChanged();
void colorizationOpaqueBlendChanged();
+ void topGlassMarginChanged();
+ void rightGlassMarginChanged();
+ void bottomGlassMarginChanged();
+ void leftGlassMarginChanged();
+ void excludedFromPeekChanged();
+ void peekDisallowedChanged();
+ void flip3DPolicyChanged();
protected:
void itemChange(ItemChange, const ItemChangeData &) Q_DECL_OVERRIDE;
diff --git a/src/imports/winextras/qquickdwmfeatures_p_p.h b/src/imports/winextras/qquickdwmfeatures_p_p.h
index fb45c5b..2f794db 100644
--- a/src/imports/winextras/qquickdwmfeatures_p_p.h
+++ b/src/imports/winextras/qquickdwmfeatures_p_p.h
@@ -65,8 +65,6 @@ public:
private:
QQuickDwmFeatures *q_ptr;
bool formatSet;
- bool frameUpdateScheduled;
- bool attributesUpdateScheduled;
Q_DECLARE_PUBLIC(QQuickDwmFeatures)
};