mirror of
https://github.com/lubosz/overte.git
synced 2025-04-13 13:13:19 +02:00
Frame construction in onCompleted was messing up the browser keyboard focus
This commit is contained in:
parent
7df3e9f306
commit
3d46eda165
7 changed files with 21 additions and 58 deletions
|
@ -8,23 +8,20 @@ import "../windows"
|
|||
import "../styles"
|
||||
|
||||
// Work in progress....
|
||||
Window {
|
||||
ModalWindow {
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
signal selectedFile(var file);
|
||||
signal canceled();
|
||||
|
||||
anchors.centerIn: parent
|
||||
resizable: true
|
||||
width: 640
|
||||
height: 480
|
||||
modality: Qt.ApplicationModal
|
||||
|
||||
property string settingsName: ""
|
||||
property alias folder: folderModel.folder
|
||||
property alias filterModel: selectionType.model
|
||||
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: parent
|
||||
color: "white"
|
||||
|
|
|
@ -7,19 +7,14 @@ import "../styles"
|
|||
import "../windows"
|
||||
|
||||
// FIXME respect default button functionality
|
||||
// FIXME force active focus at all times (modal dialog)
|
||||
Window {
|
||||
ModalWindow {
|
||||
id: root
|
||||
HifiConstants { id: hifi }
|
||||
|
||||
implicitWidth: 640
|
||||
implicitHeight: 320
|
||||
destroyOnCloseButton: true
|
||||
destroyOnInvisible: true
|
||||
visible: true
|
||||
modality: Qt.ApplicationModal
|
||||
anchors.centerIn: parent
|
||||
frame: ModalFrame {}
|
||||
|
||||
signal selected(int button);
|
||||
|
||||
|
|
|
@ -17,9 +17,10 @@ Frame {
|
|||
color: "#7f7f7f7f";
|
||||
radius: 3;
|
||||
MouseArea {
|
||||
enabled: window.visible
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.AllButtons
|
||||
onClicked: { }
|
||||
onClicked: {}
|
||||
onDoubleClicked: {}
|
||||
onPressAndHold: {}
|
||||
onReleased: {}
|
||||
|
|
12
interface/resources/qml/windows/ModalWindow.qml
Normal file
12
interface/resources/qml/windows/ModalWindow.qml
Normal file
|
@ -0,0 +1,12 @@
|
|||
import QtQuick 2.5
|
||||
|
||||
import "."
|
||||
|
||||
Window {
|
||||
id: root
|
||||
anchors.centerIn: parent
|
||||
modality: Qt.ApplicationModal
|
||||
frame: ModalFrame{}
|
||||
}
|
||||
|
||||
|
|
@ -69,28 +69,9 @@ Fadable {
|
|||
|
||||
// Default to a standard frame. Can be overriden to provide custom
|
||||
// frame styles, like a full desktop frame to simulate a modal window
|
||||
property var frame;
|
||||
property var frame: DefaultFrame { }
|
||||
|
||||
Component {
|
||||
id: defaultFrameBuilder;
|
||||
DefaultFrame { anchors.fill: parent }
|
||||
}
|
||||
|
||||
Component {
|
||||
id: modalFrameBuilder;
|
||||
ModalFrame { anchors.fill: parent }
|
||||
}
|
||||
|
||||
Component.onCompleted: {
|
||||
if (!frame) {
|
||||
if (modality === Qt.NonModal) {
|
||||
frame = defaultFrameBuilder.createObject(window);
|
||||
} else {
|
||||
frame = modalFrameBuilder.createObject(window);
|
||||
}
|
||||
}
|
||||
raise();
|
||||
}
|
||||
Component.onCompleted: raise();
|
||||
|
||||
children: [ frame, content, activator ]
|
||||
|
||||
|
|
|
@ -132,11 +132,6 @@ ApplicationWindow {
|
|||
console.log(appWindow.activeFocusItem);
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "Preferences"
|
||||
property var preferencesComponent: Component { PreferencesDialog { } }
|
||||
onClicked: preferencesComponent.createObject(desktop);
|
||||
}
|
||||
}
|
||||
|
||||
Window {
|
||||
|
@ -194,25 +189,6 @@ ApplicationWindow {
|
|||
color: "yellow"
|
||||
}
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
acceptedButtons: Qt.RightButton
|
||||
|
||||
Component {
|
||||
id: menuBuilder
|
||||
VrMenuView { }
|
||||
}
|
||||
|
||||
onClicked: {
|
||||
console.log("zzz")
|
||||
var menuItems = menuItemsToModel(stubMenu);
|
||||
var newMenu = menuBuilder.createObject(desktop, { source: stubMenu, items: menuItems });
|
||||
newMenu.x = mouseX
|
||||
newMenu.y = mouseY
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -85,5 +85,6 @@ DISTFILES += \
|
|||
../../interface/resources/qml/hifi/Desktop.qml \
|
||||
../../interface/resources/qml/menus/MenuMouseHandler.qml \
|
||||
../../interface/resources/qml/menus/VrMenuItem.qml \
|
||||
../../interface/resources/qml/menus/VrMenuView.qml
|
||||
../../interface/resources/qml/menus/VrMenuView.qml \
|
||||
../../interface/resources/qml/windows/ModalWindow.qml
|
||||
|
||||
|
|
Loading…
Reference in a new issue