- Adds "rename" to the context menu for categories, it uses the same code path as the default dblClick handler for the base class. - Added a separator so the context menu looks more like the one for models - Some whitespace changes in mdichild.h, my editor truncates whitespace on blank lines.
This commit is contained in:
committed by
Bertrand Songis
parent
58971dffea
commit
c6026e8a0f
@@ -139,6 +139,8 @@ void MdiChild::showModelsListContextMenu(const QPoint & pos)
|
||||
else if (IS_HORUS(firmware->getBoard())) {
|
||||
if (modelsListModel->getCategoryIndex(modelIndex) >= 0) {
|
||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add model"), this, SLOT(modelAdd()));
|
||||
contextMenu.addSeparator();
|
||||
contextMenu.addAction(CompanionIcon("rename.png"), tr("&Rename category"), this, SLOT(categoryRename()));
|
||||
contextMenu.addAction(CompanionIcon("delete.png"), tr("&Delete category"), this, SLOT(categoryDelete()));
|
||||
}
|
||||
else {
|
||||
@@ -370,6 +372,19 @@ void MdiChild::categoryAdd()
|
||||
setModified();
|
||||
}
|
||||
|
||||
void MdiChild::categoryRename()
|
||||
{
|
||||
QModelIndex modelIndex = ui->modelsList->currentIndex();
|
||||
int categoryIndex = modelsListModel->getCategoryIndex(modelIndex);
|
||||
if (categoryIndex < 0 || categoryIndex >= (int)radioData.categories.size()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Not calling setModified() here because QAbstractItemView::edit will
|
||||
// haandle it if the user actually makes a change
|
||||
ui->modelsList->edit(modelIndex);
|
||||
}
|
||||
|
||||
void MdiChild::categoryDelete()
|
||||
{
|
||||
int categoryIndex = modelsListModel->getCategoryIndex(ui->modelsList->currentIndex());
|
||||
|
||||
Reference in New Issue
Block a user