aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/declarative/minehunt/main.cpp4
-rw-r--r--examples/declarative/qtquick1/cppextensions/qwidgets/qwidgets.cpp6
-rw-r--r--examples/declarative/script/shell/main.cpp6
-rw-r--r--examples/declarative/text/textselection/textselection.qml79
4 files changed, 8 insertions, 87 deletions
diff --git a/examples/declarative/minehunt/main.cpp b/examples/declarative/minehunt/main.cpp
index 1f77efe543..2ae2cc0558 100644
--- a/examples/declarative/minehunt/main.cpp
+++ b/examples/declarative/minehunt/main.cpp
@@ -39,7 +39,7 @@
**
****************************************************************************/
-#include <QtGui/QApplication>
+#include <QtGui/QGuiApplication>
#include <qsgview.h>
#include <QtDeclarative/QDeclarativeContext>
#include <QtDeclarative/QDeclarativeEngine>
@@ -48,7 +48,7 @@
int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QGuiApplication app(argc, argv);
QSGView canvas;
qmlRegisterType<TileData>();
diff --git a/examples/declarative/qtquick1/cppextensions/qwidgets/qwidgets.cpp b/examples/declarative/qtquick1/cppextensions/qwidgets/qwidgets.cpp
index 843ac0f1f2..de22a415aa 100644
--- a/examples/declarative/qtquick1/cppextensions/qwidgets/qwidgets.cpp
+++ b/examples/declarative/qtquick1/cppextensions/qwidgets/qwidgets.cpp
@@ -40,9 +40,9 @@
#include <QtDeclarative/QDeclarativeExtensionPlugin>
#include <QtDeclarative/qdeclarative.h>
-#include <QtGui/QGraphicsProxyWidget>
-#include <QtGui/QPushButton>
-#include <QDebug>
+#include <QtWidgets/QGraphicsProxyWidget>
+#include <QtWidgets/QPushButton>
+#include <QtCore/QDebug>
class MyPushButton : public QGraphicsProxyWidget
{
diff --git a/examples/declarative/script/shell/main.cpp b/examples/declarative/script/shell/main.cpp
index ad29fb87e1..5ee8a5e1ca 100644
--- a/examples/declarative/script/shell/main.cpp
+++ b/examples/declarative/script/shell/main.cpp
@@ -44,7 +44,7 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qscopedpointer.h>
-#include <QtGui/qapplication.h>
+#include <QtGui/QGuiApplication>
#include <QtDeclarative/qjsengine.h>
@@ -95,7 +95,7 @@ static void interactive(QJSEngine *eng)
int main(int argc, char *argv[])
{
- QApplication app(argc, argv);
+ QGuiApplication app(argc, argv);
QScopedPointer<QJSEngine> eng(new QJSEngine());
{
QJSValue globalObject = eng->globalObject();
@@ -150,4 +150,4 @@ int main(int argc, char *argv[])
return EXIT_SUCCESS;
}
-#include <main.moc> \ No newline at end of file
+#include <main.moc>
diff --git a/examples/declarative/text/textselection/textselection.qml b/examples/declarative/text/textselection/textselection.qml
index 85d7a1166b..a25d0df621 100644
--- a/examples/declarative/text/textselection/textselection.qml
+++ b/examples/declarative/text/textselection/textselection.qml
@@ -105,85 +105,6 @@ Rectangle {
+"<p><b>Click inside the selection</b> to cut/copy/paste/cancel selection."
+"<p>It's too whacky to let you paste if there is no current selection."
- MouseArea {
- property string drag: ""
- property int pressPos
-
- x: -startHandle.width
- y: 0
- width: parent.width+startHandle.width+endHandle.width
- height: parent.height
-
- onPressAndHold: {
- if (editor.state == "") {
- edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y);
- edit.selectWord();
- editor.state = "selection"
- }
- }
-
- onClicked: {
- if (editor.state == "") {
- edit.cursorPosition = edit.positionAt(mouse.x+x,mouse.y+y);
- if (!edit.focus)
- edit.focus = true;
- edit.openSoftwareInputPanel();
- }
- }
-
- function hitHandle(h,x,y) {
- return x>=h.x+flick.contentX && x<h.x+flick.contentX+h.width && y>=h.y+flick.contentY && y<h.y+flick.contentY+h.height
- }
-
- onPressed: {
- if (editor.state == "selection") {
- if (hitHandle(startHandle,mouse.x+x,mouse.y+y)) {
- drag = "start"
- flick.interactive = false
- } else if (hitHandle(endHandle,mouse.x+x,mouse.y+y)) {
- drag = "end"
- flick.interactive = false
- } else {
- var pos = edit.positionAt(mouse.x+x,mouse.y+y);
- if (pos >= edit.selectionStart && pos <= edit.selectionEnd) {
- drag = "selection"
- flick.interactive = false
- } else {
- drag = ""
- flick.interactive = true
- }
- }
- }
- }
-
- onReleased: {
- if (editor.state == "selection") {
- if (drag == "selection") {
- editor.state = "menu"
- }
- drag = ""
- }
- flick.interactive = true
- }
-
- onPositionChanged: {
- if (editor.state == "selection" && drag != "") {
- if (drag == "start") {
- var pos = edit.positionAt(mouse.x+x+startHandle.width/2,mouse.y+y);
- var e = edit.selectionEnd;
- if (e < pos)
- e = pos;
- edit.select(pos,e);
- } else if (drag == "end") {
- var pos = edit.positionAt(mouse.x+x-endHandle.width/2,mouse.y+y);
- var s = edit.selectionStart;
- if (s > pos)
- s = pos;
- edit.select(s,pos);
- }
- }
- }
- }
}
}