add empty row, fixed bug in delete row
This commit is contained in:
parent
87985abaa0
commit
b5cee731ca
|
@ -40,6 +40,10 @@ void ButtonManager::addButton() {
|
||||||
AddNewWhat::ReturnCode type = whatshouldbeadded.returnCode;
|
AddNewWhat::ReturnCode type = whatshouldbeadded.returnCode;
|
||||||
if(type == AddNewWhat::ReturnCode::Row) {
|
if(type == AddNewWhat::ReturnCode::Row) {
|
||||||
// create new 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;
|
return;
|
||||||
}
|
}
|
||||||
if(type == AddNewWhat::ReturnCode::Button) {
|
if(type == AddNewWhat::ReturnCode::Button) {
|
||||||
|
|
|
@ -74,6 +74,14 @@ bool RowItem::hasMoveDown() const {
|
||||||
|
|
||||||
void RowItem::remove() {
|
void RowItem::remove() {
|
||||||
conf.buttons.erase(conf.buttons.begin() + pos);
|
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() {
|
void RowItem::moveUp() {
|
||||||
|
|
Loading…
Reference in New Issue