diff options
author | dos-reis <gdr@axiomatics.org> | 2013-04-07 16:52:03 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2013-04-07 16:52:03 +0000 |
commit | 026723c0e0cfc0c02838c614b3c529d1b5d50c62 (patch) | |
tree | 62774daa5b9c8188726333efb294c1f79142e047 | |
parent | b5d890ae837ea35d9f5077cf260bf85922259be9 (diff) | |
download | open-axiom-026723c0e0cfc0c02838c614b3c529d1b5d50c62.tar.gz |
gui: fix parent of Debate
-rw-r--r-- | src/gui/debate.cc | 4 | ||||
-rw-r--r-- | src/gui/debate.h | 9 | ||||
-rw-r--r-- | src/gui/main-window.cc | 2 |
3 files changed, 7 insertions, 8 deletions
diff --git a/src/gui/debate.cc b/src/gui/debate.cc index 9cb19438..022f8454 100644 --- a/src/gui/debate.cc +++ b/src/gui/debate.cc @@ -35,8 +35,8 @@ namespace OpenAxiom { - Debate::Debate(QTabWidget* tab) - : super(tab), conv(this) { + Debate::Debate(MainWindow* win, QTabWidget* tab) + : QScrollArea(tab), main_win(win), conv(this) { setWidget(&conv); setViewportMargins(0, 0, 0, 0); viewport()->setAutoFillBackground(true); diff --git a/src/gui/debate.h b/src/gui/debate.h index 60749816..b2339d76 100644 --- a/src/gui/debate.h +++ b/src/gui/debate.h @@ -43,22 +43,21 @@ namespace OpenAxiom { - class Debate : public managed_by<QScrollArea, QTabWidget> { + class Debate : public QScrollArea { Q_OBJECT; public: - explicit Debate(QTabWidget*); + explicit Debate(MainWindow*, QTabWidget*); ~Debate(); Conversation* exchanges() { return &conv; } - MainWindow* main_window() const { - return qobject_cast<MainWindow*>(parent()->parent()); - } + MainWindow* main_window() const { return main_win; } Server* server() const { return main_window()->server(); } protected: void resizeEvent(QResizeEvent*); private: + MainWindow* const main_win; Conversation conv; }; } diff --git a/src/gui/main-window.cc b/src/gui/main-window.cc index b3063638..b63e4b84 100644 --- a/src/gui/main-window.cc +++ b/src/gui/main-window.cc @@ -40,7 +40,7 @@ namespace OpenAxiom { MainWindow::MainWindow(Command& cmd) : srv(cmd), tabs(this) { setCentralWidget(&tabs); - Debate* debate = new Debate(&tabs); + Debate* debate = new Debate(this, &tabs); tabs.addTab(debate, "Main Frame"); QMenu* file = menuBar()->addMenu(tr("&File")); QAction* action = new QAction(tr("Quit"), this); |