diff options
author | Michal Klocek <michal.klocek@theqtcompany.com> | 2016-02-11 18:29:29 +0100 |
---|---|---|
committer | Michal Klocek <michal.klocek@theqtcompany.com> | 2016-02-12 15:21:45 +0000 |
commit | c86bb8a400f79be205025598310926df5d01c7bc (patch) | |
tree | 40d6eb16272f17fab61277f53dd092c6bfd5ba75 | |
parent | 151b59080f80ea4cd8b902e5a18151772de595a6 (diff) |
Move inputPanel out of browserWindow
On b2qt launcher uses own keyboard, prevent
loading the keyboard for second time. Make Main
component loaded first when run as cpp application.
B2qt launcher loads BrowserWindow directly.
Task-number: QTEE-1066
Change-Id: Ibae9250b0c67c42e6e2d050241c7c625522d43a3
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/qml/BrowserWindow.qml | 28 | ||||
-rw-r--r-- | src/qml/Keyboard.qml | 69 | ||||
-rw-r--r-- | src/qml/Main.qml | 50 | ||||
-rw-r--r-- | src/resources.qrc | 2 | ||||
-rw-r--r-- | src/src.pro | 2 |
6 files changed, 124 insertions, 29 deletions
diff --git a/src/main.cpp b/src/main.cpp index 79cb41b..919629c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -100,7 +100,7 @@ int main(int argc, char **argv) view.setFlags(Qt::Window | Qt::WindowTitleHint); view.setResizeMode(QQuickView::SizeRootObjectToView); view.setColor(Qt::black); - view.setSource(QUrl("qrc:///qml/BrowserWindow.qml")); + view.setSource(QUrl("qrc:///qml/Main.qml")); QObject::connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit())); diff --git a/src/qml/BrowserWindow.qml b/src/qml/BrowserWindow.qml index c639340..d796ca9 100644 --- a/src/qml/BrowserWindow.qml +++ b/src/qml/BrowserWindow.qml @@ -41,10 +41,8 @@ import QtWebEngine 1.1 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.0 import QtQuick.Layouts 1.0 -import QtQuick.Window 2.1 import QtQuick.Controls.Private 1.0 import QtQuick.Dialogs 1.2 -import QtQuick.Enterprise.VirtualKeyboard 2.0 import "assets" import WebBrowser 1.0 @@ -460,30 +458,4 @@ Item { right: parent.right } } - InputPanel { - id: inputPanel - y: browserWindow.height - anchors { - left: browserWindow.left - right: browserWindow.right - } - states: State { - name: "visible" - when: Qt.inputMethod.visible - PropertyChanges { - target: inputPanel - y: browserWindow.height - inputPanel.height - } - } - transitions: Transition { - from: "" - to: "visible" - reversible: true - NumberAnimation { - properties: "y" - duration: animationDuration - easing.type: Easing.InOutQuad - } - } - } } diff --git a/src/qml/Keyboard.qml b/src/qml/Keyboard.qml new file mode 100644 index 0000000..13ab64e --- /dev/null +++ b/src/qml/Keyboard.qml @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBrowser project. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPLv2 included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.5 +import QtQuick.Enterprise.VirtualKeyboard 2.0 + +InputPanel { + id: inputPanel + property int windowHeight: 0 + property int animationDuration: 0 + + y: windowHeight + anchors { + left: parent.left + right: parent.right + } + states: State { + name: "visible" + when: Qt.inputMethod.visible + PropertyChanges { + target: inputPanel + y: windowHeight - inputPanel.height + } + } + transitions: Transition { + from: "" + to: "visible" + reversible: true + NumberAnimation { + properties: "y" + duration: animationDuration + easing.type: Easing.InOutQuad + } + } +} diff --git a/src/qml/Main.qml b/src/qml/Main.qml new file mode 100644 index 0000000..3f01ecc --- /dev/null +++ b/src/qml/Main.qml @@ -0,0 +1,50 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the QtBrowser project. +** +** $QT_BEGIN_LICENSE:GPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPLv2 included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.5 + +Item { + BrowserWindow{ + id: root + anchors.fill: parent + Keyboard{ + id: inputPanel + windowHeight: root.height + animationDuration: root.animationDuration + } + } +} diff --git a/src/resources.qrc b/src/resources.qrc index 93b48eb..0ca7710 100644 --- a/src/resources.qrc +++ b/src/resources.qrc @@ -30,5 +30,7 @@ <file>qml/assets/icons/qt.png</file> <file>qml/assets/icons/AppLogoColor.png</file> <file>qml/assets/icons/AppLogoGrey.png</file> + <file>qml/Keyboard.qml</file> + <file>qml/Main.qml</file> </qresource> </RCC> diff --git a/src/src.pro b/src/src.pro index 22762f9..79e4bdc 100644 --- a/src/src.pro +++ b/src/src.pro @@ -25,6 +25,8 @@ OTHER_FILES = \ qml/NavigationBar.qml \ qml/HomeScreen.qml \ qml/SettingsView.qml \ + qml/Keyboard.qml \ + qml/Window.qml QT += qml quick webengine |