- 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())) {
|
else if (IS_HORUS(firmware->getBoard())) {
|
||||||
if (modelsListModel->getCategoryIndex(modelIndex) >= 0) {
|
if (modelsListModel->getCategoryIndex(modelIndex) >= 0) {
|
||||||
contextMenu.addAction(CompanionIcon("add.png"), tr("&Add model"), this, SLOT(modelAdd()));
|
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()));
|
contextMenu.addAction(CompanionIcon("delete.png"), tr("&Delete category"), this, SLOT(categoryDelete()));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -370,6 +372,19 @@ void MdiChild::categoryAdd()
|
|||||||
setModified();
|
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()
|
void MdiChild::categoryDelete()
|
||||||
{
|
{
|
||||||
int categoryIndex = modelsListModel->getCategoryIndex(ui->modelsList->currentIndex());
|
int categoryIndex = modelsListModel->getCategoryIndex(ui->modelsList->currentIndex());
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ class MdiChild : public QWidget
|
|||||||
void checkAndInitModel(int row);
|
void checkAndInitModel(int row);
|
||||||
void generalEdit();
|
void generalEdit();
|
||||||
void categoryAdd();
|
void categoryAdd();
|
||||||
|
void categoryRename();
|
||||||
void categoryDelete();
|
void categoryDelete();
|
||||||
void modelAdd();
|
void modelAdd();
|
||||||
void modelEdit();
|
void modelEdit();
|
||||||
|
|||||||
Reference in New Issue
Block a user