1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add sidebar monitor list

This commit is contained in:
Daniel Schukies 2017-05-23 17:36:31 +02:00
parent 2311ca54f2
commit 43f3582c4f
4 changed files with 85 additions and 2 deletions

View File

@ -66,6 +66,7 @@ Item {
anchors.centerIn: parent
anchors.margins: 30
model:monitorListModel
delegate: Rectangle {
color:"steelblue"
height: monitorSize.height / 10

View File

@ -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: ""

View File

@ -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<int, QByteArray> MonitorListModel::roleNames() const