Fix cut face list button state

master
huxingyi 2020-03-25 21:40:47 +09:30
parent 2800bf7c46
commit ae478fc064
2 changed files with 6 additions and 10 deletions

View File

@ -1820,11 +1820,11 @@ void DocumentWindow::showCutFaceSettingPopup(const QPoint &globalPos, std::set<Q
QPushButton *buttons[(int)CutFace::Count] = {0};
CutFaceListWidget *cutFaceListWidget = new CutFaceListWidget(m_document);
size_t cutFaceTypeCount = (size_t)CutFace::Count;
if (cutFaceListWidget->isEmpty())
cutFaceTypeCount = (size_t)CutFace::UserDefined;
size_t cutFaceTypeCount = (size_t)CutFace::UserDefined;
auto updateCutFaceButtonState = [&](size_t index) {
if (index != (int)CutFace::UserDefined)
cutFaceListWidget->selectCutFace(QUuid());
for (size_t i = 0; i < (size_t)cutFaceTypeCount; ++i) {
auto button = buttons[i];
if (i == index) {
@ -1835,8 +1835,6 @@ void DocumentWindow::showCutFaceSettingPopup(const QPoint &globalPos, std::set<Q
button->setEnabled(true);
}
}
if (index != (int)CutFace::UserDefined)
cutFaceListWidget->selectCutFace(QUuid());
};
cutFaceListWidget->enableMultipleSelection(false);

View File

@ -558,11 +558,11 @@ void PartWidget::showCutRotationSettingPopup(const QPoint &pos)
QPushButton *buttons[(int)CutFace::Count] = {0};
CutFaceListWidget *cutFaceListWidget = new CutFaceListWidget(m_document);
size_t cutFaceTypeCount = (size_t)CutFace::Count;
if (cutFaceListWidget->isEmpty())
cutFaceTypeCount = (size_t)CutFace::UserDefined;
size_t cutFaceTypeCount = (size_t)CutFace::UserDefined;
auto updateCutFaceButtonState = [&](size_t index) {
if (index != (int)CutFace::UserDefined)
cutFaceListWidget->selectCutFace(QUuid());
for (size_t i = 0; i < (size_t)cutFaceTypeCount; ++i) {
auto button = buttons[i];
if (i == index) {
@ -573,8 +573,6 @@ void PartWidget::showCutRotationSettingPopup(const QPoint &pos)
button->setEnabled(true);
}
}
if (index != (int)CutFace::UserDefined)
cutFaceListWidget->selectCutFace(QUuid());
};
cutFaceListWidget->enableMultipleSelection(false);