From c8952c9147f78125f323192ae5fa7d8f2aa13a3e Mon Sep 17 00:00:00 2001 From: Leonardo Zide Date: Fri, 11 May 2018 16:23:43 -0700 Subject: [PATCH] Fixed properties widget during submodel editing. --- common/lc_mainwindow.cpp | 12 ++++++------ qt/lc_qpropertiestree.cpp | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 1d702c11..b27d92c7 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -1074,7 +1074,7 @@ void lcMainWindow::Print(QPrinter* Printer) void lcMainWindow::ShowSearchDialog() { - lcModel* Model = lcGetActiveModel(); + lcModel* Model = GetActiveModel(); if (!mSearchOptions.SearchValid) { @@ -1083,7 +1083,7 @@ void lcMainWindow::ShowSearchDialog() mSearchOptions.Info = ((lcPiece*)Focus)->mPieceInfo; } - lcQFindDialog Dialog(this, &mSearchOptions, GetActiveModel()); + lcQFindDialog Dialog(this, &mSearchOptions, Model); if (Dialog.exec() == QDialog::Accepted) Model->FindPiece(true, true); } @@ -1605,7 +1605,7 @@ void lcMainWindow::SplitView(Qt::Orientation Orientation) Splitter = new QSplitter(Orientation, Parent); Parent->layout()->addWidget(Splitter); Splitter->addWidget(Focus); - Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), new View(lcGetActiveModel()), true)); + Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), new View(GetCurrentTabModel()), true)); } else { @@ -1616,7 +1616,7 @@ void lcMainWindow::SplitView(Qt::Orientation Orientation) Splitter = new QSplitter(Orientation, Parent); ParentSplitter->insertWidget(FocusIndex, Splitter); Splitter->addWidget(Focus); - Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), new View(lcGetActiveModel()), true)); + Splitter->addWidget(new lcQGLWidget(mModelTabWidget->currentWidget(), new View(GetCurrentTabModel()), true)); ParentSplitter->setSizes(Sizes); } @@ -2276,7 +2276,7 @@ bool lcMainWindow::SaveProjectIfModified() bool lcMainWindow::SetModelFromFocus() { - lcObject* FocusObject = lcGetActiveModel()->GetFocusObject(); + lcObject* FocusObject = GetActiveModel()->GetFocusObject(); if (!FocusObject || !FocusObject->IsPiece()) return false; @@ -2298,7 +2298,7 @@ void lcMainWindow::SetModelFromSelection() if (SetModelFromFocus()) return; - lcModel* Model = lcGetActiveModel()->GetFirstSelectedSubmodel(); + lcModel* Model = GetActiveModel()->GetFirstSelectedSubmodel(); if (Model) { diff --git a/qt/lc_qpropertiestree.cpp b/qt/lc_qpropertiestree.cpp index feb736a4..682a1904 100644 --- a/qt/lc_qpropertiestree.cpp +++ b/qt/lc_qpropertiestree.cpp @@ -2,8 +2,8 @@ #include "lc_qpropertiestree.h" #include "lc_qcolorpicker.h" #include "lc_application.h" -#include "project.h" #include "lc_model.h" +#include "lc_mainwindow.h" #include "object.h" #include "piece.h" #include "camera.h" @@ -526,7 +526,7 @@ void lcQPropertiesTree::updateColorEditor(QPushButton *editor, int value) const void lcQPropertiesTree::slotToggled(bool Value) { QTreeWidgetItem* Item = m_delegate->editedItem(); - lcModel* Model = lcGetActiveModel(); + lcModel* Model = gMainWindow->GetActiveModel(); if (mWidgetMode == LC_PROPERTY_WIDGET_CAMERA) { @@ -548,7 +548,7 @@ void lcQPropertiesTree::slotReturnPressed() { QLineEdit* Editor = (QLineEdit*)sender(); QTreeWidgetItem* Item = m_delegate->editedItem(); - lcModel* Model = lcGetActiveModel(); + lcModel* Model = gMainWindow->GetActiveModel(); if (mWidgetMode == LC_PROPERTY_WIDGET_PIECE) { @@ -694,7 +694,7 @@ void lcQPropertiesTree::slotReturnPressed() void lcQPropertiesTree::slotSetValue(int Value) { QTreeWidgetItem* Item = m_delegate->editedItem(); - lcModel* Model = lcGetActiveModel(); + lcModel* Model = gMainWindow->GetActiveModel(); if (mWidgetMode == LC_PROPERTY_WIDGET_PIECE) { @@ -717,7 +717,7 @@ void lcQPropertiesTree::slotSetValue(int Value) void lcQPropertiesTree::slotColorButtonClicked() { int ColorIndex = gDefaultColor; - lcObject* Focus = lcGetActiveModel()->GetFocusObject(); + lcObject* Focus = gMainWindow->GetActiveModel()->GetFocusObject(); if (Focus && Focus->IsPiece()) ColorIndex = ((lcPiece*)Focus)->mColorIndex; @@ -835,7 +835,7 @@ void lcQPropertiesTree::SetPiece(const lcArray& Selection, lcObject* mWidgetMode = LC_PROPERTY_WIDGET_PIECE; } - lcModel* Model = lcGetActiveModel(); + lcModel* Model = gMainWindow->GetActiveModel(); lcPiece* Piece = (Focus && Focus->IsPiece()) ? (lcPiece*)Focus : nullptr; mFocus = Piece;