add empty row, fixed bug in delete row

This commit is contained in:
mrbesen 2021-12-21 18:18:45 +01:00
parent 87985abaa0
commit b5cee731ca
Signed by untrusted user: MrBesen
GPG Key ID: 596B2350DCD67504
2 changed files with 12 additions and 0 deletions

View File

@ -40,6 +40,10 @@ void ButtonManager::addButton() {
AddNewWhat::ReturnCode type = whatshouldbeadded.returnCode;
if(type == AddNewWhat::ReturnCode::Row) {
// create new row
//TODO: when a row is selected: add after the selected row
workingConfig.buttons.push_back({}); // create a empty vector
RowItem* row = new RowItem(ui->buttonTreeWidget->invisibleRootItem(), workingConfig.buttons.size()-1, workingConfig);
return;
}
if(type == AddNewWhat::ReturnCode::Button) {

View File

@ -74,6 +74,14 @@ bool RowItem::hasMoveDown() const {
void RowItem::remove() {
conf.buttons.erase(conf.buttons.begin() + pos);
for(uint8_t i = pos+1; i <= conf.buttons.size(); ++i) {
RowItem* item = dynamic_cast<RowItem*>(mparent->child(i));
if(item) {
item->pos--;
item->updatePosition();
}
}
}
void RowItem::moveUp() {