mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 18:42:58 +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"
|
import "../styles"
|
||||||
|
|
||||||
// Work in progress....
|
// Work in progress....
|
||||||
Window {
|
ModalWindow {
|
||||||
id: root
|
id: root
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
signal selectedFile(var file);
|
signal selectedFile(var file);
|
||||||
signal canceled();
|
signal canceled();
|
||||||
|
|
||||||
anchors.centerIn: parent
|
|
||||||
resizable: true
|
resizable: true
|
||||||
width: 640
|
width: 640
|
||||||
height: 480
|
height: 480
|
||||||
modality: Qt.ApplicationModal
|
|
||||||
property string settingsName: ""
|
property string settingsName: ""
|
||||||
property alias folder: folderModel.folder
|
property alias folder: folderModel.folder
|
||||||
property alias filterModel: selectionType.model
|
property alias filterModel: selectionType.model
|
||||||
|
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
|
@ -7,19 +7,14 @@ import "../styles"
|
||||||
import "../windows"
|
import "../windows"
|
||||||
|
|
||||||
// FIXME respect default button functionality
|
// FIXME respect default button functionality
|
||||||
// FIXME force active focus at all times (modal dialog)
|
ModalWindow {
|
||||||
Window {
|
|
||||||
id: root
|
id: root
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
|
||||||
implicitWidth: 640
|
implicitWidth: 640
|
||||||
implicitHeight: 320
|
implicitHeight: 320
|
||||||
destroyOnCloseButton: true
|
destroyOnCloseButton: true
|
||||||
destroyOnInvisible: true
|
destroyOnInvisible: true
|
||||||
visible: true
|
visible: true
|
||||||
modality: Qt.ApplicationModal
|
|
||||||
anchors.centerIn: parent
|
|
||||||
frame: ModalFrame {}
|
|
||||||
|
|
||||||
signal selected(int button);
|
signal selected(int button);
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,10 @@ Frame {
|
||||||
color: "#7f7f7f7f";
|
color: "#7f7f7f7f";
|
||||||
radius: 3;
|
radius: 3;
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
enabled: window.visible
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
acceptedButtons: Qt.AllButtons
|
acceptedButtons: Qt.AllButtons
|
||||||
onClicked: { }
|
onClicked: {}
|
||||||
onDoubleClicked: {}
|
onDoubleClicked: {}
|
||||||
onPressAndHold: {}
|
onPressAndHold: {}
|
||||||
onReleased: {}
|
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
|
// Default to a standard frame. Can be overriden to provide custom
|
||||||
// frame styles, like a full desktop frame to simulate a modal window
|
// frame styles, like a full desktop frame to simulate a modal window
|
||||||
property var frame;
|
property var frame: DefaultFrame { }
|
||||||
|
|
||||||
Component {
|
Component.onCompleted: raise();
|
||||||
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
children: [ frame, content, activator ]
|
children: [ frame, content, activator ]
|
||||||
|
|
||||||
|
|
|
@ -132,11 +132,6 @@ ApplicationWindow {
|
||||||
console.log(appWindow.activeFocusItem);
|
console.log(appWindow.activeFocusItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Button {
|
|
||||||
text: "Preferences"
|
|
||||||
property var preferencesComponent: Component { PreferencesDialog { } }
|
|
||||||
onClicked: preferencesComponent.createObject(desktop);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
|
@ -194,25 +189,6 @@ ApplicationWindow {
|
||||||
color: "yellow"
|
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/hifi/Desktop.qml \
|
||||||
../../interface/resources/qml/menus/MenuMouseHandler.qml \
|
../../interface/resources/qml/menus/MenuMouseHandler.qml \
|
||||||
../../interface/resources/qml/menus/VrMenuItem.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