diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-07-22 07:26:28 (GMT) |
---|---|---|
committer | Eduardo M. Fleury <eduardo.fleury@openbossa.org> | 2009-07-22 18:04:46 (GMT) |
commit | 4a03627703af9119e02024239cfdb464c5013396 (patch) | |
tree | eb2b6d83091b3d415fe23156096a09c17046574a /examples | |
parent | 448a082899857f515f4040fccebaf0918ed19f19 (diff) | |
download | Qt-4a03627703af9119e02024239cfdb464c5013396.zip Qt-4a03627703af9119e02024239cfdb464c5013396.tar.gz Qt-4a03627703af9119e02024239cfdb464c5013396.tar.bz2 |
Can now specify which layout to load on the command line.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/layouts/anchorlayout/main.cpp | 4 | ||||
-rw-r--r-- | examples/layouts/anchorlayout/window.cpp | 8 | ||||
-rw-r--r-- | examples/layouts/anchorlayout/window.h | 2 |
3 files changed, 10 insertions, 4 deletions
diff --git a/examples/layouts/anchorlayout/main.cpp b/examples/layouts/anchorlayout/main.cpp index d0e6ee7..716a563 100644 --- a/examples/layouts/anchorlayout/main.cpp +++ b/examples/layouts/anchorlayout/main.cpp @@ -4,7 +4,7 @@ int main(int argc, char **argv) { QApplication app(argc, argv); - Window *w = new Window; + Window *w = new Window(app.arguments()); w->show(); return app.exec(); -}
\ No newline at end of file +} diff --git a/examples/layouts/anchorlayout/window.cpp b/examples/layouts/anchorlayout/window.cpp index 32efa69..d8d68e2 100644 --- a/examples/layouts/anchorlayout/window.cpp +++ b/examples/layouts/anchorlayout/window.cpp @@ -21,7 +21,7 @@ static QString nodeName(QGraphicsLayoutItem *item) #define _QUOTEMACRO(x) #x #define QUOTEMACRO(x) _QUOTEMACRO(x) -Window::Window(QWidget *parent) +Window::Window(const QStringList &arguments, QWidget *parent) : QMainWindow(parent), m_inAddAnchor(false) { m_ui.setupUi(this); @@ -41,6 +41,12 @@ Window::Window(QWidget *parent) WidgetChooserDelegate *delegate = new WidgetChooserDelegate(&m_layoutItems, m_layout, m_ui.anchors); m_ui.anchors->setItemDelegate(delegate); + if (arguments.count() >= 2) { + QString fileName = QString::fromAscii("%1/xml/%2.xml").arg(QUOTEMACRO(PRO_FILE_PWD), arguments.at(1)); + if (!loadLayout(fileName, m_layout)) { + QMessageBox::warning(this, tr("Not found"), tr("Could not find %1").arg(fileName)); + } + } } void Window::findLayoutFiles() diff --git a/examples/layouts/anchorlayout/window.h b/examples/layouts/anchorlayout/window.h index 911cc84..c81dbac 100644 --- a/examples/layouts/anchorlayout/window.h +++ b/examples/layouts/anchorlayout/window.h @@ -11,7 +11,7 @@ class Window : public QMainWindow { Q_OBJECT public: - Window(QWidget *parent = 0); + Window(const QStringList &arguments, QWidget *parent = 0); private slots: void on_anchors_cellChanged(int row, int column); |