mirror of
https://github.com/redstrate/Novus.git
synced 2025-04-23 20:47:45 +00:00
Slight improvements to the Vec3Edit widget
This commit is contained in:
parent
5d1a78b961
commit
19040bc5e9
3 changed files with 13 additions and 13 deletions
|
@ -7,7 +7,10 @@ add_executable(mdlviewer
|
|||
include/vec3edit.h
|
||||
src/gearview.cpp
|
||||
src/singlegearview.cpp
|
||||
src/fullmodelviewer.cpp)
|
||||
src/fullmodelviewer.cpp
|
||||
src/quaternionedit.cpp
|
||||
src/boneeditor.cpp
|
||||
src/cmpeditor.cpp)
|
||||
target_include_directories(mdlviewer
|
||||
PUBLIC
|
||||
include)
|
||||
|
|
|
@ -10,6 +10,8 @@ public:
|
|||
explicit Vector3Edit(glm::vec3& vec, QWidget* parent = nullptr);
|
||||
~Vector3Edit();
|
||||
|
||||
void setVector(glm::vec3& vec);
|
||||
|
||||
signals:
|
||||
void onValueChanged();
|
||||
|
||||
|
|
|
@ -39,20 +39,15 @@ Vector3Edit::Vector3Edit(glm::vec3& vec, QWidget* parent) : QWidget(parent), vec
|
|||
vec.z = d;
|
||||
emit onValueChanged();
|
||||
});
|
||||
|
||||
// TODO: find a better way to do this
|
||||
updateTimer = new QTimer();
|
||||
connect(updateTimer, &QTimer::timeout, [this, &vec]() {
|
||||
if (vec.x != spinBoxes.x->value() || vec.y != spinBoxes.y->value() || vec.z != spinBoxes.z->value()) {
|
||||
spinBoxes.x->setValue(vec.x);
|
||||
spinBoxes.y->setValue(vec.y);
|
||||
spinBoxes.z->setValue(vec.z);
|
||||
}
|
||||
});
|
||||
|
||||
updateTimer->start(1);
|
||||
}
|
||||
|
||||
Vector3Edit::~Vector3Edit() {
|
||||
updateTimer->stop();
|
||||
}
|
||||
|
||||
void Vector3Edit::setVector(glm::vec3 &vec) {
|
||||
this->vec = vec;
|
||||
spinBoxes.x->setValue(vec.x);
|
||||
spinBoxes.y->setValue(vec.y);
|
||||
spinBoxes.z->setValue(vec.z);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue