Merge lp:~gerboland/unity-2d/dash-searchentry-cursor into lp:unity-2d

Proposed by Gerry Boland
Status: Merged
Approved by: Albert Astals Cid
Approved revision: 942
Merged at revision: 943
Proposed branch: lp:~gerboland/unity-2d/dash-searchentry-cursor
Merge into: lp:unity-2d
Diff against target: 169 lines (+104/-0)
6 files modified
libunity-2d-private/Unity2d/plugin.cpp (+3/-0)
libunity-2d-private/src/CMakeLists.txt (+1/-0)
libunity-2d-private/src/cursorshapearea.cpp (+43/-0)
libunity-2d-private/src/cursorshapearea.h (+44/-0)
shell/common/SearchEntry.qml (+6/-0)
tests/manual-tests/dash.txt (+7/-0)
To merge this branch: bzr merge lp:~gerboland/unity-2d/dash-searchentry-cursor
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
Michał Sawicz functional Approve
Review via email: mp+94784@code.launchpad.net

Description of the change

[dash] Have Cursor change to IBeamCursor when over SearchEntry box

To post a comment you must log in.
Revision history for this message
Michał Sawicz (saviq) wrote :

It works!

review: Approve (functional)
Revision history for this message
Albert Astals Cid (aacid) wrote :

i don't think you need the Q_INVOKABLE (at least we don't have it for the other propertiy settings) and a Q_DISABLE_COPY won't hurt

I don't think anyone can claim copyright over what is basically a setCursor call, i'd just remove the copyright notice.

And as you said yourself add a manual test for it :-)

review: Needs Fixing
939. By Gerry Boland

Remove useless Q_INVOKABLE

940. By Gerry Boland

Content trivial & since modified, CC licence not desired

941. By Gerry Boland

Add Q_DISABLE_COPY as recommended by Albert

942. By Gerry Boland

Add manual test

Revision history for this message
Albert Astals Cid (aacid) wrote :

