Lupdate warnings.
Lupdate lacks of some features to support all C++ valid declarations. --HG-- branch : develop
This commit is contained in:
parent
fe32cb133b
commit
c802df2b73
|
@ -568,7 +568,8 @@ template<class Tool>
|
|||
void VToolOptionsPropertyBrowser::AddPropertyCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
VPE::VEnumProperty* itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("First point") << tr("Second point"));
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("First point"),
|
||||
VToolOptionsPropertyBrowser::tr("Second point")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetCrossCirclesPoint())-1);
|
||||
AddProperty(itemProperty, AttrCrossPoint);
|
||||
}
|
||||
|
@ -578,7 +579,8 @@ template<class Tool>
|
|||
void VToolOptionsPropertyBrowser::AddPropertyVCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("Highest point") << tr("Lowest point"));
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("Highest point"),
|
||||
VToolOptionsPropertyBrowser::tr("Lowest point")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetVCrossPoint())-1);
|
||||
AddProperty(itemProperty, AttrVCrossPoint);
|
||||
}
|
||||
|
@ -588,7 +590,8 @@ template<class Tool>
|
|||
void VToolOptionsPropertyBrowser::AddPropertyHCrossPoint(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("Leftmost point") << tr("Rightmost point"));
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("Leftmost point"),
|
||||
VToolOptionsPropertyBrowser::tr("Rightmost point")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetHCrossPoint())-1);
|
||||
AddProperty(itemProperty, AttrHCrossPoint);
|
||||
}
|
||||
|
@ -598,7 +601,8 @@ template<class Tool>
|
|||
void VToolOptionsPropertyBrowser::AddPropertyAxisType(Tool *i, const QString &propertyName)
|
||||
{
|
||||
auto itemProperty = new VPE::VEnumProperty(propertyName);
|
||||
itemProperty->setLiterals(QStringList()<< tr("Vertical axis") << tr("Horizontal axis"));
|
||||
itemProperty->setLiterals(QStringList({VToolOptionsPropertyBrowser::tr("Vertical axis"),
|
||||
VToolOptionsPropertyBrowser::tr("Horizontal axis")}));
|
||||
itemProperty->setValue(static_cast<int>(i->GetAxisType())-1);
|
||||
AddProperty(itemProperty, AttrAxisType);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <QMargins>
|
||||
|
||||
#include "vabstractlayoutdialog.h"
|
||||
#include "../vlayout/vbank.h"
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
|
@ -40,7 +41,6 @@ namespace Ui
|
|||
}
|
||||
|
||||
class VLayoutGenerator;
|
||||
enum class Cases : char;
|
||||
|
||||
class DialogLayoutSettings : public VAbstractLayoutDialog
|
||||
{
|
||||
|
|
|
@ -31,9 +31,7 @@
|
|||
|
||||
#include "../vmisc/def.h"
|
||||
#include "../core/vapplication.h"
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QItemDelegate>
|
||||
#include "../vwidgets/vcomboboxdelegate.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
|
@ -56,67 +54,6 @@ QStringList PrepareKnowMaterials(const QStringList &patternMaterials, bool remem
|
|||
}
|
||||
}
|
||||
|
||||
class VComboBoxDelegate : public QItemDelegate
|
||||
{
|
||||
public:
|
||||
VComboBoxDelegate(const QStringList &items, QObject *parent = nullptr)
|
||||
: QItemDelegate(parent),
|
||||
m_items(items)
|
||||
{
|
||||
m_items.prepend(QLatin1String("--") + tr("Select material") + QLatin1String("--"));
|
||||
}
|
||||
|
||||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(index)
|
||||
|
||||
QComboBox *editor = new QComboBox(parent);
|
||||
editor->addItems(m_items);
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override
|
||||
{
|
||||
const QString value = index.model()->data(index, Qt::EditRole).toString();
|
||||
|
||||
QComboBox *comboBox = static_cast<QComboBox*>(editor);
|
||||
const int cIndex = comboBox->findText(value);
|
||||
|
||||
if (cIndex != -1)
|
||||
{
|
||||
comboBox->setCurrentIndex(cIndex);
|
||||
}
|
||||
}
|
||||
|
||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const override
|
||||
{
|
||||
QComboBox *comboBox = static_cast<QComboBox*>(editor);
|
||||
QString value;
|
||||
const int cIndex = comboBox->currentIndex();
|
||||
|
||||
if (cIndex > 0)
|
||||
{
|
||||
value = comboBox->currentText();
|
||||
}
|
||||
|
||||
model->setData(index, value, Qt::EditRole);
|
||||
}
|
||||
|
||||
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
||||
private:
|
||||
Q_DISABLE_COPY(VComboBoxDelegate)
|
||||
QStringList m_items;
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DialogPatternMaterials::DialogPatternMaterials(const QMap<int, QString> &list, bool rememberPM, QWidget *parent)
|
||||
: QDialog(parent),
|
||||
|
|
|
@ -2212,10 +2212,10 @@ void MainWindow::MouseMove(const QPointF &scenePos)
|
|||
{
|
||||
if (not m_mouseCoordinate.isNull())
|
||||
{
|
||||
//: Coords in status line: "X, Y (units)"
|
||||
m_mouseCoordinate->setText(QString("%1, %2 (%3)").arg(static_cast<qint32>(qApp->fromPixel(scenePos.x())))
|
||||
.arg(static_cast<qint32>(qApp->fromPixel(scenePos.y())))
|
||||
.arg(UnitsToStr(qApp->patternUnit(), true)));
|
||||
m_mouseCoordinate->setText(QStringLiteral("%1, %2 (%3)")
|
||||
.arg(static_cast<qint32>(qApp->fromPixel(scenePos.x())))
|
||||
.arg(static_cast<qint32>(qApp->fromPixel(scenePos.y())))
|
||||
.arg(UnitsToStr(qApp->patternUnit(), true)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -77,8 +77,7 @@ QString VAbstractConverter::Convert()
|
|||
}
|
||||
else
|
||||
{
|
||||
const QString errorMsg(tr("Error openning a temp file: %1.").arg(m_tmpFile.errorString()));
|
||||
throw VException(errorMsg);
|
||||
throw VException(tr("Error openning a temp file: %1.").arg(m_tmpFile.errorString()));
|
||||
}
|
||||
|
||||
m_ver < MaxVer() ? ApplyPatches() : DowngradeToCurrentMaxVersion();
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
|
||||
#include "vdomdocument.h"
|
||||
|
||||
template <class Key, class T> class QMap;
|
||||
|
||||
#define FORMAT_VERSION(major, minor, patch) ((major<<16)|(minor<<8)|(patch))
|
||||
|
||||
class VAbstractConverter :public VDomDocument
|
||||
|
|
|
@ -1009,7 +1009,7 @@ QVector<QPointF> VAbstractPiece::Equidistant(QVector<VSAPoint> points, qreal wid
|
|||
points = CorrectEquidistantPoints(points);
|
||||
if ( points.size() < 3 )
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
|
||||
const QString errorMsg = tr("Piece '%1'. Not enough points to build seam allowance.").arg(name);
|
||||
qApp->IsPedantic() ? throw VException(errorMsg) : qWarning() << errorMsg;
|
||||
return QVector<QPointF>();
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include <QSharedDataPointer>
|
||||
#include <QPointF>
|
||||
#include <QDebug>
|
||||
#include <QCoreApplication>
|
||||
|
||||
#include "../vmisc/diagnostic.h"
|
||||
#include "../vmisc/def.h"
|
||||
|
@ -44,11 +45,10 @@ class VAbstractPieceData;
|
|||
class QPainterPath;
|
||||
class VGrainlineData;
|
||||
class VContainer;
|
||||
enum class LayoutGravity : qint8;
|
||||
enum class CuttingTime : unsigned char;
|
||||
|
||||
class VAbstractPiece
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VAbstractPiece)
|
||||
public:
|
||||
VAbstractPiece();
|
||||
VAbstractPiece(const VAbstractPiece &piece);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
|
||||
#include "vabstractpiece.h"
|
||||
#include "../vmisc/typedef.h"
|
||||
#include "../vpatterndb/floatItemData/floatitemdef.h"
|
||||
|
||||
class VLayoutPieceData;
|
||||
class VLayoutPiecePath;
|
||||
|
@ -54,7 +55,6 @@ class VPiece;
|
|||
class VPieceLabelData;
|
||||
class VAbstractPattern;
|
||||
class VPatternLabelData;
|
||||
enum class ArrowType : char;
|
||||
|
||||
class VLayoutPiece :public VAbstractPiece
|
||||
{
|
||||
|
|
|
@ -37,11 +37,7 @@
|
|||
#include <QMargins>
|
||||
|
||||
#include "vcommonsettings.h"
|
||||
|
||||
template <class T> class QSharedPointer;
|
||||
enum class Cases : char;
|
||||
enum class Unit : char;
|
||||
enum class PageOrientation : bool;
|
||||
#include "../vlayout/vbank.h"
|
||||
|
||||
class VSettings : public VCommonSettings
|
||||
{
|
||||
|
|
|
@ -911,7 +911,7 @@ bool VPiece::GetPassmarkPreviousSAPoints(const QVector<VPieceNode> &path, int in
|
|||
|
||||
if (points.isEmpty())
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||
return false; // Something wrong
|
||||
|
@ -949,7 +949,7 @@ bool VPiece::GetPassmarkNextSAPoints(const QVector<VPieceNode> &path, int index,
|
|||
|
||||
if (points.isEmpty())
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||
return false; // Something wrong
|
||||
|
@ -1032,7 +1032,7 @@ VPassmark VPiece::CreatePassmark(const QVector<VPieceNode> &path, int previousIn
|
|||
VSAPoint passmarkSAPoint;
|
||||
if (not GetPassmarkSAPoint(path, passmarkIndex, data, passmarkSAPoint))
|
||||
{
|
||||
const QString errorMsg = QObject::tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||
const QString errorMsg = tr("Cannot calculate a notch for point '%1' in piece '%2'.")
|
||||
.arg(VPiecePath::NodeName(path, passmarkIndex, data), GetName());
|
||||
qApp->IsPedantic() ? throw VExceptionInvalidNotch(errorMsg) : qWarning() << errorMsg;
|
||||
return VPassmark();
|
||||
|
|
|
@ -37,8 +37,6 @@
|
|||
|
||||
class VPieceData;
|
||||
class VPieceNode;
|
||||
template <class T> class QVector;
|
||||
template <class T>class QSharedPointer;
|
||||
class VPiecePath;
|
||||
class VPatternLabelData;
|
||||
class VPieceLabelData;
|
||||
|
@ -50,6 +48,7 @@ class VPassmark;
|
|||
|
||||
class VPiece : public VAbstractPiece
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(VPiece)
|
||||
public:
|
||||
VPiece();
|
||||
VPiece(const VPiece &piece);
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
|
||||
#include "../tools/dialogtool.h"
|
||||
|
||||
template <class T> class QSharedPointer;
|
||||
class VMeasurement;
|
||||
|
||||
namespace Ui
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "../vmisc/def.h"
|
||||
#include "dialogtool.h"
|
||||
|
||||
template <class T> class QSharedPointer;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogCubicBezier;
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "../vmisc/def.h"
|
||||
#include "dialogtool.h"
|
||||
|
||||
template <class T> class QSharedPointer;
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class DialogSpline;
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#include "../vmisc/def.h"
|
||||
|
||||
class VSimplePoint;
|
||||
template <class T> class QSharedPointer;
|
||||
|
||||
class VToolDoublePoint: public VAbstractPoint, public QGraphicsPathItem
|
||||
{
|
||||
|
|
|
@ -55,8 +55,6 @@
|
|||
#include "../vtools/undocommands/additemtogroup.h"
|
||||
#include "../vtools/undocommands/removeitemfromgroup.h"
|
||||
|
||||
template <class T> class QSharedPointer;
|
||||
|
||||
/**
|
||||
* @brief The VDrawTool abstract class for all draw tool.
|
||||
*/
|
||||
|
@ -114,25 +112,25 @@ protected:
|
|||
virtual void ReadToolAttributes(const QDomElement &domElement)=0;
|
||||
virtual void ChangeLabelVisibility(quint32 id, bool visible);
|
||||
|
||||
template <typename Dialog>
|
||||
template <class Dialog>
|
||||
void ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemId = NULL_ID,
|
||||
const RemoveOption &showRemove = RemoveOption::Enable,
|
||||
const Referens &ref = Referens::Follow);
|
||||
|
||||
template <typename Item>
|
||||
template <class Item>
|
||||
void ShowItem(Item *item, quint32 id, bool enable);
|
||||
|
||||
template <typename T>
|
||||
template <class T>
|
||||
QString ObjectName(quint32 id) const;
|
||||
|
||||
template <typename T>
|
||||
template <class T>
|
||||
static void InitDrawToolConnections(VMainGraphicsScene *scene, T *tool);
|
||||
private:
|
||||
Q_DISABLE_COPY(VDrawTool)
|
||||
};
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename Dialog>
|
||||
template <class Dialog>
|
||||
/**
|
||||
* @brief ContextMenu show context menu for tool.
|
||||
* @param event context menu event.
|
||||
|
@ -165,14 +163,16 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
|
||||
qCDebug(vTool, "Creating tool context menu.");
|
||||
QMenu menu;
|
||||
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
|
||||
QAction *actionOption = menu.addAction(QIcon::fromTheme(QStringLiteral("preferences-other")),
|
||||
VDrawTool::tr("Options"));
|
||||
|
||||
// add the menu "add to group" to the context menu
|
||||
QMap<quint32,QString> groupsNotContainingItem = doc->GetGroupsContainingItem(this->getId(), itemId, false);
|
||||
QActionGroup* actionsAddToGroup = new QActionGroup(this);
|
||||
if(not groupsNotContainingItem.empty())
|
||||
{
|
||||
QMenu *menuAddToGroup = menu.addMenu(QIcon::fromTheme("list-add"), tr("Add to group"));
|
||||
QMenu *menuAddToGroup = menu.addMenu(QIcon::fromTheme(QStringLiteral("list-add")),
|
||||
VDrawTool::tr("Add to group"));
|
||||
|
||||
QStringList list = QStringList(groupsNotContainingItem.values());
|
||||
list.sort(Qt::CaseInsensitive);
|
||||
|
@ -195,7 +195,8 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
QActionGroup* actionsRemoveFromGroup = new QActionGroup(this);
|
||||
if(not groupsContainingItem.empty())
|
||||
{
|
||||
QMenu *menuRemoveFromGroup = menu.addMenu(QIcon::fromTheme("list-remove"), tr("Remove from group"));
|
||||
QMenu *menuRemoveFromGroup = menu.addMenu(QIcon::fromTheme(QStringLiteral("list-remove")),
|
||||
VDrawTool::tr("Remove from group"));
|
||||
|
||||
QStringList list = QStringList(groupsContainingItem.values());
|
||||
list.sort(Qt::CaseInsensitive);
|
||||
|
@ -210,7 +211,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
}
|
||||
}
|
||||
|
||||
QAction *actionShowLabel = menu.addAction(tr("Show label"));
|
||||
QAction *actionShowLabel = menu.addAction(VDrawTool::tr("Show label"));
|
||||
actionShowLabel->setCheckable(true);
|
||||
|
||||
if (itemType == GOType::Point)
|
||||
|
@ -222,7 +223,7 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
actionShowLabel->setVisible(false);
|
||||
}
|
||||
|
||||
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
|
||||
QAction *actionRemove = menu.addAction(QIcon::fromTheme(QStringLiteral("edit-delete")), VDrawTool::tr("Delete"));
|
||||
if (showRemove == RemoveOption::Enable)
|
||||
{
|
||||
if (ref == Referens::Follow)
|
||||
|
@ -293,7 +294,8 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
SCASSERT(window != nullptr)
|
||||
{
|
||||
AddItemToGroup *addItemToGroup = new AddItemToGroup(item, doc, groupId);
|
||||
connect(addItemToGroup, &AddItemToGroup::UpdateGroups, window, &VAbstractMainWindow::UpdateVisibilityGroups);
|
||||
connect(addItemToGroup, &AddItemToGroup::UpdateGroups, window,
|
||||
&VAbstractMainWindow::UpdateVisibilityGroups);
|
||||
qApp->getUndoStack()->push(addItemToGroup);
|
||||
}
|
||||
}
|
||||
|
@ -306,14 +308,15 @@ void VDrawTool::ContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 itemI
|
|||
SCASSERT(window != nullptr)
|
||||
{
|
||||
RemoveItemFromGroup *removeItemFromGroup = new RemoveItemFromGroup(item, doc, groupId);
|
||||
connect(removeItemFromGroup, &RemoveItemFromGroup::UpdateGroups, window, &VAbstractMainWindow::UpdateVisibilityGroups);
|
||||
connect(removeItemFromGroup, &RemoveItemFromGroup::UpdateGroups, window,
|
||||
&VAbstractMainWindow::UpdateVisibilityGroups);
|
||||
qApp->getUndoStack()->push(removeItemFromGroup);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename Item>
|
||||
template <class Item>
|
||||
/**
|
||||
* @brief ShowItem highlight tool.
|
||||
* @param item tool.
|
||||
|
@ -330,7 +333,7 @@ void VDrawTool::ShowItem(Item *item, quint32 id, bool enable)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
template <class T>
|
||||
/**
|
||||
* @brief ObjectName get object (point, curve, arc) name.
|
||||
* @param id object id in container.
|
||||
|
@ -351,7 +354,7 @@ QString VDrawTool::ObjectName(quint32 id) const
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
template <class T>
|
||||
void VDrawTool::InitDrawToolConnections(VMainGraphicsScene *scene, T *tool)
|
||||
{
|
||||
SCASSERT(scene != nullptr)
|
||||
|
|
|
@ -41,6 +41,7 @@ class QGraphicsScene;
|
|||
|
||||
class MoveAbstractLabel : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MoveAbstractLabel(VAbstractPattern *doc, quint32 pointId, const QPointF &pos, QUndoCommand *parent = nullptr);
|
||||
virtual ~MoveAbstractLabel()=default;
|
||||
|
|
|
@ -41,6 +41,7 @@ enum class MoveDoublePoint: char { FirstPoint, SecondPoint };
|
|||
|
||||
class MoveDoubleLabel : public MoveAbstractLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MoveDoubleLabel(VAbstractPattern *doc, const QPointF &pos, MoveDoublePoint type,
|
||||
quint32 toolId, quint32 pointId, QUndoCommand *parent = nullptr);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
|
||||
class MoveLabel : public MoveAbstractLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MoveLabel(VAbstractPattern *doc, const QPointF &pos, const quint32 &id, QUndoCommand *parent = nullptr);
|
||||
virtual ~MoveLabel()=default;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
class OperationMoveLabel : public MoveAbstractLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OperationMoveLabel(quint32 idTool, VAbstractPattern *doc, const QPointF &pos, quint32 idPoint,
|
||||
QUndoCommand *parent = nullptr);
|
||||
|
|
|
@ -35,6 +35,7 @@ class QGraphicsScene;
|
|||
|
||||
class OperationShowLabel : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
OperationShowLabel(VAbstractPattern *doc, quint32 idTool, quint32 idPoint, bool visible,
|
||||
QUndoCommand *parent = nullptr);
|
||||
|
|
|
@ -37,6 +37,7 @@ enum class ShowDoublePoint: char { FirstPoint, SecondPoint };
|
|||
|
||||
class ShowDoubleLabel : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShowDoubleLabel(VAbstractPattern *doc, quint32 toolId, quint32 pointId, bool visible, ShowDoublePoint type,
|
||||
QUndoCommand *parent = nullptr);
|
||||
|
|
|
@ -35,6 +35,7 @@ class QGraphicsScene;
|
|||
|
||||
class ShowLabel : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShowLabel(VAbstractPattern *doc, quint32 id, bool visible, QUndoCommand *parent = nullptr);
|
||||
virtual ~ShowLabel()=default;
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
class SavePiecePathOptions : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SavePiecePathOptions(quint32 pieceId, const VPiecePath &oldPath, const VPiecePath &newPath, VAbstractPattern *doc,
|
||||
VContainer *data, quint32 id, QUndoCommand *parent = nullptr);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
class SavePlaceLabelOptions : public VUndoCommand
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SavePlaceLabelOptions(quint32 pieceId, const VPlaceLabelItem &oldLabel, const VPlaceLabelItem &newLabel,
|
||||
VAbstractPattern *doc, VContainer *data, quint32 id, QUndoCommand *parent = nullptr);
|
||||
|
|
89
src/libs/vwidgets/vcomboboxdelegate.cpp
Normal file
89
src/libs/vwidgets/vcomboboxdelegate.cpp
Normal file
|
@ -0,0 +1,89 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vcomboboxdelegate.cpp
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 10 9, 2019
|
||||
**
|
||||
** @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) 2019 Valentina project
|
||||
** <https://bitbucket.org/dismine/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 "vcomboboxdelegate.h"
|
||||
|
||||
#include <QComboBox>
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VComboBoxDelegate::VComboBoxDelegate(const QStringList &items, QObject *parent)
|
||||
: QItemDelegate(parent),
|
||||
m_items(items)
|
||||
{
|
||||
const QString dashDash = QStringLiteral("--");
|
||||
m_items.prepend(dashDash + tr("Select material") + dashDash);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QWidget *VComboBoxDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(option)
|
||||
Q_UNUSED(index)
|
||||
|
||||
QComboBox *editor = new QComboBox(parent);
|
||||
editor->addItems(m_items);
|
||||
|
||||
return editor;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VComboBoxDelegate::setEditorData(QWidget *editor, const QModelIndex &index) const
|
||||
{
|
||||
const QString value = index.model()->data(index, Qt::EditRole).toString();
|
||||
|
||||
QComboBox *comboBox = static_cast<QComboBox*>(editor);
|
||||
const int cIndex = comboBox->findText(value);
|
||||
|
||||
if (cIndex != -1)
|
||||
{
|
||||
comboBox->setCurrentIndex(cIndex);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VComboBoxDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
|
||||
{
|
||||
QComboBox *comboBox = static_cast<QComboBox*>(editor);
|
||||
QString value;
|
||||
const int cIndex = comboBox->currentIndex();
|
||||
|
||||
if (cIndex > 0)
|
||||
{
|
||||
value = comboBox->currentText();
|
||||
}
|
||||
|
||||
model->setData(index, value, Qt::EditRole);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VComboBoxDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const
|
||||
{
|
||||
Q_UNUSED(index)
|
||||
editor->setGeometry(option.rect);
|
||||
}
|
52
src/libs/vwidgets/vcomboboxdelegate.h
Normal file
52
src/libs/vwidgets/vcomboboxdelegate.h
Normal file
|
@ -0,0 +1,52 @@
|
|||
/************************************************************************
|
||||
**
|
||||
** @file vcomboboxdelegate.h
|
||||
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
||||
** @date 10 9, 2019
|
||||
**
|
||||
** @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) 2019 Valentina project
|
||||
** <https://bitbucket.org/dismine/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 VCOMBOBOXDELEGATE_H
|
||||
#define VCOMBOBOXDELEGATE_H
|
||||
|
||||
#include <QItemDelegate>
|
||||
|
||||
class VComboBoxDelegate : public QItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
VComboBoxDelegate(const QStringList &items, QObject *parent = nullptr);
|
||||
|
||||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
|
||||
const QModelIndex &index) const override;
|
||||
private:
|
||||
Q_DISABLE_COPY(VComboBoxDelegate)
|
||||
QStringList m_items;
|
||||
};
|
||||
|
||||
#endif // VCOMBOBOXDELEGATE_H
|
|
@ -2,6 +2,7 @@
|
|||
# This need for corect working file translations.pro
|
||||
|
||||
SOURCES += \
|
||||
$$PWD/vcomboboxdelegate.cpp \
|
||||
$$PWD/vmaingraphicsscene.cpp \
|
||||
$$PWD/vmaingraphicsview.cpp \
|
||||
$$PWD/vwidgetpopup.cpp \
|
||||
|
@ -30,6 +31,7 @@ SOURCES += \
|
|||
|
||||
HEADERS += \
|
||||
$$PWD/stable.h \
|
||||
$$PWD/vcomboboxdelegate.h \
|
||||
$$PWD/vmaingraphicsscene.h \
|
||||
$$PWD/vmaingraphicsview.h \
|
||||
$$PWD/vwidgetpopup.h \
|
||||
|
|
Loading…
Reference in New Issue
Block a user