Fix property value update.
Default handler doesn't work in our cases.
This commit is contained in:
parent
37722788bb
commit
8a6003752e
|
@ -70,6 +70,17 @@ QWidget *VPE::VLabelProperty::createEditor(QWidget *parent, const QStyleOptionVi
|
|||
return d_ptr->editor;
|
||||
}
|
||||
|
||||
bool VPE::VLabelProperty::setEditorData(QWidget *editor)
|
||||
{
|
||||
if (QLabel* tmpWidget = qobject_cast<QLabel*>(editor))
|
||||
{
|
||||
tmpWidget->setText(d_ptr->VariantValue.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant VPE::VLabelProperty::getEditorData(const QWidget *editor) const
|
||||
{
|
||||
const QLabel* tmpEditor = qobject_cast<const QLabel*>(editor);
|
||||
|
|
|
@ -63,6 +63,9 @@ public:
|
|||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& options,
|
||||
const QAbstractItemDelegate* delegate) override;
|
||||
|
||||
//! Sets the property's data to the editor (returns false, if the standard delegate should do that)
|
||||
virtual bool setEditorData(QWidget* editor) override;
|
||||
|
||||
//! Gets the data from the widget
|
||||
virtual QVariant getEditorData(const QWidget* editor) const override;
|
||||
|
||||
|
|
|
@ -65,6 +65,20 @@ QWidget *VPE::VStringProperty::createEditor(QWidget *parent, const QStyleOptionV
|
|||
return d_ptr->editor;
|
||||
}
|
||||
|
||||
bool VPE::VStringProperty::setEditorData(QWidget *editor)
|
||||
{
|
||||
if (QLineEdit* tmpWidget = qobject_cast<QLineEdit*>(editor))
|
||||
{
|
||||
if (not readOnly)
|
||||
{
|
||||
tmpWidget->setText(d_ptr->VariantValue.toString());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant VPE::VStringProperty::getEditorData(const QWidget *editor) const
|
||||
{
|
||||
const QLineEdit* tmpEditor = qobject_cast<const QLineEdit*>(editor);
|
||||
|
|
|
@ -55,6 +55,9 @@ public:
|
|||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& options,
|
||||
const QAbstractItemDelegate* delegate) override;
|
||||
|
||||
//! Sets the property's data to the editor (returns false, if the standard delegate should do that)
|
||||
virtual bool setEditorData(QWidget* editor) override;
|
||||
|
||||
//! Gets the data from the widget
|
||||
virtual QVariant getEditorData(const QWidget* editor) const override;
|
||||
|
||||
|
|
|
@ -86,6 +86,17 @@ QWidget *VPE::VTextProperty::createEditor(QWidget *parent, const QStyleOptionVie
|
|||
return d_ptr->editor;
|
||||
}
|
||||
|
||||
bool VPE::VTextProperty::setEditorData(QWidget *editor)
|
||||
{
|
||||
if (QPlainTextEdit* tmpWidget = qobject_cast<QPlainTextEdit*>(editor))
|
||||
{
|
||||
tmpWidget->setPlainText(d_ptr->VariantValue.toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant VPE::VTextProperty::getEditorData(const QWidget *editor) const
|
||||
{
|
||||
const QPlainTextEdit* tmpEditor = qobject_cast<const QPlainTextEdit*>(editor);
|
||||
|
|
|
@ -52,6 +52,9 @@ public:
|
|||
virtual QWidget* createEditor(QWidget* parent, const QStyleOptionViewItem& options,
|
||||
const QAbstractItemDelegate* delegate) override;
|
||||
|
||||
//! Sets the property's data to the editor (returns false, if the standard delegate should do that)
|
||||
virtual bool setEditorData(QWidget* editor) override;
|
||||
|
||||
//! Gets the data from the widget
|
||||
virtual QVariant getEditorData(const QWidget* editor) const override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user