Gui: clean-up Selection API
Replace the int of the 'resolve' argument of several functions with a proper enum class. * This avoids the inconsistencies in client code where often true/false is passed when an int is expected * This avoids the use of magic numbers like 0, 1, 2 or the undocumented 3
This commit is contained in:
@@ -458,7 +458,7 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
|
||||
bool ok;
|
||||
int scheme = root.attribute(QString::fromLatin1("SchemaVersion")).toInt(&ok);
|
||||
if (!ok)
|
||||
if (!ok)
|
||||
return;
|
||||
// SchemeVersion "1"
|
||||
if (scheme == 1) {
|
||||
@@ -1695,7 +1695,7 @@ void StdViewDockUndockFullscreen::activated(int iMsg)
|
||||
|
||||
MDIView* view = getMainWindow()->activeWindow();
|
||||
if (!view) // no active view
|
||||
return;
|
||||
return;
|
||||
|
||||
// nothing to do when the view is docked and 'Docked' is pressed
|
||||
if (iMsg == 0 && view->currentViewMode() == MDIView::Child)
|
||||
@@ -2169,7 +2169,7 @@ bool StdCmdAxisCross::isActive(void)
|
||||
if (_pcAction->isChecked())
|
||||
_pcAction->setChecked(false);
|
||||
}
|
||||
if (view )
|
||||
if (view)
|
||||
return true;
|
||||
return false;
|
||||
|
||||
@@ -3125,7 +3125,7 @@ StdCmdTreeSelectAllInstances::StdCmdTreeSelectAllInstances()
|
||||
|
||||
bool StdCmdTreeSelectAllInstances::isActive(void)
|
||||
{
|
||||
const auto &sels = Selection().getSelectionEx("*",App::DocumentObject::getClassTypeId(),true,true);
|
||||
const auto &sels = Selection().getSelectionEx("*",App::DocumentObject::getClassTypeId(), ResolveMode::OldStyleElement, true);
|
||||
if(sels.empty())
|
||||
return false;
|
||||
auto obj = sels[0].getObject();
|
||||
@@ -3138,7 +3138,7 @@ bool StdCmdTreeSelectAllInstances::isActive(void)
|
||||
void StdCmdTreeSelectAllInstances::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
const auto &sels = Selection().getSelectionEx("*",App::DocumentObject::getClassTypeId(),true,true);
|
||||
const auto &sels = Selection().getSelectionEx("*",App::DocumentObject::getClassTypeId(), ResolveMode::OldStyleElement, true);
|
||||
if(sels.empty())
|
||||
return;
|
||||
auto obj = sels[0].getObject();
|
||||
|
||||
Reference in New Issue
Block a user