mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-04 23:05:48 +02:00
fix: open shortcuts window on correct screen
corrections: - open on the same display, - center to the parent window, - has dimensions not more than the parent window Change-Id: I2315d62fef6d830b6957770807ace462fbb77901 Gitlab: #774
This commit is contained in:
parent
682721b7a7
commit
49aadea7ba
3 changed files with 11 additions and 8 deletions
|
@ -606,7 +606,7 @@ Rectangle {
|
||||||
sequence: "F10"
|
sequence: "F10"
|
||||||
context: Qt.ApplicationShortcut
|
context: Qt.ApplicationShortcut
|
||||||
onActivated: {
|
onActivated: {
|
||||||
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject()
|
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow)
|
||||||
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
|
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -241,7 +241,7 @@ Rectangle {
|
||||||
toolTipText: JamiStrings.keyboardShortcuts
|
toolTipText: JamiStrings.keyboardShortcuts
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject()
|
KeyboardShortcutTableCreation.createKeyboardShortcutTableWindowObject(appWindow)
|
||||||
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
|
KeyboardShortcutTableCreation.showKeyboardShortcutTableWindow()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,12 +19,14 @@
|
||||||
// Global select screen window component, object variable for creation.
|
// Global select screen window component, object variable for creation.
|
||||||
var keyboardShortcutTableWindowComponent
|
var keyboardShortcutTableWindowComponent
|
||||||
var keyboardShortcutTableWindowObject
|
var keyboardShortcutTableWindowObject
|
||||||
|
var mainWindow
|
||||||
|
|
||||||
function createKeyboardShortcutTableWindowObject() {
|
function createKeyboardShortcutTableWindowObject(appWindow) {
|
||||||
if (keyboardShortcutTableWindowObject)
|
if (keyboardShortcutTableWindowObject)
|
||||||
return
|
return
|
||||||
keyboardShortcutTableWindowComponent = Qt.createComponent(
|
keyboardShortcutTableWindowComponent = Qt.createComponent(
|
||||||
"../components/KeyboardShortcutTable.qml")
|
"../components/KeyboardShortcutTable.qml")
|
||||||
|
mainWindow = appWindow
|
||||||
if (keyboardShortcutTableWindowComponent.status === Component.Ready)
|
if (keyboardShortcutTableWindowComponent.status === Component.Ready)
|
||||||
finishCreation()
|
finishCreation()
|
||||||
else if (keyboardShortcutTableWindowComponent.status === Component.Error)
|
else if (keyboardShortcutTableWindowComponent.status === Component.Error)
|
||||||
|
@ -45,12 +47,13 @@ function finishCreation() {
|
||||||
|
|
||||||
function showKeyboardShortcutTableWindow() {
|
function showKeyboardShortcutTableWindow() {
|
||||||
keyboardShortcutTableWindowObject.show()
|
keyboardShortcutTableWindowObject.show()
|
||||||
|
var centerX = mainWindow.x + mainWindow.width / 2
|
||||||
|
var centerY = mainWindow.y + mainWindow.height / 2
|
||||||
|
|
||||||
var screen = keyboardShortcutTableWindowObject.screen
|
keyboardShortcutTableWindowObject.width = 0.75 * appWindow.width
|
||||||
keyboardShortcutTableWindowObject.x = screen.virtualX +
|
keyboardShortcutTableWindowObject.height = 0.75 * appWindow.height
|
||||||
(screen.width - keyboardShortcutTableWindowObject.width) / 2
|
keyboardShortcutTableWindowObject.x = centerX - keyboardShortcutTableWindowObject.width / 2
|
||||||
keyboardShortcutTableWindowObject.y = screen.virtualY +
|
keyboardShortcutTableWindowObject.y = centerY - keyboardShortcutTableWindowObject.height / 2
|
||||||
(screen.height - keyboardShortcutTableWindowObject.height) / 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destroy and reset selectScreenWindowObject when window is closed.
|
// Destroy and reset selectScreenWindowObject when window is closed.
|
||||||
|
|
Loading…
Add table
Reference in a new issue