13 changed files with 572 additions and 16 deletions
@ -0,0 +1,28 @@ |
|||||||
|
import QtQuick 2.2 |
||||||
|
import QtQuick.Controls 1.2 |
||||||
|
import QtQuick.Controls.Styles 1.2 |
||||||
|
|
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
|
||||||
|
Button { |
||||||
|
property var __qgcPal: QGCPalette { colorGroup: enabled ? QGCPalette.Active : QGCPalette.Disabled } |
||||||
|
|
||||||
|
style: ButtonStyle { |
||||||
|
background: Rectangle { |
||||||
|
implicitWidth: 100 |
||||||
|
implicitHeight: 25 |
||||||
|
color: control.hovered ? control.__qgcPal.buttonHighlight : control.__qgcPal.button |
||||||
|
} |
||||||
|
|
||||||
|
label: Text { |
||||||
|
width: parent.width |
||||||
|
height: parent.height |
||||||
|
|
||||||
|
verticalAlignment: TextEdit.AlignVCenter |
||||||
|
horizontalAlignment: TextEdit.AlignHCenter |
||||||
|
|
||||||
|
text: control.text |
||||||
|
color: control.__qgcPal.buttonText |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
import QtQuick 2.2 |
||||||
|
import QtQuick.Controls 1.2 |
||||||
|
import QtQuick.Controls.Styles 1.2 |
||||||
|
|
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
|
||||||
|
CheckBox { |
||||||
|
property var __qgcPal: QGCPalette { colorGroup: enabled ? QGCPalette.Active : QGCPalette.Disabled } |
||||||
|
|
||||||
|
style: CheckBoxStyle { |
||||||
|
label: Item { |
||||||
|
implicitWidth: text.implicitWidth + 2 |
||||||
|
implicitHeight: text.implicitHeight |
||||||
|
baselineOffset: text.baselineOffset |
||||||
|
Rectangle { |
||||||
|
anchors.fill: text |
||||||
|
anchors.margins: -1 |
||||||
|
anchors.leftMargin: -3 |
||||||
|
anchors.rightMargin: -3 |
||||||
|
visible: control.activeFocus |
||||||
|
height: 6 |
||||||
|
radius: 3 |
||||||
|
color: "#224f9fef" |
||||||
|
border.color: "#47b" |
||||||
|
opacity: 0.6 |
||||||
|
} |
||||||
|
Text { |
||||||
|
id: text |
||||||
|
text: control.text |
||||||
|
anchors.centerIn: parent |
||||||
|
color: control.__qgcPal.windowText |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
import QtQuick 2.2 |
||||||
|
import QtQuick.Controls 1.2 |
||||||
|
import QtQuick.Controls.Styles 1.2 |
||||||
|
|
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
|
||||||
|
Text { |
||||||
|
property var __palette: QGCPalette { colorGroup: enabled ? QGCPalette.Active : QGCPalette.Disabled } |
||||||
|
property bool enabled: true |
||||||
|
|
||||||
|
color: __palette.windowText |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
import QtQuick 2.2 |
||||||
|
import QtQuick.Controls 1.2 |
||||||
|
import QtQuick.Controls.Styles 1.2 |
||||||
|
|
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
|
||||||
|
RadioButton { |
||||||
|
property var __qgcPal: QGCPalette { colorGroup: enabled ? QGCPalette.Active : QGCPalette.Disabled } |
||||||
|
|
||||||
|
style: RadioButtonStyle { |
||||||
|
label: Item { |
||||||
|
implicitWidth: text.implicitWidth + 2 |
||||||
|
implicitHeight: text.implicitHeight |
||||||
|
baselineOffset: text.y + text.baselineOffset |
||||||
|
Rectangle { |
||||||
|
anchors.fill: text |
||||||
|
anchors.margins: -1 |
||||||
|
anchors.leftMargin: -3 |
||||||
|
anchors.rightMargin: -3 |
||||||
|
visible: control.activeFocus |
||||||
|
height: 6 |
||||||
|
radius: 3 |
||||||
|
color: "#224f9fef" |
||||||
|
border.color: "#47b" |
||||||
|
opacity: 0.6 |
||||||
|
} |
||||||
|
Text { |
||||||
|
id: text |
||||||
|
text: control.text |
||||||
|
anchors.centerIn: parent |
||||||
|
color: control.__qgcPal.windowText |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,344 @@ |
|||||||
|
import QtQuick 2.2 |
||||||
|
import QtQuick.Controls 1.2 |
||||||
|
import QtQuick.Controls.Styles 1.2 |
||||||
|
|
||||||
|
import QGroundControl.Palette 1.0 |
||||||
|
import QGroundControl.Controls 1.0 |
||||||
|
|
||||||
|
Rectangle { |
||||||
|
|
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
color: palette.window |
||||||
|
|
||||||
|
Column { |
||||||
|
spacing: 10 |
||||||
|
|
||||||
|
Grid { |
||||||
|
columns: 4 |
||||||
|
spacing: 5 |
||||||
|
|
||||||
|
Component { |
||||||
|
id: colorSquare |
||||||
|
|
||||||
|
Rectangle { |
||||||
|
width: 80 |
||||||
|
height: 20 |
||||||
|
border.width: 1 |
||||||
|
border.color: "white" |
||||||
|
color: parent.color |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
Component { |
||||||
|
id: rowHeader |
||||||
|
|
||||||
|
Text { |
||||||
|
width: 120 |
||||||
|
height: 20 |
||||||
|
horizontalAlignment: Text.AlignRight |
||||||
|
verticalAlignment: Text.AlignVCenter |
||||||
|
color: palette.windowText |
||||||
|
text: parent.text |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// Header row |
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "" |
||||||
|
} |
||||||
|
Text { |
||||||
|
width: 80 |
||||||
|
height: 20 |
||||||
|
color: palette.windowText |
||||||
|
horizontalAlignment: Text.AlignHCenter |
||||||
|
text: "Disabled" |
||||||
|
} |
||||||
|
Text { |
||||||
|
width: 80 |
||||||
|
height: 20 |
||||||
|
color: palette.windowText |
||||||
|
horizontalAlignment: Text.AlignHCenter |
||||||
|
text: "Active" |
||||||
|
} |
||||||
|
Text { |
||||||
|
width: 80 |
||||||
|
height: 20 |
||||||
|
color: palette.windowText |
||||||
|
horizontalAlignment: Text.AlignHCenter |
||||||
|
text: "Inactive" |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "alternateBase" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.alternateBase |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.alternateBase |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.alternateBase |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "base" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.base |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.base |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.base |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "button" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.button |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.button |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.button |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "buttonHighlight" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.buttonHighlight |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.buttonHighlight |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.buttonHighlight |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "buttonText" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.buttonText |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.buttonText |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.buttonText |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "text" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.text |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.text |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.text |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "window" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.window |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.window |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.window |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: rowHeader |
||||||
|
property var text: "windowText" |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Disabled } |
||||||
|
property var color: palette.windowText |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Active } |
||||||
|
property var color: palette.windowText |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
Loader { |
||||||
|
property var palette: QGCPalette { colorGroup: QGCPalette.Inactive } |
||||||
|
property var color: palette.windowText |
||||||
|
sourceComponent: colorSquare |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
Item { |
||||||
|
width: parent.width |
||||||
|
height: 30 |
||||||
|
} |
||||||
|
|
||||||
|
Grid { |
||||||
|
columns: 3 |
||||||
|
spacing: 5 |
||||||
|
|
||||||
|
Component { |
||||||
|
id: ctlRowHeader |
||||||
|
|
||||||
|
Text { |
||||||
|
width: 120 |
||||||
|
height: 20 |
||||||
|
horizontalAlignment: Text.AlignRight |
||||||
|
verticalAlignment: Text.AlignVCenter |
||||||
|
color: palette.windowText |
||||||
|
text: parent.text |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
// Header row |
||||||
|
Loader { |
||||||
|
sourceComponent: ctlRowHeader |
||||||
|
property var text: "" |
||||||
|
} |
||||||
|
Text { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
color: palette.windowText |
||||||
|
horizontalAlignment: Text.AlignHCenter |
||||||
|
text: "Enabled" |
||||||
|
} |
||||||
|
Text { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
color: palette.windowText |
||||||
|
horizontalAlignment: Text.AlignHCenter |
||||||
|
text: "Disabled" |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: ctlRowHeader |
||||||
|
property var text: "QGCLabel" |
||||||
|
} |
||||||
|
QGCLabel { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Label" |
||||||
|
} |
||||||
|
QGCLabel { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Label" |
||||||
|
enabled: false |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: ctlRowHeader |
||||||
|
property var text: "QGCButton" |
||||||
|
} |
||||||
|
QGCButton { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Button" |
||||||
|
} |
||||||
|
QGCButton { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Button" |
||||||
|
enabled: false |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: ctlRowHeader |
||||||
|
property var text: "QGCRadioButton" |
||||||
|
} |
||||||
|
QGCRadioButton { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Radio" |
||||||
|
} |
||||||
|
QGCRadioButton { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Radio" |
||||||
|
enabled: false |
||||||
|
} |
||||||
|
|
||||||
|
Loader { |
||||||
|
sourceComponent: ctlRowHeader |
||||||
|
property var text: "QGCCheckBox" |
||||||
|
} |
||||||
|
QGCCheckBox { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Check Box" |
||||||
|
} |
||||||
|
QGCCheckBox { |
||||||
|
width: 100 |
||||||
|
height: 20 |
||||||
|
text: "Check Box" |
||||||
|
enabled: false |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,35 @@ |
|||||||
|
/*=====================================================================
|
||||||
|
|
||||||
|
QGroundControl Open Source Ground Control Station |
||||||
|
|
||||||
|
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||||
|
|
||||||
|
This file is part of the QGROUNDCONTROL project |
||||||
|
|
||||||
|
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
======================================================================*/ |
||||||
|
|
||||||
|
/// @file
|
||||||
|
/// @author Don Gagne <don@thegagnes.com>
|
||||||
|
|
||||||
|
#include "QmlTestWidget.h" |
||||||
|
|
||||||
|
QmlTestWidget::QmlTestWidget(void) |
||||||
|
{ |
||||||
|
setAttribute(Qt::WA_DeleteOnClose); |
||||||
|
resize(500, 500); |
||||||
|
setVisible(true); |
||||||
|
setSource(QUrl::fromUserInput("qrc:qml/QmlTest.qml")); |
||||||
|
} |
@ -0,0 +1,42 @@ |
|||||||
|
/*=====================================================================
|
||||||
|
|
||||||
|
QGroundControl Open Source Ground Control Station |
||||||
|
|
||||||
|
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
|
||||||
|
|
||||||
|
This file is part of the QGROUNDCONTROL project |
||||||
|
|
||||||
|
QGROUNDCONTROL is free software: you can redistribute it and/or modify |
||||||
|
it under the terms of the GNU General Public License as published by |
||||||
|
the Free Software Foundation, either version 3 of the License, or |
||||||
|
(at your option) any later version. |
||||||
|
|
||||||
|
QGROUNDCONTROL is distributed in the hope that it will be useful, |
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||||
|
GNU General Public License for more details. |
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License |
||||||
|
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
======================================================================*/ |
||||||
|
|
||||||
|
#ifndef QmlTestWidget_h |
||||||
|
#define QmlTestWidget_h |
||||||
|
|
||||||
|
/// @file
|
||||||
|
/// @author Don Gagne <don@thegagnes.com>
|
||||||
|
|
||||||
|
#include "QGCQmlWidgetHolder.h" |
||||||
|
|
||||||
|
/// This is used to create widgets which are implemented in QML.
|
||||||
|
|
||||||
|
class QmlTestWidget : public QGCQmlWidgetHolder |
||||||
|
{ |
||||||
|
Q_OBJECT |
||||||
|
|
||||||
|
public: |
||||||
|
QmlTestWidget(void); |
||||||
|
}; |
||||||
|
|
||||||
|
#endif |
@ -0,0 +1,6 @@ |
|||||||
|
Module QGroundControl.Controls |
||||||
|
SetupButton 1.0 SetupButton.qml |
||||||
|
QGCLabel 1.0 QGCLabel.qml |
||||||
|
QGCButton 1.0 QGCButton.qml |
||||||
|
QGCRadioButton 1.0 QGCRadioButton.qml |
||||||
|
QGCCheckBox 1.0 QGCCheckBox.qml |
Loading…
Reference in new issue