summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-09 09:25:23 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-09 09:31:09 +0200
commitb59552991f79fa3d98805ee1b533e05876905f8d (patch)
tree351b9209b64bbc7de0c9d1c835e9227a23a58c15
parent3be92b70f5c737d336e3d9da96945ff8ba5cf3e5 (diff)
Changed the API for hiding a surface from setHidden to setPaintEnabled.
This makes it more explicit that setHidden() isn't just the inverse of setVisible(), but also still handles mouse events.
-rw-r--r--examples/qml-compositor/qml/QmlCompositor/ShaderEffect.qml2
-rw-r--r--src/qt-compositor/compositor_api/waylandsurfaceitem.cpp14
-rw-r--r--src/qt-compositor/compositor_api/waylandsurfaceitem.h8
3 files changed, 12 insertions, 12 deletions
diff --git a/examples/qml-compositor/qml/QmlCompositor/ShaderEffect.qml b/examples/qml-compositor/qml/QmlCompositor/ShaderEffect.qml
index ffbe58cbd..eb2f80005 100644
--- a/examples/qml-compositor/qml/QmlCompositor/ShaderEffect.qml
+++ b/examples/qml-compositor/qml/QmlCompositor/ShaderEffect.qml
@@ -47,7 +47,7 @@ ShaderEffectItem {
onSourceChanged: {
if (source != null) {
- source.setHidden(true);
+ source.setPaintEnabled(false);
vertexShader = source.isYInverted() ? vShaderInvertedY : vShader;
}
}
diff --git a/src/qt-compositor/compositor_api/waylandsurfaceitem.cpp b/src/qt-compositor/compositor_api/waylandsurfaceitem.cpp
index 813d4f58d..772fb31c2 100644
--- a/src/qt-compositor/compositor_api/waylandsurfaceitem.cpp
+++ b/src/qt-compositor/compositor_api/waylandsurfaceitem.cpp
@@ -68,7 +68,7 @@ WaylandSurfaceItem::WaylandSurfaceItem(QSGItem *parent)
: QSGItem(parent)
, m_surface(0)
, m_texture(0)
- , m_hidden(false)
+ , m_paintEnabled(true)
{
}
@@ -76,7 +76,7 @@ WaylandSurfaceItem::WaylandSurfaceItem(WaylandSurface *surface, QSGItem *parent)
: QSGItem(parent)
, m_surface(0)
, m_texture(0)
- , m_hidden(false)
+ , m_paintEnabled(true)
{
init(surface);
}
@@ -176,14 +176,14 @@ void WaylandSurfaceItem::surfaceDestroyed(QObject *)
m_surface = 0;
}
-bool WaylandSurfaceItem::hidden() const
+bool WaylandSurfaceItem::paintEnabled() const
{
- return m_hidden;
+ return m_paintEnabled;
}
-void WaylandSurfaceItem::setHidden(bool h)
+void WaylandSurfaceItem::setPaintEnabled(bool enabled)
{
- m_hidden = h;
+ m_paintEnabled = enabled;
update();
}
@@ -191,7 +191,7 @@ QSGNode *WaylandSurfaceItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDa
{
QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode *>(oldNode);
- if (!m_texture || m_hidden) {
+ if (!m_texture || !m_paintEnabled) {
delete oldNode;
return 0;
}
diff --git a/src/qt-compositor/compositor_api/waylandsurfaceitem.h b/src/qt-compositor/compositor_api/waylandsurfaceitem.h
index 1734b00bf..10f771bb5 100644
--- a/src/qt-compositor/compositor_api/waylandsurfaceitem.h
+++ b/src/qt-compositor/compositor_api/waylandsurfaceitem.h
@@ -54,7 +54,7 @@ class WaylandSurfaceItem : public QSGItem, public QSGTextureProvider
Q_OBJECT
Q_INTERFACES(QSGTextureProvider)
Q_PROPERTY(WaylandSurface* surface READ surface WRITE setSurface)
- Q_PROPERTY(bool hidden READ hidden WRITE setHidden)
+ Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled)
public:
WaylandSurfaceItem(QSGItem *parent = 0);
@@ -69,7 +69,7 @@ public:
QSGTexture *texture() const;
const char *textureChangedSignal() const { return SIGNAL(textureChanged()); }
- bool hidden() const;
+ bool paintEnabled() const;
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
@@ -81,7 +81,7 @@ protected:
public slots:
void takeFocus();
- void setHidden(bool hidden);
+ void setPaintEnabled(bool paintEnabled);
private slots:
void surfaceMapped(const QRect &rect);
@@ -100,7 +100,7 @@ private:
WaylandSurface *m_surface;
QSGTexture *m_texture;
- bool m_hidden;
+ bool m_paintEnabled;
};
#endif