- enhancement: add help link for regular expression in search dialog

This commit is contained in:
Roy Qu 2022-04-11 09:39:44 +08:00
parent b1cc0457ea
commit 9cc51a150d
4 changed files with 66 additions and 6 deletions

View File

@ -1,5 +1,6 @@
Red Panda C++ Version 1.0.4 Red Panda C++ Version 1.0.4
- fix: hide function tips, when move or resize the main window - fix: hide function tips, when move or resize the main window
- enhancement: add help link for regular expression in search dialog
Red Panda C++ Version 1.0.3 Red Panda C++ Version 1.0.3
- fix: when oj problem grabbed by competitive companion received, - fix: when oj problem grabbed by competitive companion received,

View File

@ -23,6 +23,7 @@
#include "../qsynedit/Search.h" #include "../qsynedit/Search.h"
#include "../qsynedit/SearchRegex.h" #include "../qsynedit/SearchRegex.h"
#include "../project.h" #include "../project.h"
#include "../settings.h"
#include <QMessageBox> #include <QMessageBox>
#include <QDebug> #include <QDebug>
@ -466,6 +467,20 @@ std::shared_ptr<SearchResultTreeItem> SearchDialog::batchFindInEditor(SynEdit *e
return parentItem; return parentItem;
} }
void SearchDialog::showEvent(QShowEvent *event)
{
QDialog::showEvent(event);
if (pSettings->environment().language()=="zh_CN") {
ui->txtRegExpHelp->setText(
QString("<html><head/><body><p><a href=\"%1\"><span style=\" text-decoration: underline; color:#0000ff;\">(?)</span></a></p></body></html>")
.arg("https://www.runoob.com/regexp/regexp-tutorial.html"));
} else {
ui->txtRegExpHelp->setText(
QString("<html><head/><body><p><a href=\"%1\"><span style=\" text-decoration: underline; color:#0000ff;\">(?)</span></a></p></body></html>")
.arg("https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference"));
}
}
QTabBar *SearchDialog::tabBar() const QTabBar *SearchDialog::tabBar() const
{ {
return mTabBar; return mTabBar;

View File

@ -72,6 +72,10 @@ private:
PSynSearchBase mSearchEngine; PSynSearchBase mSearchEngine;
PSynSearchBase mBasicSearchEngine; PSynSearchBase mBasicSearchEngine;
PSynSearchBase mRegexSearchEngine; PSynSearchBase mRegexSearchEngine;
// QWidget interface
protected:
void showEvent(QShowEvent *event) Q_DECL_OVERRIDE;
}; };
#endif // SEARCHDIALOG_H #endif // SEARCHDIALOG_H

View File

@ -126,10 +126,50 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="chkRegExp"> <widget class="QWidget" name="widget_2" native="true">
<property name="text"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<string>Regular Expression</string> <property name="leftMargin">
</property> <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="QCheckBox" name="chkRegExp">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Regular Expression</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="txtRegExpHelp">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;a href=&quot;https://docs.microsoft.com/en-us/dotnet/standard/base-types/regular-expression-language-quick-reference&quot;&gt;&lt;span style=&quot; text-decoration: underline; color:#0000ff;&quot;&gt;(?)&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget> </widget>
</item> </item>
<item> <item>
@ -253,7 +293,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>
@ -299,7 +339,7 @@
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>20</width> <width>20</width>
<height>40</height> <height>0</height>
</size> </size>
</property> </property>
</spacer> </spacer>