QGCViewDialog.qml 1.52 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (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
9

10
import QtQuick          2.3
11
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed
12

13 14 15 16 17
import QGroundControl.Controls      1.0
import QGroundControl.Palette       1.0
import QGroundControl.FactSystem    1.0
import QGroundControl.FactControls  1.0
import QGroundControl.ScreenTools   1.0
Don Gagne's avatar
Don Gagne committed
18 19

FactPanel {
20 21
    property var qgcTextFieldforwardKeysTo: this    ///< Causes all QGCTextFields to forward keys here if they have focus

22 23 24
    property real defaultTextWidth:     ScreenTools.defaultFontPixelWidth
    property real defaultTextHeight:    ScreenTools.defaultFontPixelHeight

Don Gagne's avatar
Don Gagne committed
25
    QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
Don Gagne's avatar
Don Gagne committed
26 27 28

    signal hideDialog

29 30 31 32
    Keys.onReleased: {
        if (event.key == Qt.Key_Escape) {
            reject()
            event.accepted = true
33
        } else if (event.key == Qt.Key_Return || event.key == Qt.Key_Enter) {
34 35 36 37 38
            accept()
            event.accepted = true
        }
    }

Don Gagne's avatar
Don Gagne committed
39
    function accept() {
40 41 42 43
        if (acceptAllowed) {
            Qt.inputMethod.hide()
            hideDialog()
        }
Don Gagne's avatar
Don Gagne committed
44 45 46
    }

    function reject() {
47 48 49 50
        if (rejectAllowed) {
            Qt.inputMethod.hide()
            hideDialog()
        }
Don Gagne's avatar
Don Gagne committed
51 52
    }

Don Gagne's avatar
Don Gagne committed
53
    color: __qgcPal.windowShadeDark
Don Gagne's avatar
Don Gagne committed
54
}