mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 10:30:53 +01:00
Add a combo box to change the QPicture scale of element picture
This is a test commit to see if we can fix the wrong scale of element in some screen size.: Add a QComboBox into the QToolBar of the diagram editor to change the current scale factor of the element QPicture.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user