From 026723c0e0cfc0c02838c614b3c529d1b5d50c62 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Sun, 7 Apr 2013 16:52:03 +0000 Subject: gui: fix parent of Debate --- src/gui/debate.cc | 4 ++-- src/gui/debate.h | 9 ++++----- src/gui/main-window.cc | 2 +- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') 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 { + 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(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); -- cgit v1.2.3