diff --git a/NEWS.md b/NEWS.md index 632d1c06..408a8a95 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,7 @@ Red Panda C++ Version 0.14.0 - enhancement: greatly speed up code completion - fix: code folding calcuation not correct when some codes are folded and editing after them - enhancement: code completion ui redesigned + - fix: mainwindow action's short cut doesn't work, if the action is not in menu or toolbar Red Panda C++ Version 0.13.4 - fix: when copy comments, don't auto indent diff --git a/RedPandaIDE/mainwindow.cpp b/RedPandaIDE/mainwindow.cpp index 7221d023..af511bd0 100644 --- a/RedPandaIDE/mainwindow.cpp +++ b/RedPandaIDE/mainwindow.cpp @@ -97,6 +97,7 @@ MainWindow::MainWindow(QWidget *parent) mSystemTurnedOff(false) { ui->setupUi(this); + addActions( this->findChildren(QString(), Qt::FindChildrenRecursively)); // status bar mFileInfoStatus=new QLabel(); mFileEncodingStatus = new LabelWithMenu(); @@ -167,6 +168,7 @@ MainWindow::MainWindow(QWidget *parent) mMenuNew->addAction(ui->actionNew_Project); ui->menuFile->insertMenu(ui->actionOpen,mMenuNew); + mMenuExport = new QMenu(tr("Export")); mMenuExport->addAction(ui->actionExport_As_RTF); mMenuExport->addAction(ui->actionExport_As_HTML); @@ -5664,6 +5666,7 @@ void MainWindow::on_actionExport_As_HTML_triggered() void MainWindow::on_actionMove_To_Other_View_triggered() { + qDebug()<<"test"; Editor * editor = mEditorList->getEditor(); if (editor) { mEditorList->swapEditor(editor); diff --git a/RedPandaIDE/mainwindow.ui b/RedPandaIDE/mainwindow.ui index 4bc7aa5d..af778c50 100644 --- a/RedPandaIDE/mainwindow.ui +++ b/RedPandaIDE/mainwindow.ui @@ -2297,6 +2297,9 @@ Ctrl+B + + Qt::ApplicationShortcut + @@ -2448,6 +2451,9 @@ Ctrl+M + + Qt::ApplicationShortcut + diff --git a/RedPandaIDE/settingsdialog/environmentshortcutwidget.cpp b/RedPandaIDE/settingsdialog/environmentshortcutwidget.cpp index fa600650..d0cb097b 100644 --- a/RedPandaIDE/settingsdialog/environmentshortcutwidget.cpp +++ b/RedPandaIDE/settingsdialog/environmentshortcutwidget.cpp @@ -57,13 +57,23 @@ void EnvironmentShortcutModel::reload() { beginResetModel(); mShortcuts.clear(); - QList actions = pMainWindow->findChildren(QString(),Qt::FindDirectChildrenOnly); + QList actions = pMainWindow->findChildren(QString(), Qt::FindDirectChildrenOnly); QList menus = pMainWindow->menuBar()->findChildren(); foreach( const QMenu* menu, menus) { if (menu->title().isEmpty()) continue; loadShortCutsOfMenu(menu, actions); } + foreach (QAction* action,actions) { + if (!action->text().isEmpty()) { + PEnvironmentShortcut item = std::make_shared(); + item->name = action->objectName(); + item->fullPath = QString("%1 : %2").arg(tr("action"),action->text()); + item->action = action; + item->shortcut = action->shortcut().toString().trimmed(); + mShortcuts.append(item); + } + } endResetModel(); }