[TD]format RichAnno frame
This commit is contained in:
@@ -277,10 +277,25 @@ void QGIRichAnno::paint ( QPainter * painter, const QStyleOptionGraphicsItem * o
|
||||
|
||||
QPen QGIRichAnno::rectPen() const
|
||||
{
|
||||
QPen pen(Qt::SolidLine);
|
||||
pen.setWidthF(1.0);
|
||||
QPen pen;
|
||||
const auto sym( dynamic_cast<TechDraw::DrawRichAnno*>(getViewObject()) );
|
||||
if( sym == nullptr ) {
|
||||
return pen;
|
||||
}
|
||||
auto vp = static_cast<ViewProviderRichAnno*>(getViewProvider(getViewObject()));
|
||||
if ( vp == nullptr ) {
|
||||
return pen;
|
||||
}
|
||||
|
||||
double rectWeight = Rez::guiX(vp->LineWidth.getValue());
|
||||
Qt::PenStyle rectStyle = (Qt::PenStyle) vp->LineStyle.getValue();
|
||||
App::Color temp = vp->LineColor.getValue();
|
||||
QColor rectColor = temp.asValue<QColor>();
|
||||
|
||||
pen = QPen(rectStyle);
|
||||
pen.setWidthF(rectWeight);
|
||||
pen.setColor(rectColor);
|
||||
return pen;
|
||||
}
|
||||
|
||||
|
||||
#include <Mod/TechDraw/Gui/moc_QGIRichAnno.cpp>
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <Gui/ViewProviderDocumentObject.h>
|
||||
|
||||
#include <Mod/TechDraw/App/DrawRichAnno.h>
|
||||
#include <Mod/TechDraw/App/LineGroup.h>
|
||||
|
||||
#include "MDIViewPage.h"
|
||||
#include "QGVPage.h"
|
||||
@@ -65,6 +66,11 @@ ViewProviderRichAnno::ViewProviderRichAnno()
|
||||
{
|
||||
sPixmap = "actions/techdraw-RichTextAnnotation";
|
||||
|
||||
static const char *group = "Frame Format";
|
||||
|
||||
ADD_PROPERTY_TYPE(LineWidth,(getDefLineWeight()), group,(App::PropertyType)(App::Prop_None),"Frame line weight");
|
||||
ADD_PROPERTY_TYPE(LineStyle,(1), group,(App::PropertyType)(App::Prop_None),"Frame line style");
|
||||
ADD_PROPERTY_TYPE(LineColor,(getDefLineColor()),group,App::Prop_None,"The color of the frame");
|
||||
}
|
||||
|
||||
ViewProviderRichAnno::~ViewProviderRichAnno()
|
||||
@@ -155,3 +161,18 @@ double ViewProviderRichAnno::getDefFontSize()
|
||||
double fontSize = hGrp->GetFloat("FontSize", 5.0);
|
||||
return fontSize;
|
||||
}
|
||||
|
||||
double ViewProviderRichAnno::getDefLineWeight(void)
|
||||
{
|
||||
double result = 0.0;
|
||||
Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
|
||||
GetGroup("BaseApp")->GetGroup("Preferences")->
|
||||
GetGroup("Mod/TechDraw/Decorations");
|
||||
std::string lgName = hGrp->GetASCII("LineGroup","FC 0.70mm");
|
||||
auto lg = TechDraw::LineGroup::lineGroupFactory(lgName);
|
||||
result = lg->getWeight("Graphics");
|
||||
delete lg;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
/// destructor
|
||||
virtual ~ViewProviderRichAnno();
|
||||
|
||||
App::PropertyFloat LineWidth;
|
||||
App::PropertyInteger LineStyle;
|
||||
App::PropertyColor LineColor;
|
||||
|
||||
virtual void attach(App::DocumentObject *);
|
||||
virtual bool useNewSelectionModel(void) const {return false;}
|
||||
@@ -63,6 +66,8 @@ protected:
|
||||
App::Color getDefLineColor(void);
|
||||
std::string getDefFont(void);
|
||||
double getDefFontSize(void);
|
||||
double getDefLineWeight(void);
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user