mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-27 12:52:07 +00:00
A bunch of tab fixes (#6551)
* Make sure the speed tab is properly hidden when toggle off advance mode * Clear each page before clearing the parent, otherwise the child pages will be destroyed twice * Fix crash if current selected tab is positioned after the removed tab * Fix issue that sometimes the printer config first page is not displayed * Fix issue that the wrong tab item get bold if the number of tabs changed
This commit is contained in:
@@ -120,6 +120,11 @@ bool TabCtrl::DeleteItem(int item)
|
||||
if (item < 0 || item >= btns.size()) {
|
||||
return false;
|
||||
}
|
||||
const bool selection_changed = sel >= item;
|
||||
|
||||
if (selection_changed) {
|
||||
sendTabCtrlEvent(true);
|
||||
}
|
||||
|
||||
Button* btn = btns[item];
|
||||
btn->Destroy();
|
||||
@@ -127,9 +132,12 @@ bool TabCtrl::DeleteItem(int item)
|
||||
sizer->Remove(item * 2);
|
||||
if (btns.size() > 1)
|
||||
sizer->GetItem(sizer->GetItemCount() - 1)->SetMinSize({0, 0});
|
||||
|
||||
if (selection_changed) {
|
||||
sel--; // `relayout()` uses `sel` so we need to update this before calling `relayout()`
|
||||
}
|
||||
relayout();
|
||||
if (sel >= item) {
|
||||
sel--;
|
||||
if (selection_changed) {
|
||||
sendTabCtrlEvent();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user