From 98e913a134653fa73204b55ae6ad1ef8da38b160 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Sun, 21 Oct 2018 17:25:35 +0200 Subject: [PATCH] =?UTF-8?q?neues=20Layout=20f=C3=BCr=20die=20interne=20Ver?= =?UTF-8?q?tretungsplananzeige?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- qml/EventForm.qml | 102 ++++++------------------------------------ source/serverconn.cpp | 7 ++- 2 files changed, 18 insertions(+), 91 deletions(-) diff --git a/qml/EventForm.qml b/qml/EventForm.qml index 6c19ad1..e340986 100644 --- a/qml/EventForm.qml +++ b/qml/EventForm.qml @@ -63,7 +63,7 @@ Page { width: listView.width id: delegate - height: visible ? cookteam.height + date.height + main_dish.height + main_dish_veg.height + garnish.height + dessert.height + spacer.height + cust_spacing*9 + 5:0 + height: visible ? cookteam.height + date.height + text.height + spacer.height + cust_spacing*9 + 5:0 visible: listView.isDayVisible(index) property int cust_spacing: 5 @@ -74,118 +74,42 @@ Page { anchors.top: parent.top anchors.topMargin: 10 font.bold: true + font.pixelSize: date.font.pixelSize * 1.5 id: cookteam text: _cppServerConn.getEventData(index).grade width: parent.width - 10 wrapMode: Label.Wrap - height: text!=""? undefined:0 + height: text!==""? undefined:0 } Label { anchors.left: parent.left anchors.leftMargin: 10 anchors.top: cookteam.bottom - font.bold: true id: date - text: _cppServerConn.getEventData(index).hour + text: _cppServerConn.getEventData(index).hour + " | " + + _cppServerConn.getEventData(index).replace + " | " + + _cppServerConn.getEventData(index).subject + " | " + + _cppServerConn.getEventData(index).room + " | " + width: parent.width - 10 wrapMode: Label.Wrap } - Rectangle { - anchors.top: date.bottom - anchors.topMargin: cust_spacing - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.right: parent.right - anchors.rightMargin: 10 - height: 2 - color: "grey" - - } Label { anchors.left: parent.left anchors.leftMargin: 10 anchors.top: date.bottom - anchors.topMargin: cust_spacing * 2 - width: parent.width - 10 - wrapMode: Label.Wrap - id: main_dish - text: _cppServerConn.getEventData(index).replace - height: text!=""? undefined:0 - } - - Rectangle { - anchors.top: main_dish.bottom anchors.topMargin: cust_spacing - anchors.left: parent.left - anchors.leftMargin: 10 - width: parent.width / 10 - height: main_dish_veg.text!=""? 1:0 - color: "grey" - + font.pixelSize: date.font.pixelSize * 2 + font.bold: true + id: text + text: _cppServerConn.getEventData(index).to + " " + _cppServerConn.getEventData(index).text } Label { anchors.left: parent.left anchors.leftMargin: 10 - anchors.top: main_dish.bottom - anchors.topMargin: cust_spacing * 2 - id: main_dish_veg - text: _cppServerConn.getEventData(index).subject - width: parent.width - 10 - wrapMode: Label.Wrap - height: text!=""? undefined:0 - } - - Rectangle { - anchors.top: main_dish_veg.bottom - anchors.topMargin: cust_spacing - anchors.left: parent.left - anchors.leftMargin: 10 - width: parent.width / 10 - height: garnish.text!=""? 1:0 - color: "grey" - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: main_dish_veg.bottom - anchors.topMargin: cust_spacing * 2 - id: garnish - text: _cppServerConn.getEventData(index).room - width: parent.width - 10 - wrapMode: Label.Wrap - height: text!=""? undefined:0 - } - - Rectangle { - anchors.top: garnish.bottom - anchors.topMargin: cust_spacing - anchors.left: parent.left - anchors.leftMargin: 10 - width: parent.width / 10 - height: dessert.text!=""? 1:0 - color: "grey" - - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: garnish.bottom - anchors.topMargin: cust_spacing * 2 - id: dessert - text: _cppServerConn.getEventData(index).to - width: parent.width - 10 - wrapMode: Label.Wrap - height: text!=""? undefined:0 - } - - Label { - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: dessert.bottom + anchors.top: test.bottom anchors.topMargin: cust_spacing id: spacer text: "" diff --git a/source/serverconn.cpp b/source/serverconn.cpp index 527eca8..618cc94 100644 --- a/source/serverconn.cpp +++ b/source/serverconn.cpp @@ -382,7 +382,7 @@ QVariantMap ServerConn::getEventData(int index) QStringList ret; //list to return //qDebug() << index; - for(int i=0;i<=5;i++){ + for(int i=0;i<=6;i++){ if(m_eventlist.size() > index){ //qDebug() << i << m_weekplan[index].size(); @@ -398,12 +398,15 @@ QVariantMap ServerConn::getEventData(int index) ret.append(NULL); } } + if(ret.length() < 7){ + ret.append(""); + } QString date_string_on_db = ret[1]; QDate Date = QDate::fromString(date_string_on_db," dd.MM.yyyy"); //date_string_on_db qDebug() << Date; qDebug() << ret; - return { {"grade", ret[0]}, {"hour", ret[1]}, {"replace", ret[2]}, {"subject", ret[3]}, {"room", ret[4]}, {"to", ret[5]} }; + return { {"grade", ret[0]}, {"hour", ret[1]}, {"replace", ret[2]}, {"subject", ret[3]}, {"room", ret[4]}, {"to", ret[5]}, {"text", ret[6]} }; } int ServerConn::getEventCount(){