diff --git a/src/Gui/3Dconnexion/GuiNativeEventWin32.h b/src/Gui/3Dconnexion/GuiNativeEventWin32.h index 59602e5cb1..c8c8006d0b 100644 --- a/src/Gui/3Dconnexion/GuiNativeEventWin32.h +++ b/src/Gui/3Dconnexion/GuiNativeEventWin32.h @@ -29,7 +29,6 @@ #include -//#define _WIN32_WINNT 0x0501 //target at least windows XP #include #include "GuiRawInputEventFilter.h" diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 431a491446..a6d1ba7e22 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -359,23 +359,6 @@ void ActionGroup::onActivated (QAction* a) { int index = _group->actions().indexOf(a); - // Calling QToolButton::setIcon() etc. has no effect if it has QAction set. - // We have to change the QAction icon instead -#if 0 - QList widgets = a->associatedWidgets(); - for (QList::iterator it = widgets.begin(); it != widgets.end(); ++it) { - QMenu* menu = qobject_cast(*it); - if (menu) { - QToolButton* button = qobject_cast(menu->parent()); - if (button) { - button->setIcon(a->icon()); - button->setText(a->text()); - button->setToolTip(a->toolTip()); - this->setProperty("defaultAction", QVariant(index)); - } - } - } -#endif this->setIcon(a->icon()); if (!this->_isMode) this->setToolTip(a->toolTip()); this->setProperty("defaultAction", QVariant(index)); diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 57173b4c56..b26f7719fd 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -360,14 +360,6 @@ Application::Application(bool GUIenabled) throw Base::RuntimeError("Invalid system settings"); } #endif -#if 0 // QuantitySpinBox and InputField try to handle the group separator now - // http://forum.freecadweb.org/viewtopic.php?f=10&t=6910 - // A workaround is to disable the group separator for double-to-string conversion, i.e. - // setting the flag 'OmitGroupSeparator'. - QLocale loc; - loc.setNumberOptions(QLocale::OmitGroupSeparator); - QLocale::setDefault(loc); -#endif // setting up Python binding Base::PyGILStateLocker lock; @@ -500,25 +492,8 @@ Application::~Application() WidgetFactorySupplier::destruct(); BitmapFactoryInst::destruct(); -#if 0 - // we must run the garbage collector before shutting down the SoDB - // subsystem because we may reference some class objects of them in Python - Base::Interpreter().cleanupSWIG("SoBase *"); - // finish also Inventor subsystem - SoFCDB::finish(); - -#if (COIN_MAJOR_VERSION >= 2) && (COIN_MINOR_VERSION >= 4) - SoDB::finish(); -#elif (COIN_MAJOR_VERSION >= 3) - SoDB::finish(); -#else - SoDB::cleanup(); -#endif -#endif - { Base::PyGILStateLocker lock; Py_DECREF(_pcWorkbenchDictionary); - } // save macros try { @@ -527,7 +502,6 @@ Application::~Application() catch (const Base::Exception& e) { std::cerr << "Saving macros failed: " << e.what() << std::endl; } - //App::GetApplication().Detach(this); delete d; Instance = nullptr; diff --git a/src/Gui/AutoSaver.cpp b/src/Gui/AutoSaver.cpp index 6f3d7336da..21d9d92ca8 100644 --- a/src/Gui/AutoSaver.cpp +++ b/src/Gui/AutoSaver.cpp @@ -362,9 +362,6 @@ private: void RecoveryWriter::writeFiles(void) { -#if 0 - FileWriter::writeFiles(); -#else // use a while loop because it is possible that while // processing the files new ones can be added size_t index = 0; @@ -397,7 +394,6 @@ void RecoveryWriter::writeFiles(void) index++; } -#endif } diff --git a/src/Gui/CADNavigationStyle.cpp b/src/Gui/CADNavigationStyle.cpp index 7cd4002ced..f6abc32ae8 100644 --- a/src/Gui/CADNavigationStyle.cpp +++ b/src/Gui/CADNavigationStyle.cpp @@ -65,18 +65,9 @@ const char* CADNavigationStyle::mouseButtons(ViewerMode mode) SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev) { -#if 0 - // Events when in "ready-to-seek" mode are ignored, except those - // which influence the seek mode itself -- these are handled further - // up the inheritance hierarchy. - if (this->isSeekMode()) { - return inherited::processSoEvent(ev); - } -#else // Switch off viewing mode (Bug #0000911) if (!this->isSeekMode() && !this->isAnimating() && this->isViewing()) this->setViewing(false); // by default disable viewing mode to render the scene -#endif const SoType type(ev->getTypeId()); diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 0cb4792452..6c87d410ed 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -214,19 +214,6 @@ QMap CallTipsList::extractTips(const QString& context) const items.pop_front(); if (!dict.hasKey(std::string(modname.toLatin1()))) return tips; // unknown object -#if 0 - // get the Python object we need - Py::Object obj = dict.getItem(std::string(modname.toLatin1())); - while (!items.isEmpty()) { - QByteArray name = items.front().toLatin1(); - std::string attr = name.constData(); - items.pop_front(); - if (obj.hasAttr(attr)) - obj = obj.getAttr(attr); - else - return tips; - } -#else // Don't use hasattr & getattr because if a property is bound to a method this will be executed twice. PyObject* code = Py_CompileString(static_cast(context.toLatin1()), "", Py_eval_input); if (!code) { @@ -244,15 +231,7 @@ QMap CallTipsList::extractTips(const QString& context) const return tips; } Py::Object obj(eval, true); -#endif - // Checks whether the type is a subclass of PyObjectBase because to get the doc string - // of a member we must get it by its type instead of its instance otherwise we get the - // wrong string, namely that of the type of the member. - // Note: 3rd party libraries may use their own type object classes so that we cannot - // reliably use Py::Type. To be on the safe side we should use Py::Object to assign - // the used type object to. - //Py::Object type = obj.type(); Py::Object type(PyObject_Type(obj.ptr()), true); Py::Object inst = obj; // the object instance PyObject* typeobj = Base::getTypeAsObject(&Base::PyObjectBase::Type); diff --git a/src/Gui/CoinRiftWidget.h b/src/Gui/CoinRiftWidget.h index 2664ca9cdc..2dd1880d85 100644 --- a/src/Gui/CoinRiftWidget.h +++ b/src/Gui/CoinRiftWidget.h @@ -38,7 +38,6 @@ // defines which method to use to render #define USE_SO_OFFSCREEN_RENDERER -//#define USE_FRAMEBUFFER #ifdef USE_SO_OFFSCREEN_RENDERER # ifdef USE_FRAMEBUFFER @@ -66,7 +65,6 @@ #include #include #include -//#include #include <../Src/OVR_CAPI_GL.h> #include <../Src/CAPI/GL/CAPI_GL_Util.h> // For framebuffer functions. @@ -75,8 +73,6 @@ class CoinRiftWidget : public QGLWidget { ovrHmd hmd; - //ovrHmdDesc hmdDesc; - //ovrEyeType eyes[2]; ovrEyeRenderDesc eyeRenderDesc[2]; ovrTexture eyeTexture[2]; diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index 07194c422c..0a400c6690 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -1513,14 +1513,6 @@ void PythonGroupCommand::activated(int iMsg) } } - // It is better to let ActionGroup::onActivated() to handle icon and - // text change. The net effect is that the GUI won't change by user - // inovking command through runCommandByName() -#if 0 - // Since the default icon is reset when enabling/disabling the command we have - // to explicitly set the icon of the used command. - pcAction->setIcon(a[iMsg]->icon()); -#endif } catch(Py::Exception&) { Base::PyGILStateLocker lock; diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index cd7de66d52..e9ee1d000a 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -634,22 +634,11 @@ StdCmdSave::StdCmdSave() void StdCmdSave::activated(int iMsg) { Q_UNUSED(iMsg); -#if 0 - Gui::Document* pActiveDoc = getActiveGuiDocument(); - if ( pActiveDoc ) - pActiveDoc->save(); - else -#endif doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"Save\")"); } bool StdCmdSave::isActive(void) { -#if 0 - if( getActiveGuiDocument() ) - return true; - else -#endif return getGuiApplication()->sendHasMsgToActiveView("Save"); } @@ -674,22 +663,11 @@ StdCmdSaveAs::StdCmdSaveAs() void StdCmdSaveAs::activated(int iMsg) { Q_UNUSED(iMsg); -#if 0 - Gui::Document* pActiveDoc = getActiveGuiDocument(); - if ( pActiveDoc ) - pActiveDoc->saveAs(); - else -#endif doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"SaveAs\")"); } bool StdCmdSaveAs::isActive(void) { -#if 0 - if( getActiveGuiDocument() ) - return true; - else -#endif return getGuiApplication()->sendHasMsgToActiveView("SaveAs"); } @@ -712,12 +690,6 @@ StdCmdSaveCopy::StdCmdSaveCopy() void StdCmdSaveCopy::activated(int iMsg) { Q_UNUSED(iMsg); -#if 0 - Gui::Document* pActiveDoc = getActiveGuiDocument(); - if ( pActiveDoc ) - pActiveDoc->saveCopy(); - else -#endif doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"SaveCopy\")"); } @@ -1359,23 +1331,6 @@ void StdCmdDelete::activated(int iMsg) break; } - // The check below is not needed because we now only get selection - // from the active document -#if 0 - //check for inactive objects in selection Mantis #3477 - std::set inactiveLabels; - App::Application& app = App::GetApplication(); - App::Document* actDoc = app.getActiveDocument(); - for (std::vector::iterator ft = sels.begin(); ft != sels.end(); ++ft) { - App::DocumentObject* obj = ft->getObject(); - App::Document* objDoc = obj->getDocument(); - if (actDoc != objDoc) { - inactiveLabels.insert(QString::fromUtf8(obj->Label.getValue())); - autoDeletion = false; - } - } -#endif - if (!autoDeletion) { QString bodyMessage; QTextStream bodyMessageStream(&bodyMessage); @@ -1386,19 +1341,6 @@ void StdCmdDelete::activated(int iMsg) bodyMessageStream << '\n' << currentLabel; if(more) bodyMessageStream << "\n..."; -#if 0 - //message for inactive items - if (!inactiveLabels.empty()) { - if (!affectedLabels.empty()) { - bodyMessageStream << "\n"; - } - std::string thisDoc = pGuiDoc->getDocument()->getName(); - bodyMessageStream << qApp->translate("Std_Delete", - "These items are selected for deletion, but are not in the active document."); - for (const auto ¤tLabel : inactiveLabels) - bodyMessageStream << currentLabel << " / " << Base::Tools::fromStdString(thisDoc) << '\n'; - } -#endif int ret = QMessageBox::warning(Gui::getMainWindow(), qApp->translate("Std_Delete", "Object dependencies"), bodyMessage, diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index 64241c21ee..551df9e074 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -559,24 +559,12 @@ StdCmdToggleClipPlane::StdCmdToggleClipPlane() Action * StdCmdToggleClipPlane::createAction(void) { Action *pcAction = (Action*)Command::createAction(); -#if 0 - pcAction->setCheckable(true); -#endif return pcAction; } void StdCmdToggleClipPlane::activated(int iMsg) { Q_UNUSED(iMsg); -#if 0 - View3DInventor* view = qobject_cast(getMainWindow()->activeWindow()); - if (view) { - if (iMsg > 0 && !view->hasClippingPlane()) - view->toggleClippingPlane(); - else if (iMsg == 0 && view->hasClippingPlane()) - view->toggleClippingPlane(); - } -#else static QPointer clipping = nullptr; if (!clipping) { View3DInventor* view = qobject_cast(getMainWindow()->activeWindow()); @@ -584,29 +572,12 @@ void StdCmdToggleClipPlane::activated(int iMsg) clipping = Gui::Dialog::Clipping::makeDockWidget(view); } } -#endif } bool StdCmdToggleClipPlane::isActive(void) { -#if 0 - View3DInventor* view = qobject_cast(getMainWindow()->activeWindow()); - if (view) { - Action* action = qobject_cast(_pcAction); - if (action->isChecked() != view->hasClippingPlane()) - action->setChecked(view->hasClippingPlane()); - return true; - } - else { - Action* action = qobject_cast(_pcAction); - if (action->isChecked()) - action->setChecked(false); - return false; - } -#else View3DInventor* view = qobject_cast(getMainWindow()->activeWindow()); return view ? true : false; -#endif } //=========================================================================== @@ -691,7 +662,6 @@ Gui::Action * StdCmdDrawStyle::createAction(void) a6->setShortcut(QKeySequence(QString::fromUtf8("V,7"))); a6->setWhatsThis(QString::fromLatin1(getWhatsThis())); - pcAction->setIcon(a0->icon()); _pcAction = pcAction; @@ -1151,26 +1121,13 @@ StdCmdSetAppearance::StdCmdSetAppearance() void StdCmdSetAppearance::activated(int iMsg) { Q_UNUSED(iMsg); -#if 0 - static QPointer dlg = 0; - if (!dlg) - dlg = new Gui::Dialog::DlgDisplayPropertiesImp(true, getMainWindow()); - dlg->setModal(false); - dlg->setAttribute(Qt::WA_DeleteOnClose); - dlg->show(); -#else Gui::Control().showDialog(new Gui::Dialog::TaskDisplayProperties()); -#endif } bool StdCmdSetAppearance::isActive(void) { -#if 0 - return Gui::Selection().size() != 0; -#else return (Gui::Control().activeDialog() == nullptr) && (Gui::Selection().size() != 0); -#endif } //=========================================================================== @@ -1517,13 +1474,11 @@ StdCmdViewFitSelection::StdCmdViewFitSelection() void StdCmdViewFitSelection::activated(int iMsg) { Q_UNUSED(iMsg); - //doCommand(Command::Gui,"Gui.activeDocument().activeView().fitAll()"); doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"ViewSelection\")"); } bool StdCmdViewFitSelection::isActive(void) { - //return isViewOfType(Gui::View3DInventor::getClassTypeId()); return getGuiApplication()->sendHasMsgToActiveView("ViewSelection"); } @@ -1733,7 +1688,6 @@ void StdViewDockUndockFullscreen::activated(int iMsg) else clone->setCurrentViewMode(MDIView::FullScreen); } - // destroy the old view view->deleteSelf(); } @@ -1779,8 +1733,7 @@ StdCmdViewVR::StdCmdViewVR() void StdCmdViewVR::activated(int iMsg) { - Q_UNUSED(iMsg); - //doCommand(Command::Gui,"Gui.activeDocument().activeView().fitAll()"); + Q_UNUSED(iMsg); doCommand(Command::Gui,"Gui.SendMsgToActiveView(\"ViewVR\")"); } @@ -2040,95 +1993,7 @@ bool StdCmdToggleNavigation::isActive(void) -#if 0 // old Axis command -// Command to show/hide axis cross -class StdCmdAxisCross : public Gui::Command -{ -private: - SoShapeScale* axisCross; - SoGroup* axisGroup; -public: - StdCmdAxisCross() : Command("Std_AxisCross"), axisCross(0), axisGroup(0) - { - sGroup = "Standard-View"; - sMenuText = QT_TR_NOOP("Toggle axis cross"); - sToolTipText = QT_TR_NOOP("Toggle axis cross"); - sStatusTip = QT_TR_NOOP("Toggle axis cross"); - sWhatsThis = "Std_AxisCross"; - sPixmap = "Std_AxisCross"; - } - ~StdCmdAxisCross() - { - if (axisGroup) - axisGroup->unref(); - if (axisCross) - axisCross->unref(); - } - const char* className() const - { return "StdCmdAxisCross"; } - Action * createAction(void) - { - axisCross = new Gui::SoShapeScale; - axisCross->ref(); - Gui::SoAxisCrossKit* axisKit = new Gui::SoAxisCrossKit(); - axisKit->set("xAxis.appearance.drawStyle", "lineWidth 2"); - axisKit->set("yAxis.appearance.drawStyle", "lineWidth 2"); - axisKit->set("zAxis.appearance.drawStyle", "lineWidth 2"); - axisCross->setPart("shape", axisKit); - axisGroup = new SoSkipBoundingGroup; - axisGroup->ref(); - axisGroup->addChild(axisCross); - - Action *pcAction = Gui::Command::createAction(); - pcAction->setCheckable(true); - return pcAction; - } - -protected: - void activated(int iMsg) - { - float scale = 1.0f; - - Gui::View3DInventor* view = qobject_cast - (getMainWindow()->activeWindow()); - if (view) { - SoNode* scene = view->getViewer()->getSceneGraph(); - SoSeparator* sep = static_cast(scene); - bool hasaxis = (sep->findChild(axisGroup) != -1); - if (iMsg > 0 && !hasaxis) { - axisCross->scaleFactor = scale; - sep->addChild(axisGroup); - } - else if (iMsg == 0 && hasaxis) { - sep->removeChild(axisGroup); - } - } - } - - bool isActive(void) - { - Gui::View3DInventor* view = qobject_cast(Gui::getMainWindow()->activeWindow()); - if (view) { - Gui::View3DInventorViewer* viewer = view->getViewer(); - if (!viewer) - return false; // no active viewer - SoGroup* group = dynamic_cast(viewer->getSceneGraph()); - if (!group) - return false; // empty scene graph - bool hasaxis = group->findChild(axisGroup) != -1; - if (_pcAction->isChecked() != hasaxis) - _pcAction->setChecked(hasaxis); - return true; - } - else { - if (_pcAction->isChecked()) - _pcAction->setChecked(false); - return false; - } - } -}; -#else //=========================================================================== // Std_ViewExample1 //=========================================================================== @@ -2175,8 +2040,6 @@ bool StdCmdAxisCross::isActive(void) } -#endif - //=========================================================================== // Std_ViewExample1 //=========================================================================== @@ -3831,7 +3694,6 @@ void CreateViewStdCommands(void) rcCmdMgr.addCommand(new StdCmdSelForward()); rcCmdMgr.addCommand(new StdCmdTreeViewActions()); - auto hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View"); if(hGrp->GetASCII("GestureRollFwdCommand").empty()) hGrp->SetASCII("GestureRollFwdCommand","Std_SelForward"); diff --git a/src/Gui/DlgDisplayPropertiesImp.cpp b/src/Gui/DlgDisplayPropertiesImp.cpp index e15aab0484..61ebf3ab8b 100644 --- a/src/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Gui/DlgDisplayPropertiesImp.cpp @@ -45,12 +45,6 @@ using namespace std; namespace bp = boost::placeholders; -/* TRANSLATOR Gui::Dialog::DlgDisplayPropertiesImp */ - -#if 0 // needed for Qt's lupdate utility - qApp->translate("QDockWidget", "Display properties"); -#endif - class DlgDisplayPropertiesImp::Private { typedef boost::signals2::connection DlgDisplayPropertiesImp_Connection; @@ -513,7 +507,6 @@ void DlgDisplayPropertiesImp::setShapeColor(const std::vectorui.buttonColor->setEnabled(shapeColor); } @@ -533,7 +526,6 @@ void DlgDisplayPropertiesImp::setLineColor(const std::vector break; } } - d->ui.buttonLineColor->setEnabled(shapeColor); } @@ -550,7 +542,6 @@ void DlgDisplayPropertiesImp::setPointSize(const std::vector break; } } - d->ui.spinPointSize->setEnabled(pointSize); } @@ -567,7 +558,6 @@ void DlgDisplayPropertiesImp::setLineWidth(const std::vector break; } } - d->ui.spinLineWidth->setEnabled(lineWidth); } @@ -588,7 +578,6 @@ void DlgDisplayPropertiesImp::setTransparency(const std::vectorui.spinTransparency->setEnabled(transparency); d->ui.horizontalSlider->setEnabled(transparency); } @@ -610,7 +599,6 @@ void DlgDisplayPropertiesImp::setLineTransparency(const std::vectorui.spinLineTransparency->setEnabled(transparency); d->ui.sliderLineTransparency->setEnabled(transparency); } @@ -625,7 +613,6 @@ std::vector DlgDisplayPropertiesImp::getSelection() const Gui::ViewProvider* view = Application::Instance->getDocument(it->pDoc)->getViewProvider(it->pObject); views.push_back(view); } - return views; } diff --git a/src/Gui/DlgExpressionInput.cpp b/src/Gui/DlgExpressionInput.cpp index b0c28e23cb..942d3007ee 100644 --- a/src/Gui/DlgExpressionInput.cpp +++ b/src/Gui/DlgExpressionInput.cpp @@ -214,53 +214,13 @@ void DlgExpressionInput::setExpressionInputSize(int width, int height) void DlgExpressionInput::mouseReleaseEvent(QMouseEvent* ev) { -#if 0//defined(Q_OS_WIN) - if (QWidget::mouseGrabber() == this) { - QList childs = this->findChildren(); - for (QList::iterator it = childs.begin(); it != childs.end(); ++it) { - QPoint pos = (*it)->mapFromGlobal(ev->globalPos()); - if ((*it)->rect().contains(pos)) { - // Create new mouse event with the correct local position - QMouseEvent me(ev->type(), pos, ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers()); - QObject* obj = *it; - obj->event(&me); - if (me.isAccepted()) { - break; - } - } - } - } -#else Q_UNUSED(ev); -#endif } void DlgExpressionInput::mousePressEvent(QMouseEvent* ev) { -#if 0//defined(Q_OS_WIN) - bool handled = false; - if (QWidget::mouseGrabber() == this) { - QList childs = this->findChildren(); - for (QList::iterator it = childs.begin(); it != childs.end(); ++it) { - QPoint pos = (*it)->mapFromGlobal(ev->globalPos()); - if ((*it)->rect().contains(pos)) { - // Create new mouse event with the correct local position - QMouseEvent me(ev->type(), pos, ev->globalPos(), ev->button(), ev->buttons(), ev->modifiers()); - QObject* obj = *it; - obj->event(&me); - if (me.isAccepted()) { - handled = true; - break; - } - } - } - } - - if (handled) - return; -#else Q_UNUSED(ev); -#endif + // The 'FramelessWindowHint' is also set when the background is transparent. if (windowFlags() & Qt::FramelessWindowHint) { //we need to reject the dialog when clicked on the background. As the background is transparent @@ -281,17 +241,6 @@ void DlgExpressionInput::show() void DlgExpressionInput::showEvent(QShowEvent* ev) { QDialog::showEvent(ev); - -#if 0//defined(Q_OS_WIN) - // This way we can fetch click events outside modal dialogs - QWidget* widget = QApplication::activeModalWidget(); - if (widget) { - QList childs = widget->findChildren(); - if (childs.contains(this)) { - this->grabMouse(); - } - } -#endif } bool DlgExpressionInput::eventFilter(QObject *obj, QEvent *ev) @@ -315,7 +264,6 @@ bool DlgExpressionInput::eventFilter(QObject *obj, QEvent *ev) } } } - return false; } diff --git a/src/Gui/DlgMaterialPropertiesImp.cpp b/src/Gui/DlgMaterialPropertiesImp.cpp index 3a2d48defb..abe0f4b361 100644 --- a/src/Gui/DlgMaterialPropertiesImp.cpp +++ b/src/Gui/DlgMaterialPropertiesImp.cpp @@ -52,12 +52,10 @@ DlgMaterialPropertiesImp::DlgMaterialPropertiesImp(const std::string& mat, QWidg ui->diffuseColor->hide(); } -//#if !defined(Q_OS_MAC) ui->ambientColor->setAutoChangeColor(true); ui->diffuseColor->setAutoChangeColor(true); ui->emissiveColor->setAutoChangeColor(true); ui->specularColor->setAutoChangeColor(true); -//#endif } /** diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index 543ad7376a..4bbbed0fdd 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -86,11 +86,6 @@ DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WindowFlags fl ) policy.setHorizontalStretch(3); paramValue->setSizePolicy(policy); -#if 0 // This is needed for Qt's lupdate - qApp->translate( "Gui::Dialog::DlgParameterImp", "System parameter" ); - qApp->translate( "Gui::Dialog::DlgParameterImp", "User parameter" ); -#endif - ParameterManager* sys = App::GetApplication().GetParameterSet("System parameter"); const std::map& rcList = App::GetApplication().GetParameterSetList(); for (std::map::const_iterator it= rcList.begin();it!=rcList.end();++it) { diff --git a/src/Gui/DlgPreferencesImp.cpp b/src/Gui/DlgPreferencesImp.cpp index 6d2cb77f58..0b7dbc11d8 100644 --- a/src/Gui/DlgPreferencesImp.cpp +++ b/src/Gui/DlgPreferencesImp.cpp @@ -321,14 +321,7 @@ void DlgPreferencesImp::restoreDefaults() App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")-> SetBool("SaveUserParameter", saveParameter); -#if 0 - QList pages = this->findChildren(); - for (QList::iterator it = pages.begin(); it != pages.end(); ++it) { - (*it)->loadSettings(); - } -#else reject(); -#endif } } @@ -435,7 +428,6 @@ void DlgPreferencesImp::applyChanges() void DlgPreferencesImp::showEvent(QShowEvent* ev) { - //canEmbedScrollArea = false; this->adjustSize(); QDialog::showEvent(ev); } diff --git a/src/Gui/DlgSettingsCacheDirectory.cpp b/src/Gui/DlgSettingsCacheDirectory.cpp index 82faa4ba94..295d5f7ba6 100644 --- a/src/Gui/DlgSettingsCacheDirectory.cpp +++ b/src/Gui/DlgSettingsCacheDirectory.cpp @@ -264,21 +264,8 @@ bool ApplicationCache::performAction(qint64 total) */ qint64 ApplicationCache::size() const { - // QDirIterator lists some directories twice -#if 0 - QDir cache = QString::fromStdString(App::Application::getUserCachePath()); - QDirIterator it(cache, QDirIterator::Subdirectories); - qint64 total = 0; - while (it.hasNext()) { - it.next(); - total += it.fileInfo().size(); - } - - return total; -#else qint64 total = dirSize(QString::fromStdString(App::Application::getUserCachePath())); return total; -#endif } /*! diff --git a/src/Gui/DlgSettingsUnitsImp.cpp b/src/Gui/DlgSettingsUnitsImp.cpp index d7391b52c4..ed7f051f38 100644 --- a/src/Gui/DlgSettingsUnitsImp.cpp +++ b/src/Gui/DlgSettingsUnitsImp.cpp @@ -38,19 +38,6 @@ using namespace Gui::Dialog; using namespace Base; -/* TRANSLATOR Gui::Dialog::DlgSettingsUnitsImp */ - -#if 0 // needed for Qt's lupdate utility - qApp->translate("Gui::Dialog::DlgSettingsUnits", "Standard (mm/kg/s/degree)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "MKS (m/kg/s/degree)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "US customary (in/lb)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "Imperial decimal (in/lb)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "Building Euro (cm/m²/m³)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "Building US (ft-in/sqft/cft)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "Metric small parts & CNC(mm, mm/min)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "Imperial for Civil Eng (ft, ft/sec)"); - qApp->translate("Gui::Dialog::DlgSettingsUnits", "FEM (mm, N, sec)"); -#endif /** * Constructs a DlgSettingsUnitsImp which is a child of 'parent', with the @@ -68,7 +55,6 @@ DlgSettingsUnitsImp::DlgSettingsUnitsImp(QWidget* parent) ui->comboBox_ViewSystem->addItem(item, i); } - //fillUpListBox(); ui->tableWidget->setVisible(false); // // Enable/disable the fractional inch option depending on system diff --git a/src/Gui/DockWindowManager.cpp b/src/Gui/DockWindowManager.cpp index 0ca9b195cb..2e7d2b0ea7 100644 --- a/src/Gui/DockWindowManager.cpp +++ b/src/Gui/DockWindowManager.cpp @@ -370,27 +370,6 @@ void DockWindowManager::setup(DockWindowItems* items) } } -#if 0 // FIXME: don't tabify always after switching the workbench - // tabify dock widgets for which "tabbed" is true and which have the same position - for (int i=0; i<4; i++) { - const QList& dws = areas[i]; - for (QList::ConstIterator it = dws.begin(); it != dws.end(); ++it) { - if (*it != dws.front()) { - getMainWindow()->tabifyDockWidget(dws.front(), *it); - } - } - } -#endif - -#if 0 - // hide all dock windows which we don't need for the moment - for (QList::Iterator it = docked.begin(); it != docked.end(); ++it) { - QByteArray dockName = (*it)->toggleViewAction()->data().toByteArray(); - hPref->SetBool(dockName.constData(), (*it)->isVisible()); - (*it)->hide(); - (*it)->toggleViewAction()->setVisible(false); - } -#endif } void DockWindowManager::saveState() diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index d28598bf11..9d197f1b36 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -487,17 +487,7 @@ void Document::_resetEdit(void) // changed into a private one, _resetEdit(). And the exposed // resetEdit() above calls into Application->setEditDocument(0) which // will prevent recursive calling. -#if 0 - // Nullify the member variable before calling finishEditing(). - // This is to avoid a possible stack overflow when a view provider wrongly - // invokes the document's resetEdit() method. - ViewProvider* editViewProvider = d->_editViewProvider; - d->_editViewProvider = nullptr; - editViewProvider->finishEditing(); - if (editViewProvider->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId())) - signalResetEdit(*(static_cast(editViewProvider))); -#endif App::GetApplication().closeActiveTransaction(); } d->_editViewProviderParent = nullptr; @@ -759,9 +749,6 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj) handleChildren3D(viewProvider,true); -#if 0 // With this we can show child objects again if this method was called by undo - viewProvider->onDelete(std::vector()); -#endif if (viewProvider && viewProvider->getTypeId().isDerivedFrom (ViewProviderDocumentObject::getClassTypeId())) { // go through the views @@ -796,7 +783,6 @@ void Document::beforeDelete() { void Document::slotChangedObject(const App::DocumentObject& Obj, const App::Property& Prop) { - //Base::Console().Log("Document::slotChangedObject() called\n"); ViewProvider* viewProvider = getViewProvider(&Obj); if (viewProvider) { try { diff --git a/src/Gui/Flag.h b/src/Gui/Flag.h index 2767cf5781..3694989141 100644 --- a/src/Gui/Flag.h +++ b/src/Gui/Flag.h @@ -36,7 +36,6 @@ class View3DInventorViewer; /** * @author Werner Mayer */ -#if 1 class GuiExport Flag : public QtGLWidget { Q_OBJECT @@ -67,35 +66,7 @@ private: SbVec3f coord; QPoint dragPosition; }; -#else -class GuiExport Flag : public QWidget -{ - Q_OBJECT -public: - Flag(QWidget* parent=0); - ~Flag(); - - QSize sizeHint() const; - void setOrigin(const SbVec3f&); - const SbVec3f& getOrigin() const; - void drawLine(int tox, int toy); - void setText(const QString&); - -protected: - void paintEvent(QPaintEvent *); - void mouseMoveEvent(QMouseEvent *); - void mousePressEvent(QMouseEvent *); - void resizeEvent(QResizeEvent *); - void contextMenuEvent(QContextMenuEvent *); - -private: - QString text; - SbVec3f coord; - QPoint dragPosition; - QImage image; -}; -#endif class FlagLayout : public QLayout { diff --git a/src/Gui/Inventor/SoDrawingGrid.h b/src/Gui/Inventor/SoDrawingGrid.h index 1637faf002..70fde0203f 100644 --- a/src/Gui/Inventor/SoDrawingGrid.h +++ b/src/Gui/Inventor/SoDrawingGrid.h @@ -23,10 +23,8 @@ #ifndef GUI_INVENTOR_SODRAWINGGRID_H #define GUI_INVENTOR_SODRAWINGGRID_H -//#include #include - namespace Gui { namespace Inventor { class GuiExport SoDrawingGrid : public SoShape { diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 9e94227395..8fab549ff6 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -101,8 +101,6 @@ FC_LOG_LEVEL_INIT("MainWindow",false,true,true) #if defined(Q_OS_WIN32) #define slots -//#include -//#include #endif using namespace Gui; @@ -336,18 +334,6 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) if (ht != config.end()) hiddenDockWindows = ht->second; - // Show all dockable windows over the workbench facility - // -#if 0 - // Toolbox - if (hiddenDockWindows.find("Std_ToolBox") == std::string::npos) { - ToolBox* toolBox = new ToolBox(this); - toolBox->setObjectName(QT_TRANSLATE_NOOP("QDockWidget","Toolbox")); - pDockMgr->registerDockWindow("Std_ToolBox", toolBox); - ToolBoxManager::getInstance()->setToolBox( toolBox ); - } -#endif - bool treeView = false, propertyView = false; if (hiddenDockWindows.find("Std_TreeView") == std::string::npos) { //work through parameter. @@ -435,7 +421,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) } //TODO: Add external object support for DAGView -#if 1 + //Dag View. if (hiddenDockWindows.find("Std_DAGView") == std::string::npos) { //work through parameter. @@ -459,25 +445,6 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) pDockMgr->registerDockWindow("Std_DAGView", dagDockWindow); } } -#endif - -#if 0 //defined(Q_OS_WIN32) this portion of code is not able to run with a vanilla Qtlib build on Windows. - // The MainWindowTabBar is used to show tabbed dock windows with icons - // - // add our own QTabBar-derived class to the main window layout - // NOTE: This uses some private stuff from QMainWindow which doesn't - // seem to be accessible on all platforms. - QMainWindowLayout* l = static_cast(this->layout()); - for (int i=0; i<5; i++) { - MainWindowTabBar* result = new MainWindowTabBar(this); - result->setDrawBase(true); - result->setElideMode(Qt::ElideRight); - result->hide(); // avoid to show horizontal bar in top left area - //result->setDocumentMode(_documentMode); - connect(result, SIGNAL(currentChanged(int)), l, SLOT(tabChanged())); - l->unusedTabBars << result; - } -#endif // accept drops on the window, get handled in dropEvent, dragEnterEvent setAcceptDrops(true); @@ -1624,17 +1591,6 @@ void MainWindow::dragEnterEvent (QDragEnterEvent * e) // Here we must allow uri drafs and check them in dropEvent const QMimeData* data = e->mimeData(); if (data->hasUrls()) { -#if 0 -#ifdef QT_NO_OPENSSL - QList urls = data->urls(); - for (QList::ConstIterator it = urls.begin(); it != urls.end(); ++it) { - if (it->scheme().toLower() == QLatin1String("https")) { - e->ignore(); - return; - } - } -#endif -#endif e->accept(); } else { @@ -1850,7 +1806,7 @@ void MainWindow::loadUrls(App::Document* doc, const QList& urls) Gui::Dialog::DownloadManager* dm = Gui::Dialog::DownloadManager::getInstance(); dm->download(dm->redirectUrl(*it)); } -//#ifndef QT_NO_OPENSSL + else if (it->scheme().toLower() == QLatin1String("https")) { QUrl url = *it; QUrlQuery urlq(url); @@ -1862,7 +1818,7 @@ void MainWindow::loadUrls(App::Document* doc, const QList& urls) Gui::Dialog::DownloadManager* dm = Gui::Dialog::DownloadManager::getInstance(); dm->download(dm->redirectUrl(url)); } -//#endif + else if (it->scheme().toLower() == QLatin1String("ftp")) { Gui::Dialog::DownloadManager::getInstance()->download(*it); } diff --git a/src/Gui/MergeDocuments.cpp b/src/Gui/MergeDocuments.cpp index 8b7dcfd3e6..4760b7c054 100644 --- a/src/Gui/MergeDocuments.cpp +++ b/src/Gui/MergeDocuments.cpp @@ -65,54 +65,7 @@ public: return true; } protected: - // See App::MergeDocument::XMLMergeReader for comments, with one additional - // benefits, we can save repetitive coding here. -#if 0 - void startElement(const XMLCh* const uri, const XMLCh* const localname, - const XMLCh* const qname, - const XERCES_CPP_NAMESPACE_QUALIFIER Attributes& attrs) - { - Base::XMLReader::startElement(uri, localname, qname, attrs); - if (LocalName == "Property") - propertyStack.push(std::make_pair(AttrMap["name"],AttrMap["type"])); - if (!propertyStack.empty()) { - // replace the stored object name with the real one - if (LocalName == "Link" || LocalName == "LinkSub" || (LocalName == "String" && propertyStack.top().first == "Label")) { - for (std::map::iterator it = AttrMap.begin(); it != AttrMap.end(); ++it) { - std::map::const_iterator jt = nameMap.find(it->second); - if (jt != nameMap.end()) - it->second = jt->second; - } - } - // update the expression if name of the object is used - else if (LocalName == "Expression") { - std::map::iterator it = AttrMap.find("expression"); - if (it != AttrMap.end()) { - // search for the part before the first dot that should be the object name. - std::string expression = it->second; - std::string::size_type dotpos = expression.find_first_of("."); - if (dotpos != std::string::npos) { - std::string name = expression.substr(0, dotpos); - std::map::const_iterator jt = nameMap.find(name); - if (jt != nameMap.end()) { - std::string newexpression = jt->second; - newexpression += expression.substr(dotpos); - it->second = newexpression; - } - } - } - } - } - } - - void endElement(const XMLCh* const uri, const XMLCh *const localname, const XMLCh *const qname) - { - Base::XMLReader::endElement(uri, localname, qname); - if (LocalName == "Property") - propertyStack.pop(); - } -#endif private: std::map& nameMap; diff --git a/src/Gui/MouseSelection.cpp b/src/Gui/MouseSelection.cpp index ecfea6f386..ee4c5c5f07 100644 --- a/src/Gui/MouseSelection.cpp +++ b/src/Gui/MouseSelection.cpp @@ -117,87 +117,6 @@ BaseMouseSelection::BaseMouseSelection() { } -// ----------------------------------------------------------------------------------- -#if 0 -/* XPM */ -static const char* cursor_polypick[]= { - "32 32 2 1", - "# c #646464", - ". c None", - "................................", - "................................", - ".......#........................", - ".......#........................", - ".......#........................", - "................................", - ".......#........................", - "..###.###.###...................", - ".......#...............#........", - "......................##........", - ".......#..............#.#.......", - ".......#.............#..#.......", - ".......#............#...#.......", - "....................#....#......", - "...................#.....#......", - "..................#......#......", - "............#.....#.......#.....", - "...........#.##..#........#.....", - "..........#....##.........#.....", - ".........#...............#......", - "........#................#......", - ".......#................#.......", - "......#.................#.......", - ".....#.................#........", - "....#####..............#........", - ".........#########....#.........", - "..................#####.........", - "................................", - "................................", - "................................", - "................................", - "................................" -}; - -/* XPM */ -static const char* cursor_scissors[]= { - "32 32 3 1", - "# c #000000", - "+ c #ffffff", - ". c None", - "....+...........................", - "....+...........................", - "....+...........................", - "................................", - "+++.+.+++.......................", - "................................", - "....+...........................", - "....+...................#####...", - "....+.................########..", - ".....................#########..", - ".....###............##########..", - "....##++##.........#####...###..", - "...#++++++##.......####...####..", - "...##+++++++#......####.######..", - ".....#+++++++##....##########...", - "......##+++++++##.##########....", - "........##+++++++#########......", - "..........#+++++++#####.........", - "...........##+++++####..........", - "...........##+++++###...........", - ".........##+++++++########......", - "........##+++++++###########....", - "......##+++++++##.###########...", - "....##+++++++##....##########...", - "...#+++++++##......####..#####..", - "...#++++++#........#####..####..", - "....##++##..........#####..###..", - "......#.............##########..", - ".....................#########..", - ".......................######...", - "................................", - "................................" -}; -#endif static const char* cursor_cut_scissors[]= { "32 32 6 1", "a c #800000", diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index fe616a4d30..2713c7df19 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -559,15 +559,6 @@ void NavigationStyle::viewAll() if (box.isEmpty()) return; -#if 0 - // check whether the box is very wide or tall, if not do nothing - float box_width, box_height, box_depth; - box.getSize( box_width, box_height, box_depth ); - if (box_width < 5.0f*box_height && box_width < 5.0f*box_depth && - box_height < 5.0f*box_width && box_height < 5.0f*box_depth && - box_depth < 5.0f*box_width && box_depth < 5.0f*box_height ) - return; -#endif SoCamera* cam = viewer->getSoRenderManager()->getCamera(); if (!cam) @@ -592,23 +583,7 @@ void NavigationStyle::viewAll() float aspect = cam->aspectRatio.getValue(); - if (cam->getTypeId() == SoPerspectiveCamera::getClassTypeId()) { - // set the new camera position dependent on the occupied space of projected bounding box - //SbVec3f direction = cam->position.getValue() - box.getCenter(); - //float movelength = direction.length(); - //direction.normalize(); - //float fRatio = getViewportRegion().getViewportAspectRatio(); - //if ( fRatio > 1.0f ) { - // float factor = std::max(s[0]/fRatio,s[1]); - // movelength = factor * movelength; - //} - //else { - // float factor = std::max(s[0],s[1]/fRatio); - // movelength = factor * movelength; - //} - //cam->position.setValue(box.getCenter() + direction * movelength); - } - else if (cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) { + if (cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) { SoOrthographicCamera* ocam = (SoOrthographicCamera *)cam; // safe downward cast, knows the type if (aspect < 1.0f) ocam->height = cam_height / aspect; diff --git a/src/Gui/PythonWrapper.cpp b/src/Gui/PythonWrapper.cpp index d520760b25..1be2246c87 100644 --- a/src/Gui/PythonWrapper.cpp +++ b/src/Gui/PythonWrapper.cpp @@ -363,11 +363,6 @@ QObject* PythonWrapper::toQObject(const Py::Object& pyobject) return reinterpret_cast(ptr); #endif -#if 0 // Unwrapping using sip/PyQt - void* ptr = qt_getCppPointer(pyobject, "sip", "unwrapinstance"); - return reinterpret_cast(ptr); -#endif - return nullptr; } @@ -499,10 +494,6 @@ Py::Object PythonWrapper::fromQObject(QObject* object, const char* className) // return qt_wrapInstance(object, className, "shiboken2", "PySide2.QtCore", "wrapInstance"); #endif -#if 0 // Unwrapping using sip/PyQt - Q_UNUSED(className); - return qt_wrapInstance(object, "QObject", "sip", "PyQt5.QtCore", "wrapinstance"); -#endif } Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className) @@ -528,11 +519,6 @@ Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className) // return qt_wrapInstance(widget, className, "shiboken2", "PySide2.QtWidgets", "wrapInstance"); #endif - -#if 0 // Unwrapping using sip/PyQt - Q_UNUSED(className); - return qt_wrapInstance(widget, "QWidget", "sip", "PyQt5.QtWidgets", "wrapinstance"); -#endif } const char* PythonWrapper::getWrapperName(QObject* obj) const diff --git a/src/Gui/QSint/actionpanel/taskheader_p.cpp b/src/Gui/QSint/actionpanel/taskheader_p.cpp index 6fa3d58d30..627d5c3f34 100644 --- a/src/Gui/QSint/actionpanel/taskheader_p.cpp +++ b/src/Gui/QSint/actionpanel/taskheader_p.cpp @@ -192,20 +192,6 @@ void TaskHeader::fold() { if (myExpandable) { Q_EMIT activated(); - // Toggling the 'm_fold' member here may lead to inconsistencies with its ActionGroup. - // Thus, the method setFold() was added and called from ActionGroup when required. -#if 0 - m_fold = !m_fold; - changeIcons(); - if (myButton) { - myButton->setProperty("fold", m_fold); - if (myButton->style()) { - myButton->style()->unpolish(myButton); - myButton->style()->polish(myButton); - myButton->update(); - } - } -#endif } } diff --git a/src/Gui/QuantitySpinBox.cpp b/src/Gui/QuantitySpinBox.cpp index e54c236743..5e6cc9b20c 100644 --- a/src/Gui/QuantitySpinBox.cpp +++ b/src/Gui/QuantitySpinBox.cpp @@ -889,27 +889,6 @@ void QuantitySpinBox::closeEvent(QCloseEvent * event) bool QuantitySpinBox::event(QEvent * event) { - // issue #0004059: Tooltips for Gui::QuantitySpinBox not showing - // Here we must not try to show the tooltip of the icon label - // because it would override a custom tooltip set to this widget. - // - // We could also check if the text of this tooltip is empty but - // it will fail in cases where the widget is embedded into the - // property editor and the corresponding item has set a tooltip. - // Instead of showing the item's tooltip it will again show the - // tooltip of the icon label. -#if 0 - if (event->type() == QEvent::ToolTip) { - if (isBound() && getExpression() && lineEdit()->isReadOnly()) { - QHelpEvent * helpEvent = static_cast(event); - - QToolTip::showText( helpEvent->globalPos(), Base::Tools::fromStdString(getExpression()->toString()), this); - event->accept(); - return true; - } - } -#endif - return QAbstractSpinBox::event(event); } @@ -1002,7 +981,6 @@ Base::Quantity QuantitySpinBox::valueFromText(const QString &text) const QValidator::State QuantitySpinBox::validate(QString &text, int &pos) const { Q_D(const QuantitySpinBox); - QValidator::State state; d->validateAndInterpret(text, pos, state); return state; diff --git a/src/Gui/Quarter/KeyboardP.cpp b/src/Gui/Quarter/KeyboardP.cpp index 4a8c028c8c..5ff7acdf02 100644 --- a/src/Gui/Quarter/KeyboardP.cpp +++ b/src/Gui/Quarter/KeyboardP.cpp @@ -235,15 +235,6 @@ KeyboardP::initKeyMap() keypadmap->insert(Qt::Key_Delete, SoKeyboardEvent::PAD_DELETE); keypadmap->insert(Qt::Key_Period, SoKeyboardEvent::PAD_PERIOD); - -#if 0 // FIXME: don't know what to do with these (20070306 frodo) - keyboardmap->insert(Qt::, SoKeyboardEvent::RIGHT_SHIFT); - keyboardmap->insert(Qt::, SoKeyboardEvent::RIGHT_CONTROL); - keyboardmap->insert(Qt::, SoKeyboardEvent::RIGHT_ALT); - keyboardmap->insert(Qt::, SoKeyboardEvent::PRIOR); - keyboardmap->insert(Qt::, SoKeyboardEvent::NEXT); - keyboardmap->insert(Qt::, SoKeyboardEvent::SHIFT_LOCK); -#endif } #undef PUBLIC diff --git a/src/Gui/Quarter/QuarterWidget.cpp b/src/Gui/Quarter/QuarterWidget.cpp index 5e1f89e04d..daf65aa0b4 100644 --- a/src/Gui/Quarter/QuarterWidget.cpp +++ b/src/Gui/Quarter/QuarterWidget.cpp @@ -924,31 +924,7 @@ void QuarterWidget::paintEvent(QPaintEvent* event) bool QuarterWidget::viewportEvent(QEvent* event) { - // Disable the old implementation of this method as it show - // problems with panning and rotations when a widget item is - // added to the scene. -#if 0 - if (event->type() == QEvent::Paint || event->type() == QEvent::Resize) { - return QGraphicsView::viewportEvent(event); - } - else if (event->type() == QEvent::MouseMove || - event->type() == QEvent::Wheel || - event->type() == QEvent::MouseButtonDblClick || - event->type() == QEvent::MouseButtonRelease || - event->type() == QEvent::MouseButtonPress) { - QMouseEvent* mouse = static_cast(event); - QGraphicsItem *item = itemAt(mouse->pos()); - if (!item) { - return false; - } - return QGraphicsView::viewportEvent(event); - } - - //if we return false the events get processed normally, this means they get passed to the quarter - //event filters for processing in the scene graph. If we return true event processing stops here. - return false; -#else // If no item is selected still let the graphics scene handle it but // additionally handle it by this viewer. This is e.g. needed when // resizing a widget item because the cursor may already be outside @@ -973,7 +949,6 @@ bool QuarterWidget::viewportEvent(QEvent* event) } return QGraphicsView::viewportEvent(event); -#endif } /*! @@ -1217,19 +1192,13 @@ QuarterWidget::setNavigationModeFile(const QUrl & url) if (url.scheme()=="coin") { filename = url.path(); - //FIXME: This conditional needs to be implemented when the - //CoinResources systems if working -#if 0 - //#if (COIN_MAJOR_VERSION==3) && (COIN_MINOR_VERSION==0) -#endif + //Workaround for differences between url scheme, and Coin internal //scheme in Coin 3.0. if (filename[0]=='/') { filename.remove(0,1); } -#if 0 - //#endif -#endif + filename = url.scheme()+':'+filename; } else if (url.scheme()=="file") diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index 5c35241465..01f96d5851 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -792,18 +792,6 @@ int SelectionSingleton::setPreselect(const char* pDocName, const char* pObjectNa if (!pSubName) pSubName = ""; if (DocName==pDocName && FeatName==pObjectName && SubName==pSubName) { - // MovePreselect is likely going to slow down large scene rendering. - // Disable it for now. -#if 0 - if(hx!=x || hy!=y || hz!=z) { - hx = x; - hy = y; - hz = z; - SelectionChanges Chng(SelectionChanges::MovePreselect, - DocName,FeatName,SubName,std::string(),x,y,z); - notify(Chng); - } -#endif return -1; } @@ -972,7 +960,6 @@ void SelectionSingleton::rmvPreselect(bool signal) // notify observing objects notify(std::move(Chng)); - } const SelectionChanges &SelectionSingleton::getPreselection(void) const @@ -2116,7 +2103,6 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args) docObj->getNameInDocument(), subname.c_str(), 0, 0, 0, nullptr, Base::asBoolean(clearPreselect)); } - Py_Return; } } diff --git a/src/Gui/SoFCDB.cpp b/src/Gui/SoFCDB.cpp index 95b758ab0f..ad7f7ea50c 100644 --- a/src/Gui/SoFCDB.cpp +++ b/src/Gui/SoFCDB.cpp @@ -406,59 +406,6 @@ bool Gui::SoFCDB::writeToX3D(SoNode* node, const char* filename, bool binary) bool Gui::SoFCDB::writeToX3D(SoNode* node, bool exportViewpoints, std::string& buffer) { -#if 0 - writeToVRML(node, buffer); - if (buffer.empty()) - return false; - - QString filename = QDir::tempPath(); - filename += QLatin1String("/sceneXXXXXX.wrl"); - QTemporaryFile wrlFile(filename); - if (wrlFile.open()) { - filename = wrlFile.fileName(); - wrlFile.write(buffer.c_str(), buffer.size()); - wrlFile.close(); - - QString exe(QLatin1String("tovrmlx3d")); - QStringList args; - args << filename << QLatin1String("--encoding") << QLatin1String("xml"); - QProcess proc; - proc.setEnvironment(QProcess::systemEnvironment()); - proc.start(exe, args); - if (proc.waitForStarted() && proc.waitForFinished()) { - QByteArray x3d = proc.readAll(); - if (x3d.isEmpty()) - return false; - - x3d.replace('\t', " "); - - if (exportViewpoints) { - // compute a sensible view point - SoGetBoundingBoxAction bboxAction(SbViewportRegion(1280, 1024)); - bboxAction.apply(node); - SbBox3f bbox = bboxAction.getBoundingBox(); - SbSphere bs; - bs.circumscribe(bbox); - const SbVec3f& cnt = bs.getCenter(); - float dist = bs.getRadius(); - - QString vp = QString::fromLatin1(" \n") - .arg(cnt[0]).arg(cnt[1]).arg(cnt[2]).arg(cnt[2] + 2.0f * dist); - int index = x3d.indexOf("\n"); - if (index >= 0) { - x3d.insert(index + 8, vp); - } - } - - buffer = x3d.data(); - return true; - } - } - - return false; -#else SoNode* noSwitches = replaceSwitchesInSceneGraph(node); noSwitches->ref(); SoVRMLAction vrml2; @@ -510,7 +457,6 @@ bool Gui::SoFCDB::writeToX3D(SoNode* node, bool exportViewpoints, std::string& b noSwitches->unref(); return true; -#endif } void Gui::SoFCDB::writeX3DFields(SoNode* node, std::map& nodeMap, @@ -748,7 +694,6 @@ bool Gui::SoFCDB::writeToFile(SoNode* node, const char* filename, bool binary) ret = true; } } - return ret; } diff --git a/src/Gui/SoFCSelection.cpp b/src/Gui/SoFCSelection.cpp index 06c653b276..4016ef2ab8 100644 --- a/src/Gui/SoFCSelection.cpp +++ b/src/Gui/SoFCSelection.cpp @@ -47,17 +47,8 @@ #include "ViewParams.h" -// For 64-bit system the method using the front buffer doesn't work at all for lines. -// Thus, use the method which forces a redraw every time. This is a bit slower but at -// least it works. -// -// Disable front buffer in all cases, in order to spare the repeating logic of -// handling selection contextn. SoFCSelection is not really used that much -// anyway. -// -// #if defined(_OCC64) // is set by configure or cmake # define NO_FRONTBUFFER -// #endif + using namespace Gui; @@ -331,19 +322,6 @@ SoFCSelection::getPickedPoint(SoHandleEventAction* action) const return nullptr; else if (points.getLength() == 1) return points[0]; - //const SoPickedPoint* pp0 = points[0]; - //const SoPickedPoint* pp1 = points[1]; - //const SoDetail* det0 = pp0->getDetail(); - //const SoDetail* det1 = pp1->getDetail(); - //if (det0 && det0->isOfType(SoFaceDetail::getClassTypeId()) && - // det1 && det1->isOfType(SoLineDetail::getClassTypeId())) { - // const SbVec3f& pt0 = pp0->getPoint(); - // const SbVec3f& pt1 = pp1->getPoint(); - // if (pt0.equals(pt1, 0.01f)) - // return pp1; - //} - - //return pp0; const SoPickedPoint* picked = points[0]; @@ -574,13 +552,6 @@ SoFCSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[2]); } } - //if(selected == SELECTED){ - // redrawHighlighted(action, true); - //} - //if(selectionCleared ){ - // redrawHighlighted(action, false); - // selectionCleared = false; - //} } // key press events else if (event->isOfType(SoKeyboardEvent ::getClassTypeId())) { @@ -861,7 +832,6 @@ SoFCSelection::redrawHighlighted(SoAction * action , SbBool doHighlight ) { Q_UNUSED(action); Q_UNUSED(doHighlight); - //Base::Console().Log("SoFCSelection::redrawHighlighted() (%p) doHigh=%d \n",this,doHighlight?1:0); #ifdef NO_FRONTBUFFER #else @@ -912,12 +882,8 @@ SoFCSelection::redrawHighlighted(SoAction * action , SbBool doHighlight ) SoState *state = action->getState(); - //void* window; - //void* context; - //void *display; - QtGLWidget* window; + QtGLWidget* window; SoGLRenderAction *glAction; - //SoWindowElement::get(state, window, context, display, glAction); SoGLWidgetElement::get(state, window); SoGLRenderActionElement::get(state, glAction); @@ -1094,4 +1060,3 @@ void SoFCSelection::applySettings () } } -//#undef THIS diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index 0de6df63a1..384fce8c91 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -658,32 +658,6 @@ bool SoFCUnifiedSelection::setSelection(const std::vector &infos, bo } } -#if 0 // ViewProviderDocumentObject now has default implementation of getElementPicked - - // If no next hierarchy is found, do another try on view provider hierarchies, - // which is used by geo feature group. - if(!hasNext) { - bool found = false; - auto vps = this->pcDocument->getViewProvidersByPath(pPath); - for(auto it=vps.begin();it!=vps.end();++it) { - auto vpdNext = it->first; - if(Gui::Selection().isSelected(vpdNext->getObject(),"")) { - found = true; - continue; - } - if(!found || !vpdNext->useNewSelectionModel() || !vpdNext->isSelectable()) - continue; - hasNext = true; - vpd = vpdNext; - det = 0; - pPath->truncate(it->second+1); - objectName = vpd->getObject()->getNameInDocument(); - subName = ""; - break; - } - } -#endif - FC_TRACE("clearing selection"); Gui::Selection().clearSelection(); FC_TRACE("add selection"); diff --git a/src/Gui/SoMouseWheelEvent.h b/src/Gui/SoMouseWheelEvent.h index a08b49a7b8..de630bbbb5 100644 --- a/src/Gui/SoMouseWheelEvent.h +++ b/src/Gui/SoMouseWheelEvent.h @@ -23,9 +23,6 @@ #ifndef SOMOUSEWHEELEVENT_H_FC #define SOMOUSEWHEELEVENT_H_FC -//#ifndef GuiExport -//#define GuiExport -//#endif #include #include diff --git a/src/Gui/SoTextLabel.cpp b/src/Gui/SoTextLabel.cpp index 4fe5a78463..f69505bc4f 100644 --- a/src/Gui/SoTextLabel.cpp +++ b/src/Gui/SoTextLabel.cpp @@ -68,31 +68,6 @@ using namespace Gui; -/*! -\code - -s=""" - #Inventor V2.1 ascii - - Annotation { - Translation { translation 4 0 0 } - FontStyle { - size 20 - style BOLD - } - BaseColor { - rgb 0.0 0.0 0.0 - } - - - SoTextLabel { string ["Text label", "Second line"] backgroundColor 1.0 0.447059 0.337255} - } -""" - -App.ActiveDocument.addObject("App::InventorObject","iv").Buffer=s - -\endcode -*/ SO_NODE_SOURCE(SoTextLabel) @@ -136,15 +111,11 @@ void SoTextLabel::GLRender(SoGLRenderAction *action) SoMaterialBundle mb(action); mb.sendFirst(); const SbMatrix & mat = SoModelMatrixElement::get(state); - //const SbViewVolume & vv = SoViewVolumeElement::get(state); const SbMatrix & projmatrix = (mat * SoViewingMatrixElement::get(state) * SoProjectionMatrixElement::get(state)); const SbViewportRegion & vp = SoViewportRegionElement::get(state); SbVec2s vpsize = vp.getViewportSizePixels(); - // font stuff - //float space = this->spacing.getValue(); - //float fontsize = SoFontSizeElement::get(state); SbName fontname = SoFontNameElement::get(state); int lines = this->string.getNum(); @@ -154,7 +125,7 @@ void SoTextLabel::GLRender(SoGLRenderAction *action) nilpoint[0] = (nilpoint[0] + 1.0f) * 0.5f * vpsize[0]; nilpoint[1] = (nilpoint[1] + 1.0f) * 0.5f * vpsize[1]; -#if 1 + // Unfortunately, the size of the label is stored in the pimpl class of // SoText2 which cannot be accessed directly. However, there is a trick // to get the required information: set model, viewing and projection @@ -203,40 +174,6 @@ void SoTextLabel::GLRender(SoGLRenderAction *action) if (lines > 1) { nilpoint[1] -= (float(lines-1)/(float)lines*height); } -#else - // Unfortunately, the required size (in pixels) is stored in a non-accessible way - // in the subclass SoText2. Thus, we try to get a satisfactory solution with Qt - // methods. - // The font name is of the form "family:style". If 'style' is given it can be - // 'Bold', 'Italic' or 'Bold Italic'. - QFont font; - QString fn = QString::fromLatin1(fontname.getString()); - int pos = fn.indexOf(QLatin1Char(':')); - if (pos > -1) { - if (fn.indexOf(QLatin1String("Bold"),pos,Qt::CaseInsensitive) > pos) - font.setBold(true); - if (fn.indexOf(QLatin1String("Italic"),pos,Qt::CaseInsensitive) > pos) - font.setItalic(true); - fn = fn.left(pos); - } - font.setFamily(fn); - font.setPixelSize((int)fontsize); - QFontMetrics fm(font); - - float width = 0.0f; - float height = 0.75f*fontsize*lines + (lines-1)*space;//fm.height(); - float hh=0; - for (int i = 0; i < lines; i++) { - SbString str = this->string[i]; - float w = fm.width(QLatin1String(this->string[i].getString())); - width = std::max(width, w); - hh = fm.height(); - } - - if (lines > 1) { - nilpoint[1] -= ((lines-1)*fontsize*0.75f+space); - } -#endif SbVec3f toppoint = nilpoint; toppoint[0] += width; @@ -377,25 +314,9 @@ void SoStringLabel::GLRender(SoGLRenderAction *action) glBlendFunc(GL_ONE,GL_SRC_ALPHA); - /* Background Box */ - //glColor4f(1,0.1f,0.1f,1); - //int ln =4; - //float ls = font.pixelSize()*1.5f; - //float bh = -1 + 2.0*(ls*(ln+.25))/float(window->height()); - - //glBegin(GL_QUADS); - //glVertex2f(-1.f,bh); glVertex2f(-1.f,-1.f); - //glVertex2f( 1.f,-1.f); glVertex2f( 1.f,bh); - //glEnd(); - - //float middleCol=window->width()*0.40; - //float rightCol=window->width()*0.85; - //float startPos = window->height()-(5+ls*(ln)); - // text color SbColor color = this->textColor.getValue(); glColor4f(color[0], color[1], color[2],1); - //window->renderText(20,20/*startPos+ 1*ls*/,QLatin1String(this->string[0].getString()),font); const SbMatrix & mat = SoModelMatrixElement::get(state); const SbMatrix & projmatrix = (mat * SoViewingMatrixElement::get(state) * SoProjectionMatrixElement::get(state)); @@ -404,11 +325,6 @@ void SoStringLabel::GLRender(SoGLRenderAction *action) QStringList list; for (int i=0; istring.getNum(); i++) list << QLatin1String(this->string[i].getString()); -#if 0 // Old OpenGL API - window->renderText(nil[0],nil[1],nil[2],list.join(QLatin1String("\n")),font); -#else - //FIXME: renderText -#endif // Leave 2D screen mode glPopAttrib(); @@ -523,76 +439,6 @@ void SoFrameLabel::drawImage() void SoFrameLabel::GLRender(SoGLRenderAction *action) { inherited::GLRender(action); -#if 0 - QtGLWidget* window; - SoState * state = action->getState(); - state->push(); - SoLazyElement::setLightModel(state, SoLazyElement::BASE_COLOR); - SoGLWidgetElement::get(state, window); - if (!window) { - state->pop(); - return; - } - - // Enter in 2D screen mode - glMatrixMode(GL_PROJECTION); - glPushMatrix(); - glLoadIdentity(); - glOrtho(-1,1,-1,1,-1,1); - glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glLoadIdentity(); - glPushAttrib(GL_ENABLE_BIT); - glDisable(GL_DEPTH_TEST); - glDisable(GL_LIGHTING); - glDisable(GL_TEXTURE_2D); - glEnable(GL_BLEND); - - QFont font; - font.setStyleStrategy(QFont::NoAntialias); - font.setFamily(QLatin1String(this->name.getValue())); - font.setPixelSize(this->size.getValue()); - - glBlendFunc(GL_ONE,GL_SRC_ALPHA); - - /* Background Box */ - //glColor4f(1,0.1f,0.1f,1); - //int ln =4; - //float ls = font.pixelSize()*1.5f; - //float bh = -1 + 2.0*(ls*(ln+.25))/float(window->height()); - - //glBegin(GL_QUADS); - //glVertex2f(-1.f,bh); glVertex2f(-1.f,-1.f); - //glVertex2f( 1.f,-1.f); glVertex2f( 1.f,bh); - //glEnd(); - - //float middleCol=window->width()*0.40; - //float rightCol=window->width()*0.85; - //float startPos = window->height()-(5+ls*(ln)); - - // text color - SbColor color = this->textColor.getValue(); - glColor4f(color[0], color[1], color[2],1); - //window->renderText(20,20/*startPos+ 1*ls*/,QLatin1String(this->string[0].getString()),font); - const SbMatrix & mat = SoModelMatrixElement::get(state); - const SbMatrix & projmatrix = (mat * SoViewingMatrixElement::get(state) * - SoProjectionMatrixElement::get(state)); - SbVec3f nil(0.0f, 0.0f, 0.0f); - projmatrix.multVecMatrix(nil, nil); - QStringList list; - for (int i=0; istring.getNum(); i++) - list << QLatin1String(this->string[i].getString()); - window->renderText(nil[0],nil[1],nil[2],list.join(QLatin1String("\n")),font); - - // Leave 2D screen mode - glPopAttrib(); - glPopMatrix(); - glMatrixMode(GL_PROJECTION); - glPopMatrix(); - glMatrixMode(GL_MODELVIEW); - - state->pop(); -#endif } // ------------------------------------------------------ diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 869b511e32..44b3328c7d 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -968,28 +968,10 @@ void TreeWidget::contextMenuEvent(QContextMenuEvent* e) } void TreeWidget::hideEvent(QHideEvent* ev) { - // No longer required. Visibility is now handled inside onUpdateStatus() by - // UpdateDisabler. -#if 0 - TREE_TRACE("detaching selection observer"); - this->detachSelection(); - selectTimer->stop(); -#endif QTreeWidget::hideEvent(ev); } void TreeWidget::showEvent(QShowEvent* ev) { - // No longer required. Visibility is now handled inside onUpdateStatus() by - // UpdateDisabler. -#if 0 - TREE_TRACE("attaching selection observer"); - this->attachSelection(); - int timeout = TreeParams::Instance()->SelectionTimeout(); - if (timeout <= 0) - timeout = 1; - selectTimer->start(timeout); - _updateStatus(); -#endif QTreeWidget::showEvent(ev); } @@ -1042,22 +1024,9 @@ void TreeWidget::onStartEditing() MDIView* view = doc->getActiveView(); if (view) getMainWindow()->setActiveWindow(view); - // Always open a transaction here doesn't make much sense because: - // - many objects open transactions when really changing some properties - // - this leads to certain inconsistencies with the doubleClicked() method - // So, only the view provider class should decide what to do -#if 0 - // open a transaction before starting edit mode - std::string cmd("Edit "); - cmd += obj->Label.getValue(); - doc->openCommand(cmd.c_str()); - bool ok = doc->setEdit(objitem->object(), edit); - if (!ok) doc->abortCommand(); -#else editingItem = objitem; if (!doc->setEdit(objitem->object(), edit)) editingItem = nullptr; -#endif } } } @@ -1345,15 +1314,6 @@ Qt::DropActions TreeWidget::supportedDropActions() const bool TreeWidget::event(QEvent* e) { -#if 0 - if (e->type() == QEvent::ShortcutOverride) { - QKeyEvent* ke = static_cast(e); - switch (ke->key()) { - case Qt::Key_Delete: - ke->accept(); - } - } -#endif return QTreeWidget::event(e); } @@ -1380,11 +1340,6 @@ bool TreeWidget::eventFilter(QObject*, QEvent* ev) { void TreeWidget::keyPressEvent(QKeyEvent* event) { -#if 0 - if (event && event->matches(QKeySequence::Delete)) { - event->ignore(); - } -#endif if (event->matches(QKeySequence::Find)) { event->accept(); onSearchObjects(); @@ -1533,19 +1488,6 @@ void TreeWidget::startDrag(Qt::DropActions supportedActions) QMimeData* TreeWidget::mimeData(const QList items) const { -#if 0 - // all selected items must reference an object from the same document - App::Document* doc = 0; - for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { - if ((*it)->type() != TreeWidget::ObjectType) - return 0; - App::DocumentObject* obj = static_cast(*it)->object()->getObject(); - if (!doc) - doc = obj->getDocument(); - else if (doc != obj->getDocument()) - return 0; - } -#endif return QTreeWidget::mimeData(items); } diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index 84cda465b0..f726039e5f 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -119,8 +119,6 @@ FC_LOG_LEVEL_INIT("3DViewer",true,true) -//#define FC_LOGGING_CB - using namespace Gui; /*** zoom-style cursor ******/ @@ -389,36 +387,16 @@ void View3DInventorViewer::init() cam->nearDistance = 0; cam->farDistance = 10; - // dragger - //SoSeparator * dragSep = new SoSeparator(); - //SoScale *scale = new SoScale(); - //scale->scaleFactor = SbVec3f (0.2,0.2,0.2); - //dragSep->addChild(scale); - //SoCenterballDragger *dragger = new SoCenterballDragger(); - //dragger->center = SbVec3f (0.8,0.8,0); - ////dragger->rotation = SbRotation(rrot[0],rrot[1],rrot[2],rrot[3]); - //dragSep->addChild(dragger); - this->foregroundroot->addChild(cam); this->foregroundroot->addChild(lm); this->foregroundroot->addChild(bc); - //this->foregroundroot->addChild(dragSep); -#if 0 - // NOTE: For every mouse click event the SoSelection searches for the picked - // point which causes a certain slow-down because for all objects the primitives - // must be created. Using an SoSeparator avoids this drawback. - SoSelection* selectionRoot = new SoSelection(); - selectionRoot->addSelectionCallback(View3DInventorViewer::selectCB, this); - selectionRoot->addDeselectionCallback(View3DInventorViewer::deselectCB, this); - selectionRoot->setPickFilterCallback(View3DInventorViewer::pickFilterCB, this); -#else // NOTE: For every mouse click event the SoFCUnifiedSelection searches for the picked // point which causes a certain slow-down because for all objects the primitives // must be created. Using an SoSeparator avoids this drawback. selectionRoot = new Gui::SoFCUnifiedSelection(); selectionRoot->applySettings(); -#endif + // set the ViewProvider root node pcViewProviderRoot = selectionRoot; @@ -453,7 +431,6 @@ void View3DInventorViewer::init() auto pcGroupOnTopPickStyle = new SoPickStyle; pcGroupOnTopPickStyle->style = SoPickStyle::UNPICKABLE; - // pcGroupOnTopPickStyle->style = SoPickStyle::SHAPE_ON_TOP; pcGroupOnTopPickStyle->setOverride(true); pcGroupOnTop->addChild(pcGroupOnTopPickStyle); @@ -502,10 +479,7 @@ void View3DInventorViewer::init() this->getSoRenderManager()->setGLRenderAction(new SoBoxSelectionRenderAction); this->getSoRenderManager()->getGLRenderAction()->setCacheContext(id); - // set the transparency and antialiasing settings -// getGLRenderAction()->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_BLEND); getSoRenderManager()->getGLRenderAction()->setTransparencyType(SoGLRenderAction::SORTED_OBJECT_SORTED_TRIANGLE_BLEND); -// getGLRenderAction()->setSmoothing(true); // Settings setSeekTime(0.4f); @@ -1428,7 +1402,6 @@ void View3DInventorViewer::setAxisCross(bool on) axisCross->scaleFactor = 1.0f; axisGroup = new SoSkipBoundingGroup; axisGroup->addChild(axisCross); - sep->addChild(axisGroup); } } @@ -2165,9 +2138,6 @@ void View3DInventorViewer::renderToFramebuffer(QtGLFramebufferObject* fbo) glClearColor(col.redF(), col.greenF(), col.blueF(), col.alphaF()); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); - // If on then transparent areas may shine through opaque areas - //glDepthRange(0.1,1.0); - SoBoxSelectionRenderAction gl(SbViewportRegion(width, height)); // When creating a new GL render action we have to copy over the cache context id // For further details see init(). @@ -2191,7 +2161,6 @@ void View3DInventorViewer::renderToFramebuffer(QtGLFramebufferObject* fbo) if (this->axiscrossEnabled) { this->drawAxisCross(); } - fbo->release(); } @@ -2284,9 +2253,6 @@ void View3DInventorViewer::renderGLImage() glEnable(GL_DEPTH_TEST); } -// #define ENABLE_GL_DEPTH_RANGE -// The calls of glDepthRange inside renderScene() causes problems with transparent objects -// so that's why it is disabled now: http://forum.freecadweb.org/viewtopic.php?f=3&t=6037&hilit=transparency // Documented in superclass. Overrides this method to be able to draw // the axis cross, if selected, and to keep a continuous animation @@ -2307,11 +2273,6 @@ void View3DInventorViewer::renderScene(void) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glEnable(GL_DEPTH_TEST); -#if defined(ENABLE_GL_DEPTH_RANGE) - // using 90% of the z-buffer for the background and the main node - glDepthRange(0.1,1.0); -#endif - // Render our scenegraph with the image. SoGLRenderAction* glra = this->getSoRenderManager()->getGLRenderAction(); SoState* state = glra->getState(); @@ -2346,11 +2307,6 @@ void View3DInventorViewer::renderScene(void) state->pop(); } -#if defined (ENABLE_GL_DEPTH_RANGE) - // using 10% of the z-buffer for the foreground node - glDepthRange(0.0,0.1); -#endif - // Render overlay front scenegraph. glra->apply(this->foregroundroot); @@ -2358,21 +2314,11 @@ void View3DInventorViewer::renderScene(void) this->drawAxisCross(); } -#if defined (ENABLE_GL_DEPTH_RANGE) - // using the main portion of z-buffer again (for frontbuffer highlighting) - glDepthRange(0.1,1.0); -#endif - // Immediately reschedule to get continuous spin animation. if (this->isAnimating()) { this->getSoRenderManager()->scheduleRedraw(); } -#if 0 // this breaks highlighting of edges - glDisable(GL_LIGHTING); - glDisable(GL_DEPTH_TEST); -#endif - printDimension(); navigation->redraw(); @@ -2390,11 +2336,6 @@ void View3DInventorViewer::renderScene(void) if (naviCubeEnabled) naviCube->drawNaviCube(); - -#if 0 // this breaks highlighting of edges - glEnable(GL_LIGHTING); - glEnable(GL_DEPTH_TEST); -#endif } void View3DInventorViewer::setSeekMode(SbBool on) @@ -2465,7 +2406,6 @@ void View3DInventorViewer::selectAll() if (obj) objs.push_back(obj); } } - if (!objs.empty()) Gui::Selection().setSelection(objs.front()->getDocument()->getName(), objs); } @@ -2495,7 +2435,6 @@ bool View3DInventorViewer::processSoEvent(const SoEvent* ev) break; } } - return navigation->processEvent(ev); } @@ -3284,12 +3223,9 @@ void View3DInventorViewer::drawAxisCross(void) SbVec2s view = this->getSoRenderManager()->getSize(); const int pixelarea = int(float(this->axiscrossSize)/100.0f * std::min(view[0], view[1])); -#if 0 // middle of canvas - SbVec2s origin(view[0]/2 - pixelarea/2, view[1]/2 - pixelarea/2); -#endif // middle of canvas -#if 1 // lower right of canvas + SbVec2s origin(view[0] - pixelarea, 0); -#endif // lower right of canvas + glViewport(origin[0], origin[1], pixelarea, pixelarea); // Set up the projection matrix. diff --git a/src/Gui/ViewProviderDocumentObjectGroup.cpp b/src/Gui/ViewProviderDocumentObjectGroup.cpp index d5bb582816..8423e926f9 100644 --- a/src/Gui/ViewProviderDocumentObjectGroup.cpp +++ b/src/Gui/ViewProviderDocumentObjectGroup.cpp @@ -41,9 +41,6 @@ PROPERTY_SOURCE_WITH_EXTENSIONS(Gui::ViewProviderDocumentObjectGroup, Gui::ViewP */ ViewProviderDocumentObjectGroup::ViewProviderDocumentObjectGroup() { -#if 0 - setDefaultMode(SO_SWITCH_ALL); -#endif ViewProviderGroupExtension::initExtension(this); sPixmap = "folder"; diff --git a/src/Gui/ViewProviderLink.cpp b/src/Gui/ViewProviderLink.cpp index 60d2268e78..851c9d8c85 100644 --- a/src/Gui/ViewProviderLink.cpp +++ b/src/Gui/ViewProviderLink.cpp @@ -739,15 +739,7 @@ void ViewProviderLinkObserver::extensionReattach(App::DocumentObject *) { } void ViewProviderLinkObserver::extensionOnChanged(const App::Property *prop) { -#if 0 - auto owner = freecad_dynamic_cast(getExtendedContainer()); - if(!owner || !linkInfo) - return; - if(prop != &owner->Visibility && prop != &owner->DisplayMode) - linkInfo->update(); -#else (void)prop; -#endif } void ViewProviderLinkObserver::extensionModeSwitchChange() { @@ -1053,68 +1045,12 @@ void LinkView::setLinkViewObject(ViewProviderDocumentObject *vpd, } void LinkView::setTransform(SoTransform *pcTransform, const Base::Matrix4D &mat) { -#if 1 double dMtrx[16]; mat.getGLMatrix(dMtrx); pcTransform->setMatrix(SbMatrix(dMtrx[0], dMtrx[1], dMtrx[2], dMtrx[3], dMtrx[4], dMtrx[5], dMtrx[6], dMtrx[7], dMtrx[8], dMtrx[9], dMtrx[10], dMtrx[11], dMtrx[12],dMtrx[13],dMtrx[14], dMtrx[15])); -#else - // extract scale factor from column vector length - double sx = Base::Vector3d(mat[0][0],mat[1][0],mat[2][0]).Sqr(); - double sy = Base::Vector3d(mat[0][1],mat[1][1],mat[2][1]).Sqr(); - double sz = Base::Vector3d(mat[0][2],mat[1][2],mat[2][2]).Sqr(); - bool bx,by,bz; - if((bx=fabs(sx-1.0)>=1e-10)) - sx = sqrt(sx); - else - sx = 1.0; - if((by=fabs(sy-1.0)>=1e-10)) - sy = sqrt(sy); - else - sy = 1.0; - if((bz=fabs(sz-1.0)>=1e-10)) - sz = sqrt(sz); - else - sz = 1.0; - // TODO: how to deal with negative scale? - pcTransform->scaleFactor.setValue(sx,sy,sz); - - Base::Matrix4D matRotate; - if(bx) { - matRotate[0][0] = mat[0][0]/sx; - matRotate[1][0] = mat[1][0]/sx; - matRotate[2][0] = mat[2][0]/sx; - }else{ - matRotate[0][0] = mat[0][0]; - matRotate[1][0] = mat[1][0]; - matRotate[2][0] = mat[2][0]; - } - if(by) { - matRotate[0][1] = mat[0][1]/sy; - matRotate[1][1] = mat[1][1]/sy; - matRotate[2][1] = mat[2][1]/sy; - }else{ - matRotate[0][1] = mat[0][1]; - matRotate[1][1] = mat[1][1]; - matRotate[2][1] = mat[2][1]; - } - if(bz) { - matRotate[0][2] = mat[0][2]/sz; - matRotate[1][2] = mat[1][2]/sz; - matRotate[2][2] = mat[2][2]/sz; - }else{ - matRotate[0][2] = mat[0][2]; - matRotate[1][2] = mat[1][2]; - matRotate[2][2] = mat[2][2]; - } - - Base::Rotation rot(matRotate); - pcTransform->rotation.setValue(rot[0],rot[1],rot[2],rot[3]); - pcTransform->translation.setValue(mat[0][3],mat[1][3],mat[2][3]); - pcTransform->center.setValue(0.0f,0.0f,0.0f); -#endif } void LinkView::setSize(int _size) { diff --git a/src/Gui/ViewProviderPyImp.cpp b/src/Gui/ViewProviderPyImp.cpp index ce00d8b3f6..6e8126f3d5 100644 --- a/src/Gui/ViewProviderPyImp.cpp +++ b/src/Gui/ViewProviderPyImp.cpp @@ -641,19 +641,11 @@ Py::String ViewProviderPy::getIV() const Py::Object ViewProviderPy::getIcon() const { -#if 0 - QByteArray ba; - QDataStream str(&ba, QIODevice::WriteOnly); - QIcon icon = getViewProviderPtr()->getIcon(); - str << icon; - return Py::String(ba.constData(), ba.size()); -#else PythonWrapper wrap; wrap.loadGuiModule(); wrap.loadWidgetsModule(); QIcon icon = getViewProviderPtr()->getIcon(); return wrap.fromQIcon(new QIcon(icon)); -#endif } Py::Int ViewProviderPy::getDefaultMode() const diff --git a/src/Gui/ViewProviderPythonFeature.cpp b/src/Gui/ViewProviderPythonFeature.cpp index e7251ba741..bbdcddbde3 100644 --- a/src/Gui/ViewProviderPythonFeature.cpp +++ b/src/Gui/ViewProviderPythonFeature.cpp @@ -52,219 +52,6 @@ FC_LOG_LEVEL_INIT("ViewProviderPythonFeature", true, true) using namespace Gui; namespace bp = boost::placeholders; -// #0003564: Python objects: updateData calls to proxy instance that should have been deleted -// See https://forum.freecadweb.org/viewtopic.php?f=22&t=30429&p=252429#p252429 -#if 0 -namespace Gui { - -struct ProxyInfo { - Py::Object viewObject; - Py::Object proxy; - - ~ProxyInfo() { - Base::PyGILStateLocker lock; - viewObject = Py::Object(); - proxy = Py::Object(); - } -}; - -class PropertyEvent : public QEvent -{ -public: - PropertyEvent(const Gui::ViewProviderDocumentObject* vp, const ProxyInfo &info) - : QEvent(QEvent::Type(QEvent::User)), view(vp), info(info) - { - } - - const Gui::ViewProviderDocumentObject* view; - ProxyInfo info; -}; - -class ViewProviderPythonFeatureObserver : public QObject -{ -public: - /// The one and only instance. - static ViewProviderPythonFeatureObserver* instance(); - /// Destructs the sole instance. - static void destruct (); - void slotAppendObject(const Gui::ViewProvider&); - void slotDeleteObject(const Gui::ViewProvider&); - void slotDeleteDocument(const Gui::Document&); - -private: - void customEvent(QEvent* e) - { - PropertyEvent* pe = static_cast(e); - std::set::iterator it = viewMap.find(pe->view); - // Make sure that the object hasn't been deleted in the meantime (#0001522) - if (it != viewMap.end()) { - viewMap.erase(it); - - // We check below the python object of the view provider to make - // sure that the view provider is actually the owner of the proxy - // object we cached before. This step is necessary to prevent a - // very obscure bug described here. - // - // The proxy caching is only effective when an object is deleted in - // an event of undo, and we restore the proxy in the event of redo. - // The object is not really freed while inside undo/redo stack. It - // gets really deleted from memory when either the user clears the - // undo/redo stack manually, or the redo stack gets automatically - // cleared when new transaction is created. FC has no explicit - // signaling of when the object is really deleted from the memory. - // This ViewProviderPythonFeatureObserver uses a heuristic to - // decide when to flush the cache in slotAppendObject(), that is, - // it sees any cache miss event as the signaling of an redo clear. - // The bug happens in the very rare event, when the redo stack is - // cleared when new transaction is added, and the freed object's - // memory gets immediately reused by c++ allocator for the new - // object created in the new transaction. This creates a cache - // false hit event, where the old deleted view provider's proxy - // gets mistakenly assigned to the newly created object, which - // happens to have the exact same memory location. This situation - // is very rare and really depends on the system's allocator - // implementation. However, tests show that it happens regularly - // in Linux debug build. To prevent this, we use the trick of - // checking the python object pointer of the view provider to make - // sure the view provider are in fact the same. We hold the python - // object reference count, so it never gets freed and reused like - // its owner view provider. - // - // Side note: the original implementation uses property copy and - // paste to store the proxy object, which is fine, but has the - // trouble of having to manually freed the copied property. And the - // original implementation didn't do that in every case, causing - // memory leak. We now simply stores the python object with - // reference counting, so no need to worry about deleting - - Py::Object viewObject(const_cast(pe->view)->getPyObject(),true); - if(viewObject.ptr() != pe->info.viewObject.ptr()) { - if(FC_LOG_INSTANCE.isEnabled(FC_LOGLEVEL_LOG)) - FC_WARN("invalid proxy cache " << viewObject.ptr() << ", " << - pe->info.viewObject.ptr() << ", " << pe->info.proxy.ptr()); - }else{ - App::Property* prop = pe->view->getPropertyByName("Proxy"); - if (prop && prop->isDerivedFrom(App::PropertyPythonObject::getClassTypeId())) { - prop->setPyObject(pe->info.proxy.ptr()); - } - } - } - } - static ViewProviderPythonFeatureObserver* _singleton; - - ViewProviderPythonFeatureObserver(); - ~ViewProviderPythonFeatureObserver(); - typedef std::map< - const App::DocumentObject*, - ProxyInfo - > ObjectProxy; - - std::map proxyMap; - std::set viewMap; -}; - -} - -ViewProviderPythonFeatureObserver* ViewProviderPythonFeatureObserver::_singleton = 0; - -ViewProviderPythonFeatureObserver* ViewProviderPythonFeatureObserver::instance() -{ - if (!_singleton) - _singleton = new ViewProviderPythonFeatureObserver; - return _singleton; -} - -void ViewProviderPythonFeatureObserver::destruct () -{ - delete _singleton; - _singleton = 0; -} - -void ViewProviderPythonFeatureObserver::slotDeleteDocument(const Gui::Document& d) -{ - App::Document* doc = d.getDocument(); - std::map::iterator it = proxyMap.find(doc); - if (it != proxyMap.end()) { - Base::PyGILStateLocker lock; - proxyMap.erase(it); - } -} - -void ViewProviderPythonFeatureObserver::slotAppendObject(const Gui::ViewProvider& obj) -{ - if (!obj.isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) - return; - const Gui::ViewProviderDocumentObject& vp = static_cast(obj); - const App::DocumentObject* docobj = vp.getObject(); - App::Document* doc = docobj->getDocument(); - std::map::iterator it = proxyMap.find(doc); - if (it != proxyMap.end()) { - ObjectProxy::iterator jt = it->second.find(docobj); - if (jt != it->second.end()) { - Base::PyGILStateLocker lock; - try { - App::Property* prop = vp.getPropertyByName("Proxy"); - if (prop && prop->isDerivedFrom(App::PropertyPythonObject::getClassTypeId())) { - // make this delayed so that the corresponding item in the tree view is accessible - QApplication::postEvent(this, new PropertyEvent(&vp, jt->second)); - // needed in customEvent() - viewMap.insert(&vp); - it->second.erase(jt); - } - } - catch (Py::Exception& e) { - e.clear(); - } - } - // all cached objects of the documents are already destroyed - else { - it->second.clear(); - } - } -} - -void ViewProviderPythonFeatureObserver::slotDeleteObject(const Gui::ViewProvider& obj) -{ - // check this in customEvent() if the object is still there - std::set::iterator it = viewMap.find(&obj); - if (it != viewMap.end()) - viewMap.erase(it); - if (!obj.isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) - return; - const Gui::ViewProviderDocumentObject& vp = static_cast(obj); - const App::DocumentObject* docobj = vp.getObject(); - App::Document* doc = docobj->getDocument(); - if (!doc->getUndoMode()) - return; // object will be deleted immediately, thus we don't need to store anything - Base::PyGILStateLocker lock; - try { - App::Property* prop = vp.getPropertyByName("Proxy"); - if (prop && prop->isDerivedFrom(App::PropertyPythonObject::getClassTypeId())) { - auto &info = proxyMap[doc][docobj]; - info.viewObject = Py::asObject(const_cast(vp).getPyObject()); - info.proxy = Py::asObject(prop->getPyObject()); - FC_LOG("proxy cache " << info.viewObject.ptr() << ", " << info.proxy.ptr()); - } - } - catch (Py::Exception& e) { - e.clear(); - } -} - -ViewProviderPythonFeatureObserver::ViewProviderPythonFeatureObserver() -{ - Gui::Application::Instance->signalDeletedObject.connect(boost::bind - (&ViewProviderPythonFeatureObserver::slotDeleteObject, this, bp::_1)); - Gui::Application::Instance->signalNewObject.connect(boost::bind - (&ViewProviderPythonFeatureObserver::slotAppendObject, this, bp::_1)); - Gui::Application::Instance->signalDeleteDocument.connect(boost::bind - (&ViewProviderPythonFeatureObserver::slotDeleteDocument, this, bp::_1)); -} - -ViewProviderPythonFeatureObserver::~ViewProviderPythonFeatureObserver() -{ -} -#endif // ---------------------------------------------------------------------------- @@ -272,9 +59,6 @@ ViewProviderPythonFeatureImp::ViewProviderPythonFeatureImp( ViewProviderDocumentObject* vp, App::PropertyPythonObject &proxy) : object(vp), Proxy(proxy), has__object__(false) { -#if 0 - (void)ViewProviderPythonFeatureObserver::instance(); -#endif } ViewProviderPythonFeatureImp::~ViewProviderPythonFeatureImp() @@ -307,9 +91,6 @@ QIcon ViewProviderPythonFeatureImp::getIcon() const { _FC_PY_CALL_CHECK(getIcon,return(QIcon())); - // default icon - //static QPixmap px = BitmapFactory().pixmap("Tree_Python"); - // Run the getIcon method of the proxy object. Base::PyGILStateLocker lock; try { @@ -366,7 +147,6 @@ QIcon ViewProviderPythonFeatureImp::getIcon() const e.ReportException(); } } - return QIcon(); } @@ -966,8 +746,6 @@ bool ViewProviderPythonFeatureImp::getDefaultDisplayMode(std::string &mode) cons Base::PyGILStateLocker lock; try { Py::String str(Base::pyCall(py_getDefaultDisplayMode.ptr())); - //if (str.isUnicode()) - // str = str.encode("ascii"); // json converts strings into unicode mode = str.as_std_string("ascii"); return true; } diff --git a/src/Gui/Widgets.cpp b/src/Gui/Widgets.cpp index aedf846d95..7534ee1156 100644 --- a/src/Gui/Widgets.cpp +++ b/src/Gui/Widgets.cpp @@ -652,10 +652,8 @@ ColorButton::ColorButton(QWidget* parent) d->col = palette().color(QPalette::Active,QPalette::Midlight); connect(this, SIGNAL(clicked()), SLOT(onChooseColor())); -#if 1 int e = style()->pixelMetric(QStyle::PM_ButtonIconSize); setIconSize(QSize(2*e, e)); -#endif } /** @@ -744,36 +742,6 @@ bool ColorButton::autoChangeColor() const */ void ColorButton::paintEvent (QPaintEvent * e) { -#if 0 - // first paint the complete button - QPushButton::paintEvent(e); - - // repaint the rectangle area - QPalette::ColorGroup group = isEnabled() ? hasFocus() ? QPalette::Active : QPalette::Inactive : QPalette::Disabled; - QColor pen = palette().color(group,QPalette::ButtonText); - { - QPainter paint(this); - paint.setPen(pen); - - if (d->drawFrame) { - paint.setBrush(QBrush(d->col)); - paint.drawRect(5, 5, width()-10, height()-10); - } - else { - paint.fillRect(5, 5, width()-10, height()-10, QBrush(d->col)); - } - } - - // overpaint the rectangle to paint icon and text - QStyleOptionButton opt; - opt.init(this); - opt.text = text(); - opt.icon = icon(); - opt.iconSize = iconSize(); - - QStylePainter p(this); - p.drawControl(QStyle::CE_PushButtonLabel, opt); -#else if (d->dirty) { QSize isize = iconSize(); QPixmap pix(isize); @@ -797,7 +765,6 @@ void ColorButton::paintEvent (QPaintEvent * e) } QPushButton::paintEvent(e); -#endif } /** @@ -1222,7 +1189,6 @@ bool ToolTip::eventFilter(QObject* o, QEvent*e) StatusWidget::StatusWidget(QWidget* parent) : QDialog(parent, Qt::Dialog | Qt::FramelessWindowHint) { - //setWindowModality(Qt::ApplicationModal); label = new QLabel(this); label->setAlignment(Qt::AlignCenter); diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp index b59f9d4cb3..fc390fb13b 100644 --- a/src/Gui/Workbench.cpp +++ b/src/Gui/Workbench.cpp @@ -511,55 +511,6 @@ std::list Workbench::listCommandbars() const return bars; } -// -------------------------------------------------------------------- - -#if 0 // needed for Qt's lupdate utility - qApp->translate("CommandGroup", "File"); - qApp->translate("CommandGroup", "Edit"); - qApp->translate("CommandGroup", "Help"); - qApp->translate("CommandGroup", "Link"); - qApp->translate("CommandGroup", "Tools"); - qApp->translate("CommandGroup", "View"); - qApp->translate("CommandGroup", "Window"); - qApp->translate("CommandGroup", "Standard"); - qApp->translate("CommandGroup", "Macros"); - qApp->translate("CommandGroup", "Macro"); - qApp->translate("CommandGroup", "Structure"); - qApp->translate("CommandGroup", "Standard-Test"); - qApp->translate("CommandGroup", "Standard-View"); - qApp->translate("CommandGroup", "TreeView"); - qApp->translate("CommandGroup", "Measure"); - - qApp->translate("Workbench", "&File"); - qApp->translate("Workbench", "&Edit"); - qApp->translate("Workbench", "Standard views"); - qApp->translate("Workbench", "Axonometric"); - qApp->translate("Workbench", "&Stereo"); - qApp->translate("Workbench", "&Zoom"); - qApp->translate("Workbench", "Visibility"); - qApp->translate("Workbench", "&View"); - qApp->translate("Workbench", "&Tools"); - qApp->translate("Workbench", "&Macro"); - qApp->translate("Workbench", "&Windows"); - qApp->translate("Workbench", "&On-line help"); - qApp->translate("Workbench", "&Help"); - qApp->translate("Workbench", "File"); - qApp->translate("Workbench", "Macro"); - qApp->translate("Workbench", "View"); - qApp->translate("Workbench", "Special Ops"); - // needed for Structure toolbar - qApp->translate("Workbench", "Link actions"); -#endif - -#if 0 // needed for the application menu on OSX - qApp->translate("MAC_APPLICATION_MENU", "Services"); - qApp->translate("MAC_APPLICATION_MENU", "Hide %1"); - qApp->translate("MAC_APPLICATION_MENU", "Hide Others"); - qApp->translate("MAC_APPLICATION_MENU", "Show All"); - qApp->translate("MAC_APPLICATION_MENU", "Preferences..."); - qApp->translate("MAC_APPLICATION_MENU", "Quit %1"); - qApp->translate("MAC_APPLICATION_MENU", "About %1"); -#endif TYPESYSTEM_SOURCE(Gui::StdWorkbench, Gui::Workbench) diff --git a/src/Gui/propertyeditor/PropertyItemDelegate.cpp b/src/Gui/propertyeditor/PropertyItemDelegate.cpp index f0288c3972..527d15a78a 100644 --- a/src/Gui/propertyeditor/PropertyItemDelegate.cpp +++ b/src/Gui/propertyeditor/PropertyItemDelegate.cpp @@ -132,36 +132,7 @@ bool PropertyItemDelegate::eventFilter(QObject *o, QEvent *ev) if (widget && parentEditor && parentEditor->activeEditor && widget != parentEditor->activeEditor) { -#if 1 - // All the attempts to ignore the focus-out event has been approved to not work - // reliably because there are still cases that cannot be handled. - // So, the best for now is to always ignore this event. - // See https://forum.freecadweb.org/viewtopic.php?p=579530#p579530 why this is not - // possible. return false; -#else - // We event filter child QAbstractButton and QLabel of an editor, - // which requires special focus change in order to not mess up with - // QItemDelegate's logic. - QWidget *w = QApplication::focusWidget(); - // For some reason, Qt (5.15) on Windows will remove current focus - // before bringing up a modal dialog. - if (!w) - return false; - while (w) { // don't worry about focus changes internally in the editor - if (w == widget || w == parentEditor->activeEditor) - return false; - - // ignore focus change to 3D view or tree view, because, for - // example DlgPropertyLink is implemented as modeless dialog - // to allow selection in 3D and tree view. - if (qobject_cast(w)) - return false; - if (qobject_cast(w)) - return false; - w = w->parentWidget(); - } -#endif } } return QItemDelegate::eventFilter(o, ev); diff --git a/src/Gui/propertyeditor/PropertyModel.cpp b/src/Gui/propertyeditor/PropertyModel.cpp index 1b6e837b04..8db3a650f7 100644 --- a/src/Gui/propertyeditor/PropertyModel.cpp +++ b/src/Gui/propertyeditor/PropertyModel.cpp @@ -35,8 +35,6 @@ using namespace Gui; using namespace Gui::PropertyEditor; -/* TRANSLATOR Gui::PropertyEditor::PropertyModel */ - PropertyModel::PropertyModel(QObject* parent) : QAbstractItemModel(parent) { @@ -493,15 +491,6 @@ void PropertyModel::updateChildren(PropertyItem* item, int column, const QModelI QModelIndex topLeft = this->index(0, column, parent); QModelIndex bottomRight = this->index(numChild, column, parent); Q_EMIT dataChanged(topLeft, bottomRight); -#if 0 // It seems we don't have to inform grand children - for (int row=0; rowchild(row); - QModelIndex data = this->index(row, column, parent); - if (data.isValid()) { - updateChildren(child, column, data); - } - } -#endif } } diff --git a/src/Gui/resource.cpp b/src/Gui/resource.cpp index 45bdb4bb2e..ac2b8ae313 100644 --- a/src/Gui/resource.cpp +++ b/src/Gui/resource.cpp @@ -40,7 +40,6 @@ #include "DlgSettingsMacroImp.h" #include "DlgSettingsUnitsImp.h" #include "DlgSettingsDocumentImp.h" -//#include "DlgOnlineHelpImp.h" #include "DlgReportViewImp.h" #include "DlgSettingsLazyLoadedImp.h" @@ -68,7 +67,6 @@ WidgetFactorySupplier::WidgetFactorySupplier() // // new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","General") ); - //new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","General") ); new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","General") ); new PrefPageProducer ( QT_TRANSLATE_NOOP("QObject","General") ); new PrefPageProducer( QT_TRANSLATE_NOOP("QObject","General") ); @@ -89,7 +87,6 @@ WidgetFactorySupplier::WidgetFactorySupplier() new CustomPageProducer; new CustomPageProducer; new CustomPageProducer; - //new CustomPageProducer; new CustomPageProducer; new CustomPageProducer; new CustomPageProducer;