From 71649bf93bbbf871f48e1e94f4a42aa2534d5370 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 2 Dec 2008 14:05:39 +0000 Subject: Fixed re-adding of all headers, when updating course. --- client/mainwindow.cc | 22 +++++++++++++++------- client/mainwindow.h | 2 ++ 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'client') diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 90c1e40..2daefcc 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -50,6 +50,7 @@ MainWindow::MainWindow(QString cpr, QString course, QString host, quint16 port, w->setLayout(new QVBoxLayout()); this->course = course; + init(); } @@ -59,7 +60,9 @@ MainWindow::~MainWindow() void MainWindow::init() { + initialising = true; update(); + initialising = false; } void MainWindow::update() @@ -79,13 +82,18 @@ void MainWindow::update() if(xml_elem.hasAttribute("header")) { // Macro is a special headline macro. // Simply create a headline, and ignore the rest. - QLabel *header = new QLabel(); - header->setText(xml_elem.attribute("header")); - QFont headerfont = header->font(); - headerfont.setBold(true); - headerfont.setPointSize(headerfont.pointSize() + 2); - header->setFont(headerfont); - w->layout()->addWidget(header); + + // Only add header on initial contruction. + if(initialising == true) { + QLabel *header = new QLabel(); + header->setText(xml_elem.attribute("header")); + QFont headerfont = header->font(); + headerfont.setBold(true); + headerfont.setPointSize(headerfont.pointSize() + 2); + header->setFont(headerfont); + w->layout()->addWidget(header); + } + continue; } diff --git a/client/mainwindow.h b/client/mainwindow.h index 37afa5b..f4b12ec 100644 --- a/client/mainwindow.h +++ b/client/mainwindow.h @@ -49,6 +49,8 @@ private: QMap< QString, MacroWindow* > macros; QWidget *w; + bool initialising; + void init(); }; -- cgit v1.2.3