summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorSamuel Gaist <samuel.gaist@edeltech.ch>2017-01-21 23:33:14 +0100
committerSamuel Gaist <samuel.gaist@edeltech.ch>2017-02-15 14:45:29 +0000
commita1cf6e52818d10ac5d4e6339d5bc4cf9b01bf44e (patch)
tree4dcda20be1a64bb10cf8b0b8c8315a290b26f314 /examples
parent280225495dc2ac1ca1a2b03c4e19a0b84e0b6bcf (diff)
Example: migrate stylesheet example to use QRegularExpression
Update the stylesheet example to use the new QRegularExpression class in place of the deprecated QRegExp. Change-Id: I7061b8fd462ff012cb67bfdade656b3bfe442dd8 Reviewed-by: Sze Howe Koh <szehowe.koh@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/widgets/widgets/stylesheet/stylesheeteditor.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/examples/widgets/widgets/stylesheet/stylesheeteditor.cpp b/examples/widgets/widgets/stylesheet/stylesheeteditor.cpp
index 7a75233628..3247fa774d 100644
--- a/examples/widgets/widgets/stylesheet/stylesheeteditor.cpp
+++ b/examples/widgets/widgets/stylesheet/stylesheeteditor.cpp
@@ -57,11 +57,12 @@ StyleSheetEditor::StyleSheetEditor(QWidget *parent)
{
ui.setupUi(this);
- QRegExp regExp(".(.*)\\+?Style");
+ QRegularExpression regExp("^.(.*)\\+?Style$");
QString defaultStyle = QApplication::style()->metaObject()->className();
+ QRegularExpressionMatch match = regExp.match(defaultStyle);
- if (regExp.exactMatch(defaultStyle))
- defaultStyle = regExp.cap(1);
+ if (match.hasMatch())
+ defaultStyle = match.captured(1);
ui.styleCombo->addItems(QStyleFactory::keys());
ui.styleCombo->setCurrentIndex(ui.styleCombo->findText(defaultStyle, Qt::MatchContains));