Looks good :-)

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/Unity2d/plugin.cpp'
2--- libunity-2d-private/Unity2d/plugin.cpp 2012-02-20 17:16:55 +0000
3+++ libunity-2d-private/Unity2d/plugin.cpp 2012-02-28 12:03:18 +0000
4@@ -41,6 +41,7 @@
5 #include "plugin.h"
6 #include "cacheeffect.h"
7 #include "iconutilities.h"
8+#include "cursorshapearea.h"
9 #include "unity2dtr.h"
10 #include "giodefaultapplication.h"
11
12@@ -149,6 +150,8 @@
13
14 qmlRegisterType<IconUtilities>(); // Register the type as non creatable
15
16+ qmlRegisterType<CursorShapeArea>(uri, 0, 1, "CursorShapeArea");
17+
18 qmlRegisterType<GioDefaultApplication>(uri, 0, 1, "GioDefaultApplication");
19
20 qmlRegisterType<Lenses>(uri, 1, 0, "Lenses");
21
22=== modified file 'libunity-2d-private/src/CMakeLists.txt'
23--- libunity-2d-private/src/CMakeLists.txt 2012-02-28 10:30:30 +0000
24+++ libunity-2d-private/src/CMakeLists.txt 2012-02-28 12:03:18 +0000
25@@ -38,6 +38,7 @@
26 dragitemwithurl.cpp
27 dropitem.cpp
28 iconimageprovider.cpp
29+ cursorshapearea.cpp
30 listaggregatormodel.cpp
31 launcheritem.cpp
32 application.cpp
33
34=== added file 'libunity-2d-private/src/cursorshapearea.cpp'
35--- libunity-2d-private/src/cursorshapearea.cpp 1970-01-01 00:00:00 +0000
36+++ libunity-2d-private/src/cursorshapearea.cpp 2012-02-28 12:03:18 +0000
37@@ -0,0 +1,43 @@
38+/*
39+ * This file is part of unity-2d
40+ *
41+ * Copyright 2012 Canonical Ltd.
42+ *
43+ * This program is free software; you can redistribute it and/or modify
44+ * it under the terms of the GNU General Public License as published by
45+ * the Free Software Foundation; version 3.
46+ *
47+ * This program is distributed in the hope that it will be useful,
48+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
49+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
50+ * GNU General Public License for more details.
51+ *
52+ * You should have received a copy of the GNU General Public License
53+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
54+ */
55+
56+#include "cursorshapearea.h"
57+
58+CursorShapeArea::CursorShapeArea(QDeclarativeItem *parent)
59+: QDeclarativeItem(parent)
60+, m_currentShape(Qt::ArrowCursor)
61+{
62+}
63+
64+Qt::CursorShape CursorShapeArea::cursorShape() const
65+{
66+ return cursor().shape();
67+}
68+
69+void CursorShapeArea::setCursorShape(Qt::CursorShape cursorShape)
70+{
71+ if (m_currentShape == cursorShape)
72+ return;
73+
74+ setCursor(cursorShape);
75+ Q_EMIT cursorShapeChanged();
76+
77+ m_currentShape = cursorShape;
78+}
79+
80+#include "cursorshapearea.moc"
81
82=== added file 'libunity-2d-private/src/cursorshapearea.h'
83--- libunity-2d-private/src/cursorshapearea.h 1970-01-01 00:00:00 +0000
84+++ libunity-2d-private/src/cursorshapearea.h 2012-02-28 12:03:18 +0000
85@@ -0,0 +1,44 @@
86+/*
87+ * This file is part of unity-2d
88+ *
89+ * Copyright 2012 Canonical Ltd.
90+ *
91+ * This program is free software; you can redistribute it and/or modify
92+ * it under the terms of the GNU General Public License as published by
93+ * the Free Software Foundation; version 3.
94+ *
95+ * This program is distributed in the hope that it will be useful,
96+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
97+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
98+ * GNU General Public License for more details.
99+ *
100+ * You should have received a copy of the GNU General Public License
101+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
102+ */
103+
104+#ifndef CURSORSHAPEAREA_H
105+#define CURSORSHAPEAREA_H
106+
107+#include <QDeclarativeItem>
108+
109+class CursorShapeArea : public QDeclarativeItem
110+{
111+ Q_OBJECT
112+
113+ Q_PROPERTY(Qt::CursorShape cursorShape READ cursorShape WRITE setCursorShape NOTIFY cursorShapeChanged)
114+
115+public:
116+ explicit CursorShapeArea(QDeclarativeItem *parent = 0);
117+
118+ Qt::CursorShape cursorShape() const;
119+ void setCursorShape(Qt::CursorShape cursorShape);
120+
121+private:
122+ Q_DISABLE_COPY(CursorShapeArea)
123+ Qt::CursorShape m_currentShape;
124+
125+Q_SIGNALS:
126+ void cursorShapeChanged();
127+};
128+
129+#endif // CURSORSHAPEAREA_H
130
131=== modified file 'shell/common/SearchEntry.qml'
132--- shell/common/SearchEntry.qml 2012-02-24 17:58:11 +0000
133+++ shell/common/SearchEntry.qml 2012-02-28 12:03:18 +0000
134@@ -18,6 +18,7 @@
135
136 import QtQuick 1.1
137 import Effects 1.0
138+import Unity2d 1.0
139 import "fontUtils.js" as FontUtils
140 import "utils.js" as Utils
141
142@@ -166,4 +167,9 @@
143 }
144 }
145 }
146+
147+ CursorShapeArea {
148+ anchors.fill: parent
149+ cursorShape: Qt.IBeamCursor
150+ }
151 }
152
153=== modified file 'tests/manual-tests/dash.txt'
154--- tests/manual-tests/dash.txt 2012-02-07 18:53:20 +0000
155+++ tests/manual-tests/dash.txt 2012-02-28 12:03:18 +0000
156@@ -18,6 +18,13 @@
157
158 ----
159
160+ * Open Dash, hover mouse over Search Entry box
161+
162+--> The mouse cursor should change to the I-beam cursor over the Search box, and be standard
163+ cursor elsewhere.
164+
165+----
166+
167 # Test case objectives:
168 # * Check that Super+s does not type s in the search line
169 # Pre-conditions

Subscribers

People subscribed via source and target branches