Merge branch 'master' into master

This commit is contained in:
Gauthier Brière
2020-03-30 20:08:31 +02:00
committed by GitHub
20 changed files with 1471 additions and 1346 deletions

View File

@@ -91,7 +91,7 @@ def export(
femnodes_mesh = obj.FemMesh.Nodes
femelement_table = meshtools.get_femelement_table(obj.FemMesh)
z88_element_type = get_z88_element_type(obj.FemMesh, femelement_table)
f = pyopen(filename, "wb")
f = pyopen(filename, "w")
write_z88_mesh_to_file(femnodes_mesh, femelement_table, z88_element_type, f)
f.close()

View File

@@ -49,8 +49,17 @@ DrawTile::DrawTile(void)
ADD_PROPERTY_TYPE(TileParent,(0),group,(App::PropertyType)(App::Prop_None),
"Object to which this tile is attached");
ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent");
ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent");
ADD_PROPERTY_TYPE(TileRow, (0), group, App::Prop_None, "Row in parent object\n 0 for arrow side, -1 for other side");
ADD_PROPERTY_TYPE(TileColumn, (0), group, App::Prop_None, "Column in parent object");
// there is currently only one column, this don't allow to edit
TileColumn.setStatus(App::Property::ReadOnly, true);
// the row can only have the value 0 or -1
// allow its editing because this way the tiles can be flipped
TileRowConstraints.LowerBound = -1;
TileRowConstraints.UpperBound = 0;
TileRowConstraints.StepSize = 1;
TileRow.setConstraints(&TileRowConstraints);
}
DrawTile::~DrawTile()
@@ -77,6 +86,18 @@ App::DocumentObjectExecReturn *DrawTile::execute(void)
return DocumentObject::execute();
}
void DrawTile::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
// transforms properties that had been changed
{
// property TileRow had App::PropertyInteger and was changed to App::PropertyIntegerConstraint
if (prop == &TileRow && strcmp(TypeName, "App::PropertyInteger") == 0) {
App::PropertyInteger TileRowProperty;
// restore the PropertyInteger to be able to set its value
TileRowProperty.Restore(reader);
TileRow.setValue(TileRowProperty.getValue());
}
}
DrawView* DrawTile::getParent(void) const
{
// Base::Console().Message("DT::getParent() - %s\n", getNameInDocument());

View File

@@ -40,9 +40,9 @@ public:
virtual ~DrawTile();
App::PropertyLink TileParent; //eg DrawWeldSymbol
App::PropertyInteger TileRow;
App::PropertyIntegerConstraint TileRow;
App::PropertyIntegerConstraint::Constraints TileRowConstraints;
App::PropertyInteger TileColumn;
/* App::PropertyVector TileOrigin; //sb call to TileParent - WeldingSymbol*/
virtual short mustExecute() const;
virtual App::DocumentObjectExecReturn *execute(void);
@@ -55,6 +55,7 @@ public:
protected:
virtual void onChanged(const App::Property* prop);
virtual void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property * prop);
private:
};

View File

@@ -53,18 +53,17 @@ DrawTileWeld::DrawTileWeld(void)
static const char *group = "TileWeld";
ADD_PROPERTY_TYPE(LeftText,(""),group,(App::PropertyType)(App::Prop_None),
"Text LHS");
ADD_PROPERTY_TYPE(RightText, (0), group, App::Prop_None, "Text RHS");
ADD_PROPERTY_TYPE(CenterText, (0), group, App::Prop_None, "Text above Symbol");
ADD_PROPERTY_TYPE(SymbolFile, (prefSymbol()), group, App::Prop_None, "Symbol Symbol File");
ADD_PROPERTY_TYPE(SymbolIncluded, (""), group,App::Prop_None,
"Text before symbol");
ADD_PROPERTY_TYPE(RightText, (0), group, App::Prop_None, "Text after symbol");
ADD_PROPERTY_TYPE(CenterText, (0), group, App::Prop_None, "Text above/below symbol");
ADD_PROPERTY_TYPE(SymbolFile, (prefSymbol()), group, App::Prop_None, "Symbol File");
ADD_PROPERTY_TYPE(SymbolIncluded, (""), group, App::Prop_None,
"Embedded Symbol. System use only."); // n/a to end users
// SymbolFile.setStatus(App::Property::ReadOnly,true);
std::string svgFilter("Symbol files (*.svg *.SVG);;All files (*)");
SymbolFile.setFilter(svgFilter);
}
DrawTileWeld::~DrawTileWeld()

View File

