mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Compare commits
1 Commits
terminal_s
...
element_pi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de2f161566 |
@@ -738,11 +738,36 @@ void QETDiagramEditor::setUpToolBar()
|
||||
m_depth_tool_bar->setObjectName("diagram_depth_toolbar");
|
||||
m_depth_tool_bar->addActions(m_depth_action_group->actions());
|
||||
|
||||
auto element_picture_scale_tool_bar = new QToolBar(tr("Facteur d'échelle des élements"), this);
|
||||
auto label_ = new QLabel(tr("Facteur d'échelle des élements : "), this);
|
||||
element_picture_scale_tool_bar->addWidget(label_);
|
||||
m_scale_picture_cb = new QComboBox(this);
|
||||
m_scale_picture_cb->addItem("0,25", 0.25);
|
||||
m_scale_picture_cb->addItem("0,50", 0.5);
|
||||
m_scale_picture_cb->addItem("0,75", 0.75);
|
||||
m_scale_picture_cb->addItem("1", 1);
|
||||
m_scale_picture_cb->addItem("1,25", 1.25);
|
||||
m_scale_picture_cb->addItem("1,50", 1.5);
|
||||
m_scale_picture_cb->addItem("1,75", 1.75);
|
||||
m_scale_picture_cb->addItem("2", 2);
|
||||
m_scale_picture_cb->setCurrentIndex(3);
|
||||
element_picture_scale_tool_bar->addWidget(m_scale_picture_cb);
|
||||
connect(m_scale_picture_cb, QOverload<int>::of(&QComboBox::currentIndexChanged), [this](int)
|
||||
{
|
||||
Element::setPictureScale(m_scale_picture_cb->currentData().toReal());
|
||||
auto dv = this->currentDiagramView();
|
||||
if (dv && dv->scene()) {
|
||||
dv->scene()->update();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
addToolBar(Qt::TopToolBarArea, main_tool_bar);
|
||||
addToolBar(Qt::TopToolBarArea, view_tool_bar);
|
||||
addToolBar(Qt::TopToolBarArea, diagram_tool_bar);
|
||||
addToolBar(Qt::TopToolBarArea, m_add_item_tool_bar);
|
||||
addToolBar(Qt::TopToolBarArea, m_depth_tool_bar);
|
||||
addToolBar(Qt::TopToolBarArea, element_picture_scale_tool_bar);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,7 @@ class RecentFiles;
|
||||
class DiagramPropertiesEditorDockWidget;
|
||||
class ElementsCollectionWidget;
|
||||
class AutoNumberingDockWidget;
|
||||
class QComboBox;
|
||||
|
||||
#ifdef BUILD_WITHOUT_KF5
|
||||
#else
|
||||
@@ -240,5 +241,6 @@ class QETDiagramEditor : public QETMainWindow
|
||||
int activeSubWindowIndex;
|
||||
bool m_first_show = true;
|
||||
SearchAndReplaceWidget m_search_and_replace_widget;
|
||||
QComboBox *m_scale_picture_cb = nullptr;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,8 @@
|
||||
#include <QDomElement>
|
||||
#include <utility>
|
||||
|
||||
qreal PICTURE_SCALE = 1;
|
||||
|
||||
class ElementXmlRetroCompatibility
|
||||
{
|
||||
friend class Element;
|
||||
@@ -126,6 +128,11 @@ Element::Element(
|
||||
});
|
||||
}
|
||||
|
||||
void Element::setPictureScale(qreal scale)
|
||||
{
|
||||
PICTURE_SCALE = scale;
|
||||
}
|
||||
|
||||
/**
|
||||
@brief Element::~Element
|
||||
*/
|
||||
@@ -234,7 +241,17 @@ void Element::paint(
|
||||
{
|
||||
painter->drawPicture(0, 0, m_low_zoom_picture);
|
||||
} else {
|
||||
if (Q_UNLIKELY(PICTURE_SCALE != 1.0))
|
||||
{
|
||||
painter->save();
|
||||
painter->scale(PICTURE_SCALE, PICTURE_SCALE);
|
||||
painter->drawPicture(0, 0, m_picture);
|
||||
painter->restore();
|
||||
}
|
||||
else
|
||||
{
|
||||
painter->drawPicture(0, 0, m_picture);
|
||||
}
|
||||
}
|
||||
|
||||
painter->restore(); //Restor the QPainter after use drawPicture
|
||||
|
||||
@@ -95,6 +95,7 @@ class Element : public QetGraphicsItem
|
||||
|
||||
|
||||
public:
|
||||
static void setPictureScale(qreal scale);
|
||||
QList<Terminal *> terminals() const;
|
||||
QList<Conductor *> conductors() const;
|
||||
QList<QPair<Terminal *,Terminal *>> AlignedFreeTerminals() const;
|
||||
|
||||
Reference in New Issue
Block a user