60 #include <QCoreApplication>
65 #include <QStaticStringData>
66 #include <QStringData>
67 #include <QStringDataPtr>
70 #include "../ifc/ifcdef.h"
71 #include "../vtools/tools/vabstracttool.h"
72 #include "../vproperty_p.h"
94 if (tmpIndex < 0 || tmpIndex >= indexList.count())
99 if (column == DPC_Data && Qt::DisplayRole == role)
101 return indexList.at(tmpIndex);
103 else if (column == DPC_Data && Qt::EditRole == role)
114 const QAbstractItemDelegate *delegate)
118 QComboBox *colorEditor =
new QComboBox(parent);
119 colorEditor->clear();
121 #if defined(Q_OS_MAC)
123 colorEditor->setIconSize(QSize(m_iconWidth-= 2 ,m_iconHeight-= 2));
126 colorEditor->setIconSize(QSize(m_iconWidth, m_iconHeight));
130 while (i != colors.constEnd())
133 colorEditor->addItem(QIcon(pixmap), i.value(), QVariant(i.key()));
137 colorEditor->setMinimumWidth(140);
138 colorEditor->setLocale(parent->locale());
140 connect(colorEditor,
static_cast<void (QComboBox::*)(
int)
>(&QComboBox::currentIndexChanged),
this,
149 const QComboBox *colorEditor = qobject_cast<const QComboBox*>(editor);
152 return colorEditor->currentIndex();
160 this->colors = colors;
163 while (i != colors.constEnd())
165 indexList.append(i.key());
178 int tmpIndex = value.toInt();
180 if (tmpIndex < 0 || tmpIndex >= indexList.count())
196 return QStringLiteral(
"lineColor");
208 while (i != colors.constEnd())
210 indexList.append(i.key());
213 return indexList.indexOf(color);
virtual void setValue(const QVariant &value) Q_DECL_OVERRIDE
Sets the value of the property.
virtual QString type() const Q_DECL_OVERRIDE
Returns a string containing the type of the property.
VLineColorProperty(const QString &name)
Constructor.
virtual QMap< QString, QString > getColors() const
Get the settings. This function has to be implemented in a subclass in order to have an effect.
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const Q_DECL_OVERRIDE
Get the data how it should be displayed.
virtual Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const Q_DECL_OVERRIDE
Clones this property.
static int indexOfColor(const QMap< QString, QString > &colors, const QString &color)
virtual QVariant getEditorData(const QWidget *editor) const Q_DECL_OVERRIDE
Gets the data from the widget.
virtual void setColors(const QMap< QString, QString > &colors)
Sets the colors.
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &options, const QAbstractItemDelegate *delegate) Q_DECL_OVERRIDE
Returns an editor widget, or NULL if it doesn't supply one.
void currentIndexChanged(int index)
QVariant VariantValue
The property's value. This does not have to be used by subclasses, but it makes sense in cases where ...
virtual Q_REQUIRED_RESULT VProperty * clone(bool include_children=true, VProperty *container=nullptr) const
Clones this property.
VPropertyPrivate * d_ptr
The protected structure holding the member variables (to assure binary compatibility)
virtual QVariant data(int column=DPC_Name, int role=Qt::DisplayRole) const
Get the data how it should be displayed.