Fixed properties widget during submodel editing.

This commit is contained in:
Leonardo Zide 2018-05-11 16:23:43 -07:00
parent 8d3b6a1d7a
commit c8952c9147
2 changed files with 12 additions and 12 deletions

View file

@ -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)
{

View file

@ -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<lcObject*>& Selection, lcObject*
mWidgetMode = LC_PROPERTY_WIDGET_PIECE;
}
lcModel* Model = lcGetActiveModel();
lcModel* Model = gMainWindow->GetActiveModel();
lcPiece* Piece = (Focus && Focus->IsPiece()) ? (lcPiece*)Focus : nullptr;
mFocus = Piece;