-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Pascal Bies
committed
Mar 11, 2022
1 parent
fbc5d43
commit d7189e4
Showing
8 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
target_sources(libommpfritt PRIVATE | ||
facelistwidget.cpp | ||
facelistwidget.h | ||
facelistpropertyconfigwidget.cpp | ||
facelistpropertyconfigwidget.h | ||
facelistpropertywidget.cpp | ||
facelistpropertywidget.h | ||
) |
20 changes: 20 additions & 0 deletions
20
src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
19 changes: 19 additions & 0 deletions
19
src/propertywidgets/facelistpropertywidget/facelistpropertyconfigwidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#pragma once | ||
|
||
#include "properties/facelistproperty.h" | ||
#include "propertywidgets/propertyconfigwidget.h" | ||
|
||
class QListWidget; | ||
|
||
namespace omm | ||
{ | ||
|
||
class FaceListPropertyConfigWidget : public PropertyConfigWidget<FaceListProperty> | ||
{ | ||
public: | ||
FaceListPropertyConfigWidget(); | ||
void init(const PropertyConfiguration&) override; | ||
void update(PropertyConfiguration&) const override; | ||
}; | ||
|
||
} // namespace omm |
25 changes: 25 additions & 0 deletions
25
src/propertywidgets/facelistpropertywidget/facelistpropertywidget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "propertywidgets/facelistpropertywidget/facelistpropertywidget.h" | ||
#include "properties/typedproperty.h" | ||
#include "propertywidgets/facelistpropertywidget/facelistwidget.h" | ||
|
||
#include <QLabel> | ||
#include <QVBoxLayout> | ||
|
||
namespace omm | ||
{ | ||
FaceListPropertyWidget::FaceListPropertyWidget(Scene& scene, const std::set<Property*>& properties) | ||
: PropertyWidget(scene, properties) | ||
{ | ||
auto face_list_widget = std::make_unique<FaceListWidget>(); | ||
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 |
22 changes: 22 additions & 0 deletions
22
src/propertywidgets/facelistpropertywidget/facelistpropertywidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#pragma once | ||
|
||
#include "properties/facelistproperty.h" | ||
#include "propertywidgets/propertywidget.h" | ||
|
||
namespace omm | ||
{ | ||
class FaceListWidget; | ||
|
||
class FaceListPropertyWidget : public PropertyWidget<FaceListProperty> | ||
{ | ||
public: | ||
explicit FaceListPropertyWidget(Scene& scene, const std::set<Property*>& properties); | ||
|
||
protected: | ||
void update_edit() override; | ||
|
||
private: | ||
FaceListWidget* m_face_list_widget; | ||
}; | ||
|
||
} // namespace omm |
44 changes: 44 additions & 0 deletions
44
src/propertywidgets/facelistpropertywidget/facelistwidget.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "propertywidgets/facelistpropertywidget/facelistwidget.h" | ||
|
||
#include <QListWidget> | ||
#include <QCheckBox> | ||
#include <QPushButton> | ||
#include <QGridLayout> | ||
|
||
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<QGridLayout>(); | ||
|
||
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<QListWidget>(), 0, 0, 2); | ||
m_pb_clear = &insert(std::make_unique<QPushButton>(), 1, 0); | ||
m_cb_invert = &insert(std::make_unique<QCheckBox>(), 1, 1); | ||
setLayout(layout.release()); | ||
} | ||
|
||
} // namespace omm |
30 changes: 30 additions & 0 deletions
30
src/propertywidgets/facelistpropertywidget/facelistwidget.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include "propertywidgets/multivalueedit.h" | ||
#include "facelist.h" | ||
#include <QWidget> | ||
|
||
class QCheckBox; | ||
class QListWidget; | ||
class QPushButton; | ||
|
||
namespace omm | ||
{ | ||
|
||
class FaceListWidget : public QWidget, public MultiValueEdit<FaceList> | ||
{ | ||
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 |