Go to the documentation of this file.
31 #include <QStringList>
32 #include <QStyleOptionViewItem>
42 const QColor& default_value,
43 const QString& description,
67 if (new_value.type() == QVariant::Color)
69 return setColor(new_value.value<QColor>());
72 QColor new_color =
parseColor(new_value.toString());
73 if (new_color.isValid())
91 color = QColor(200, 200, 200);
92 painter->setPen(QColor(Qt::lightGray));
94 QString text =
value_.toString();
95 QRect rect = option.rect;
97 rect.adjust(rect.height() + 4, 1, 0, 0);
98 painter->drawText(rect, text);
108 editor->setFrame(
false);
bool setValue(const QVariant &new_value) override
Set the new value for this property. Returns true if the new value is different from the old value,...
bool paint(QPainter *painter, const QStyleOptionViewItem &option) const override
Hook to provide custom painting of the value data (right-hand column) in a subclass.
ColorProperty(const QString &name=QString(), const QColor &default_value=Qt::black, const QString &description=QString(), Property *parent=nullptr)
A single element of a property tree, with a name, value, description, and possibly children.
QString printColor(const QColor &color)
void emitDataChanged(Property *property, bool emit_config_changed=true)
static void paintColorBox(QPainter *painter, const QRect &rect, const QColor &color)
PropertyTreeModel * model_
Pointer to the PropertyTreeModel managing this property tree.
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option) override
Create an editor widget to edit the value of this property.
virtual Qt::ItemFlags getViewFlags(int column) const
Return item flags appropriate for the given column (0 or 1) for this Property.
void changed()
Emitted by setValue() just after the value has changed.
QColor parseColor(const QString &color_string)
QVariant value_
This is the central property value. If you set it directly in a subclass, do so with care because man...
void aboutToChange()
Emitted by setValue() just before the value has changed.
virtual bool setColor(const QColor &color)
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Thu May 16 2024 02:30:48