diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-20 18:46:48 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-20 18:46:48 (GMT) |
commit | c220a549d185989fc2b0f429ceb75dd6a84332f6 (patch) | |
tree | 7b5eaefa8e9a306cc2430495911a9be2fa9287b9 | |
parent | c6b9ed9c2c0a8617e1d076fcad8f72e60156f455 (diff) | |
parent | 917307b393e613a891fa762f70cb676e33ca68ee (diff) | |
download | Qt-c220a549d185989fc2b0f429ceb75dd6a84332f6.zip Qt-c220a549d185989fc2b0f429ceb75dd6a84332f6.tar.gz Qt-c220a549d185989fc2b0f429ceb75dd6a84332f6.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Add a menu option to open remote files in the QML viewer
-rw-r--r-- | tools/qml/qmlruntime.cpp | 14 | ||||
-rw-r--r-- | tools/qml/qmlruntime.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index b9fd570..321b7fd 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -85,6 +85,7 @@ #include <QMenu> #include <QAction> #include <QFileDialog> +#include <QInputDialog> #include <QTimer> #include <QGraphicsObject> #include <QNetworkProxyFactory> @@ -715,6 +716,9 @@ void QDeclarativeViewer::createMenu() openAction->setShortcuts(QKeySequence::Open); connect(openAction, SIGNAL(triggered()), this, SLOT(openFile())); + QAction *openUrlAction = new QAction(tr("Open &URL..."), this); + connect(openUrlAction, SIGNAL(triggered()), this, SLOT(openUrl())); + QAction *reloadAction = new QAction(tr("&Reload"), this); reloadAction->setShortcuts(QKeySequence::Refresh); connect(reloadAction, SIGNAL(triggered()), this, SLOT(reload())); @@ -789,6 +793,7 @@ void QDeclarativeViewer::createMenu() #if defined(Q_WS_MAEMO_5) menu->addAction(openAction); + menu->addAction(openUrlAction); menu->addAction(reloadAction); menu->addAction(snapshotAction); @@ -809,6 +814,7 @@ void QDeclarativeViewer::createMenu() QMenu *fileMenu = menu->addMenu(tr("&File")); fileMenu->addAction(openAction); + fileMenu->addAction(openUrlAction); fileMenu->addAction(reloadAction); fileMenu->addSeparator(); fileMenu->addAction(closeAction); @@ -1021,6 +1027,14 @@ void QDeclarativeViewer::openFile() } } +void QDeclarativeViewer::openUrl() +{ + QString cur = canvas->source().toLocalFile(); + QString url= QInputDialog::getText(this, tr("Open QML file"), tr("URL of main QML file:"), QLineEdit::Normal, cur); + if (!url.isEmpty()) + open(url); +} + void QDeclarativeViewer::statusChanged() { if (canvas->status() == QDeclarativeView::Error && tester) diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 6fa7d81..d1ec26d 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -113,6 +113,7 @@ public slots: void sceneResized(QSize size); bool open(const QString&); void openFile(); + void openUrl(); void reload(); void takeSnapShot(); void toggleRecording(); |