From 485c014490b47c1cfc6b3a234b0b01127fdd108b Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Wed, 4 Jul 2018 16:52:16 -0700 Subject: [PATCH] Fix crash on the placeholder icon and fix display of multiple PCs --- app/gui/PcView.qml | 13 ++++++++++--- app/gui/computermodel.cpp | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/gui/PcView.qml b/app/gui/PcView.qml index 114c0692..677c566a 100644 --- a/app/gui/PcView.qml +++ b/app/gui/PcView.qml @@ -4,9 +4,15 @@ import QtQuick.Controls 2.2 import ComputerModel 1.0 Frame { + anchors.fill: parent + GridView { anchors.fill: parent - cellWidth: 200; cellHeight: 300; + anchors.leftMargin: 5 + anchors.topMargin: 5 + anchors.rightMargin: 5 + anchors.bottomMargin: 5 + cellWidth: 350; cellHeight: 350; focus: true model: ComputerModel {} @@ -16,7 +22,7 @@ Frame { Image { id: pcIcon - y: 10; anchors.horizontalCenter: parent.horizontalCenter; + anchors.horizontalCenter: parent.horizontalCenter; source: { model.addPc ? "ic_add_to_queue_white_48px.svg" : "ic_tv_white_48px.svg" } @@ -34,7 +40,7 @@ Frame { width: parent.width anchors.top: pcIcon.bottom minimumPointSize: 12 - font.pointSize: 36 + font.pointSize: 48 horizontalAlignment: Text.AlignHCenter fontSizeMode: Text.HorizontalFit } @@ -63,6 +69,7 @@ Frame { id: pcPairedText text: getStatusText(model) + visible: !model.addPc width: parent.width anchors.top: pcNameText.bottom diff --git a/app/gui/computermodel.cpp b/app/gui/computermodel.cpp index 94cd53ff..5fa57cdc 100644 --- a/app/gui/computermodel.cpp +++ b/app/gui/computermodel.cpp @@ -23,6 +23,8 @@ QVariant ComputerModel::data(const QModelIndex& index, int role) const return "Add PC"; case AddPcRole: return true; + default: + return QVariant(); } } else if (index.row() > m_Computers.count()) { @@ -69,6 +71,7 @@ QHash ComputerModel::roleNames() const names[OnlineRole] = "online"; names[PairedRole] = "paired"; names[BusyRole] = "busy"; + names[AddPcRole] = "addPc"; return names; }