19 #include <QColorDialog>
20 #include <QHBoxLayout>
30 setMouseTracking(
true);
31 setAutoFillBackground(
true);
33 auto layout =
new QHBoxLayout;
34 layout->setContentsMargins(4, 0, 0, 0);
38 layout->addStretch(1);
39 setFocusPolicy(Qt::StrongFocus);
40 setAttribute(Qt::WA_InputMethodEnabled);
54 if (new_color.isValid()) {
62 return m_data.value<QColor>();
68 throw std::runtime_error(
"ColorEditor::update_components() -> Error. Wrong variant type");
void update_components() override
Should update widget components from m_data, if necessary.
ColorEditor(QWidget *parent=nullptr)
LostFocusFilter * m_focusFilter
QColor currentColor() const
void mousePressEvent(QMouseEvent *event) override
Base class for all custom variant editors.
void setDataIntern(const QVariant &data)
Saves the data as given by editor's internal components and notifies the model.
Event filter to prevent loss of the focus.
MVVM_VIEWMODEL_EXPORT int DefaultPixmapSize()
Returns int value corresponding to pixmap in standard Qt table/tree decorations.
MVVM_MODEL_EXPORT bool IsColorVariant(const Variant &variant)
Returns true in the case of QColor based variant.
materialitems.h Collection of materials to populate MaterialModel.