@@ -116,6 +116,9 @@ void DrawView::checkScale(void)
void DrawView::onChanged(const App::Property* prop)
{
//Coding note: calling execute, recompute or recomputeFeature inside an onChanged
//method can create infinite loops. In general don't do this! There may be
//situations where it is OK, but careful analysis is a must.
if (!isRestoring()) {
if (prop == &ScaleType) {
auto page = findParentPage();
@@ -144,14 +147,9 @@ void DrawView::onChanged(const App::Property* prop)
handleXYLock();
LockPosition.purgeTouched();
}
if ((prop == &Caption) ||
(prop == &Label)) {
requestPaint();
} // rotation and scaling requires recompute
else if ((prop == &Rotation) ||
(prop == &Scale) ||
(prop == &ScaleType)) {
recompute();
if ((prop == &Caption) ||
(prop == &Label)) {
requestPaint();
}
}
App::DocumentObject::onChanged(prop);

View File

@@ -9,8 +9,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>420</width>
<height>160</height>
<width>340</width>
<height>90</height>
</rect>
</property>
<property name="windowTitle">
@@ -19,68 +19,46 @@
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblMsg">
<property name="text">
<string>Text Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblName">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Value:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leInput"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="bbButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
<property name="centerButtons">
<bool>false</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLabel" name="lblMsg">
<property name="text">
<string>Text Name:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLabel" name="lblName">
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Value:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leInput"/>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="bbButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>

View File

@@ -48,10 +48,6 @@ SymbolChooser::SymbolChooser(QWidget *parent,
m_source(source)
{
ui->setupUi(this);
connect(ui->pbOK, SIGNAL(clicked(bool)),
this, SLOT(onOKClicked(bool)));
connect(ui->pbCancel, SIGNAL(clicked(bool)),
this, SLOT(onCancelClicked(bool)));
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
this, SLOT(onDirectorySelected(const QString&)));
connect(ui->lwSymbols, SIGNAL(itemClicked(QListWidgetItem*)), //double click?
@@ -85,10 +81,9 @@ void SymbolChooser::setUiPrimary()
ui->lwSymbols->setAcceptDrops(false);
}
void SymbolChooser::onOKClicked(bool b)
void SymbolChooser::onOKClicked()
{
Q_UNUSED(b);
// Base::Console().Message("SC::OnOKClicked()\n");
QDialog::accept();
QListWidgetItem* sourceItem = ui->lwSymbols->currentItem();
if (!sourceItem)
return;
@@ -98,15 +93,11 @@ void SymbolChooser::onOKClicked(bool b)
QString::fromUtf8(".svg");
Q_EMIT symbolSelected(m_symbolPath, m_source);
// Base::Console().Message("SC::onOKClicked - symbol; %s\n", qPrintable(m_symbolPath));
accept();
}
void SymbolChooser::onCancelClicked(bool b)
void SymbolChooser::onCancelClicked()
{
Q_UNUSED(b);
// Base::Console().Message("SC::OnCancelCicked()\n");
reject();
QDialog::reject();
}
void SymbolChooser::onItemClicked(QListWidgetItem* item)

View File

@@ -40,8 +40,8 @@ public:
QString source = QString());
public Q_SLOTS:
void onOKClicked(bool b);
void onCancelClicked(bool b);
void onOKClicked();
void onCancelClicked();
void onItemClicked(QListWidgetItem* item);
void onDirectorySelected(const QString& newDir);

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>SymbolChooser</class>
<widget class="QDialog" name="SymbolChooser">
<class>TechDrawGui::SymbolChooser</class>
<widget class="QDialog" name="TechDrawGui::SymbolChooser">
<property name="windowModality">
<enum>Qt::WindowModal</enum>
</property>
@@ -9,108 +9,59 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>394</height>
<width>360</width>
<height>280</height>
</rect>
</property>
<property name="windowTitle">
<string>SymbolChooser</string>
<string>Symbol Chooser</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<widget class="QFrame" name="frame">
<property name="geometry">
<rect>
<x>19</x>
<y>19</y>
<width>361</width>
<height>341</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<property name="lineWidth">
<number>2</number>
</property>
<widget class="QWidget" name="verticalLayoutWidget">
<property name="geometry">
<rect>
<x>9</x>
<y>19</y>
<width>341</width>
<height>191</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="lwSymbols"/>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget">
<property name="geometry">
<rect>
<x>10</x>
<y>220</y>
<width>341</width>
<height>41</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="pbCancel">
<property name="text">
<string>Cancel</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pbOK">
<property name="text">
<string>OK</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="horizontalLayoutWidget_2">
<property name="geometry">
<rect>
<x>10</x>
<y>280</y>
<width>341</width>
<height>35</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QListWidget" name="lwSymbols">
<property name="toolTip">
<string>Select a symbol that should be used</string>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="bbButtons">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
<property name="centerButtons">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Symbol Dir</string>
</property>
</widget>
</item>
<item>
<item row="0" column="1">
<widget class="Gui::FileChooser" name="fcSymbolDir">
<property name="toolTip">
<string>Directory to welding symbols.</string>
</property>
<property name="mode">
<enum>Gui::FileChooser::Directory</enum>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
@@ -120,5 +71,38 @@
</customwidget>
</customwidgets>
<resources/>
<connections/>
<connections>
<connection>
<sender>bbButtons</sender>
<signal>accepted()</signal>
<receiver>TechDrawGui::SymbolChooser</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>179</x>
<y>228</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>139</y>
</hint>
</hints>
</connection>
<connection>
<sender>bbButtons</sender>
<signal>rejected()</signal>
<receiver>TechDrawGui::SymbolChooser</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>179</x>
<y>228</y>
</hint>
<hint type="destinationlabel">
<x>179</x>
<y>139</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -73,11 +73,15 @@ TaskActiveView::TaskActiveView(TechDraw::DrawPage* pageFeat) :
// Base::Console().Message("TAV::TAV() - create mode\n");
if (m_pageFeat == nullptr) {
//should be caught in CMD caller
Base::Console().Error("TaskActiveView - bad parameters. Can not proceed.\n");
Base::Console().Error("TaskActiveView - bad parameters. Can not proceed.\n");
return;
}
ui->setupUi(this);
ui->qsbWidth->setUnit(Base::Unit::Length);
ui->qsbHeight->setUnit(Base::Unit::Length);
ui->qsbBorder->setUnit(Base::Unit::Length);
setUiPrimary();
}

View File

@@ -1,243 +1,284 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskActiveView</class>
<widget class="QWidget" name="TaskActiveView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>317</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>ActiveView to TD View</string>
</property>
<property name="windowIcon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/actions/techdraw-ActiveView.svg</normaloff>:/icons/actions/techdraw-activeview.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="qsbWidth">
<property name="toolTip">
<string>Width of generated view</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="value">
<double>297.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Border</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="qsbBorder">
<property name="toolTip">
<string>Unused area around view</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="cbbg">
<property name="toolTip">
<string>Paint background yes/no</string>
</property>
<property name="text">
<string>Background</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::ColorButton" name="ccBgColor">
<property name="toolTip">
<string>Background color</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Line Width</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="Gui::QuantitySpinBox" name="qsbWeight">
<property name="toolTip">
<string>Width of lines in generated view.</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Render Mode</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QComboBox" name="cbMode">
<property name="toolTip">
<string>Drawing style - see SoRenderManager</string>
</property>
<item>
<property name="text">
<string>AS_IS</string>
</property>
</item>
<item>
<property name="text">
<string>WIREFRAME</string>
</property>
</item>
<item>
<property name="text">
<string>POINTS</string>
</property>
</item>
<item>
<property name="text">
<string>WIREFRAME_OVERLAY</string>
</property>
</item>
<item>
<property name="text">
<string>HIDDEN_LINE</string>
</property>
</item>
<item>
<property name="text">
<string>BOUNDING_BOX</string>
</property>
</item>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="qsbHeight">
<property name="toolTip">
<string>Height of generated view</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="value">
<double>210.000000000000000</double>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::ColorButton</class>
<extends>QPushButton</extends>
<header>Gui/Widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/TechDraw.qrc"/>
</resources>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TaskActiveView</class>
<widget class="QWidget" name="TaskActiveView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>375</width>
<height>176</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle">
<string>ActiveView to TD View</string>
</property>
<property name="windowIcon">
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/actions/techdraw-ActiveView.svg</normaloff>:/icons/actions/techdraw-ActiveView.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Width</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Width of generated view</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="value">
<double>297.000000000000000</double>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Height</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbHeight">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Height of generated view</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="value">
<double>210.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_4">
<property name="text">
<string>Border</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbBorder">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Minimal distance of the object from
the top and left view border</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="cbbg">
<property name="toolTip">
<string>Paint background yes/no</string>
</property>
<property name="text">
<string>Background</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>28</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="2">
<widget class="Gui::ColorButton" name="ccBgColor">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Background color</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Line Width</string>
</property>
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::QuantitySpinBox" name="qsbWeight">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Width of lines in generated view</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>0.500000000000000</double>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Render Mode</string>
</property>
</widget>
</item>
<item row="5" column="2">
<widget class="QComboBox" name="cbMode">
<property name="toolTip">
<string>Drawing style - see SoRenderManager</string>
</property>
<item>
<property name="text">
<string>AS_IS</string>
</property>
</item>
<item>
<property name="text">
<string>WIREFRAME</string>
</property>
</item>
<item>
<property name="text">
<string>POINTS</string>
</property>
</item>
<item>
<property name="text">
<string>WIREFRAME_OVERLAY</string>
</property>
</item>
<item>
<property name="text">
<string>HIDDEN_LINE</string>
</property>
</item>
<item>
<property name="text">
<string>BOUNDING_BOX</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::ColorButton</class>
<extends>QPushButton</extends>
<header>Gui/Widgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/TechDraw.qrc"/>
</resources>
<connections>
<connection>
<sender>cbbg</sender>
<signal>toggled(bool)</signal>
<receiver>ccBgColor</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>49</x>
<y>99</y>
</hint>
<hint type="destinationlabel">
<x>295</x>
<y>99</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@@ -105,11 +105,11 @@ void TaskGeomHatch::updateValues()
QString cText = ui->cbName->currentText();
m_name = cText.toUtf8().constData();
m_hatch->NamePattern.setValue(m_name);
m_scale = ui->sbScale->value();
m_scale = ui->sbScale->value().getValue();
m_hatch->ScalePattern.setValue(m_scale);
m_color.setValue<QColor>(ui->ccColor->color());
m_Vp->ColorPattern.setValue(m_color);
m_weight = ui->sbWeight->value();
m_weight = ui->sbWeight->value().getValue();
m_Vp->WeightPattern.setValue(m_weight);
}
@@ -152,13 +152,13 @@ void TaskGeomHatch::onNameChanged()
void TaskGeomHatch::onScaleChanged()
{
m_hatch->ScalePattern.setValue(ui->sbScale->value());
m_hatch->ScalePattern.setValue(ui->sbScale->value().getValue());
m_source->getDocument()->recompute();
}
void TaskGeomHatch::onLineWeightChanged()
{
m_Vp->WeightPattern.setValue(ui->sbWeight->value());
m_Vp->WeightPattern.setValue(ui->sbWeight->value().getValue());
m_source->getDocument()->recompute();
}

