1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-18 08:22:33 +02:00

Add basic monitor displaying

This commit is contained in:
kelteseth 2017-04-28 17:14:14 +02:00
parent d7caa5804e
commit ac096124ce
2 changed files with 36 additions and 8 deletions

View File

@ -51,17 +51,29 @@ Item {
anchors.top: parent.top
anchors.topMargin: 20
Row {
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: Item {
height: 200
width: 200
delegate: Rectangle {
color:"steelblue"
height: monitorSize.height / 10
width: monitorSize.width / 10
x:monitorAvailableGeometry.x /10
y: monitorAvailableGeometry.y / 10
anchors.margins: 10
Column {
spacing: 5
@ -70,16 +82,27 @@ Item {
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
text: monitorName
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
text: monitorAvailableGeometryRole.x + " " + monitorAvailableGeometryRole.y
text: monitorSize.width + " " + monitorSize.height
anchors.horizontalCenter: parent.horizontalCenter
}
Text {
text: monitorAvailableGeometry.x + " " + monitorAvailableGeometry.y
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
}
}
}
}
}

View File

@ -5,7 +5,12 @@ MonitorListModel::MonitorListModel(QObject *parent)
{
for (int i = 0; i < QApplication::screens().count(); i++) {
QScreen* screen = QApplication::screens().at(i);
_monitorList.append(Monitor(screen->name(),screen->size(),screen->availableGeometry(),i));
_monitorList.append(Monitor(screen->manufacturer(),
screen->size(),
screen->availableGeometry(),
// More convenient for the user if the first monitor == 1
i + 1));
}
}
@ -14,7 +19,7 @@ QHash<int, QByteArray> MonitorListModel::roleNames() const
static const QHash<int, QByteArray> roles{
{ NameRole, "monitorName" },
{ SizeRole, "monitorSize" },
{ AvailableGeometryRole, "monitorAvailableGeometryRole" },
{ AvailableGeometryRole, "monitorAvailableGeometry" },
{ NumberRole, "monitorNumber" },
};
return roles;