QmlTestWidget.cc 1.05 KB
Newer Older
1 2 3 4 5 6 7 8 9
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/

Don Gagne's avatar
Don Gagne committed
10 11 12 13 14 15

/// @file
///     @author Don Gagne <don@thegagnes.com>

#include "QmlTestWidget.h"

16 17
#include <QColorDialog>

Don Gagne's avatar
Don Gagne committed
18
QmlTestWidget::QmlTestWidget(void)
19
    : QGCQmlWidgetHolder(QString(), NULL, NULL)
Don Gagne's avatar
Don Gagne committed
20 21
{
    setAttribute(Qt::WA_DeleteOnClose);
22
    resize(900, 500);
Don Gagne's avatar
Don Gagne committed
23
    setVisible(true);
24 25 26

    setContextPropertyObject("controller", this);

Don Gagne's avatar
Don Gagne committed
27 28
    setSource(QUrl::fromUserInput("qrc:qml/QmlTest.qml"));
}
29 30 31 32 33 34 35 36 37 38 39 40 41 42

void QmlTestWidget::showColorDialog(QQuickItem* item)
{
    Q_UNUSED(item)
    QColorDialog colorDialog(this);
    connect(&colorDialog, &QColorDialog::colorSelected, this, &QmlTestWidget::_colorSelected);
    colorDialog.open();
}

void QmlTestWidget::_colorSelected(const QColor & color)
{
    Q_UNUSED(color);
}