View File

@@ -7,11 +7,11 @@
<x>0</x>
<y>0</y>
<width>385</width>
<height>265</height>
<height>191</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -25,8 +25,8 @@
<property name="windowTitle">
<string>Apply Geometric Hatch to Face</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QGroupBox" name="groupBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
@@ -37,8 +37,8 @@
<property name="title">
<string>Define your pattern</string>
</property>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_3" columnstretch="0,1">
<item row="0" column="1">
<widget class="Gui::FileChooser" name="fcFile">
@@ -62,7 +62,7 @@
</item>
</layout>
</item>
<item row="1" column="0">
<item>
<layout class="QGridLayout" name="gridLayout_2" columnstretch="1,0,1">
<item row="0" column="0">
<widget class="QLabel" name="label_4">
@@ -107,6 +107,12 @@
</item>
<item row="0" column="2">
<widget class="QComboBox" name="cbName">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Name of pattern within file</string>
</property>
@@ -114,26 +120,56 @@
</item>
<item row="3" column="2">
<widget class="Gui::ColorButton" name="ccColor">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Color of pattern lines</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QDoubleSpinBox" name="sbScale">
<widget class="Gui::QuantitySpinBox" name="sbScale">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Enlarges/shrinks the pattern</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QDoubleSpinBox" name="sbWeight">
<widget class="Gui::QuantitySpinBox" name="sbWeight">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Thickness of lines within the pattern</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="singleStep">
<double>0.100000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
@@ -144,19 +180,6 @@
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
@@ -165,6 +188,11 @@
<extends>QWidget</extends>
<header>Gui/FileDialog.h</header>
</customwidget>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
<customwidget>
<class>Gui::ColorButton</class>
<extends>QPushButton</extends>

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>227</width>
<height>180</height>
<height>130</height>
</rect>
</property>
<property name="windowTitle">

View File

