From 43f3582c4f4a5fdaebff1840f5f1636dc36cb434 Mon Sep 17 00:00:00 2001 From: Daniel Schukies Date: Tue, 23 May 2017 17:36:31 +0200 Subject: [PATCH] Add sidebar monitor list --- qml/Components/Monitors.qml | 1 + qml/Components/Sidebar.qml | 76 +++++++++++++++++++++++++++++++++++++ src/monitorlistmodel.cpp | 8 +++- src/monitorlistmodel.h | 2 +- 4 files changed, 85 insertions(+), 2 deletions(-) diff --git a/qml/Components/Monitors.qml b/qml/Components/Monitors.qml index 84c03572..af49a77e 100644 --- a/qml/Components/Monitors.qml +++ b/qml/Components/Monitors.qml @@ -66,6 +66,7 @@ Item { anchors.centerIn: parent anchors.margins: 30 model:monitorListModel + delegate: Rectangle { color:"steelblue" height: monitorSize.height / 10 diff --git a/qml/Components/Sidebar.qml b/qml/Components/Sidebar.qml index 98a0e096..c8dbd5f9 100644 --- a/qml/Components/Sidebar.qml +++ b/qml/Components/Sidebar.qml @@ -107,6 +107,82 @@ Item { } } + MouseArea { + id: mouseArea + anchors.rightMargin: -11 + anchors.bottomMargin: 282 + anchors.leftMargin: 26 + anchors.topMargin: 486 + anchors.fill: parent + + Rectangle { + id: rect + color: "#dfdfdf" + anchors.bottom: parent.bottom + anchors.bottomMargin: -158 + anchors.right: parent.right + anchors.rightMargin: 42 + anchors.left: parent.left + anchors.leftMargin: -7 + anchors.top: parent.top + anchors.topMargin: 20 + + Item { + id:monitorListCenter + width:0 + height:0 + anchors.centerIn: parent + } + + + + Repeater { + id:rp + anchors.fill: parent + anchors.centerIn: parent + anchors.margins: 30 + model:monitorListModel + + delegate: Rectangle { + color:"steelblue" + height: 100 + width: 100 + x:monitorAvailableGeometry.x /10 + y: monitorAvailableGeometry.y / 10 + anchors.margins: 10 + + Column { + spacing: 5 + + Text { + text: monitorNumber + anchors.horizontalCenter: parent.horizontalCenter + } + + Text { + text: monitorName + anchors.horizontalCenter: parent.horizontalCenter + } + + + Text { + text: monitorSize.width + " " + monitorSize.height + anchors.horizontalCenter: parent.horizontalCenter + } + + + Text { + text: monitorAvailableGeometry.x + " " + monitorAvailableGeometry.y + anchors.horizontalCenter: parent.horizontalCenter + } + + } + } + } + + } + } + Text { id: text1 text: "" diff --git a/src/monitorlistmodel.cpp b/src/monitorlistmodel.cpp index 6a0a23fa..3581cff3 100644 --- a/src/monitorlistmodel.cpp +++ b/src/monitorlistmodel.cpp @@ -6,12 +6,18 @@ MonitorListModel::MonitorListModel(QObject *parent) for (int i = 0; i < QApplication::screens().count(); i++) { QScreen* screen = QApplication::screens().at(i); - _monitorList.append(Monitor(screen->manufacturer(), + _monitorList.append(Monitor(screen->name(), screen->size(), screen->availableGeometry(), // More convenient for the user if the first monitor == 1 i + 1)); } + + _monitorList.append(Monitor(QString("lool"), + QSize(1000,1000), + QRect(1920, 0, 1000, 1000), + // More convenient for the user if the first monitor == 1 + QApplication::screens().count())); } QHash MonitorListModel::roleNames() const diff --git a/src/monitorlistmodel.h b/src/monitorlistmodel.h index 2eeb3182..198a042c 100644 --- a/src/monitorlistmodel.h +++ b/src/monitorlistmodel.h @@ -59,7 +59,7 @@ class Monitor { public: Monitor(); - Monitor(QString name, QSize size, QRect availableGeometry, int number); + Monitor(QString name, QSize size, QRect availableGeometry, int number); QString _name; QSize _size;