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