@@ -94,19 +94,12 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewPart* base) :
m_saveBaseName = m_base->getNameInDocument();
m_savePageName = m_base->findParentPage()->getNameInDocument();
ui->setupUi(this);
ui->setupUi(this);
connect(ui->pbUp, SIGNAL(clicked(bool)),
this, SLOT(onUpClicked(bool)));
connect(ui->pbDown, SIGNAL(clicked(bool)),
this, SLOT(onDownClicked(bool)));
connect(ui->pbRight, SIGNAL(clicked(bool)),
this, SLOT(onRightClicked(bool)));
connect(ui->pbLeft, SIGNAL(clicked(bool)),
this, SLOT(onLeftClicked(bool)));
connect(ui->pbApply, SIGNAL(clicked(bool)),
this, SLOT(onApplyClicked(bool)));
connect(ui->pbUp, SIGNAL(clicked(bool)), this, SLOT(onUpClicked()));
connect(ui->pbDown, SIGNAL(clicked(bool)), this, SLOT(onDownClicked()));
connect(ui->pbRight, SIGNAL(clicked(bool)), this, SLOT(onRightClicked()));
connect(ui->pbLeft, SIGNAL(clicked(bool)), this, SLOT(onLeftClicked()));
setUiPrimary();
}
@@ -143,16 +136,10 @@ TaskSectionView::TaskSectionView(TechDraw::DrawViewSection* section) :
ui->setupUi(this);
connect(ui->pbUp, SIGNAL(clicked(bool)),
this, SLOT(onUpClicked(bool)));
connect(ui->pbDown, SIGNAL(clicked(bool)),
this, SLOT(onDownClicked(bool)));
connect(ui->pbRight, SIGNAL(clicked(bool)),
this, SLOT(onRightClicked(bool)));
connect(ui->pbLeft, SIGNAL(clicked(bool)),
this, SLOT(onLeftClicked(bool)));
connect(ui->pbApply, SIGNAL(clicked(bool)),
this, SLOT(onApplyClicked(bool)));
connect(ui->pbUp, SIGNAL(clicked(bool)), this, SLOT(onUpClicked()));
connect(ui->pbDown, SIGNAL(clicked(bool)), this, SLOT(onDownClicked()));
connect(ui->pbRight, SIGNAL(clicked(bool)), this, SLOT(onRightClicked()));
connect(ui->pbLeft, SIGNAL(clicked(bool)), this, SLOT(onLeftClicked()));
m_dirName = m_section->SectionDirection.getValueAsString();
saveSectionState();
@@ -167,7 +154,7 @@ TaskSectionView::~TaskSectionView()
void TaskSectionView::setUiPrimary()
{
// Base::Console().Message("TSV::setUiPrimary()\n");
setWindowTitle(QObject::tr("Create SectionView"));
setWindowTitle(QObject::tr("Create Section View"));
std::string temp = m_base->getNameInDocument();
QString qTemp = Base::Tools::fromStdString(temp);
ui->leBaseView->setText(qTemp);
@@ -177,29 +164,54 @@ void TaskSectionView::setUiPrimary()
ui->sbScale->setValue(m_base->getScale());
Base::Vector3d origin = m_base->getOriginalCentroid();
ui->sbOrgX->setUnit(Base::Unit::Length);
ui->sbOrgX->setValue(origin.x);
ui->sbOrgY->setUnit(Base::Unit::Length);
ui->sbOrgY->setValue(origin.y);
ui->sbOrgZ->setUnit(Base::Unit::Length);
ui->sbOrgZ->setValue(origin.z);
// before the user did not select an orientation,
// the section properties cannot be changed
this->setToolTip(QObject::tr("Select at first an orientation"));
enableAll(false);
// now connect and not earlier to avoid premature apply() calls
connect(ui->leSymbol, SIGNAL(textChanged(QString)), this, SLOT(onIdentifierChanged()));
connect(ui->sbScale, SIGNAL(valueChanged(double)), this, SLOT(onScaleChanged()));
connect(ui->sbOrgX, SIGNAL(valueChanged(double)), this, SLOT(onXChanged()));
connect(ui->sbOrgY, SIGNAL(valueChanged(double)), this, SLOT(onYChanged()));
connect(ui->sbOrgZ, SIGNAL(valueChanged(double)), this, SLOT(onZChanged()));
}
void TaskSectionView::setUiEdit()
{
// Base::Console().Message("TSV::setUiEdit()\n");
setWindowTitle(QObject::tr("Edit SectionView"));
setWindowTitle(QObject::tr("Edit Section View"));
std::string temp = m_base->getNameInDocument();
QString qTemp = Base::Tools::fromStdString(temp);
ui->leBaseView->setText(qTemp);
temp = m_section->SectionSymbol.getValue();
qTemp = Base::Tools::fromStdString(temp);
qTemp = Base::Tools::fromStdString(temp);
ui->leSymbol->setText(qTemp);
ui->sbScale->setValue(m_section->getScale());
Base::Vector3d origin = m_section->SectionOrigin.getValue();
ui->sbOrgX->setUnit(Base::Unit::Length);
ui->sbOrgX->setValue(origin.x);
ui->sbOrgY->setUnit(Base::Unit::Length);
ui->sbOrgY->setValue(origin.y);
ui->sbOrgZ->setUnit(Base::Unit::Length);
ui->sbOrgZ->setValue(origin.z);
// connect affter initializing the object values
connect(ui->leSymbol, SIGNAL(textChanged(QString)), this, SLOT(onIdentifierChanged()));
connect(ui->sbScale, SIGNAL(valueChanged(double)), this, SLOT(onScaleChanged()));
connect(ui->sbOrgX, SIGNAL(valueChanged(double)), this, SLOT(onXChanged()));
connect(ui->sbOrgY, SIGNAL(valueChanged(double)), this, SLOT(onYChanged()));
connect(ui->sbOrgZ, SIGNAL(valueChanged(double)), this, SLOT(onZChanged()));
}
//save the start conditions
@@ -231,51 +243,64 @@ void TaskSectionView::restoreSectionState()
}
}
void TaskSectionView::blockButtons(bool b)
{
Q_UNUSED(b);
}
void TaskSectionView::onUpClicked(bool b)
void TaskSectionView::onUpClicked()
{
// Base::Console().Message("TSV::onUpClicked()\n");
Q_UNUSED(b);
checkAll(false);
ui->pbUp->setChecked(true);
applyQuick("Up");
}
void TaskSectionView::onDownClicked(bool b)
void TaskSectionView::onDownClicked()
{
// Base::Console().Message("TSV::onDownClicked()\n");
Q_UNUSED(b);
checkAll(false);
ui->pbDown->setChecked(true);
applyQuick("Down");
}
void TaskSectionView::onLeftClicked(bool b)
void TaskSectionView::onLeftClicked()
{
// Base::Console().Message("TSV::onLeftClicked()\n");
checkAll(false);
ui->pbLeft->setChecked(true);
Q_UNUSED(b);
applyQuick("Left");
}
void TaskSectionView::onRightClicked(bool b)
void TaskSectionView::onRightClicked()
{
// Base::Console().Message("TSV::onRightClicked()\n");
Q_UNUSED(b);
checkAll(false);
ui->pbRight->setChecked(true);
applyQuick("Right");
}
void TaskSectionView::onApplyClicked(bool b)
void TaskSectionView::onIdentifierChanged()
{
checkAll(false);
apply();
}
void TaskSectionView::onScaleChanged()
{
checkAll(false);
apply();
}
void TaskSectionView::onXChanged()
{
checkAll(false);
apply();
}
void TaskSectionView::onYChanged()
{
checkAll(false);
apply();
}
void TaskSectionView::onZChanged()
{
// Base::Console().Message("TSV::onApplyClicked()\n");
Q_UNUSED(b);
checkAll(false);
apply();
}
@@ -288,13 +313,22 @@ void TaskSectionView::checkAll(bool b)
ui->pbLeft->setChecked(b);
}
void TaskSectionView::enableAll(bool b)
{
ui->leSymbol->setEnabled(b);
ui->sbScale->setEnabled(b);
ui->sbOrgX->setEnabled(b);
ui->sbOrgY->setEnabled(b);
ui->sbOrgZ->setEnabled(b);
}
//******************************************************************************
bool TaskSectionView::apply(void)
{
// Base::Console().Message("TSV::apply() - m_dirName: %s\n", m_dirName.c_str());
if (m_dirName.empty()) {
std::string msg =
Base::Tools::toStdString(tr("TSV::apply - Nothing to apply. No section direction picked yet"));
Base::Tools::toStdString(tr("Nothing to apply. No section direction picked yet"));
Base::Console().Error((msg + "\n").c_str());
return false;
}
@@ -318,6 +352,11 @@ void TaskSectionView::applyQuick(std::string dir)
if (isSectionValid()) {
updateSectionView();
m_section->recomputeFeature();
this->setToolTip(QObject::tr("Select at first an orientation"));
// we can in any case enable all objects in the dialog
// and remove the dialog-wide tooltip if there was one
enableAll(true);
this->setToolTip(QString());
} else {
failNoObject(m_sectionName);
}
@@ -420,7 +459,7 @@ void TaskSectionView::updateSectionView(void)
lblText.c_str());
Command::doCommand(Command::Doc,"App.activeDocument().%s.Scale = %0.6f",
m_sectionName.c_str(),
ui->sbScale->value());
ui->sbScale->value().getValue());
m_section->setCSFromBase(m_dirName.c_str());
}
}

