summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2008-12-02 14:05:39 +0000
committerdeva <deva>2008-12-02 14:05:39 +0000
commit71649bf93bbbf871f48e1e94f4a42aa2534d5370 (patch)
treede846375ec8bf6f9638e31dfbeccafc6029359e9
parentc50c7103f5a2a81115d60f5646b08565c7712326 (diff)
Fixed re-adding of all headers, when updating course.
-rw-r--r--client/mainwindow.cc22
-rw-r--r--client/mainwindow.h2
2 files changed, 17 insertions, 7 deletions
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();
};