1 /******************************************************************************
3 ** This file is part of quickdice.
5 ** Copyright (C) 2011 Digia Plc. and/or its subsidiary(-ies).
6 ** Contact: Zoltan Papp <zoltan.papp@digia.com>
8 ** This library is free software; you can redistribute it and/or modify it
9 ** under the terms of the GNU Lesser General Public License version 2.1 as
10 ** published by the Free Software Foundation.
12 ** This library is distributed in the hope that it will be useful, but
13 ** WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 ** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 ** License for more details.
17 ** You should have received a copy of the GNU Lesser General Public License
18 ** along with this library; if not, write to the Free Software Foundation, Inc.,
19 ** 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 ******************************************************************************/
23 #include "mainwindow.h"
24 #include <QtDeclarative/QtDeclarative>
25 #include <QtGui/QAction>
27 MainWindow::MainWindow(QWidget *parent)
30 QDeclarativeView *view = new QDeclarativeView;
31 setCentralWidget(view);
33 QDeclarativeEngine *engine = view->engine();
34 QDeclarativeContext *context = engine->rootContext();
35 context->setContextProperty(QLatin1String("message"),
36 QLatin1String("Hello World!"));
37 context->setContextProperty(QLatin1String("defaultColor"),
38 QColor(Qt::lightGray));
40 QAction *action = new QAction(this);
45 context->setContextProperty(QLatin1String("action"),
48 // FIXME: load it properly from a resource file
49 QString fn = "test.qml";
53 MainWindow::~MainWindow()