View File

@@ -51,15 +51,17 @@ public:
virtual bool reject();
protected Q_SLOTS:
void onUpClicked(bool b);
void onDownClicked(bool b);
void onLeftClicked(bool b);
void onRightClicked(bool b);
void onApplyClicked(bool b);
void onUpClicked();
void onDownClicked();
void onLeftClicked();
void onRightClicked();
void onIdentifierChanged();
void onScaleChanged();
void onXChanged();
void onYChanged();
void onZChanged();
protected:
void blockButtons(bool b);
void changeEvent(QEvent *e);
void saveSectionState();
void restoreSectionState();
@@ -75,6 +77,7 @@ protected:
void setUiEdit();
void checkAll(bool b);
void enableAll(bool b);
void failNoObject(std::string objName);
bool isBaseValid(void);

View File

@@ -1,468 +1,433 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TechDrawGui::TaskSectionView</class>
<widget class="QWidget" name="TechDrawGui::TaskSectionView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>368</width>
<height>450</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>250</width>
<height>450</height>
</size>
</property>
<property name="windowTitle">
<string>Section Parameters</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>350</width>
<height>400</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="1" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>BaseView</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leBaseView">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Identifier</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLineEdit" name="leSymbol">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Identifier for this section</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QDoubleSpinBox" name="sbScale">
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="decimals">
<number>4</number>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Scale</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>Section Orientation</string>
</property>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="3">
<widget class="QPushButton" name="pbRight">
<property name="toolTip">
<string>Looking right</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-right.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="pbUp">
<property name="toolTip">
<string>Looking up</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-up.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pbLeft">
<property name="toolTip">
<string>Looking left</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-left.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbDown">
<property name="toolTip">
<string>Looking down</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-down.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Section Plane Location</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QFormLayout" name="formLayout">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgX">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Location of section plane in 3D coordinates&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgY">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Location of section plane in 3D coordinates&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::QuantitySpinBox" name="sbOrgZ">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Location of section plane in 3D coordinates&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QPushButton" name="pbApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/TechDraw.qrc"/>
</resources>
<connections/>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TechDrawGui::TaskSectionView</class>
<widget class="QWidget" name="TechDrawGui::TaskSectionView">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>370</width>
<height>326</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Section Parameters</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="0" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string>BaseView</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="leBaseView">
<property name="enabled">
<bool>false</bool>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Identifier</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLineEdit" name="leSymbol">
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="toolTip">
<string>Identifier for this section</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Scale</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::QuantitySpinBox" name="sbScale">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>22</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Scale factor for the section view</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999.000000000000000</double>
</property>
<property name="value">
<double>1.000000000000000</double>
</property>
<property name="decimals" stdset="0">
<number>4</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Section Orientation</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QPushButton" name="pbUp">
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="toolTip">
<string>Looking up</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="whatsThis">
<string/>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-up.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbDown">
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="toolTip">
<string>Looking down</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-down.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QPushButton" name="pbLeft">
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="toolTip">
<string>Looking left</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-left.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QPushButton" name="pbRight">
<property name="maximumSize">
<size>
<width>50</width>
<height>50</height>
</size>
</property>
<property name="toolTip">
<string>Looking right</string>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset>
<normalon>:/icons/actions/section-right.svg</normalon>
</iconset>
</property>
<property name="iconSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox">
<property name="toolTip">
<string>Position from the 3D origin of the object in the view</string>
</property>
<property name="title">
<string>Section Plane Location</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label_10">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>X</string>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="2">
<widget class="Gui::QuantitySpinBox" name="sbOrgX">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>22</height>
</size>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_11">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Y</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="Gui::QuantitySpinBox" name="sbOrgY">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>22</height>
</size>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_12">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Z</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="Gui::QuantitySpinBox" name="sbOrgZ">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>150</width>
<height>22</height>
</size>
</property>
<property name="unit" stdset="0">
<string notr="true"/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/TechDraw.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -83,44 +83,29 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawLeaderLine* leader) :
m_leadFeat(leader),
m_weldFeat(nullptr),
m_createMode(true),
m_arrowDirty(false),
m_otherDirty(false)
{
//TODO: why does DWS need DLL as parent?
// Base::Console().Message("TWS::TWS() - create mode\n");
if (m_leadFeat == nullptr) {
//should be caught in CMD caller
Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n");
Base::Console().Error("TaskWeldingSymbol - bad parameters. Can not proceed.\n");
return;
}
ui->setupUi(this);
connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
this, SLOT(onArrowSymbolClicked(bool)));
connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
this, SLOT(onOtherSymbolClicked(bool)));
connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
this, SLOT(onOtherEraseClicked(bool)));
setUiPrimary();
connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
this, SLOT(onArrowSymbolCreateClicked()));
connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
this, SLOT(onOtherSymbolCreateClicked()));
connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
this, SLOT(onOtherEraseCreateClicked()));
connect(ui->pbFlipSides, SIGNAL(clicked(bool)),
this, SLOT(onFlipSidesCreateClicked()));
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
this, SLOT(onDirectorySelected(const QString&)));
connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)),
this, SLOT(onArrowTextChanged(const QString&)));
connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)),
this, SLOT(onArrowTextChanged(const QString&)));
connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)),
this, SLOT(onArrowTextChanged(const QString&)));
connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)),
this, SLOT(onOtherTextChanged(const QString&)));
connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)),
this, SLOT(onOtherTextChanged(const QString&)));
connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)),
this, SLOT(onOtherTextChanged(const QString&)));
setUiPrimary();
}
//ctor for edit
@@ -129,7 +114,6 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) :
m_leadFeat(nullptr),
m_weldFeat(weld),
m_createMode(false),
m_arrowDirty(false),
m_otherDirty(false)
{
// Base::Console().Message("TWS::TWS() - edit mode\n");
@@ -150,33 +134,42 @@ TaskWeldingSymbol::TaskWeldingSymbol(TechDraw::DrawWeldSymbol* weld) :
ui->setupUi(this);
connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
this, SLOT(onArrowSymbolClicked(bool)));
setUiEdit();
connect(ui->pbArrowSymbol, SIGNAL(clicked(bool)),
this, SLOT(onArrowSymbolClicked()));
connect(ui->pbOtherSymbol, SIGNAL(clicked(bool)),
this, SLOT(onOtherSymbolClicked(bool)));
this, SLOT(onOtherSymbolClicked()));
connect(ui->pbOtherErase, SIGNAL(clicked(bool)),
this, SLOT(onOtherEraseClicked(bool)));
this, SLOT(onOtherEraseClicked()));
connect(ui->pbFlipSides, SIGNAL(clicked(bool)),
this, SLOT(onFlipSidesClicked()));
connect(ui->fcSymbolDir, SIGNAL(fileNameSelected(const QString&)),
this, SLOT(onDirectorySelected(const QString&)));
this, SLOT(onDirectorySelected(const QString&)));
connect(ui->leArrowTextL, SIGNAL(textEdited(const QString&)),
this, SLOT(onArrowTextChanged(const QString&)));
connect(ui->leArrowTextR, SIGNAL(textEdited(const QString&)),
this, SLOT(onArrowTextChanged(const QString&)));
connect(ui->leArrowTextC, SIGNAL(textEdited(const QString&)),
this, SLOT(onArrowTextChanged(const QString&)));
connect(ui->leArrowTextL, SIGNAL(textEdited(QString)),
this, SLOT(onArrowTextChanged()));
connect(ui->leArrowTextR, SIGNAL(textEdited(QString)),
this, SLOT(onArrowTextChanged()));
connect(ui->leArrowTextC, SIGNAL(textEdited(QString)),
this, SLOT(onArrowTextChanged()));
connect(ui->leOtherTextL, SIGNAL(textEdited(const QString&)),
this, SLOT(onOtherTextChanged(const QString&)));
connect(ui->leOtherTextR, SIGNAL(textEdited(const QString&)),
this, SLOT(onOtherTextChanged(const QString&)));
connect(ui->leOtherTextC, SIGNAL(textEdited(const QString&)),
this, SLOT(onOtherTextChanged(const QString&)));
connect(ui->leOtherTextL, SIGNAL(textEdited(QString)),
this, SLOT(onOtherTextChanged()));
connect(ui->leOtherTextR, SIGNAL(textEdited(QString)),
this, SLOT(onOtherTextChanged()));
connect(ui->leOtherTextC, SIGNAL(textEdited(QString)),
this, SLOT(onOtherTextChanged()));
saveState();
setUiEdit();
connect(ui->leTailText, SIGNAL(textEdited(QString)),
this, SLOT(onWeldingChanged()));
connect(ui->cbFieldWeld, SIGNAL(toggled(bool)),
this, SLOT(onWeldingChanged()));
connect(ui->cbAllAround, SIGNAL(toggled(bool)),
this, SLOT(onWeldingChanged()));
connect(ui->cbAltWeld, SIGNAL(toggled(bool)),
this, SLOT(onWeldingChanged()));
}
TaskWeldingSymbol::~TaskWeldingSymbol()
@@ -212,6 +205,9 @@ void TaskWeldingSymbol::setUiPrimary()
m_otherOut.init();
m_otherPath = QString();
m_otherSymbol = QString();
// we must mark the other side dirty to assure it gets created
m_otherDirty = true;
}
void TaskWeldingSymbol::setUiEdit()
@@ -241,12 +237,12 @@ void TaskWeldingSymbol::setUiEdit()
if (fi.isReadable()) {
qTemp = QString::fromUtf8(m_arrowFeat->SymbolFile.getValue());
QIcon targetIcon(qTemp);
QSize iconSize(32,32);
QSize iconSize(32, 32);
ui->pbArrowSymbol->setIcon(targetIcon);
ui->pbArrowSymbol->setIconSize(iconSize);
ui->pbArrowSymbol->setText(QString());
} else {
ui->pbArrowSymbol->setText(QString::fromUtf8("Symbol"));
ui->pbArrowSymbol->setText(tr("Symbol"));
}
}
@@ -263,78 +259,156 @@ void TaskWeldingSymbol::setUiEdit()
if (fi.isReadable()) {
qTemp = QString::fromUtf8(m_otherFeat->SymbolFile.getValue());
QIcon targetIcon(qTemp);
QSize iconSize(32,32);
QSize iconSize(32, 32);
ui->pbOtherSymbol->setIcon(targetIcon);
ui->pbOtherSymbol->setIconSize(iconSize);
ui->pbOtherSymbol->setText(QString());
} else {
ui->pbOtherSymbol->setText(QString::fromUtf8("Symbol"));
ui->pbOtherSymbol->setText(tr("Symbol"));
}
}
ui->pbArrowSymbol->setFocus();
}
void TaskWeldingSymbol::onArrowSymbolClicked(bool b)
void TaskWeldingSymbol::onArrowSymbolCreateClicked()
{
// Base::Console().Message("TWS::OnArrowSymbolClicked()\n");
Q_UNUSED(b);
QString source = tr("arrow");
SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
connect(dlg, SIGNAL(symbolSelected(QString, QString)),
this, SLOT(onSymbolSelected(QString, QString)));
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->exec();
}
QString source = QString::fromUtf8("arrow");
void TaskWeldingSymbol::onArrowSymbolClicked()
{
QString source = tr("arrow");
SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
connect(dlg, SIGNAL(symbolSelected(QString, QString)),
this, SLOT(onSymbolSelected(QString, QString)));
dlg->setAttribute(Qt::WA_DeleteOnClose);
//int rc =
dlg->exec();
updateTiles();
m_weldFeat->requestPaint();
}
void TaskWeldingSymbol::onOtherSymbolCreateClicked()
{
QString source = tr("other");
SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
connect(dlg, SIGNAL(symbolSelected(QString, QString)),
this, SLOT(onSymbolSelected(QString, QString)));
dlg->setAttribute(Qt::WA_DeleteOnClose);
dlg->exec();
}
void TaskWeldingSymbol::onOtherSymbolClicked(bool b)
void TaskWeldingSymbol::onOtherSymbolClicked()
{
// Base::Console().Message("TWS::OnOtherSymbolClicked()\n");
Q_UNUSED(b);
QString source = QString::fromUtf8("other");
QString source = tr("other");
SymbolChooser* dlg = new SymbolChooser(this, m_currDir, source);
connect(dlg, SIGNAL(symbolSelected(QString, QString)),
this, SLOT(onSymbolSelected(QString, QString)));
dlg->setAttribute(Qt::WA_DeleteOnClose);
// int rc =
dlg->exec();
updateTiles();
m_weldFeat->requestPaint();
}
void TaskWeldingSymbol::onOtherEraseClicked(bool b)
void TaskWeldingSymbol::onOtherEraseCreateClicked()
{
// Base::Console().Message("TWS::onOtherEraseClicked()\n");
Q_UNUSED(b);
m_otherDirty = true;
m_otherOut.init();
ui->leOtherTextL->setText(QString());
ui->leOtherTextC->setText(QString());
ui->leOtherTextR->setText(QString());
ui->pbOtherSymbol->setIcon(QIcon());
ui->pbOtherSymbol->setText(QString::fromUtf8("Symbol"));
ui->pbOtherSymbol->setText(tr("Symbol"));
m_otherOut.init();
m_otherPath = QString();
}
void TaskWeldingSymbol::onArrowTextChanged(const QString& qs)
void TaskWeldingSymbol::onOtherEraseClicked()
{
// Base::Console().Message("TWS::onArrowTextChanged(%s)\n", qPrintable(qs));
Q_UNUSED(qs);
m_arrowDirty = true;
}
void TaskWeldingSymbol::onOtherTextChanged(const QString& qs)
{
// Base::Console().Message("TWS::onOtherTextChanged(%s)\n", qPrintable(qs));
Q_UNUSED(qs);
m_otherDirty = true;
ui->leOtherTextL->setText(QString());
ui->leOtherTextC->setText(QString());
ui->leOtherTextR->setText(QString());
ui->pbOtherSymbol->setIcon(QIcon());
ui->pbOtherSymbol->setText(tr("Symbol"));
m_otherOut.init();
m_otherPath = QString();
updateTiles();
m_weldFeat->requestPaint();
}
void TaskWeldingSymbol::onFlipSidesCreateClicked()
{
QString tempText = ui->leOtherTextL->text();
ui->leOtherTextL->setText(ui->leArrowTextL->text());
ui->leArrowTextL->setText(tempText);
tempText = ui->leOtherTextC->text();
ui->leOtherTextC->setText(ui->leArrowTextC->text());
ui->leArrowTextC->setText(tempText);
tempText = ui->leOtherTextR->text();
ui->leOtherTextR->setText(ui->leArrowTextR->text());
ui->leArrowTextR->setText(tempText);
QString tempPathArrow = m_otherPath;
m_otherPath = m_arrowPath;
m_arrowPath = tempPathArrow;
tempText = ui->pbOtherSymbol->text();
ui->pbOtherSymbol->setText(ui->pbArrowSymbol->text());
ui->pbArrowSymbol->setText(tempText);
QIcon tempIcon = ui->pbOtherSymbol->icon();
ui->pbOtherSymbol->setIcon(ui->pbArrowSymbol->icon());
ui->pbArrowSymbol->setIcon(tempIcon);
}
void TaskWeldingSymbol::onFlipSidesClicked()
{
QString tempText = ui->leOtherTextL->text();
ui->leOtherTextL->setText(ui->leArrowTextL->text());
ui->leArrowTextL->setText(tempText);
tempText = ui->leOtherTextC->text();
ui->leOtherTextC->setText(ui->leArrowTextC->text());
ui->leArrowTextC->setText(tempText);
tempText = ui->leOtherTextR->text();
ui->leOtherTextR->setText(ui->leArrowTextR->text());
ui->leArrowTextR->setText(tempText);
// one cannot get the path from the icon therfore read out
// the path property
auto tempPathArrow = m_arrowFeat->SymbolFile.getValue();
auto tempPathOther = m_otherFeat->SymbolFile.getValue();
m_otherPath = QString::fromLatin1(tempPathArrow);
m_arrowPath = QString::fromLatin1(tempPathOther);
QIcon tempIcon = ui->pbOtherSymbol->icon();
ui->pbOtherSymbol->setIcon(ui->pbArrowSymbol->icon());
ui->pbArrowSymbol->setIcon(tempIcon);
m_otherDirty = true;
updateTiles();
m_weldFeat->requestPaint();
}
void TaskWeldingSymbol::onArrowTextChanged()
{
updateTiles();
m_weldFeat->requestPaint();
}
void TaskWeldingSymbol::onOtherTextChanged()
{
m_otherDirty = true;
updateTiles();
m_weldFeat->requestPaint();
}
void TaskWeldingSymbol::onWeldingChanged()
{
updateWeldingSymbol();
m_weldFeat->requestPaint();
}
void TaskWeldingSymbol::onDirectorySelected(const QString& newDir)
{
@@ -349,10 +423,9 @@ void TaskWeldingSymbol::onSymbolSelected(QString symbolPath,
// qPrintable(symbolPath), qPrintable(source));
QIcon targetIcon(symbolPath);
QSize iconSize(32,32);
QString arrow = QString::fromUtf8("arrow");
QString other = QString::fromUtf8("other");
QString arrow = tr("arrow");
QString other = tr("other");
if (source == arrow) {
m_arrowDirty = true;
ui->pbArrowSymbol->setIcon(targetIcon);
ui->pbArrowSymbol->setIconSize(iconSize);
ui->pbArrowSymbol->setText(QString());
@@ -366,16 +439,6 @@ void TaskWeldingSymbol::onSymbolSelected(QString symbolPath,
}
}
void TaskWeldingSymbol::blockButtons(bool b)
{
Q_UNUSED(b);
}
//obsolete. tiles are only updated on accept.
void TaskWeldingSymbol::saveState(void)
{
}
void TaskWeldingSymbol::collectArrowData(void)
{
// Base::Console().Message("TWS::collectArrowData()\n");
@@ -383,10 +446,10 @@ void TaskWeldingSymbol::collectArrowData(void)
m_arrowOut.arrowSide = false;
m_arrowOut.row = 0;
m_arrowOut.col = 0;
m_arrowOut.leftText = Base::Tools::toStdString(ui->leArrowTextL->text());
m_arrowOut.centerText = Base::Tools::toStdString(ui->leArrowTextC->text());
m_arrowOut.rightText = Base::Tools::toStdString(ui->leArrowTextR->text());
m_arrowOut.symbolPath= Base::Tools::toStdString(m_arrowPath);
m_arrowOut.leftText = ui->leArrowTextL->text().toStdString();
m_arrowOut.centerText = ui->leArrowTextC->text().toStdString();
m_arrowOut.rightText = ui->leArrowTextR->text().toStdString();
m_arrowOut.symbolPath= m_arrowPath.toStdString();
m_arrowOut.tileName = "";
}
@@ -397,10 +460,10 @@ void TaskWeldingSymbol::collectOtherData(void)
m_otherOut.arrowSide = false;
m_otherOut.row = -1;
m_otherOut.col = 0;
m_otherOut.leftText = Base::Tools::toStdString(ui->leOtherTextL->text());
m_otherOut.centerText = Base::Tools::toStdString(ui->leOtherTextC->text());
m_otherOut.rightText = Base::Tools::toStdString(ui->leOtherTextR->text());
m_otherOut.symbolPath = Base::Tools::toStdString(m_otherPath);
m_otherOut.leftText = ui->leOtherTextL->text().toStdString();
m_otherOut.centerText = ui->leOtherTextC->text().toStdString();
m_otherOut.rightText = ui->leOtherTextR->text().toStdString();
m_otherOut.symbolPath = m_otherPath.toStdString();
m_otherOut.tileName = "";
}
@@ -462,7 +525,7 @@ TechDraw::DrawWeldSymbol* TaskWeldingSymbol::createWeldingSymbol(void)
Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s",
symbolName.c_str(), altWeldText.c_str());
std::string tailText = Base::Tools::toStdString(ui->leTailText->text());
std::string tailText = ui->leTailText->text().toStdString();
tailText = Base::Tools::escapeEncodeString(tailText);
Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'",
symbolName.c_str(), tailText.c_str());
@@ -497,7 +560,7 @@ void TaskWeldingSymbol::updateWeldingSymbol(void)
Command::doCommand(Command::Doc,"App.activeDocument().%s.AlternatingWeld = %s",
symbolName.c_str(), altWeldText.c_str());
std::string tailText = Base::Tools::toStdString(ui->leTailText->text());
std::string tailText = ui->leTailText->text().toStdString();
tailText = Base::Tools::escapeEncodeString(tailText);
Command::doCommand(Command::Doc,"App.activeDocument().%s.TailText = '%s'",
symbolName.c_str(), tailText.c_str());

