diff --git a/src/propertywidgets/CMakeLists.txt b/src/propertywidgets/CMakeLists.txt index b206d7253..5fe4bf85f 100644 --- a/src/propertywidgets/CMakeLists.txt +++ b/src/propertywidgets/CMakeLists.txt @@ -10,6 +10,7 @@ target_sources(libommpfritt PRIVATE add_subdirectory(boolpropertywidget) add_subdirectory(colorpropertywidget) add_subdirectory(numericpropertywidget) +add_subdirectory(facelistpropertywidget) add_subdirectory(floatpropertywidget) add_subdirectory(floatvectorpropertywidget) add_subdirectory(integerpropertywidget) diff --git a/src/propertywidgets/facelistpropertywidget/CMakeLists.txt b/src/propertywidgets/facelistpropertywidget/CMakeLists.txt new file mode 100644 index 000000000..db4699f9e --- /dev/null +++ b/src/propertywidgets/facelistpropertywidget/CMakeLists.txt @@ -0,0 +1,8 @@ +target_sources(libommpfritt PRIVATE + facelistwidget.cpp + facelistwidget.h + facelistpropertyconfigwidget.cpp + facelistpropertyconfigwidget.h + facelistpropertywidget.cpp + facelistpropertywidget.h +) diff --git a/src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.cpp b/src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.cpp new file mode 100644 index 000000000..a69e3dedb --- /dev/null +++ b/src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.cpp @@ -0,0 +1,20 @@ +#include "propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.h" + + +namespace omm +{ + +FaceListPropertyConfigWidget ::FaceListPropertyConfigWidget() +{ +} + +void FaceListPropertyConfigWidget::init(const PropertyConfiguration&) +{ +} + +void FaceListPropertyConfigWidget::update(PropertyConfiguration&) const +{ + +} + +} // namespace omm diff --git a/src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.h b/src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.h new file mode 100644 index 000000000..f11400176 --- /dev/null +++ b/src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.h @@ -0,0 +1,19 @@ +#pragma once + +#include "properties/facelistproperty.h" +#include "propertywidgets/propertyconfigwidget.h" + +class QListWidget; + +namespace omm +{ + +class FaceListPropertyConfigWidget : public PropertyConfigWidget +{ +public: + FaceListPropertyConfigWidget(); + void init(const PropertyConfiguration&) override; + void update(PropertyConfiguration&) const override; +}; + +} // namespace omm diff --git a/src/propertywidgets/facelistpropertywidget/facelistpropertywidget.cpp b/src/propertywidgets/facelistpropertywidget/facelistpropertywidget.cpp new file mode 100644 index 000000000..7542f0707 --- /dev/null +++ b/src/propertywidgets/facelistpropertywidget/facelistpropertywidget.cpp @@ -0,0 +1,25 @@ +#include "propertywidgets/facelistpropertywidget/facelistpropertywidget.h" +#include "properties/typedproperty.h" +#include "propertywidgets/facelistpropertywidget/facelistwidget.h" + +#include +#include + +namespace omm +{ +FaceListPropertyWidget::FaceListPropertyWidget(Scene& scene, const std::set& properties) + : PropertyWidget(scene, properties) +{ + auto face_list_widget = std::make_unique(); + m_face_list_widget = face_list_widget.get(); + set_widget(std::move(face_list_widget)); + FaceListPropertyWidget::update_edit(); +} + +void FaceListPropertyWidget::update_edit() +{ + QSignalBlocker blocker(m_face_list_widget); + m_face_list_widget->set_values(get_properties_values()); +} + +} // namespace omm diff --git a/src/propertywidgets/facelistpropertywidget/facelistpropertywidget.h b/src/propertywidgets/facelistpropertywidget/facelistpropertywidget.h new file mode 100644 index 000000000..8861b524d --- /dev/null +++ b/src/propertywidgets/facelistpropertywidget/facelistpropertywidget.h @@ -0,0 +1,22 @@ +#pragma once + +#include "properties/facelistproperty.h" +#include "propertywidgets/propertywidget.h" + +namespace omm +{ +class FaceListWidget; + +class FaceListPropertyWidget : public PropertyWidget +{ +public: + explicit FaceListPropertyWidget(Scene& scene, const std::set& properties); + +protected: + void update_edit() override; + +private: + FaceListWidget* m_face_list_widget; +}; + +} // namespace omm diff --git a/src/propertywidgets/facelistpropertywidget/facelistwidget.cpp b/src/propertywidgets/facelistpropertywidget/facelistwidget.cpp new file mode 100644 index 000000000..b7a0fa3ac --- /dev/null +++ b/src/propertywidgets/facelistpropertywidget/facelistwidget.cpp @@ -0,0 +1,44 @@ +#include "propertywidgets/facelistpropertywidget/facelistwidget.h" + +#include +#include +#include +#include + +namespace omm +{ + +void FaceListWidget::set_value(const value_type& value) +{ + Q_UNUSED(value) +} + +void FaceListWidget::set_inconsistent_value() +{ + set_value(FaceList{}); +} + +FaceListWidget::value_type FaceListWidget::value() const +{ + return FaceList{}; +} + +FaceListWidget::FaceListWidget(QWidget* parent) + : QWidget(parent) +{ + setFocusPolicy(Qt::StrongFocus); + auto layout = std::make_unique(); + + auto insert = [layout=layout.get()](auto&& widget, const int row, const int col, const int row_span = 1) -> auto& { + auto& ref = *widget; + layout->addWidget(widget.release(), row, col, row_span, Qt::AlignLeft); + return ref; + }; + + m_lw = &insert(std::make_unique(), 0, 0, 2); + m_pb_clear = &insert(std::make_unique(), 1, 0); + m_cb_invert = &insert(std::make_unique(), 1, 1); + setLayout(layout.release()); +} + +} // namespace omm diff --git a/src/propertywidgets/facelistpropertywidget/facelistwidget.h b/src/propertywidgets/facelistpropertywidget/facelistwidget.h new file mode 100644 index 000000000..cb5c6f194 --- /dev/null +++ b/src/propertywidgets/facelistpropertywidget/facelistwidget.h @@ -0,0 +1,30 @@ +#pragma once + +#include "propertywidgets/multivalueedit.h" +#include "facelist.h" +#include + +class QCheckBox; +class QListWidget; +class QPushButton; + +namespace omm +{ + +class FaceListWidget : public QWidget, public MultiValueEdit +{ +public: + explicit FaceListWidget(QWidget* parent = nullptr); + void set_value(const value_type& value) override; + [[nodiscard]] value_type value() const override; + +protected: + void set_inconsistent_value() override; + +private: + QCheckBox* m_cb_invert; + QListWidget* m_lw; + QPushButton* m_pb_clear; +}; + +} // namespace omm