Clean up qtk.
This commit is contained in:
@@ -72,7 +72,7 @@ namespace Qtk {
|
||||
*
|
||||
* @param name Base name for the DebugConsole window.
|
||||
*/
|
||||
inline void setTitle(QString name) {
|
||||
inline void setTitle(const QString& name) {
|
||||
setWindowTitle(name + " Debug Console");
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,7 @@ int main(int argc, char * argv[]) {
|
||||
QApplication a(argc, argv);
|
||||
|
||||
auto window = MainWindow::getMainWindow();
|
||||
|
||||
// Qtk currently uses the decorator pattern to save / load scenes.
|
||||
// This is a temporary solution and will be improved in the future.
|
||||
auto emptyScene = new Qtk::SceneEmpty;
|
||||
window->getQtkWidget()->setScene(new QtkScene(emptyScene));
|
||||
|
||||
window->show();
|
||||
|
||||
return QApplication::exec();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,9 @@ MainWindow::MainWindow(QWidget * parent) : QMainWindow(parent) {
|
||||
// Initialize static container for all active QtkWidgets
|
||||
auto qtkWidgets = findChildren<Qtk::QtkWidget *>();
|
||||
for(auto & qtkWidget : qtkWidgets) {
|
||||
qtkWidget->setScene(new Qtk::SceneEmpty);
|
||||
// Qtk currently uses the decorator pattern to save / load scenes.
|
||||
// This is a temporary solution and will be improved in the future.
|
||||
qtkWidget->setScene(new QtkScene);
|
||||
views_.emplace(qtkWidget->getScene()->getSceneName(), qtkWidget);
|
||||
|
||||
// Add GUI 'view' toolbar option to show debug console.
|
||||
@@ -77,7 +79,9 @@ Qtk::QtkWidget * MainWindow::getQtkWidget(int64_t index) {
|
||||
if(views_.size() <= index) {
|
||||
return Q_NULLPTR;
|
||||
}
|
||||
return views_.begin(index)->second;
|
||||
auto it = views_.begin();
|
||||
std::advance(it, index);
|
||||
return it->second;
|
||||
}
|
||||
|
||||
Qtk::QtkWidget * MainWindow::getQtkWidget(const QString & name) {
|
||||
|
||||
@@ -14,7 +14,7 @@ using namespace Qtk;
|
||||
* Constructors, Destructors
|
||||
******************************************************************************/
|
||||
|
||||
QtkScene::QtkScene(Qtk::Scene * scene) : Qtk::SceneInterface(scene) {
|
||||
QtkScene::QtkScene() {
|
||||
setSceneName("Qtk Scene");
|
||||
getCamera().getTransform().setTranslation(0.0f, 0.0f, 20.0f);
|
||||
getCamera().getTransform().setRotation(-5.0f, 0.0f, 1.0f, 0.0f);
|
||||
|
||||
@@ -29,13 +29,13 @@
|
||||
*
|
||||
* To create your own Scene from scratch see Qtk::Scene.
|
||||
*/
|
||||
class QtkScene : public Qtk::SceneInterface {
|
||||
class QtkScene : public Qtk::Scene {
|
||||
public:
|
||||
/***************************************************************************
|
||||
* Contructors / Destructors
|
||||
**************************************************************************/
|
||||
|
||||
QtkScene(Qtk::Scene * scene);
|
||||
QtkScene();
|
||||
|
||||
~QtkScene();
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace Qtk {
|
||||
|
||||
// TODO: Use this signal in treeview and toolbox to update object
|
||||
// properties
|
||||
void objectFocusChanged(const QString objectName);
|
||||
void objectFocusChanged(QString objectName);
|
||||
|
||||
protected:
|
||||
/*************************************************************************
|
||||
|
||||
@@ -46,7 +46,7 @@ void Qtk::TreeView::updateView(const Qtk::Scene * scene) {
|
||||
void Qtk::TreeView::itemFocus(QTreeWidgetItem * item, int column) {
|
||||
QString name = item->text(column);
|
||||
auto scene = MainWindow::getMainWindow()->getQtkWidget()->getScene();
|
||||
auto & transform = scene->getCamera().getTransform();
|
||||
auto & transform = Qtk::Scene::getCamera().getTransform();
|
||||
auto object = scene->getObject(name);
|
||||
Transform3D * objectTransform;
|
||||
// If the object is a mesh or model, focus the camera on it.
|
||||
|
||||
@@ -24,7 +24,7 @@ WidgetPlugin::WidgetPlugin(
|
||||
WidgetPlugin::Factory factory) :
|
||||
m_group(std::move(group)),
|
||||
m_className(std::move(class_name)), m_includeFile(std::move(include)),
|
||||
m_factory(std::move(factory)), m_objectName(class_name) {}
|
||||
m_factory(std::move(factory)), m_objectName(m_className) {}
|
||||
|
||||
WidgetPlugin::WidgetPlugin(QObject * parent) : QObject(parent) {}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class WidgetPluginCollection :
|
||||
/**
|
||||
* @return QList of all custom widgets pointers.
|
||||
*/
|
||||
[[nodiscard]] QList<QDesignerCustomWidgetInterface *> customWidgets() const;
|
||||
[[nodiscard]] QList<QDesignerCustomWidgetInterface *> customWidgets() const override;
|
||||
|
||||
private:
|
||||
/***************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user