View File

@@ -102,14 +102,17 @@ public:
~TaskWeldingSymbol();
public Q_SLOTS:
void onArrowSymbolClicked(bool b);
void onOtherSymbolClicked(bool b);
void onOtherEraseClicked(bool b);
void onArrowTextChanged(const QString& qs);
void onOtherTextChanged(const QString& qs);
void onArrowSymbolCreateClicked();
void onArrowSymbolClicked();
void onOtherSymbolCreateClicked();
void onOtherSymbolClicked();
void onOtherEraseCreateClicked();
void onOtherEraseClicked();
void onFlipSidesCreateClicked();
void onFlipSidesClicked();
void onArrowTextChanged();
void onOtherTextChanged();
void onWeldingChanged();
void onDirectorySelected(const QString& newDir);
void onSymbolSelected(QString symbolPath, QString source);
@@ -125,8 +128,6 @@ protected Q_SLOTS:
protected:
void changeEvent(QEvent *e);
void blockButtons(bool b);
void setUiPrimary(void);
void setUiEdit();
@@ -141,7 +142,6 @@ protected:
void collectOtherData(void);
std::string prefSymbolDir();
void saveState(void);
QString m_currDir;
@@ -163,14 +163,10 @@ private:
QString m_arrowSymbol;
QString m_otherSymbol;
/* std::vector<std::string> m_toRemove;*/
QPushButton* m_btnOK;
QPushButton* m_btnCancel;
bool m_createMode;
bool m_arrowDirty;
bool m_otherDirty;
};

