forked from MrBesen/soundboard
delete button for rows
This commit is contained in:
parent
93709ff3fd
commit
89564c70ce
|
@ -33,10 +33,11 @@ public:
|
||||||
|
|
||||||
const static int TYPE = 1000;
|
const static int TYPE = 1000;
|
||||||
|
|
||||||
|
virtual bool hasRemove() const;
|
||||||
virtual bool hasMoveUp() const;
|
virtual bool hasMoveUp() const;
|
||||||
virtual bool hasMoveDown() const;
|
virtual bool hasMoveDown() const;
|
||||||
|
|
||||||
|
virtual void remove();
|
||||||
virtual void moveUp();
|
virtual void moveUp();
|
||||||
virtual void moveDown();
|
virtual void moveDown();
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,9 @@ void ButtonManager::editButton() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonManager::deleteButton() {
|
void ButtonManager::deleteButton() {
|
||||||
|
QTreeWidgetItem* currentSelectedItem = getSelectedItem();
|
||||||
perform<&ButtonManagerItem::remove>();
|
perform<&ButtonManagerItem::remove>();
|
||||||
|
delete currentSelectedItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ButtonManager::upButton() {
|
void ButtonManager::upButton() {
|
||||||
|
|
|
@ -67,6 +67,10 @@ RowItem::RowItem(QTreeWidgetItem* parent, uint8_t rownr, Config::RootConfig& con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RowItem::hasRemove() const {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool RowItem::hasMoveUp() const {
|
bool RowItem::hasMoveUp() const {
|
||||||
return pos > 0;
|
return pos > 0;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +79,10 @@ bool RowItem::hasMoveDown() const {
|
||||||
return pos < conf.buttons.size()-1;
|
return pos < conf.buttons.size()-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RowItem::remove() {
|
||||||
|
conf.buttons.erase(conf.buttons.begin() + pos);
|
||||||
|
}
|
||||||
|
|
||||||
void RowItem::moveUp() {
|
void RowItem::moveUp() {
|
||||||
//apply change to config
|
//apply change to config
|
||||||
conf.buttons.at(pos-1).swap(conf.buttons.at(pos));
|
conf.buttons.at(pos-1).swap(conf.buttons.at(pos));
|
||||||
|
|
Loading…
Reference in New Issue