summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets')
-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));