QGCViewDialog.qml 1.34 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 11 12 13


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

14 15
import QtQuick 2.3
import QtQuick.Controls 1.2
Don Gagne's avatar
Don Gagne committed
16 17 18 19

import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0

Don Gagne's avatar
Don Gagne committed
20 21 22 23
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0

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

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

    signal hideDialog

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

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

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

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