diff options
author | deva <deva> | 2009-02-27 10:00:28 +0000 |
---|---|---|
committer | deva <deva> | 2009-02-27 10:00:28 +0000 |
commit | ee5b3e99fcff0573ea39a2ed52027ef6a60f6b01 (patch) | |
tree | f981639f9a00cc7e8d651e938854baed7d9e9053 | |
parent | 95549f54dcb24584ad7fbd467e47453a1ef56b85 (diff) |
Fixed multiple adding of the header (on each update)
-rw-r--r-- | client/mainwindow.cc | 22 | ||||
-rw-r--r-- | client/mainwindow.h | 2 |
2 files changed, 15 insertions, 9 deletions
diff --git a/client/mainwindow.cc b/client/mainwindow.cc index 884ecf2..6ba72e0 100644 --- a/client/mainwindow.cc +++ b/client/mainwindow.cc @@ -44,6 +44,8 @@ MainWindow::MainWindow(QString cpr, QString course, QString host, quint16 port, : QMainWindow(0, Qt::WindowContextHelpButtonHint), netcom(host, port, user, cpr) { + header = NULL; + setWindowTitle("Pracro - " + cpr); QStatusBar *status = statusBar(); @@ -103,15 +105,17 @@ void MainWindow::update() QString course_title = course_elem.attribute("title"); QString course_name = course_elem.attribute("name"); - QLabel *header = new QLabel(); - header->setText(course_title); - QFont headerfont = header->font(); - headerfont.setBold(true); - headerfont.setPointSize(headerfont.pointSize() + 4); - header->setFont(headerfont); - header->setAlignment(Qt::AlignHCenter); - w->layout()->addWidget(header); - + if(!header) { + header = new QLabel(); + header->setText(course_title); + QFont headerfont = header->font(); + headerfont.setBold(true); + headerfont.setPointSize(headerfont.pointSize() + 4); + header->setFont(headerfont); + header->setAlignment(Qt::AlignHCenter); + w->layout()->addWidget(header); + } + statusBar()->showMessage(course_title + " (" + course_name + ")"); QDomNodeList macronodes = coursenode.childNodes(); diff --git a/client/mainwindow.h b/client/mainwindow.h index f23ade1..00300f4 100644 --- a/client/mainwindow.h +++ b/client/mainwindow.h @@ -51,6 +51,8 @@ private: QMap< QString, MacroWindow* > macros; QWidget *w; + QLabel *header; + bool initialising; void init(); |