diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-04-28 13:26:35 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2021-06-01 21:54:35 +0000 |
commit | 6ac77e81aec0b48a76b385092d9050941fa0e257 (patch) | |
tree | f5f2e1ee71690d9d1904e992db9cdc067840fa9d /examples/widgets/tools/regularexpression/regularexpressiondialog.h | |
parent | c59fbf576d2995f1c4fb52c1b21cf7d29cdf1a50 (diff) |
Regular Expression example: Brush up and add a way to preview replacements
- Set a fixed font on text edits so that parentheses stand out
- Rearrange the layout to have the text at the top be prevent
long texts from being wrapped
- Add a replacement field where one can exercise replacement
with the \1, \2... placeholders.
Pick-to: 6.1
Change-Id: I140a62e1fb2cd1c6bfe02a2f01b7f06a6f3b5eb2
Reviewed-by: Paul Wicking <paul.wicking@qt.io>
Diffstat (limited to 'examples/widgets/tools/regularexpression/regularexpressiondialog.h')
-rw-r--r-- | examples/widgets/tools/regularexpression/regularexpressiondialog.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.h b/examples/widgets/tools/regularexpression/regularexpressiondialog.h index b0db4d884c..b5d592c3c2 100644 --- a/examples/widgets/tools/regularexpression/regularexpressiondialog.h +++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.h @@ -54,6 +54,7 @@ #define REGULAREXPRESSIONDIALOG_H #include <QDialog> +#include <QRegularExpression> QT_BEGIN_NAMESPACE class QCheckBox; @@ -72,18 +73,25 @@ class RegularExpressionDialog : public QDialog public: RegularExpressionDialog(QWidget *parent = nullptr); +private slots: + void updateReplacement(); + private: void refresh(); void setupUi(); QWidget *setupLeftUi(); - QWidget *setupRightUi(); + QWidget *setupTextUi(); + QWidget *setupOptionsUi(); + QWidget *setupInfoUi(); void setResultUiEnabled(bool enabled); QLineEdit *patternLineEdit; QLineEdit *rawStringLiteralLineEdit; QLineEdit *escapedPatternLineEdit; + QLineEdit *replacementLineEdit; QPlainTextEdit *subjectTextEdit; + QPlainTextEdit *replacementTextEdit; QCheckBox *caseInsensitiveOptionCheckBox; QCheckBox *dotMatchesEverythingOptionCheckBox; @@ -104,6 +112,8 @@ private: QLabel *regexpStatusLabel; QTreeWidget *namedGroupsTreeWidget; + + QRegularExpression regularExpression; }; #endif |