View File

@@ -6,12 +6,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>423</width>
<height>374</height>
<width>400</width>
<height>244</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@@ -29,268 +29,282 @@
<iconset resource="Resources/TechDraw.qrc">
<normaloff>:/icons/actions/techdraw-weldsymbol.svg</normaloff>:/icons/actions/techdraw-weldsymbol.svg</iconset>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="hlArrowSideLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLineEdit" name="leArrowTextL">
<property name="toolTip">
<string>Text before arrow side symbol</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="leArrowTextR">
<property name="toolTip">
<string>Text after arrow side symbol</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pbArrowSymbol">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Pick arrow side symbol</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text">
<string>Symbol</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leArrowTextC">
<property name="toolTip">
<string>Text above arrow side symbol</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>5</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlOtherSideLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QPushButton" name="pbOtherSymbol">
<property name="toolTip">
<string>Pick other side symbol</string>
</property>
<property name="text">
<string>Symbol</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leOtherTextC">
<property name="toolTip">
<string>Text below other side symbol</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLineEdit" name="leOtherTextR">
<property name="toolTip">
<string>Text after other side symbol</string>
</property>
</widget>
</item>
<item row="1" column="2" alignment="Qt::AlignRight">
<widget class="QPushButton" name="pbFlipSides">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="baseSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Flips the sides</string>
</property>
<property name="text">
<string>Flip Sides</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="leOtherTextL">
<property name="toolTip">
<string>Text before other side symbol</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pbOtherErase">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="baseSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Remove other side symbol</string>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="frameShape">
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="hlArrowSideLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLineEdit" name="leArrowTextL">
<property name="toolTip">
<string>Text before arrow side symbol</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="leArrowTextR">
<property name="toolTip">
<string>Text after arrow side symbol</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="pbArrowSymbol">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>32</height>
</size>
</property>
<property name="toolTip">
<string>Pick arrow side symbol</string>
</property>
<property name="statusTip">
<string/>
</property>
<property name="text">
<string>Symbol</string>
</property>
<property name="checkable">
<bool>false</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leArrowTextC">
<property name="toolTip">
<string>Text above arrow side symbol</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>5</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="hlOtherSideLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="2">
<widget class="QLineEdit" name="leOtherTextR">
<property name="toolTip">
<string>Text after other side symbol</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="pbOtherSymbol">
<property name="toolTip">
<string>Pick other side symbol</string>
</property>
<property name="text">
<string>Symbol</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLineEdit" name="leOtherTextL">
<property name="toolTip">
<string>Text before other side symbol</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="leOtherTextC">
<property name="toolTip">
<string>Text below other side symbol</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="pbOtherErase">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="baseSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Remove other side symbol</string>
</property>
<property name="text">
<string>Delete</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="cbFieldWeld">
<property name="text">
<string>Field Weld</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="cbAllAround">
<property name="text">
<string>All Around</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cbAltWeld">
<property name="text">
<string>Alternating</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QFormLayout" name="formLayout_2">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Tail Text</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leTailText">
<property name="toolTip">
<string>Text at end of symbol</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Symbol Directory</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::FileChooser" name="fcSymbolDir">
<property name="toolTip">
<string>Pick a directory of welding symbols</string>
</property>
<property name="mode">
<enum>Gui::FileChooser::Directory</enum>
</property>
<property name="filter">
<string>*.svg</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QCheckBox" name="cbFieldWeld">
<property name="toolTip">
<string>Adds the 'Field Weld' symbol (flag)
at the kink in the leader line</string>
</property>
<property name="text">
<string>Field Weld</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QCheckBox" name="cbAllAround">
<property name="toolTip">
<string>Adds the 'All Around' symbol (circle)
at the kink in the leader line</string>
</property>
<property name="text">
<string>All Around</string>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QCheckBox" name="cbAltWeld">
<property name="toolTip">
<string>Offsets the lower symbol to indicate alternating welds</string>
</property>
<property name="text">
<string>Alternating</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" name="gridLayout_4">
<item row="1" column="1">
<widget class="Gui::FileChooser" name="fcSymbolDir">
<property name="toolTip">
<string>Directory to welding symbols.
This directory will be used for the symbol selection.</string>
</property>
<property name="mode">
<enum>Gui::FileChooser::Directory</enum>
</property>
<property name="filter">
<string>*.svg</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="leTailText">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Text at end of symbol</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Symbol Directory</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Tail Text</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>