Opacity option for a background image.
This commit is contained in:
parent
111b7f356c
commit
fd8d2f8a9d
|
@ -37,6 +37,7 @@
|
||||||
#include "../vwidgets/vsimplepoint.h"
|
#include "../vwidgets/vsimplepoint.h"
|
||||||
#include "../vwidgets/vsimplecurve.h"
|
#include "../vwidgets/vsimplecurve.h"
|
||||||
#include "../vpropertyexplorer/vproperties.h"
|
#include "../vpropertyexplorer/vproperties.h"
|
||||||
|
#include "def.h"
|
||||||
#include "vformulaproperty.h"
|
#include "vformulaproperty.h"
|
||||||
#include "../vpatterndb/vformula.h"
|
#include "../vpatterndb/vformula.h"
|
||||||
#include "../vgeometry/vcubicbezier.h"
|
#include "../vgeometry/vcubicbezier.h"
|
||||||
|
@ -52,6 +53,7 @@ namespace
|
||||||
{
|
{
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrHold, (QLatin1String("hold")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrHold, (QLatin1String("hold")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrVisible, (QLatin1String("visible")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrVisible, (QLatin1String("visible")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, AttrOpacity, (QLatin1String("opacity")))
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -753,6 +755,22 @@ void VToolOptionsPropertyBrowser::AddPropertyApproximationScale(const QString &p
|
||||||
AddProperty(aScaleProperty, AttrAScale);
|
AddProperty(aScaleProperty, AttrAScale);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolOptionsPropertyBrowser::AddPropertyOpacity(const QString &propertyName, int opacity)
|
||||||
|
{
|
||||||
|
QMap<QString, QVariant> settings
|
||||||
|
{
|
||||||
|
{QStringLiteral("Min"), 0},
|
||||||
|
{QStringLiteral("Max"), 100},
|
||||||
|
{QStringLiteral("Step"), 1},
|
||||||
|
{QStringLiteral("Suffix"), QChar('%')}
|
||||||
|
};
|
||||||
|
|
||||||
|
auto *opacityProperty = new VPE::VIntegerProperty(propertyName, settings);
|
||||||
|
opacityProperty->setValue(opacity);
|
||||||
|
AddProperty(opacityProperty, *AttrOpacity);
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void VToolOptionsPropertyBrowser::SetName(VPE::VProperty *property)
|
void VToolOptionsPropertyBrowser::SetName(VPE::VProperty *property)
|
||||||
|
@ -813,6 +831,26 @@ void VToolOptionsPropertyBrowser::SetVisible(VPE::VProperty *property)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
template<class Tool>
|
||||||
|
void VToolOptionsPropertyBrowser::SetOpacity(VPE::VProperty *property)
|
||||||
|
{
|
||||||
|
if (auto *i = qgraphicsitem_cast<Tool *>(currentItem))
|
||||||
|
{
|
||||||
|
const int opacity = property->data(VPE::VProperty::DPC_Data, Qt::DisplayRole).toInt();
|
||||||
|
if (VFuzzyComparePossibleNulls(opacity, i->GetOpacity()))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
i->SetOpacity(opacity/100.);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning()<<"Can't cast item";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void VToolOptionsPropertyBrowser::SetPointName(VPE::VProperty *property)
|
void VToolOptionsPropertyBrowser::SetPointName(VPE::VProperty *property)
|
||||||
|
@ -2612,7 +2650,7 @@ void VToolOptionsPropertyBrowser::ChangeDataBackgroundPixmapItem(VPE::VProperty
|
||||||
{
|
{
|
||||||
SCASSERT(property != nullptr)
|
SCASSERT(property != nullptr)
|
||||||
|
|
||||||
const QString id = propertyToId[property];
|
const QString id = propertyToId.value(property);
|
||||||
|
|
||||||
switch (PropertiesList().indexOf(id))
|
switch (PropertiesList().indexOf(id))
|
||||||
{
|
{
|
||||||
|
@ -2625,6 +2663,9 @@ void VToolOptionsPropertyBrowser::ChangeDataBackgroundPixmapItem(VPE::VProperty
|
||||||
case 66: // AttrVisible
|
case 66: // AttrVisible
|
||||||
SetVisible<VBackgroundPixmapItem>(property);
|
SetVisible<VBackgroundPixmapItem>(property);
|
||||||
break;
|
break;
|
||||||
|
case 67: // AttrOpacity
|
||||||
|
SetOpacity<VBackgroundPixmapItem>(property);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Unknown property type. id = "<<id;
|
qWarning()<<"Unknown property type. id = "<<id;
|
||||||
break;
|
break;
|
||||||
|
@ -2636,7 +2677,7 @@ void VToolOptionsPropertyBrowser::ChangeDataBackgroundSVGItem(VPE::VProperty *pr
|
||||||
{
|
{
|
||||||
SCASSERT(property != nullptr)
|
SCASSERT(property != nullptr)
|
||||||
|
|
||||||
const QString id = propertyToId[property];
|
const QString id = propertyToId.value(property);
|
||||||
|
|
||||||
switch (PropertiesList().indexOf(id))
|
switch (PropertiesList().indexOf(id))
|
||||||
{
|
{
|
||||||
|
@ -2649,6 +2690,9 @@ void VToolOptionsPropertyBrowser::ChangeDataBackgroundSVGItem(VPE::VProperty *pr
|
||||||
case 66: // AttrVisible
|
case 66: // AttrVisible
|
||||||
SetVisible<VBackgroundSVGItem>(property);
|
SetVisible<VBackgroundSVGItem>(property);
|
||||||
break;
|
break;
|
||||||
|
case 67: // AttrOpacity
|
||||||
|
SetOpacity<VBackgroundPixmapItem>(property);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
qWarning()<<"Unknown property type. id = "<<id;
|
qWarning()<<"Unknown property type. id = "<<id;
|
||||||
break;
|
break;
|
||||||
|
@ -3235,6 +3279,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsBackgroundPixmapItem(QGraphicsItem
|
||||||
AddPropertyObjectName(i, tr("Name:"), false);
|
AddPropertyObjectName(i, tr("Name:"), false);
|
||||||
AddPropertyBool(tr("Hold:"), i->IsHold(), *AttrHold);
|
AddPropertyBool(tr("Hold:"), i->IsHold(), *AttrHold);
|
||||||
AddPropertyBool(tr("Visible:"), i->IsVisible(), *AttrVisible);
|
AddPropertyBool(tr("Visible:"), i->IsVisible(), *AttrVisible);
|
||||||
|
AddPropertyOpacity(tr("Opacity:"), static_cast<int>(i->GetOpacity()*100));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -3246,6 +3291,7 @@ void VToolOptionsPropertyBrowser::ShowOptionsBackgroundSVGItem(QGraphicsItem *it
|
||||||
AddPropertyObjectName(i, tr("Name:"), false);
|
AddPropertyObjectName(i, tr("Name:"), false);
|
||||||
AddPropertyBool(tr("Hold:"), i->IsHold(), *AttrHold);
|
AddPropertyBool(tr("Hold:"), i->IsHold(), *AttrHold);
|
||||||
AddPropertyBool(tr("Visible:"), i->IsVisible(), *AttrVisible);
|
AddPropertyBool(tr("Visible:"), i->IsVisible(), *AttrVisible);
|
||||||
|
AddPropertyOpacity(tr("Opacity:"), static_cast<int>(i->GetOpacity()*100));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -4200,6 +4246,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsBackgroundPixmapItem()
|
||||||
idToProperty.value(AttrName)->setValue(i->name());
|
idToProperty.value(AttrName)->setValue(i->name());
|
||||||
idToProperty.value(*AttrHold)->setValue(i->IsHold());
|
idToProperty.value(*AttrHold)->setValue(i->IsHold());
|
||||||
idToProperty.value(*AttrVisible)->setValue(i->IsVisible());
|
idToProperty.value(*AttrVisible)->setValue(i->IsVisible());
|
||||||
|
idToProperty.value(*AttrOpacity)->setValue(static_cast<int>(i->GetOpacity()*100));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -4210,6 +4257,7 @@ void VToolOptionsPropertyBrowser::UpdateOptionsBackgroundSVGItem()
|
||||||
idToProperty.value(AttrName)->setValue(i->name());
|
idToProperty.value(AttrName)->setValue(i->name());
|
||||||
idToProperty.value(*AttrHold)->setValue(i->IsHold());
|
idToProperty.value(*AttrHold)->setValue(i->IsHold());
|
||||||
idToProperty.value(*AttrVisible)->setValue(i->IsVisible());
|
idToProperty.value(*AttrVisible)->setValue(i->IsVisible());
|
||||||
|
idToProperty.value(*AttrOpacity)->setValue(static_cast<int>(i->GetOpacity()*100));
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
@ -4282,7 +4330,8 @@ QStringList VToolOptionsPropertyBrowser::PropertiesList() const
|
||||||
AttrAlias1, /* 63 */
|
AttrAlias1, /* 63 */
|
||||||
AttrAlias2, /* 64 */
|
AttrAlias2, /* 64 */
|
||||||
*AttrHold, /* 65 */
|
*AttrHold, /* 65 */
|
||||||
*AttrVisible /* 66 */
|
*AttrVisible, /* 66 */
|
||||||
|
*AttrOpacity /* 67 */
|
||||||
};
|
};
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,9 @@ private:
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void SetVisible(VPE::VProperty *property);
|
void SetVisible(VPE::VProperty *property);
|
||||||
|
|
||||||
|
template<class Tool>
|
||||||
|
void SetOpacity(VPE::VProperty *property);
|
||||||
|
|
||||||
template<class Tool>
|
template<class Tool>
|
||||||
void SetPointName(VPE::VProperty *property);
|
void SetPointName(VPE::VProperty *property);
|
||||||
|
|
||||||
|
@ -188,6 +191,7 @@ private:
|
||||||
const QString &id);
|
const QString &id);
|
||||||
|
|
||||||
void AddPropertyApproximationScale(const QString &propertyName, qreal aScale);
|
void AddPropertyApproximationScale(const QString &propertyName, qreal aScale);
|
||||||
|
void AddPropertyOpacity(const QString &propertyName, int opacity);
|
||||||
void AddPropertyFormula(const QString &propertyName, const VFormula &formula, const QString &attrName);
|
void AddPropertyFormula(const QString &propertyName, const VFormula &formula, const QString &attrName);
|
||||||
void AddPropertyParentPointName(const QString &pointName, const QString &propertyName,
|
void AddPropertyParentPointName(const QString &pointName, const QString &propertyName,
|
||||||
const QString &propertyAttribure);
|
const QString &propertyAttribure);
|
||||||
|
|
|
@ -112,6 +112,8 @@ PreferencesPatternPage::PreferencesPatternPage(QWidget *parent)
|
||||||
ui->checkBoxRemeberPatternMaterials->setChecked(settings->IsRememberPatternMaterials());
|
ui->checkBoxRemeberPatternMaterials->setChecked(settings->IsRememberPatternMaterials());
|
||||||
m_knownMaterials = settings->GetKnownMaterials();
|
m_knownMaterials = settings->GetKnownMaterials();
|
||||||
|
|
||||||
|
ui->spinBoxOpacity->setValue(settings->GetBackgroundImageDefOpacity());
|
||||||
|
|
||||||
connect(ui->pushButtonKnownMaterials, &QPushButton::clicked, this, &PreferencesPatternPage::ManageKnownMaterials);
|
connect(ui->pushButtonKnownMaterials, &QPushButton::clicked, this, &PreferencesPatternPage::ManageKnownMaterials);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,6 +177,8 @@ QStringList PreferencesPatternPage::Apply()
|
||||||
settings->SetKnownMaterials(m_knownMaterials);
|
settings->SetKnownMaterials(m_knownMaterials);
|
||||||
settings->SetRememberPatternMaterials(ui->checkBoxRemeberPatternMaterials->isChecked());
|
settings->SetRememberPatternMaterials(ui->checkBoxRemeberPatternMaterials->isChecked());
|
||||||
|
|
||||||
|
settings->SetBackgroundImageDefOpacity(ui->spinBoxOpacity->value());
|
||||||
|
|
||||||
return preferences;
|
return preferences;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>373</width>
|
<width>553</width>
|
||||||
<height>760</height>
|
<height>887</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
@ -24,8 +24,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>353</width>
|
<width>533</width>
|
||||||
<height>740</height>
|
<height>867</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
@ -381,6 +381,38 @@ This option will take an affect after restart.</string>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="groupBox_7">
|
||||||
|
<property name="title">
|
||||||
|
<string>Background image</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Opacity:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="spinBoxOpacity">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Opacity value by default</string>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string notr="true">%</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>100</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
|
|
@ -1392,6 +1392,9 @@ void MainWindow::PlaceBackgroundImage(const QPointF &pos, const QString &fileNam
|
||||||
VBackgroundPatternImage image = VBackgroundPatternImage::FromFile(fileName, dialog.BuiltIn());
|
VBackgroundPatternImage image = VBackgroundPatternImage::FromFile(fileName, dialog.BuiltIn());
|
||||||
image.SetName(dialog.Name());
|
image.SetName(dialog.Name());
|
||||||
|
|
||||||
|
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
image.SetOpacity(settings->GetBackgroundImageDefOpacity()/100.);
|
||||||
|
|
||||||
QTransform m;
|
QTransform m;
|
||||||
m.translate(pos.x(), pos.y());
|
m.translate(pos.x(), pos.y());
|
||||||
|
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
<xs:attribute name="hold" type="xs:boolean"/>
|
<xs:attribute name="hold" type="xs:boolean"/>
|
||||||
<xs:attribute name="visible" type="xs:boolean"/>
|
<xs:attribute name="visible" type="xs:boolean"/>
|
||||||
<xs:attribute name="zValue" type="xs:unsignedInt"/>
|
<xs:attribute name="zValue" type="xs:unsignedInt"/>
|
||||||
|
<xs:attribute name="opacity" type="xs:double"/>
|
||||||
</xs:extension>
|
</xs:extension>
|
||||||
</xs:simpleContent>
|
</xs:simpleContent>
|
||||||
</xs:complexType>
|
</xs:complexType>
|
||||||
|
|
|
@ -52,6 +52,7 @@
|
||||||
#include "../vpatterndb/vcontainer.h"
|
#include "../vpatterndb/vcontainer.h"
|
||||||
#include "../vpatterndb/vpiecenode.h"
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
#include "../vtools/tools/vdatatool.h"
|
#include "../vtools/tools/vdatatool.h"
|
||||||
|
#include "def.h"
|
||||||
#include "vpatternconverter.h"
|
#include "vpatternconverter.h"
|
||||||
#include "vdomdocument.h"
|
#include "vdomdocument.h"
|
||||||
#include "vtoolrecord.h"
|
#include "vtoolrecord.h"
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
#include "../vlayout/vtextmanager.h"
|
#include "../vlayout/vtextmanager.h"
|
||||||
#include "vpatternimage.h"
|
#include "vpatternimage.h"
|
||||||
#include "vbackgroundpatternimage.h"
|
#include "vbackgroundpatternimage.h"
|
||||||
|
#include "vvalentinasettings.h"
|
||||||
|
|
||||||
class QDomElement;
|
class QDomElement;
|
||||||
|
|
||||||
|
@ -2156,6 +2158,10 @@ auto VAbstractPattern::GetBackgroundPatternImage(const QDomElement &element) con
|
||||||
image.SetZValue(GetParametrUInt(element, AttrZValue, QChar('0')));
|
image.SetZValue(GetParametrUInt(element, AttrZValue, QChar('0')));
|
||||||
image.SetVisible(GetParametrBool(element, AttrVisible, trueStr));
|
image.SetVisible(GetParametrBool(element, AttrVisible, trueStr));
|
||||||
|
|
||||||
|
VValentinaSettings *settings = VAbstractValApplication::VApp()->ValentinaSettings();
|
||||||
|
image.SetOpacity(GetParametrDouble(element, AttrOpacity,
|
||||||
|
QString::number(settings->GetBackgroundImageDefOpacity()/100.)));
|
||||||
|
|
||||||
QString matrix = GetParametrEmptyString(element, AttrTransform);
|
QString matrix = GetParametrEmptyString(element, AttrTransform);
|
||||||
image.SetMatrix(StringToTransfrom(matrix));
|
image.SetMatrix(StringToTransfrom(matrix));
|
||||||
|
|
||||||
|
@ -2221,6 +2227,8 @@ void VAbstractPattern::WriteBackgroundImage(QDomElement &element, const VBackgro
|
||||||
SetAttributeOrRemoveIf<bool>(element, AttrHold, image.Hold(), [](bool hold) noexcept {return not hold;});
|
SetAttributeOrRemoveIf<bool>(element, AttrHold, image.Hold(), [](bool hold) noexcept {return not hold;});
|
||||||
SetAttributeOrRemoveIf<qreal>(element, AttrZValue, image.ZValue(), [](qreal z) noexcept {return qFuzzyIsNull(z);});
|
SetAttributeOrRemoveIf<qreal>(element, AttrZValue, image.ZValue(), [](qreal z) noexcept {return qFuzzyIsNull(z);});
|
||||||
SetAttributeOrRemoveIf<bool>(element, AttrVisible, image.Visible(), [](bool visible) noexcept {return visible;});
|
SetAttributeOrRemoveIf<bool>(element, AttrVisible, image.Visible(), [](bool visible) noexcept {return visible;});
|
||||||
|
SetAttributeOrRemoveIf<qreal>(element, AttrOpacity, image.Opacity(),
|
||||||
|
[](qreal o) noexcept {return VFuzzyComparePossibleNulls(o, 1);});
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
|
|
@ -400,6 +400,7 @@ signals:
|
||||||
void BackgroundImageNameChanged(const QUuid &id);
|
void BackgroundImageNameChanged(const QUuid &id);
|
||||||
void BackgroundImagesZValueChanged();
|
void BackgroundImagesZValueChanged();
|
||||||
void BackgroundImagePositionChanged(const QUuid &id);
|
void BackgroundImagePositionChanged(const QUuid &id);
|
||||||
|
void BackgroundImageOpacityChanged(const QUuid &id);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
virtual void LiteParseTree(const Document &parse)=0;
|
virtual void LiteParseTree(const Document &parse)=0;
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#include "vbackgroundpatternimage.h"
|
#include "vbackgroundpatternimage.h"
|
||||||
|
|
||||||
|
#include "qglobal.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "../vmisc/compatibility.h"
|
#include "../vmisc/compatibility.h"
|
||||||
|
|
||||||
|
@ -310,3 +311,15 @@ void VBackgroundPatternImage::SetVisible(bool newVisible)
|
||||||
{
|
{
|
||||||
m_visible = newVisible;
|
m_visible = newVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VBackgroundPatternImage::Opacity() const -> qreal
|
||||||
|
{
|
||||||
|
return m_opacity;
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VBackgroundPatternImage::SetOpacity(qreal newOpacity)
|
||||||
|
{
|
||||||
|
m_opacity = qBound(0.0, newOpacity, 1.0);
|
||||||
|
}
|
||||||
|
|
|
@ -93,6 +93,9 @@ public:
|
||||||
auto Visible() const -> bool;
|
auto Visible() const -> bool;
|
||||||
void SetVisible(bool newVisible);
|
void SetVisible(bool newVisible);
|
||||||
|
|
||||||
|
auto Opacity() const -> qreal;
|
||||||
|
void SetOpacity(qreal newOpacity);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QUuid m_id{QUuid::createUuid()};
|
QUuid m_id{QUuid::createUuid()};
|
||||||
QString m_contentType{};
|
QString m_contentType{};
|
||||||
|
@ -104,6 +107,7 @@ private:
|
||||||
QTransform m_matrix{};
|
QTransform m_matrix{};
|
||||||
bool m_hold{false};
|
bool m_hold{false};
|
||||||
bool m_visible{true};
|
bool m_visible{true};
|
||||||
|
qreal m_opacity{1.0};
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // VBACKGROUNDPATTERNIMAGE_H
|
#endif // VBACKGROUNDPATTERNIMAGE_H
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vmisc/vmath.h"
|
#include "../vmisc/vmath.h"
|
||||||
#include "../vlayout/vbank.h"
|
#include "../vlayout/vbank.h"
|
||||||
|
#include "qglobal.h"
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(QMarginsF)
|
Q_DECLARE_METATYPE(QMarginsF)
|
||||||
|
|
||||||
|
@ -60,6 +61,8 @@ Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPathsLayout, (QLatin1String("pat
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternKnownMaterials, (QLatin1String("pattern/knownMaterials")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternRememberMaterials, (QLatin1String("pattern/rememberMaterials")))
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingPatternBackgroundImageDefOpacity,
|
||||||
|
(QLatin1String("pattern/backgroundImageDefOpacity")))
|
||||||
|
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutWidth, (QLatin1String("layout/width")))
|
||||||
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting")))
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, settingLayoutSorting, (QLatin1String("layout/sorting")))
|
||||||
|
@ -956,6 +959,18 @@ void VValentinaSettings::SetFinalMeasurementsSearchOptionMatchCase(bool value)
|
||||||
setValue(*settingSearchOptionsFinalMeasurementsMatchCase, value);
|
setValue(*settingSearchOptionsFinalMeasurementsMatchCase, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
int VValentinaSettings::GetBackgroundImageDefOpacity() const
|
||||||
|
{
|
||||||
|
return value(*settingPatternBackgroundImageDefOpacity, 100).toInt();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VValentinaSettings::SetBackgroundImageDefOpacity(int value)
|
||||||
|
{
|
||||||
|
setValue(*settingPatternBackgroundImageDefOpacity, qBound(0, value, 100));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
template<typename T>
|
template<typename T>
|
||||||
T VValentinaSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
T VValentinaSettings::GetCachedValue(T &cache, const QString &setting, T defValue, T valueMin, T valueMax) const
|
||||||
|
|
|
@ -234,6 +234,9 @@ public:
|
||||||
auto GetFinalMeasurementsSearchOptionMatchCase() const ->bool;
|
auto GetFinalMeasurementsSearchOptionMatchCase() const ->bool;
|
||||||
void SetFinalMeasurementsSearchOptionMatchCase(bool value);
|
void SetFinalMeasurementsSearchOptionMatchCase(bool value);
|
||||||
|
|
||||||
|
auto GetBackgroundImageDefOpacity() const -> int;
|
||||||
|
void SetBackgroundImageDefOpacity(int value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VValentinaSettings)
|
Q_DISABLE_COPY(VValentinaSettings)
|
||||||
|
|
||||||
|
|
|
@ -29,12 +29,27 @@
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "../vproperty_p.h"
|
#include "../vproperty_p.h"
|
||||||
|
#include "qstringliteral.h"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, StrMin, (QLatin1String("Min"))) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, StrMax, (QLatin1String("Max"))) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, StrInteger, (QLatin1String("integer"))) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, StrStep, (QLatin1String("Step"))) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, StrSuffix, (QLatin1String("Suffix"))) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, StrPrecision, (QLatin1String("Precision"))) // NOLINT
|
||||||
|
Q_GLOBAL_STATIC_WITH_ARGS(const QString, StrDouble, (QLatin1String("double"))) // NOLINT
|
||||||
|
}
|
||||||
|
|
||||||
const int VPE::VIntegerProperty::StandardMin = -1000000;
|
const int VPE::VIntegerProperty::StandardMin = -1000000;
|
||||||
const int VPE::VIntegerProperty::StandardMax = 1000000;
|
const int VPE::VIntegerProperty::StandardMax = 1000000;
|
||||||
|
|
||||||
VPE::VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings)
|
VPE::VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings)
|
||||||
: VProperty(name, QVariant::Int), minValue(StandardMin), maxValue(StandardMax), singleStep(1.0)
|
: VProperty(name, QVariant::Int),
|
||||||
|
m_minValue(StandardMin),
|
||||||
|
m_maxValue(StandardMax),
|
||||||
|
m_singleStep(1.0)
|
||||||
{
|
{
|
||||||
VProperty::setSettings(settings);
|
VProperty::setSettings(settings);
|
||||||
VProperty::d_ptr->VariantValue.setValue(0);
|
VProperty::d_ptr->VariantValue.setValue(0);
|
||||||
|
@ -42,26 +57,27 @@ VPE::VIntegerProperty::VIntegerProperty(const QString& name, const QMap<QString,
|
||||||
}
|
}
|
||||||
|
|
||||||
VPE::VIntegerProperty::VIntegerProperty(const QString &name)
|
VPE::VIntegerProperty::VIntegerProperty(const QString &name)
|
||||||
: VProperty(name), minValue(StandardMin), maxValue(StandardMax), singleStep(1.0)
|
: VProperty(name), m_minValue(StandardMin), m_maxValue(StandardMax), m_singleStep(1.0)
|
||||||
{
|
{
|
||||||
VProperty::d_ptr->VariantValue.setValue(0);
|
VProperty::d_ptr->VariantValue.setValue(0);
|
||||||
VProperty::d_ptr->VariantValue.convert(QVariant::Int);
|
VProperty::d_ptr->VariantValue.convert(QVariant::Int);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns an editor widget, or NULL if it doesn't supply one
|
//! Returns an editor widget, or NULL if it doesn't supply one
|
||||||
QWidget* VPE::VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
|
auto VPE::VIntegerProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
|
||||||
const QAbstractItemDelegate* delegate)
|
const QAbstractItemDelegate* delegate) -> QWidget*
|
||||||
{
|
{
|
||||||
Q_UNUSED(options)
|
Q_UNUSED(options)
|
||||||
Q_UNUSED(delegate)
|
Q_UNUSED(delegate)
|
||||||
|
|
||||||
QSpinBox* tmpEditor = new QSpinBox(parent);
|
auto* tmpEditor = new QSpinBox(parent);
|
||||||
tmpEditor->setLocale(parent->locale());
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->setMinimum(static_cast<int>(minValue));
|
tmpEditor->setMinimum(static_cast<int>(m_minValue));
|
||||||
tmpEditor->setMaximum(static_cast<int>(maxValue));
|
tmpEditor->setMaximum(static_cast<int>(m_maxValue));
|
||||||
tmpEditor->setSingleStep(static_cast<int>(singleStep));
|
tmpEditor->setSingleStep(static_cast<int>(m_singleStep));
|
||||||
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||||
tmpEditor->setValue(VProperty::d_ptr->VariantValue.toInt());
|
tmpEditor->setValue(VProperty::d_ptr->VariantValue.toInt());
|
||||||
|
tmpEditor->setSuffix(m_suffix);
|
||||||
connect(tmpEditor, QOverload<int>::of(&QSpinBox::valueChanged), this, &VIntegerProperty::valueChanged);
|
connect(tmpEditor, QOverload<int>::of(&QSpinBox::valueChanged), this, &VIntegerProperty::valueChanged);
|
||||||
|
|
||||||
VProperty::d_ptr->editor = tmpEditor;
|
VProperty::d_ptr->editor = tmpEditor;
|
||||||
|
@ -69,62 +85,73 @@ QWidget* VPE::VIntegerProperty::createEditor(QWidget * parent, const QStyleOptio
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Gets the data from the widget
|
//! Gets the data from the widget
|
||||||
QVariant VPE::VIntegerProperty::getEditorData(const QWidget *editor) const
|
auto VPE::VIntegerProperty::getEditorData(const QWidget *editor) const -> QVariant
|
||||||
{
|
{
|
||||||
const QSpinBox* tmpEditor = qobject_cast<const QSpinBox*>(editor);
|
const auto* tmpEditor = qobject_cast<const QSpinBox*>(editor);
|
||||||
if (tmpEditor)
|
if (tmpEditor)
|
||||||
{
|
{
|
||||||
return tmpEditor->value();
|
return tmpEditor->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant(0);
|
return {0};
|
||||||
}
|
}
|
||||||
|
|
||||||
void VPE::VIntegerProperty::setSetting(const QString& key, const QVariant& value)
|
void VPE::VIntegerProperty::setSetting(const QString& key, const QVariant& value)
|
||||||
{
|
{
|
||||||
if (key == QLatin1String("Min"))
|
if (key == *StrMax)
|
||||||
{
|
{
|
||||||
maxValue = value.toInt();
|
m_maxValue = value.toInt();
|
||||||
}
|
}
|
||||||
else if (key == QLatin1String("Max"))
|
else if (key == *StrMin)
|
||||||
{
|
{
|
||||||
minValue = value.toInt();
|
m_minValue = value.toInt();
|
||||||
}
|
}
|
||||||
else if (key == QLatin1String("Step"))
|
else if (key == *StrStep)
|
||||||
{
|
{
|
||||||
singleStep = value.toInt();
|
m_singleStep = value.toInt();
|
||||||
|
}
|
||||||
|
else if (key == *StrSuffix)
|
||||||
|
{
|
||||||
|
m_suffix = value.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant VPE::VIntegerProperty::getSetting(const QString& key) const
|
auto VPE::VIntegerProperty::getSetting(const QString& key) const -> QVariant
|
||||||
{
|
{
|
||||||
if (key == QLatin1String("Min"))
|
if (key == *StrMin)
|
||||||
{
|
{
|
||||||
return minValue;
|
return m_minValue;
|
||||||
}
|
}
|
||||||
if (key == QLatin1String("Max"))
|
|
||||||
|
if (key == *StrMax)
|
||||||
{
|
{
|
||||||
return maxValue;
|
return m_maxValue;
|
||||||
}
|
}
|
||||||
if (key == QLatin1String("Step"))
|
|
||||||
|
if (key == *StrStep)
|
||||||
{
|
{
|
||||||
return singleStep;
|
return m_singleStep;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (key == *StrSuffix)
|
||||||
|
{
|
||||||
|
return m_suffix;
|
||||||
|
}
|
||||||
|
|
||||||
return VProperty::getSetting(key);
|
return VProperty::getSetting(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList VPE::VIntegerProperty::getSettingKeys() const
|
auto VPE::VIntegerProperty::getSettingKeys() const -> QStringList
|
||||||
{
|
{
|
||||||
return (QStringList("Min") << "Max" << "Step");
|
return {*StrMin, *StrMax, *StrStep, *StrSuffix};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VPE::VIntegerProperty::type() const
|
auto VPE::VIntegerProperty::type() const -> QString
|
||||||
{
|
{
|
||||||
return "integer";
|
return *StrInteger;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPE::VProperty* VPE::VIntegerProperty::clone(bool include_children, VProperty* container) const
|
auto VPE::VIntegerProperty::clone(bool include_children, VProperty* container) const -> VPE::VProperty*
|
||||||
{
|
{
|
||||||
return VProperty::clone(include_children, container ? container : new VIntegerProperty(getName()));
|
return VProperty::clone(include_children, container ? container : new VIntegerProperty(getName()));
|
||||||
}
|
}
|
||||||
|
@ -132,23 +159,31 @@ VPE::VProperty* VPE::VIntegerProperty::clone(bool include_children, VProperty* c
|
||||||
void VPE::VIntegerProperty::valueChanged(int i)
|
void VPE::VIntegerProperty::valueChanged(int i)
|
||||||
{
|
{
|
||||||
Q_UNUSED(i)
|
Q_UNUSED(i)
|
||||||
UserChangeEvent *event = new UserChangeEvent();
|
QCoreApplication::postEvent ( VProperty::d_ptr->editor, new UserChangeEvent() );
|
||||||
QCoreApplication::postEvent ( VProperty::d_ptr->editor, event );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int VPE::VDoubleProperty::StandardMin = -1000000;
|
||||||
|
const int VPE::VDoubleProperty::StandardMax = 1000000;
|
||||||
const double VPE::VDoubleProperty::StandardPrecision = 5;
|
const double VPE::VDoubleProperty::StandardPrecision = 5;
|
||||||
|
|
||||||
VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings)
|
VPE::VDoubleProperty::VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings)
|
||||||
: VIntegerProperty(name), Precision(static_cast<int>(StandardPrecision))
|
: VProperty(name, QVariant::Double),
|
||||||
|
m_minValue(StandardMin),
|
||||||
|
m_maxValue(StandardMax),
|
||||||
|
m_singleStep(1.0),
|
||||||
|
m_precision(static_cast<int>(StandardPrecision))
|
||||||
{
|
{
|
||||||
VProperty::setSettings(settings);
|
VProperty::setSettings(settings);
|
||||||
VProperty::d_ptr->VariantValue.setValue(0);
|
VProperty::d_ptr->VariantValue.setValue(0);
|
||||||
VProperty::d_ptr->VariantValue.convert(QVariant::Double);
|
VProperty::d_ptr->VariantValue.convert(QVariant::Double);
|
||||||
VProperty::d_ptr->PropertyVariantType = QVariant::Double;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VPE::VDoubleProperty::VDoubleProperty(const QString &name)
|
VPE::VDoubleProperty::VDoubleProperty(const QString &name)
|
||||||
: VIntegerProperty(name), Precision(static_cast<int>(StandardPrecision))
|
: VProperty(name),
|
||||||
|
m_minValue(StandardMin),
|
||||||
|
m_maxValue(StandardMax),
|
||||||
|
m_singleStep(1.0),
|
||||||
|
m_precision(static_cast<int>(StandardPrecision))
|
||||||
{
|
{
|
||||||
VProperty::d_ptr->VariantValue.setValue(0);
|
VProperty::d_ptr->VariantValue.setValue(0);
|
||||||
VProperty::d_ptr->VariantValue.convert(QVariant::Double);
|
VProperty::d_ptr->VariantValue.convert(QVariant::Double);
|
||||||
|
@ -156,90 +191,109 @@ VPE::VDoubleProperty::VDoubleProperty(const QString &name)
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Returns an editor widget, or NULL if it doesn't supply one
|
//! Returns an editor widget, or NULL if it doesn't supply one
|
||||||
QWidget* VPE::VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
|
auto VPE::VDoubleProperty::createEditor(QWidget * parent, const QStyleOptionViewItem& options,
|
||||||
const QAbstractItemDelegate* delegate)
|
const QAbstractItemDelegate* delegate) -> QWidget*
|
||||||
{
|
{
|
||||||
Q_UNUSED(options)
|
Q_UNUSED(options)
|
||||||
Q_UNUSED(delegate)
|
Q_UNUSED(delegate)
|
||||||
QDoubleSpinBox* tmpEditor = new QDoubleSpinBox(parent);
|
auto* tmpEditor = new QDoubleSpinBox(parent);
|
||||||
tmpEditor->setLocale(parent->locale());
|
tmpEditor->setLocale(parent->locale());
|
||||||
tmpEditor->setMinimum(minValue);
|
tmpEditor->setMinimum(m_minValue);
|
||||||
tmpEditor->setMaximum(maxValue);
|
tmpEditor->setMaximum(m_maxValue);
|
||||||
tmpEditor->setDecimals(Precision);
|
tmpEditor->setDecimals(m_precision);
|
||||||
tmpEditor->setSingleStep(singleStep);
|
tmpEditor->setSingleStep(m_singleStep);
|
||||||
|
tmpEditor->setSuffix(m_suffix);
|
||||||
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
tmpEditor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
|
||||||
tmpEditor->setValue(VProperty::d_ptr->VariantValue.toDouble());
|
tmpEditor->setValue(VProperty::d_ptr->VariantValue.toDouble());
|
||||||
connect(tmpEditor, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &VIntegerProperty::valueChanged);
|
connect(tmpEditor, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &VDoubleProperty::valueChanged);
|
||||||
|
|
||||||
VProperty::d_ptr->editor = tmpEditor;
|
VProperty::d_ptr->editor = tmpEditor;
|
||||||
return VProperty::d_ptr->editor;
|
return VProperty::d_ptr->editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Gets the data from the widget
|
//! Gets the data from the widget
|
||||||
QVariant VPE::VDoubleProperty::getEditorData(const QWidget *editor) const
|
auto VPE::VDoubleProperty::getEditorData(const QWidget *editor) const -> QVariant
|
||||||
{
|
{
|
||||||
const QDoubleSpinBox* tmpEditor = qobject_cast<const QDoubleSpinBox*>(editor);
|
const auto* tmpEditor = qobject_cast<const QDoubleSpinBox*>(editor);
|
||||||
if (tmpEditor)
|
if (tmpEditor)
|
||||||
{
|
{
|
||||||
return tmpEditor->value();
|
return tmpEditor->value();
|
||||||
}
|
}
|
||||||
|
|
||||||
return QVariant(0);
|
return {0};
|
||||||
}
|
}
|
||||||
|
|
||||||
void VPE::VDoubleProperty::setSetting(const QString& key, const QVariant& value)
|
void VPE::VDoubleProperty::setSetting(const QString& key, const QVariant& value)
|
||||||
{
|
{
|
||||||
if (key == QLatin1String("Min"))
|
if (key == *StrMin)
|
||||||
{
|
{
|
||||||
minValue = value.toDouble();
|
m_minValue = value.toDouble();
|
||||||
}
|
}
|
||||||
else if (key == QLatin1String("Max"))
|
else if (key == *StrMax)
|
||||||
{
|
{
|
||||||
maxValue = value.toDouble();
|
m_maxValue = value.toDouble();
|
||||||
}
|
}
|
||||||
else if (key == QLatin1String("Step"))
|
else if (key == *StrStep)
|
||||||
{
|
{
|
||||||
singleStep = value.toDouble();
|
m_singleStep = value.toDouble();
|
||||||
}
|
}
|
||||||
else if (key == QLatin1String("Precision"))
|
else if (key == *StrSuffix)
|
||||||
{
|
{
|
||||||
Precision = value.toInt();
|
m_suffix = value.toString();
|
||||||
|
}
|
||||||
|
else if (key == *StrPrecision)
|
||||||
|
{
|
||||||
|
m_precision = value.toInt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant VPE::VDoubleProperty::getSetting(const QString& key) const
|
auto VPE::VDoubleProperty::getSetting(const QString& key) const -> QVariant
|
||||||
{
|
{
|
||||||
if (key == QLatin1String("Min"))
|
if (key == *StrMin)
|
||||||
{
|
{
|
||||||
return minValue;
|
return m_minValue;
|
||||||
}
|
}
|
||||||
if (key == QLatin1String("Max"))
|
|
||||||
|
if (key == *StrMax)
|
||||||
{
|
{
|
||||||
return maxValue;
|
return m_maxValue;
|
||||||
}
|
}
|
||||||
if (key == QLatin1String("Step"))
|
|
||||||
|
if (key == *StrStep)
|
||||||
{
|
{
|
||||||
return singleStep;
|
return m_singleStep;
|
||||||
}
|
}
|
||||||
if (key == QLatin1String("Precision"))
|
|
||||||
|
if (key == *StrSuffix)
|
||||||
{
|
{
|
||||||
return Precision;
|
return m_suffix;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
if (key == *StrPrecision)
|
||||||
|
{
|
||||||
|
return m_precision;
|
||||||
|
}
|
||||||
|
|
||||||
return VProperty::getSetting(key);
|
return VProperty::getSetting(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList VPE::VDoubleProperty::getSettingKeys() const
|
auto VPE::VDoubleProperty::getSettingKeys() const -> QStringList
|
||||||
{
|
{
|
||||||
return (QStringList("Min") << "Max" << "Step" << "Precision");
|
return {*StrMin, *StrMax, *StrStep, *StrSuffix, *StrPrecision};
|
||||||
}
|
}
|
||||||
|
|
||||||
QString VPE::VDoubleProperty::type() const
|
auto VPE::VDoubleProperty::type() const -> QString
|
||||||
{
|
{
|
||||||
return "double";
|
return *StrDouble;
|
||||||
}
|
}
|
||||||
|
|
||||||
VPE::VProperty* VPE::VDoubleProperty::clone(bool include_children, VProperty* container) const
|
auto VPE::VDoubleProperty::clone(bool include_children, VProperty* container) const -> VPE::VProperty*
|
||||||
{
|
{
|
||||||
return VIntegerProperty::clone(include_children, container ? container : new VDoubleProperty(getName()));
|
return VProperty::clone(include_children, container ? container : new VDoubleProperty(getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void VPE::VDoubleProperty::valueChanged(int i)
|
||||||
|
{
|
||||||
|
Q_UNUSED(i)
|
||||||
|
QCoreApplication::postEvent ( VProperty::d_ptr->editor, new UserChangeEvent() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,14 +21,11 @@
|
||||||
#ifndef VNUMBERPROPERTY_H
|
#ifndef VNUMBERPROPERTY_H
|
||||||
#define VNUMBERPROPERTY_H
|
#define VNUMBERPROPERTY_H
|
||||||
|
|
||||||
#include <qcompilerdetection.h>
|
|
||||||
#include <stddef.h>
|
|
||||||
#include <QMap>
|
#include <QMap>
|
||||||
#include <QMetaObject>
|
#include <QMetaObject>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QStyleOptionViewItem>
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
@ -44,7 +41,7 @@ QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
|
||||||
//! Class for holding an integer property
|
//! Class for holding an integer property
|
||||||
class VPROPERTYEXPLORERSHARED_EXPORT VIntegerProperty : public VProperty
|
class VPROPERTYEXPLORERSHARED_EXPORT VIntegerProperty : public VProperty
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT // NOLINT
|
||||||
public:
|
public:
|
||||||
VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings);
|
VIntegerProperty(const QString& name, const QMap<QString, QVariant>& settings);
|
||||||
|
|
||||||
|
@ -55,51 +52,55 @@ public:
|
||||||
//! \options Render options
|
//! \options Render options
|
||||||
//! \delegate A pointer to the QAbstractItemDelegate requesting the editor. This can be used to connect signals and
|
//! \delegate A pointer to the QAbstractItemDelegate requesting the editor. This can be used to connect signals and
|
||||||
//! slots.
|
//! slots.
|
||||||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& options,
|
auto createEditor(QWidget* parent, const QStyleOptionViewItem& options,
|
||||||
const QAbstractItemDelegate* delegate) override;
|
const QAbstractItemDelegate* delegate) -> QWidget* override;
|
||||||
|
|
||||||
//! Gets the data from the widget
|
//! Gets the data from the widget
|
||||||
virtual QVariant getEditorData(const QWidget* editor) const override;
|
auto getEditorData(const QWidget* editor) const -> QVariant override;
|
||||||
|
|
||||||
//! Sets the settings. Available settings:
|
//! Sets the settings. Available settings:
|
||||||
//!
|
//!
|
||||||
//! key: "Min" - value: Minimum number as integer
|
//! key: "Min" - value: Minimum number as integer
|
||||||
//! key: "Max" - value: Maximum number as integer
|
//! key: "Max" - value: Maximum number as integer
|
||||||
virtual void setSetting(const QString& key, const QVariant& value) override;
|
//! key: "Step" - value: Increment step
|
||||||
|
//! key: "Suffix" - value: Editor's suffix
|
||||||
|
void setSetting(const QString& key, const QVariant& value) override;
|
||||||
|
|
||||||
//! Get the settings. This function has to be implemented in a subclass in order to have an effect
|
//! Get the settings. This function has to be implemented in a subclass in order to have an effect
|
||||||
virtual QVariant getSetting(const QString& key) const override;
|
auto getSetting(const QString& key) const -> QVariant override;
|
||||||
|
|
||||||
//! Returns the list of keys of the property's settings
|
//! Returns the list of keys of the property's settings
|
||||||
virtual QStringList getSettingKeys() const override;
|
auto getSettingKeys() const -> QStringList override;
|
||||||
|
|
||||||
//! Returns a string containing the type of the property
|
//! Returns a string containing the type of the property
|
||||||
virtual QString type() const override;
|
auto type() const -> QString override;
|
||||||
|
|
||||||
//! Clones this property
|
//! Clones this property
|
||||||
//! \param include_children Indicates whether to also clone the children
|
//! \param include_children Indicates whether to also clone the children
|
||||||
//! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
|
//! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
|
||||||
//! to fill all the data into container. This can also be used when subclassing this function.
|
//! to fill all the data into container. This can also be used when subclassing this function.
|
||||||
//! \return Returns the newly created property (or container, if it was not NULL)
|
//! \return Returns the newly created property (or container, if it was not NULL)
|
||||||
Q_REQUIRED_RESULT virtual VProperty* clone(bool include_children = true,
|
Q_REQUIRED_RESULT auto clone(bool include_children = true,
|
||||||
VProperty* container = nullptr) const override;
|
VProperty* container = nullptr) const -> VProperty* override;
|
||||||
public slots:
|
public slots:
|
||||||
void valueChanged(int i);
|
void valueChanged(int i);
|
||||||
protected:
|
private:
|
||||||
double minValue, maxValue, singleStep;
|
Q_DISABLE_COPY(VIntegerProperty) // NOLINT
|
||||||
|
|
||||||
|
double m_minValue;
|
||||||
|
double m_maxValue;
|
||||||
|
double m_singleStep;
|
||||||
|
QString m_suffix{};
|
||||||
|
|
||||||
static const int StandardMin;// = -1000000;
|
static const int StandardMin;// = -1000000;
|
||||||
static const int StandardMax;// = 1000000;
|
static const int StandardMax;// = 1000000;
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(VIntegerProperty)
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//! Class for holding a double property
|
//! Class for holding a double property
|
||||||
class VPROPERTYEXPLORERSHARED_EXPORT VDoubleProperty : public VIntegerProperty
|
class VPROPERTYEXPLORERSHARED_EXPORT VDoubleProperty : public VProperty
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT // NOLINT
|
||||||
public:
|
public:
|
||||||
VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings);
|
VDoubleProperty(const QString& name, const QMap<QString, QVariant>& settings);
|
||||||
|
|
||||||
|
@ -110,46 +111,58 @@ public:
|
||||||
//! \options Render options
|
//! \options Render options
|
||||||
//! \delegate A pointer to the QAbstractItemDelegate requesting the editor. This can be used to connect signals and
|
//! \delegate A pointer to the QAbstractItemDelegate requesting the editor. This can be used to connect signals and
|
||||||
//! slots.
|
//! slots.
|
||||||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& options,
|
auto createEditor(QWidget* parent, const QStyleOptionViewItem& options,
|
||||||
const QAbstractItemDelegate* delegate) override;
|
const QAbstractItemDelegate* delegate) -> QWidget* override;
|
||||||
|
|
||||||
//! Gets the data from the widget
|
//! Gets the data from the widget
|
||||||
virtual QVariant getEditorData(const QWidget* editor) const override;
|
auto getEditorData(const QWidget* editor) const -> QVariant override;
|
||||||
|
|
||||||
//! Sets the settings. Available settings:
|
//! Sets the settings. Available settings:
|
||||||
//!
|
//!
|
||||||
//! key: "Min" - value: Minimum number as integer
|
//! key: "Min" - value: Minimum number as integer
|
||||||
//! key: "Max" - value: Maximum number as integer
|
//! key: "Max" - value: Maximum number as integer
|
||||||
virtual void setSetting(const QString& key, const QVariant& value) override;
|
//! key: "Step" - value: Increment step
|
||||||
|
//! key: "Suffix" - value: Editor's suffix
|
||||||
|
//! key: "Precision" - value: Number of decimals after the decimal point
|
||||||
|
void setSetting(const QString& key, const QVariant& value) override;
|
||||||
|
|
||||||
//! Get the settings. This function has to be implemented in a subclass in order to have an effect
|
//! Get the settings. This function has to be implemented in a subclass in order to have an effect
|
||||||
virtual QVariant getSetting(const QString& key) const override;
|
auto getSetting(const QString& key) const -> QVariant override;
|
||||||
|
|
||||||
//! Returns the list of keys of the property's settings
|
//! Returns the list of keys of the property's settings
|
||||||
virtual QStringList getSettingKeys() const override;
|
auto getSettingKeys() const -> QStringList override;
|
||||||
|
|
||||||
//! Returns a string containing the type of the property
|
//! Returns a string containing the type of the property
|
||||||
virtual QString type() const override;
|
auto type() const -> QString override;
|
||||||
|
|
||||||
//! Clones this property
|
//! Clones this property
|
||||||
//! \param include_children Indicates whether to also clone the children
|
//! \param include_children Indicates whether to also clone the children
|
||||||
//! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
|
//! \param container If a property is being passed here, no new VProperty is being created but instead it is tried
|
||||||
//! to fill all the data into container. This can also be used when subclassing this function.
|
//! to fill all the data into container. This can also be used when subclassing this function.
|
||||||
//! \return Returns the newly created property (or container, if it was not NULL)
|
//! \return Returns the newly created property (or container, if it was not NULL)
|
||||||
virtual VProperty* clone(bool include_children = true, VProperty* container = NULL) const override;
|
auto clone(bool include_children = true, VProperty* container = nullptr) const -> VProperty* override;
|
||||||
|
|
||||||
protected:
|
public slots:
|
||||||
//! Number of decimals after the decimal point
|
void valueChanged(int i);
|
||||||
int Precision;
|
|
||||||
|
|
||||||
const static double StandardPrecision;// = 5;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Q_DISABLE_COPY(VDoubleProperty)
|
Q_DISABLE_COPY(VDoubleProperty)
|
||||||
|
|
||||||
|
double m_minValue;
|
||||||
|
double m_maxValue;
|
||||||
|
double m_singleStep;
|
||||||
|
QString m_suffix{};
|
||||||
|
|
||||||
|
//! Number of decimals after the decimal point
|
||||||
|
int m_precision;
|
||||||
|
|
||||||
|
static const int StandardMin;// = -1000000;
|
||||||
|
static const int StandardMax;// = 1000000;
|
||||||
|
const static double StandardPrecision;// = 5;
|
||||||
};
|
};
|
||||||
|
|
||||||
QT_WARNING_POP
|
QT_WARNING_POP
|
||||||
|
|
||||||
}
|
} // namespace VPE
|
||||||
|
|
||||||
#endif // VNUMBERPROPERTY_H
|
#endif // VNUMBERPROPERTY_H
|
||||||
|
|
|
@ -38,6 +38,7 @@
|
||||||
#include "../../undocommands/image/renamebackgroundimage.h"
|
#include "../../undocommands/image/renamebackgroundimage.h"
|
||||||
#include "../../undocommands/image/hidebackgroundimage.h"
|
#include "../../undocommands/image/hidebackgroundimage.h"
|
||||||
#include "../../undocommands/image/resetbackgroundimage.h"
|
#include "../../undocommands/image/resetbackgroundimage.h"
|
||||||
|
#include "../../undocommands/image/opaquebackgroundimage.h"
|
||||||
#include "../toolsdef.h"
|
#include "../toolsdef.h"
|
||||||
|
|
||||||
#include <QUndoStack>
|
#include <QUndoStack>
|
||||||
|
@ -69,6 +70,7 @@ VBackgroundImageItem::VBackgroundImageItem(const VBackgroundPatternImage &image,
|
||||||
&VBackgroundImageItem::UpdateVisibilityState);
|
&VBackgroundImageItem::UpdateVisibilityState);
|
||||||
connect(doc, &VAbstractPattern::BackgroundImagesZValueChanged, this, &VBackgroundImageItem::ZValueChanged);
|
connect(doc, &VAbstractPattern::BackgroundImagesZValueChanged, this, &VBackgroundImageItem::ZValueChanged);
|
||||||
connect(doc, &VAbstractPattern::BackgroundImagePositionChanged, this, &VBackgroundImageItem::PositionChanged);
|
connect(doc, &VAbstractPattern::BackgroundImagePositionChanged, this, &VBackgroundImageItem::PositionChanged);
|
||||||
|
connect(doc, &VAbstractPattern::BackgroundImageOpacityChanged, this, &VBackgroundImageItem::OpacityChanged);
|
||||||
|
|
||||||
InitImage();
|
InitImage();
|
||||||
}
|
}
|
||||||
|
@ -130,6 +132,18 @@ void VBackgroundImageItem::SetVisible(bool visible)
|
||||||
VAbstractApplication::VApp()->getUndoStack()->push(new HideBackgroundImage(m_image.Id(), not visible, m_doc));
|
VAbstractApplication::VApp()->getUndoStack()->push(new HideBackgroundImage(m_image.Id(), not visible, m_doc));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
auto VBackgroundImageItem::GetOpacity() const -> qreal
|
||||||
|
{
|
||||||
|
return m_image.Opacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VBackgroundImageItem::SetOpacity(qreal opacity)
|
||||||
|
{
|
||||||
|
VAbstractApplication::VApp()->getUndoStack()->push(new OpaqueBackgroundImage(m_image.Id(), opacity, m_doc));
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VBackgroundImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
void VBackgroundImageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
@ -196,6 +210,18 @@ void VBackgroundImageItem::HoldChanged(QUuid id)
|
||||||
UpdateHoldState();
|
UpdateHoldState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VBackgroundImageItem::OpacityChanged(const QUuid &id)
|
||||||
|
{
|
||||||
|
if (m_image.Id() != id)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_image = m_doc->GetBackgroundImage(m_image.Id());
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VBackgroundImageItem::VisibilityChanged(QUuid id)
|
void VBackgroundImageItem::VisibilityChanged(QUuid id)
|
||||||
{
|
{
|
||||||
|
|
|
@ -63,6 +63,9 @@ public:
|
||||||
auto IsVisible() const -> bool;
|
auto IsVisible() const -> bool;
|
||||||
void SetVisible(bool visible);
|
void SetVisible(bool visible);
|
||||||
|
|
||||||
|
auto GetOpacity() const -> qreal;
|
||||||
|
void SetOpacity(qreal opacity);
|
||||||
|
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -77,6 +80,7 @@ public slots:
|
||||||
void PositionChanged(QUuid id);
|
void PositionChanged(QUuid id);
|
||||||
void ImageTransformationChanged(QUuid id);
|
void ImageTransformationChanged(QUuid id);
|
||||||
void HoldChanged(QUuid id);
|
void HoldChanged(QUuid id);
|
||||||
|
void OpacityChanged(const QUuid &id);
|
||||||
void VisibilityChanged(QUuid id);
|
void VisibilityChanged(QUuid id);
|
||||||
void NameChanged(QUuid id);
|
void NameChanged(QUuid id);
|
||||||
void EnableSelection(bool enable);
|
void EnableSelection(bool enable);
|
||||||
|
|
|
@ -93,6 +93,7 @@ void VBackgroundPixmapItem::paint(QPainter *painter, const QStyleOptionGraphicsI
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setTransform(Image().Matrix(), true);
|
painter->setTransform(Image().Matrix(), true);
|
||||||
|
painter->setOpacity(Image().Opacity());
|
||||||
|
|
||||||
painter->drawPixmap(QPointF(), Pixmap());
|
painter->drawPixmap(QPointF(), Pixmap());
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ void VBackgroundSVGItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
|
||||||
|
|
||||||
painter->save();
|
painter->save();
|
||||||
painter->setTransform(Image().Matrix(), true);
|
painter->setTransform(Image().Matrix(), true);
|
||||||
|
painter->setOpacity(Image().Opacity());
|
||||||
|
|
||||||
renderer->render(painter, QRectF(QPointF(0, 0), renderer->defaultSize()));
|
renderer->render(painter, QRectF(QPointF(0, 0), renderer->defaultSize()));
|
||||||
|
|
||||||
|
|
68
src/libs/vtools/undocommands/image/opaquebackgroundimage.cpp
Normal file
68
src/libs/vtools/undocommands/image/opaquebackgroundimage.cpp
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file opaquebackgroundimage.cpp
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 3 2, 2022
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2022 Valentina project
|
||||||
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#include "opaquebackgroundimage.h"
|
||||||
|
#include "../ifc/xml/vbackgroundpatternimage.h"
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
OpaqueBackgroundImage::OpaqueBackgroundImage(QUuid id, qreal opacity, VAbstractPattern *doc, QUndoCommand *parent)
|
||||||
|
: VUndoCommand(QDomElement(), doc, parent),
|
||||||
|
m_id(id),
|
||||||
|
m_opacity(opacity)
|
||||||
|
{
|
||||||
|
setText(tr("change a background image opacity"));
|
||||||
|
|
||||||
|
VBackgroundPatternImage image = doc->GetBackgroundImage(m_id);
|
||||||
|
|
||||||
|
m_oldOpacity = image.Opacity();
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void OpaqueBackgroundImage::undo()
|
||||||
|
{
|
||||||
|
VBackgroundPatternImage image = doc->GetBackgroundImage(m_id);
|
||||||
|
|
||||||
|
if (not image.IsNull())
|
||||||
|
{
|
||||||
|
image.SetOpacity(m_oldOpacity);
|
||||||
|
doc->SaveBackgroundImage(image);
|
||||||
|
emit doc->BackgroundImageOpacityChanged(m_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void OpaqueBackgroundImage::redo()
|
||||||
|
{
|
||||||
|
VBackgroundPatternImage image = doc->GetBackgroundImage(m_id);
|
||||||
|
|
||||||
|
if (not image.IsNull())
|
||||||
|
{
|
||||||
|
image.SetOpacity(m_opacity);
|
||||||
|
doc->SaveBackgroundImage(image);
|
||||||
|
emit doc->BackgroundImageOpacityChanged(m_id);
|
||||||
|
}
|
||||||
|
}
|
51
src/libs/vtools/undocommands/image/opaquebackgroundimage.h
Normal file
51
src/libs/vtools/undocommands/image/opaquebackgroundimage.h
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
/************************************************************************
|
||||||
|
**
|
||||||
|
** @file opaquebackgroundimage.h
|
||||||
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||||
|
** @date 3 2, 2022
|
||||||
|
**
|
||||||
|
** @brief
|
||||||
|
** @copyright
|
||||||
|
** This source code is part of the Valentina project, a pattern making
|
||||||
|
** program, whose allow create and modeling patterns of clothing.
|
||||||
|
** Copyright (C) 2022 Valentina project
|
||||||
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
||||||
|
**
|
||||||
|
** Valentina is free software: you can redistribute it and/or modify
|
||||||
|
** it under the terms of the GNU General Public License as published by
|
||||||
|
** the Free Software Foundation, either version 3 of the License, or
|
||||||
|
** (at your option) any later version.
|
||||||
|
**
|
||||||
|
** Valentina is distributed in the hope that it will be useful,
|
||||||
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
** GNU General Public License for more details.
|
||||||
|
**
|
||||||
|
** You should have received a copy of the GNU General Public License
|
||||||
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
**
|
||||||
|
*************************************************************************/
|
||||||
|
#ifndef OPAQUEBACKGROUNDIMAGE_H
|
||||||
|
#define OPAQUEBACKGROUNDIMAGE_H
|
||||||
|
|
||||||
|
#include "../vundocommand.h"
|
||||||
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
|
#include "../vmisc/defglobal.h"
|
||||||
|
#endif // QT_VERSION < QT_VERSION_CHECK(5, 13, 0)
|
||||||
|
|
||||||
|
class OpaqueBackgroundImage : public VUndoCommand
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
OpaqueBackgroundImage(QUuid id, qreal opacity, VAbstractPattern *doc, QUndoCommand *parent = nullptr);
|
||||||
|
~OpaqueBackgroundImage() override =default;
|
||||||
|
void undo() override;
|
||||||
|
void redo() override;
|
||||||
|
private:
|
||||||
|
Q_DISABLE_COPY_MOVE(OpaqueBackgroundImage)
|
||||||
|
QUuid m_id;
|
||||||
|
qreal m_opacity;
|
||||||
|
qreal m_oldOpacity{1.0};
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // OPAQUEBACKGROUNDIMAGE_H
|
|
@ -11,6 +11,7 @@ HEADERS += \
|
||||||
$$PWD/image/holdallbackgroundimages.h \
|
$$PWD/image/holdallbackgroundimages.h \
|
||||||
$$PWD/image/holdbackgroundimage.h \
|
$$PWD/image/holdbackgroundimage.h \
|
||||||
$$PWD/image/movebackgroundimage.h \
|
$$PWD/image/movebackgroundimage.h \
|
||||||
|
$$PWD/image/opaquebackgroundimage.h \
|
||||||
$$PWD/image/renamebackgroundimage.h \
|
$$PWD/image/renamebackgroundimage.h \
|
||||||
$$PWD/image/resetbackgroundimage.h \
|
$$PWD/image/resetbackgroundimage.h \
|
||||||
$$PWD/image/rotatebackgroundimage.h \
|
$$PWD/image/rotatebackgroundimage.h \
|
||||||
|
@ -50,6 +51,7 @@ SOURCES += \
|
||||||
$$PWD/image/holdallbackgroundimages.cpp \
|
$$PWD/image/holdallbackgroundimages.cpp \
|
||||||
$$PWD/image/holdbackgroundimage.cpp \
|
$$PWD/image/holdbackgroundimage.cpp \
|
||||||
$$PWD/image/movebackgroundimage.cpp \
|
$$PWD/image/movebackgroundimage.cpp \
|
||||||
|
$$PWD/image/opaquebackgroundimage.cpp \
|
||||||
$$PWD/image/renamebackgroundimage.cpp \
|
$$PWD/image/renamebackgroundimage.cpp \
|
||||||
$$PWD/image/resetbackgroundimage.cpp \
|
$$PWD/image/resetbackgroundimage.cpp \
|
||||||
$$PWD/image/rotatebackgroundimage.cpp \
|
$$PWD/image/rotatebackgroundimage.cpp \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user