DrawHatch derives from DocumentObject

Remove Face selected box
Add Face# to Hatch Label
This commit is contained in:
WandererFan 2016-06-13 09:44:42 -04:00 committed by wmayer
parent efe10e0fb9
commit ba71e074ce
5 changed files with 10 additions and 10 deletions

View File

@ -45,7 +45,7 @@
using namespace TechDraw; using namespace TechDraw;
using namespace std; using namespace std;
PROPERTY_SOURCE(TechDraw::DrawHatch, TechDraw::DrawView) PROPERTY_SOURCE(TechDraw::DrawHatch, App::DocumentObject)
DrawHatch::DrawHatch(void) DrawHatch::DrawHatch(void)
@ -83,10 +83,6 @@ void DrawHatch::onChanged(const App::Property* prop)
prop == &HatchColor) { prop == &HatchColor) {
if (!isRestoring()) { if (!isRestoring()) {
DrawHatch::execute(); DrawHatch::execute();
if (getSourceView()) {
getSourceView()->touch();
getSourceView()->recompute();
}
} }
} }
App::DocumentObject::onChanged(prop); App::DocumentObject::onChanged(prop);
@ -98,6 +94,7 @@ App::DocumentObjectExecReturn *DrawHatch::execute(void)
DrawViewPart* parent = getSourceView(); DrawViewPart* parent = getSourceView();
if (parent) { if (parent) {
parent->touch(); parent->touch();
parent->recompute();
} }
return App::DocumentObject::StdReturn; return App::DocumentObject::StdReturn;
} }

View File

@ -34,7 +34,7 @@
namespace TechDraw namespace TechDraw
{ {
class TechDrawExport DrawHatch : public TechDraw::DrawView class TechDrawExport DrawHatch : public App::DocumentObject
{ {
PROPERTY_HEADER(TechDraw::DrawHatch); PROPERTY_HEADER(TechDraw::DrawHatch);

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd"> <GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport <PythonExport
Father="DrawViewPy" Father="DocumentObjectPy"
Name="DrawHatchPy" Name="DrawHatchPy"
Twin="DrawHatch" Twin="DrawHatch"
TwinPointer="DrawHatch" TwinPointer="DrawHatch"
Include="Mod/TechDraw/App/DrawHatch.h" Include="Mod/TechDraw/App/DrawHatch.h"
Namespace="TechDraw" Namespace="TechDraw"
FatherInclude="Mod/TechDraw/App/DrawViewPy.h" FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="TechDraw"> FatherNamespace="App">
<Documentation> <Documentation>
<Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" /> <Author Licence="LGPL" Name="WandererFan" EMail="wandererfan@gmail.com" />
<UserDocu>Feature for creating and manipulating Technical Drawing Hatch areas</UserDocu> <UserDocu>Feature for creating and manipulating Technical Drawing Hatch areas</UserDocu>

View File

@ -136,9 +136,12 @@ void CmdTechDrawNewHatch::activated(int iMsg)
TechDraw::DrawHatch *hatch = 0; TechDraw::DrawHatch *hatch = 0;
std::string FeatName = getUniqueObjectName("Hatch"); std::string FeatName = getUniqueObjectName("Hatch");
std::stringstream featLabel;
featLabel << FeatName << "F" << TechDraw::DrawUtil::getIndexFromName(subNames.at(0));
openCommand("Create Hatch"); openCommand("Create Hatch");
doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawHatch','%s')",FeatName.c_str()); doCommand(Doc,"App.activeDocument().addObject('TechDraw::DrawHatch','%s')",FeatName.c_str());
doCommand(Doc,"App.activeDocument().%s.Label = '%s'",FeatName.c_str(),featLabel.str().c_str());
hatch = dynamic_cast<TechDraw::DrawHatch *>(getDocument()->getObject(FeatName.c_str())); hatch = dynamic_cast<TechDraw::DrawHatch *>(getDocument()->getObject(FeatName.c_str()));
hatch->Source.setValue(objFeat, subNames); hatch->Source.setValue(objFeat, subNames);

View File

@ -184,7 +184,7 @@ QPainterPath QGIFace::shape() const
void QGIFace::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) { void QGIFace::paint ( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget) {
QStyleOptionGraphicsItem myOption(*option); QStyleOptionGraphicsItem myOption(*option);
//myOption.state &= ~QStyle::State_Selected; myOption.state &= ~QStyle::State_Selected;
m_pen.setColor(m_colCurrent); m_pen.setColor(m_colCurrent);
setPen(m_pen); setPen(m_pen);