making sure presentation has focus when viewed
This commit is contained in:
parent
c1f0e87056
commit
7c281c1d1e
3 changed files with 26 additions and 26 deletions
|
@ -24,6 +24,8 @@ Kirigami.ApplicationWindow {
|
||||||
|
|
||||||
signal edit()
|
signal edit()
|
||||||
|
|
||||||
|
onActiveFocusItemChanged: showPassiveNotification("CHANGED TO: " + activeFocusControl)
|
||||||
|
|
||||||
pageStack.initialPage: mainPage
|
pageStack.initialPage: mainPage
|
||||||
header: Presenter.Header {}
|
header: Presenter.Header {}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,8 @@ Controls.Page {
|
||||||
|
|
||||||
property string editType
|
property string editType
|
||||||
|
|
||||||
Component.onCompleted: {refocusTimer.start(); changeServiceItem(0);}
|
Component.onCompleted: {changeServiceItem(0); presentation.forceActiveFocus();}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: mainItem
|
id: mainItem
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
@ -68,7 +69,7 @@ Controls.Page {
|
||||||
z: 1
|
z: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
FocusScope {
|
||||||
id: mainPageArea
|
id: mainPageArea
|
||||||
Controls.SplitView.fillWidth: true
|
Controls.SplitView.fillWidth: true
|
||||||
Controls.SplitView.minimumWidth: 100
|
Controls.SplitView.minimumWidth: 100
|
||||||
|
@ -76,6 +77,7 @@ Controls.Page {
|
||||||
Presenter.Presentation {
|
Presenter.Presentation {
|
||||||
id: presentation
|
id: presentation
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Presenter.SongEditor {
|
Presenter.SongEditor {
|
||||||
|
@ -136,24 +138,6 @@ Controls.Page {
|
||||||
id: serviceItemModel
|
id: serviceItemModel
|
||||||
}
|
}
|
||||||
|
|
||||||
Timer {
|
|
||||||
id: refocusTimer
|
|
||||||
interval: 500
|
|
||||||
repeat: true
|
|
||||||
onTriggered: keyHandler.forceActiveFocus()
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
id: keyHandler
|
|
||||||
anchors.fill: parent
|
|
||||||
focus: true
|
|
||||||
Keys.onLeftPressed: presentation.previousSlideAction()
|
|
||||||
Keys.onRightPressed: presentation.nextSlideAction()
|
|
||||||
Keys.onUpPressed: presentation.previousSlideAction()
|
|
||||||
Keys.onDownPressed: presentation.nextSlideAction()
|
|
||||||
Keys.onSpacePressed: presentation.nextSlideAction()
|
|
||||||
}
|
|
||||||
|
|
||||||
function changeServiceItem(index) {
|
function changeServiceItem(index) {
|
||||||
const item = serviceItemModel.getItem(index);
|
const item = serviceItemModel.getItem(index);
|
||||||
print("index grabbed: " + index);
|
print("index grabbed: " + index);
|
||||||
|
@ -181,7 +165,6 @@ Controls.Page {
|
||||||
|
|
||||||
function editSwitch(item) {
|
function editSwitch(item) {
|
||||||
if (editMode) {
|
if (editMode) {
|
||||||
refocusTimer.repeat = false;
|
|
||||||
switch (editType) {
|
switch (editType) {
|
||||||
case "song" :
|
case "song" :
|
||||||
presentation.visible = false;
|
presentation.visible = false;
|
||||||
|
@ -225,6 +208,7 @@ Controls.Page {
|
||||||
imageEditor.visible = false;
|
imageEditor.visible = false;
|
||||||
presentationEditor.visible = false;
|
presentationEditor.visible = false;
|
||||||
presentation.visible = true;
|
presentation.visible = true;
|
||||||
|
presentation.forceActiveFocus();
|
||||||
editMode = false;
|
editMode = false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -234,8 +218,8 @@ Controls.Page {
|
||||||
imageEditor.visible = false;
|
imageEditor.visible = false;
|
||||||
presentationEditor.visible = false;
|
presentationEditor.visible = false;
|
||||||
presentation.visible = true;
|
presentation.visible = true;
|
||||||
|
presentation.forceActiveFocus();
|
||||||
editMode = false;
|
editMode = false;
|
||||||
refocusTimer.repeat = true;
|
|
||||||
presenting = true;
|
presenting = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ import org.kde.kirigami 2.13 as Kirigami
|
||||||
import "./" as Presenter
|
import "./" as Presenter
|
||||||
import org.presenter 1.0
|
import org.presenter 1.0
|
||||||
|
|
||||||
Item {
|
FocusScope {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property var text
|
property var text
|
||||||
|
@ -19,6 +19,19 @@ Item {
|
||||||
|
|
||||||
property Item slide: previewSlide
|
property Item slide: previewSlide
|
||||||
|
|
||||||
|
onActiveFocusChanged: showPassiveNotification("OUCH")
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: keyHandler
|
||||||
|
anchors.fill: parent
|
||||||
|
focus: true
|
||||||
|
Keys.onLeftPressed: previousSlideAction()
|
||||||
|
Keys.onRightPressed: nextSlideAction()
|
||||||
|
Keys.onUpPressed: previousSlideAction()
|
||||||
|
Keys.onDownPressed: nextSlideAction()
|
||||||
|
Keys.onSpacePressed: nextSlideAction()
|
||||||
|
}
|
||||||
|
|
||||||
/* Component.onCompleted: nextSlideAction() */
|
/* Component.onCompleted: nextSlideAction() */
|
||||||
|
|
||||||
GridLayout {
|
GridLayout {
|
||||||
|
@ -213,8 +226,7 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: serviceItemModel
|
target: serviceItemModel
|
||||||
onDataChanged: if (active)
|
onDataChanged: if (active)
|
||||||
previewSlidesList.positionViewAtIndex(index,
|
previewSlidesList.positionViewAtIndex(index, ListView.Center)
|
||||||
ListView.Center)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.WheelHandler {
|
Kirigami.WheelHandler {
|
||||||
|
@ -267,6 +279,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nextSlideAction() {
|
function nextSlideAction() {
|
||||||
|
root.forceActiveFocus();
|
||||||
if (currentServiceItem === totalServiceItems)
|
if (currentServiceItem === totalServiceItems)
|
||||||
return;
|
return;
|
||||||
const nextServiceItemIndex = currentServiceItem + 1;
|
const nextServiceItemIndex = currentServiceItem + 1;
|
||||||
|
@ -289,6 +302,7 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function previousSlideAction() {
|
function previousSlideAction() {
|
||||||
|
root.forceActiveFocus();
|
||||||
if (currentServiceItem === 0) {
|
if (currentServiceItem === 0) {
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue