- enhancement: Add various menu items for cursor actions using Home/End/Page Up/Page Down keys.

- enhancement: Filter names in the shortcut config page of options dialog.
This commit is contained in:
Roy Qu 2023-05-31 08:52:59 +08:00
parent 89cc44bcf6
commit 72189f0a94
10 changed files with 1375 additions and 770 deletions

View File

@ -12,6 +12,8 @@ Red Panda C++ Version 2.22
- upgrade raylib to 4.5, raygui to 3.6 - upgrade raylib to 4.5, raygui to 3.6
- enhancement: support -std=c++2d gcc parameter - enhancement: support -std=c++2d gcc parameter
- fix: vertice shader(.vs) and fragment shader(.fs) files can't be openned by double click in the project browser. - fix: vertice shader(.vs) and fragment shader(.fs) files can't be openned by double click in the project browser.
- enhancement: Add various menu items for cursor actions using Home/End/Page Up/Page Down keys.
- enhancement: Filter names in the shortcut config page of options dialog.
Red Panda C++ Version 2.21 Red Panda C++ Version 2.21

View File

@ -9776,3 +9776,147 @@ void MainWindow::on_actionNew_Text_File_triggered()
newEditor("txt"); newEditor("txt");
} }
void MainWindow::on_actionPage_Up_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::PageUp);
}
}
void MainWindow::on_actionPage_Down_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::PageDown);
}
}
void MainWindow::on_actionGoto_Line_Start_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::LineStart);
}
}
void MainWindow::on_actionGoto_Line_End_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::LineEnd);
}
}
void MainWindow::on_actionGoto_File_Start_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::EditorStart);
}
}
void MainWindow::on_actionGoto_File_End_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::EditorEnd);
}
}
void MainWindow::on_actionPage_Up_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelPageUp);
}
}
void MainWindow::on_actionPage_Down_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelPageDown);
}
}
void MainWindow::on_actionGoto_Page_Start_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::PageTop);
}
}
void MainWindow::on_actionGoto_Page_End_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::PageBottom);
}
}
void MainWindow::on_actionGoto_Page_Start_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelPageTop);
}
}
void MainWindow::on_actionGoto_Page_End_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelPageBottom);
}
}
void MainWindow::on_actionGoto_Line_Start_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelLineStart);
}
}
void MainWindow::on_actionGoto_Line_End_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelLineEnd);
}
}
void MainWindow::on_actionGoto_File_Start_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelEditorStart);
}
}
void MainWindow::on_actionGoto_File_End_and_Select_triggered()
{
Editor * editor = mEditorList->getEditor();
if (editor && editor->hasFocus()) {
editor->processCommand(QSynedit::EditCommand::SelEditorEnd);
}
}

View File

@ -809,6 +809,38 @@ private slots:
void on_actionNew_Text_File_triggered(); void on_actionNew_Text_File_triggered();
void on_actionPage_Up_triggered();
void on_actionPage_Down_triggered();
void on_actionGoto_Line_Start_triggered();
void on_actionGoto_Line_End_triggered();
void on_actionGoto_File_Start_triggered();
void on_actionGoto_File_End_triggered();
void on_actionPage_Up_and_Select_triggered();
void on_actionPage_Down_and_Select_triggered();
void on_actionGoto_Page_Start_triggered();
void on_actionGoto_Page_End_triggered();
void on_actionGoto_Page_Start_and_Select_triggered();
void on_actionGoto_Page_End_and_Select_triggered();
void on_actionGoto_Line_Start_and_Select_triggered();
void on_actionGoto_Line_End_and_Select_triggered();
void on_actionGoto_File_Start_and_Select_triggered();
void on_actionGoto_File_End_and_Select_triggered();
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
bool mFullInitialized; bool mFullInitialized;

View File

@ -177,6 +177,19 @@
<property name="title"> <property name="title">
<string>Edit</string> <string>Edit</string>
</property> </property>
<widget class="QMenu" name="menuMove_Cursor">
<property name="title">
<string>Move Cursor</string>
</property>
<addaction name="actionPage_Up"/>
<addaction name="actionPage_Down"/>
<addaction name="actionGoto_Line_Start"/>
<addaction name="actionGoto_Line_End"/>
<addaction name="actionGoto_File_Start"/>
<addaction name="actionGoto_File_End"/>
<addaction name="actionGoto_Page_Start"/>
<addaction name="actionGoto_Page_End"/>
</widget>
<addaction name="actionUndo"/> <addaction name="actionUndo"/>
<addaction name="actionRedo"/> <addaction name="actionRedo"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -193,6 +206,7 @@
<addaction name="actionFoldAll"/> <addaction name="actionFoldAll"/>
<addaction name="actionUnfoldAll"/> <addaction name="actionUnfoldAll"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="menuMove_Cursor"/>
<addaction name="actionDelete_Line"/> <addaction name="actionDelete_Line"/>
<addaction name="actionDuplicate_Line"/> <addaction name="actionDuplicate_Line"/>
<addaction name="actionDelete_Word"/> <addaction name="actionDelete_Word"/>
@ -344,6 +358,15 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionMove_Selection_Up"/> <addaction name="actionMove_Selection_Up"/>
<addaction name="actionMove_Selection_Down"/> <addaction name="actionMove_Selection_Down"/>
<addaction name="separator"/>
<addaction name="actionPage_Up_and_Select"/>
<addaction name="actionPage_Down_and_Select"/>
<addaction name="actionGoto_Page_Start_and_Select"/>
<addaction name="actionGoto_Page_End_and_Select"/>
<addaction name="actionGoto_Line_Start_and_Select"/>
<addaction name="actionGoto_Line_End_and_Select"/>
<addaction name="actionGoto_File_Start_and_Select"/>
<addaction name="actionGoto_File_End_and_Select"/>
</widget> </widget>
<addaction name="menuFile"/> <addaction name="menuFile"/>
<addaction name="menuEdit"/> <addaction name="menuEdit"/>
@ -3359,6 +3382,134 @@
<string>New Text File</string> <string>New Text File</string>
</property> </property>
</action> </action>
<action name="actionPage_Up">
<property name="text">
<string>Page Up</string>
</property>
<property name="menuRole">
<enum>QAction::TextHeuristicRole</enum>
</property>
</action>
<action name="actionPage_Down">
<property name="text">
<string>Page Down</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Line_Start">
<property name="text">
<string>Goto Line Start</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Line_End">
<property name="text">
<string>Goto Line End</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_File_Start">
<property name="text">
<string>Goto File Start</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_File_End">
<property name="text">
<string>Goto File End</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionPage_Up_and_Select">
<property name="text">
<string>Page Up and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionPage_Down_and_Select">
<property name="text">
<string>Page Down and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Page_Start">
<property name="text">
<string>Goto Page Start</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Page_End">
<property name="text">
<string>Goto Page End</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Page_Start_and_Select">
<property name="text">
<string>Goto Page Start and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Page_End_and_Select">
<property name="text">
<string>Goto Page End and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Line_Start_and_Select">
<property name="text">
<string>Goto Line Start and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_Line_End_and_Select">
<property name="text">
<string>Goto Line End and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_File_Start_and_Select">
<property name="text">
<string>Goto File Start and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
<action name="actionGoto_File_End_and_Select">
<property name="text">
<string>Goto File End and Select</string>
</property>
<property name="menuRole">
<enum>QAction::NoRole</enum>
</property>
</action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>

