r19001 by craig - Fix QML crash, update QML file

scribus-commit scribus-commit at lists.scribus.net
Fri Apr 4 14:37:11 UTC 2014


Author: craig
Date: Fri Apr  4 14:37:11 2014
New Revision: 19001

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19001
Log:
Fix QML crash, update QML file

Modified:
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/ui/qml/qtq_test1.qml

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19001&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Fri Apr  4 14:37:11 2014
@@ -52,7 +52,9 @@
 #include <QProgressBar>
 //<<QML testing
 #include <QHBoxLayout>
-//#include <QQuickView>
+#include <QQuickView>
+#include <QQmlEngine>
+#include <QQmlComponent>
 //>>
 #include <QRegExp>
 #include <QScopedPointer>
@@ -10861,26 +10863,31 @@
 
 void ScribusMainWindow::testQTQuick2_1()
 {
-	/*
-	QQuickView *qqv = new QQuickView;
-	qqv->setSource(QUrl::fromLocalFile(ScPaths::instance().qmlDir() + "qtq_test1.qml"));
-	qqv->show();
-	*/
-	/*
+
 	qDebug()<<"Testing Qt Quick 2.0";
 
-	QQuickView qqv;
-	QDialog d(this);
-	QHBoxLayout *layout = new QHBoxLayout(&d);
-	QWidget *container = createWindowContainer(&qqv, this);
-	d.setMinimumSize(300, 200);
-	d.setMaximumSize(300, 200);
-	d.setFocusPolicy(Qt::TabFocus);
-	qqv.setSource(QUrl::fromLocalFile(ScPaths::instance().qmlDir() + "qtq_test1.qml"));
-
-	layout->addWidget(container);
-	d.exec();
-	*/
+	QQuickView *qqview = new QQuickView();
+	qqview->resize(300,200);
+	//QDialog d(this);
+	//QHBoxLayout *layout = new QHBoxLayout(&d);
+	//QWidget *container = createWindowContainer(view);
+	//d.setMinimumSize(200, 200);
+	//d.setMaximumSize(400, 400);
+	//d.setFocusPolicy(Qt::TabFocus);
+
+	qqview->setSource(QUrl::fromLocalFile(ScPaths::instance().qmlDir() + "qtq_test1.qml"));
+
+	//	QObject *object = qqv.rootObject();
+	//layout->addWidget(container);
+	//d.exec();
+
+	//container->deleteLater();
+	//layout->deleteLater();
+
+	qqview->show();
+
+//	qDebug() << "Property value:" << QQmlProperty::read(object, "someNumber").toInt();
+
 }
 
 void ScribusMainWindow::adjustCMS()

Modified: trunk/Scribus/scribus/ui/qml/qtq_test1.qml
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19001&path=/trunk/Scribus/scribus/ui/qml/qtq_test1.qml
==============================================================================
--- trunk/Scribus/scribus/ui/qml/qtq_test1.qml (original)
+++ trunk/Scribus/scribus/ui/qml/qtq_test1.qml Fri Apr  4 14:37:11 2014
@@ -1,8 +1,9 @@
 import QtQuick 2.2
 import QtQuick.Controls 1.1
 import QtQuick.Controls.Styles 1.1
-import QtQuick.Layouts 1.0
-
+//import QtQuick.Layouts 1.0
+
+/*
 ApplicationWindow {
     width: 360
     height: 360
@@ -20,8 +21,12 @@
             MenuItem { text: "Paste" }
         }
     }
+    */
+Rectangle {
+    width: 300
+    height: 200
     Text {
-        text: qsTr("Hello World")
+      //  text: qsTr("Hello World")
         anchors.centerIn: parent
     }
     MouseArea {
@@ -31,7 +36,7 @@
         anchors.topMargin: 0
         anchors.fill: parent
         onClicked: {
-            Qt.quit();
+            Qt.close();
         }
 
         CheckBox {
@@ -196,4 +201,38 @@
         }
 
     }
+
+
+
+    CheckBox {
+        x: 204
+        y: 110
+        text: "Close"
+        style: CheckBoxStyle {
+            indicator: Rectangle {
+                    implicitWidth: 10
+                    implicitHeight: 10
+                    radius: 1
+                    border.color: control.activeFocus ? "darkblue" : "gray"
+                    border.width: 1
+                    Rectangle {
+                        visible: control.checked
+                        color: "#555"
+                        border.color: "#333"
+                        radius: 1
+                        anchors.margins: 2
+                        anchors.fill: parent
+                    }
+            }
+            label: Text {
+                text: "Close"
+                font.pixelSize: 10
+                font.italic: true
+                color: "red"
+            }
+        }
+        onClicked: {
+            Qt.close();
+        }
+    }
 }




More information about the scribus-commit mailing list