Remove QtkWidget dependency on MainWindow.
This commit is contained in:
parent
0551b4f91f
commit
8d60355ccf
@ -25,6 +25,7 @@ MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent)
|
||||
// Initialize static container for all active QtkWidgets
|
||||
auto qtkWidgets = findChildren<Qtk::QtkWidget *>();
|
||||
for (auto & qtkWidget : qtkWidgets) {
|
||||
qtkWidget->setMainWindow(this);
|
||||
// NOTE: Set a temporary scene for the widget to use for initialization.
|
||||
// This should be replaced by loading a scene, or creating a new (unsaved)
|
||||
// scene when Qtk is opened.
|
||||
|
@ -7,16 +7,14 @@
|
||||
##############################################################################*/
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMimeData>
|
||||
#include <QVBoxLayout>
|
||||
#include <QMainWindow>
|
||||
#include <QMimeData>
|
||||
|
||||
#include "qtk/input.h"
|
||||
#include "qtk/scene.h"
|
||||
#include "qtk/shape.h"
|
||||
|
||||
#include "debugconsole.h"
|
||||
#include "app/qtkmainwindow.h"
|
||||
#include "qtkwidget.h"
|
||||
|
||||
using namespace Qtk;
|
||||
@ -85,8 +83,10 @@ void QtkWidget::initializeGL()
|
||||
connect(this, SIGNAL(frameSwapped()), this, SLOT(update()));
|
||||
|
||||
// Add the debug console widget to the window and set its hidden state.
|
||||
MainWindow::getMainWindow()->addDockWidget(
|
||||
Qt::DockWidgetArea::BottomDockWidgetArea, mConsole);
|
||||
if (mMainWindow != nullptr) {
|
||||
mMainWindow->addDockWidget(Qt::DockWidgetArea::BottomDockWidgetArea,
|
||||
mConsole);
|
||||
}
|
||||
mConsole->setHidden(!mConsoleActive);
|
||||
|
||||
// Initialize OpenGL debug context
|
||||
|
@ -119,6 +119,11 @@ namespace Qtk
|
||||
*/
|
||||
void setScene(Qtk::Scene * scene);
|
||||
|
||||
/**
|
||||
* @param window The QMainWindow that owns this QtkWidget.
|
||||
*/
|
||||
void setMainWindow(QMainWindow * window) { mMainWindow = window; }
|
||||
|
||||
/*************************************************************************
|
||||
* Public Members
|
||||
************************************************************************/
|
||||
@ -218,6 +223,7 @@ namespace Qtk
|
||||
Qtk::Scene * mScene;
|
||||
Qtk::DebugConsole * mConsole;
|
||||
bool mConsoleActive = true;
|
||||
QMainWindow * mMainWindow = Q_NULLPTR;
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user