refine radio button handling
This commit is contained in:
parent
f880de181e
commit
cf72e340c7
|
|
@ -42,6 +42,13 @@ using ffi::Mode;
|
||||||
using ffi::ShapeArgs;
|
using ffi::ShapeArgs;
|
||||||
using ffi::RedrawArgs;
|
using ffi::RedrawArgs;
|
||||||
|
|
||||||
|
/// Cast an integer to @c Mode, returning a fallback if the input is out of range.
|
||||||
|
inline static Mode modeFromInt(std::uint32_t mode) {
|
||||||
|
if (mode > (std::uint32_t)Mode::Mesh)
|
||||||
|
return Mode::Solid;
|
||||||
|
return (Mode)mode;
|
||||||
|
}
|
||||||
|
|
||||||
class MutCore {
|
class MutCore {
|
||||||
friend class BoxCore;
|
friend class BoxCore;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ void Hyperboloid::updateView() {
|
||||||
m_ui->layersDown->setMaximum(max_layers);
|
m_ui->layersDown->setMaximum(max_layers);
|
||||||
const auto color = m_ui->inBackground->color();
|
const auto color = m_ui->inBackground->color();
|
||||||
const ShapeArgs shape {
|
const ShapeArgs shape {
|
||||||
.mode = (Mode)m_ui->mode->checkedId(),
|
.mode = modeFromInt(m_ui->mode->checkedId()),
|
||||||
.sides = (std::uint32_t)m_ui->sides->value(),
|
.sides = (std::uint32_t)m_ui->sides->value(),
|
||||||
.layers_up = (std::uint32_t)m_ui->layersUp->value(),
|
.layers_up = (std::uint32_t)m_ui->layersUp->value(),
|
||||||
.layers_down = (std::uint32_t)m_ui->layersDown->value(),
|
.layers_down = (std::uint32_t)m_ui->layersDown->value(),
|
||||||
|
|
@ -57,9 +57,4 @@ void Hyperboloid::updateView() {
|
||||||
m_ui->viewport->setView(args);
|
m_ui->viewport->setView(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Hyperboloid::updateViewIf(bool update) {
|
|
||||||
if (update)
|
|
||||||
updateView();
|
|
||||||
}
|
|
||||||
|
|
||||||
#include "moc_main_window.cpp"
|
#include "moc_main_window.cpp"
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ public:
|
||||||
public slots:
|
public slots:
|
||||||
void updateModeUi();
|
void updateModeUi();
|
||||||
void updateView();
|
void updateView();
|
||||||
void updateViewIf(bool update); // for radio buttons
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const std::unique_ptr<Ui::MainWindow> m_ui;
|
const std::unique_ptr<Ui::MainWindow> m_ui;
|
||||||
|
|
|
||||||
|
|
@ -618,7 +618,6 @@
|
||||||
</connections>
|
</connections>
|
||||||
<slots>
|
<slots>
|
||||||
<slot>updateView()</slot>
|
<slot>updateView()</slot>
|
||||||
<slot>updateViewIf(bool)</slot>
|
|
||||||
<slot>updateModeUi()</slot>
|
<slot>updateModeUi()</slot>
|
||||||
</slots>
|
</slots>
|
||||||
<buttongroups>
|
<buttongroups>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user