PartDesign Gui: Extend ViewProvider with Part::ViewProviderAttachExtension
This commit is contained in:
@@ -49,11 +49,12 @@
|
||||
|
||||
using namespace PartDesignGui;
|
||||
|
||||
PROPERTY_SOURCE(PartDesignGui::ViewProvider, PartGui::ViewProviderPart)
|
||||
PROPERTY_SOURCE_WITH_EXTENSIONS(PartDesignGui::ViewProvider, PartGui::ViewProviderPart)
|
||||
|
||||
ViewProvider::ViewProvider()
|
||||
:oldWb(""), oldTip(NULL), isSetTipIcon(false)
|
||||
{
|
||||
PartGui::ViewProviderAttachExtension::initExtension(this);
|
||||
}
|
||||
|
||||
ViewProvider::~ViewProvider()
|
||||
@@ -244,11 +245,11 @@ QIcon ViewProvider::mergeOverlayIcons (const QIcon & orig) const
|
||||
"...###..."};
|
||||
px = QPixmap(feature_tip_xpm);
|
||||
|
||||
mergedicon = mergePixmap(mergedicon, px, Gui::BitmapFactoryInst::BottomRight);
|
||||
mergedicon = Gui::BitmapFactoryInst::mergePixmap(mergedicon, px, Gui::BitmapFactoryInst::BottomRight);
|
||||
|
||||
}
|
||||
|
||||
return mergedicon;
|
||||
return Gui::ViewProvider::mergeOverlayIcons(mergedicon);
|
||||
}
|
||||
|
||||
bool ViewProvider::onDelete(const std::vector<std::string> &)
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "ViewProviderBody.h"
|
||||
#include <Gui/ViewProviderPythonFeature.h>
|
||||
|
||||
#include <Mod/Part/Gui/ViewProviderAttachExtension.h>
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
@@ -36,9 +37,10 @@ class TaskDlgFeatureParameters;
|
||||
/**
|
||||
* A common base class for all part design features view providers
|
||||
*/
|
||||
class PartDesignGuiExport ViewProvider : public PartGui::ViewProviderPart {
|
||||
class PartDesignGuiExport ViewProvider : public PartGui::ViewProviderPart, PartGui::ViewProviderAttachExtension
|
||||
{
|
||||
typedef PartGui::ViewProviderPart inherited;
|
||||
PROPERTY_HEADER(PartDesignGui::ViewProvider);
|
||||
PROPERTY_HEADER_WITH_EXTENSIONS(PartDesignGui::ViewProvider);
|
||||
|
||||
public:
|
||||
/// constructor
|
||||
|
||||
@@ -51,8 +51,8 @@ const char* PartDesignGui::ViewProviderBoolean::DisplayEnum[] = {"Result","Tools
|
||||
ViewProviderBoolean::ViewProviderBoolean()
|
||||
{
|
||||
sPixmap = "PartDesign_Boolean.svg";
|
||||
initExtension(this);
|
||||
|
||||
Gui::ViewProviderGeoFeatureGroupExtension::initExtension(this);
|
||||
|
||||
ADD_PROPERTY(Display,((long)0));
|
||||
Display.setEnums(DisplayEnum);
|
||||
}
|
||||
@@ -128,22 +128,22 @@ bool ViewProviderBoolean::onDelete(const std::vector<std::string> &s)
|
||||
|
||||
void ViewProviderBoolean::attach(App::DocumentObject* obj) {
|
||||
PartGui::ViewProviderPartExt::attach(obj);
|
||||
|
||||
|
||||
//set default display mode to override the "Group" display mode
|
||||
setDisplayMode("Flat Lines");
|
||||
}
|
||||
|
||||
void ViewProviderBoolean::onChanged(const App::Property* prop) {
|
||||
|
||||
|
||||
PartDesignGui::ViewProvider::onChanged(prop);
|
||||
|
||||
|
||||
if(prop == &Display) {
|
||||
|
||||
|
||||
if(Display.getValue() == 0) {
|
||||
auto vp = getBodyViewProvider();
|
||||
if(vp)
|
||||
setDisplayMode(vp->DisplayMode.getValueAsString());
|
||||
else
|
||||
else
|
||||
setDisplayMode("Flat Lines");
|
||||
} else {
|
||||
setDisplayMode("Group");
|
||||
|
||||
Reference in New Issue
Block a user