mirror of
https://github.com/KDE/latte-dock.git
synced 2025-03-09 00:58:15 +03:00
update screens in config window in each show event
This commit is contained in:
parent
f791f0b209
commit
8aa5021645
@ -195,6 +195,8 @@ void DockConfigView::showEvent(QShowEvent *ev)
|
||||
|
||||
m_screenSyncTimer.start();
|
||||
QTimer::singleShot(400, this, &DockConfigView::syncGeometry);
|
||||
|
||||
emit showSignal();
|
||||
}
|
||||
|
||||
void DockConfigView::hideEvent(QHideEvent *ev)
|
||||
|
@ -53,6 +53,9 @@ public slots:
|
||||
Q_INVOKABLE void setSticker(bool blockFocusLost);
|
||||
Q_INVOKABLE void syncGeometry();
|
||||
|
||||
signals:
|
||||
void showSignal();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *ev) override;
|
||||
void hideEvent(QHideEvent *ev) override;
|
||||
|
@ -52,16 +52,35 @@ PlasmaComponents.Page {
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: screenRow
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: units.smallSpacing * 2
|
||||
Layout.rightMargin: units.smallSpacing * 2
|
||||
spacing: 1
|
||||
|
||||
Component.onCompleted: {
|
||||
function updateScreens() {
|
||||
if (dock.screens.length > 1)
|
||||
visible = true;
|
||||
screenRow.visible = true;
|
||||
else
|
||||
visible = false;
|
||||
screenRow.visible = false;
|
||||
|
||||
var screens = []
|
||||
|
||||
// screens.push(i18n("On Primary"));
|
||||
|
||||
for (var i = 0; i < dock.screens.length; i++) {
|
||||
screens.push(dock.screens[i].name)
|
||||
}
|
||||
|
||||
screenCmb.model = screens;
|
||||
|
||||
screenCmb.currentIndex = screenCmb.find(dock.currentScreen);
|
||||
console.log(dock.currentScreen);
|
||||
}
|
||||
|
||||
Connections{
|
||||
target: dockConfig
|
||||
onShowSignal: screenRow.updateScreens();
|
||||
}
|
||||
|
||||
PlasmaComponents.Label {
|
||||
@ -72,24 +91,11 @@ PlasmaComponents.Page {
|
||||
PlasmaComponents.ComboBox {
|
||||
id: screenCmb
|
||||
Layout.fillWidth: true
|
||||
Component.onCompleted: {
|
||||
var screens = []
|
||||
Component.onCompleted: screenRow.updateScreens();
|
||||
|
||||
// screens.push(i18n("On Primary"));
|
||||
|
||||
for (var i = 0; i < dock.screens.length; i++) {
|
||||
screens.push(dock.screens[i].name)
|
||||
}
|
||||
|
||||
model = screens;
|
||||
|
||||
currentIndex = find(dock.currentScreen);
|
||||
console.log(dock.currentScreen);
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
console.log("current index changed!!! :"+ currentIndex);
|
||||
onActivated: {
|
||||
if (currentIndex !== find(dock.currentScreen)) {
|
||||
console.log("current index changed!!! :"+ currentIndex);
|
||||
console.log("screen must be changed...");
|
||||
dock.setCurrentScreen(currentText);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user