diff options
Diffstat (limited to 'src')
-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); |