View File

@ -27,9 +27,12 @@ EnvironmentShortcutWidget::EnvironmentShortcutWidget(const QString& name, const
ui(new Ui::EnvironmentShortcutWidget) ui(new Ui::EnvironmentShortcutWidget)
{ {
ui->setupUi(this); ui->setupUi(this);
mFilterProxy = new QSortFilterProxyModel(this);
mFilterProxy->setSourceModel(&mModel);
mFilterProxy->setFilterKeyColumn(0);
mDelegate =new EnvironmentShortcutDelegate(this); mDelegate =new EnvironmentShortcutDelegate(this);
QItemSelectionModel* m=ui->tblShortcut->selectionModel(); QItemSelectionModel* m=ui->tblShortcut->selectionModel();
ui->tblShortcut->setModel(&mModel); ui->tblShortcut->setModel(mFilterProxy);
delete m; delete m;
ui->tblShortcut->setItemDelegate(mDelegate); ui->tblShortcut->setItemDelegate(mDelegate);
connect(&mModel, &EnvironmentShortcutModel::shortcutChanged, connect(&mModel, &EnvironmentShortcutModel::shortcutChanged,
@ -220,3 +223,9 @@ void EnvironmentShortcutDelegate::onEditingFinished(QWidget* editor)
emit commitData(editor); emit commitData(editor);
emit closeEditor(editor, QAbstractItemDelegate::SubmitModelCache); emit closeEditor(editor, QAbstractItemDelegate::SubmitModelCache);
} }
void EnvironmentShortcutWidget::on_txtKeyword_textChanged(const QString &arg1)
{
mFilterProxy->setFilterFixedString(arg1);
}

View File

@ -18,6 +18,7 @@
#define ENVIRONMENTSHORTCUTWIDGET_H #define ENVIRONMENTSHORTCUTWIDGET_H
#include <QAbstractTableModel> #include <QAbstractTableModel>
#include <QSortFilterProxyModel>
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QWidget> #include <QWidget>
#include "settingswidget.h" #include "settingswidget.h"
@ -79,8 +80,12 @@ private:
protected: protected:
void doLoad() override; void doLoad() override;
void doSave() override; void doSave() override;
private slots:
void on_txtKeyword_textChanged(const QString &arg1);
private: private:
EnvironmentShortcutModel mModel; EnvironmentShortcutModel mModel;
QSortFilterProxyModel* mFilterProxy;
EnvironmentShortcutDelegate* mDelegate; EnvironmentShortcutDelegate* mDelegate;
}; };

View File

@ -13,7 +13,35 @@
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QWidget" name="widget" native="true">
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Keyword</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="txtKeyword"/>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QTableView" name="tblShortcut"> <widget class="QTableView" name="tblShortcut">
<property name="alternatingRowColors"> <property name="alternatingRowColors">

View File

@ -1952,6 +1952,10 @@
<source>Form</source> <source>Form</source>
<translation>Configuração</translation> <translation>Configuração</translation>
</message> </message>
<message>
<source>Keyword</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ExecutableRunner</name> <name>ExecutableRunner</name>
@ -5195,6 +5199,74 @@
<source>You should recompile after change the compiler set or it&apos;s settings.</source> <source>You should recompile after change the compiler set or it&apos;s settings.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Move Cursor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Up</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Down</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Up and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Down and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page Start and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page End and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line Start and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line End and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File Start and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File End and Select</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MemoryModel</name> <name>MemoryModel</name>

File diff suppressed because it is too large Load Diff

View File

@ -1785,6 +1785,10 @@
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Keyword</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>ExecutableRunner</name> <name>ExecutableRunner</name>
@ -4920,6 +4924,74 @@
<source>You should recompile after change the compiler set or it&apos;s settings.</source> <source>You should recompile after change the compiler set or it&apos;s settings.</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<source>Move Cursor</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Up</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Down</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Up and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Page Down and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page Start</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page End</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page Start and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Page End and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line Start and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto Line End and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File Start and Select</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Goto File End and Select</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>MemoryModel</name> <name>MemoryModel</name>