From 8a3a63b05f82404dad09f3f970526620f90f95c9 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Sun, 6 Sep 2015 03:55:39 +0000 Subject: [PATCH] qguiplatformplugin_kde: minor code shrink --- qguiplatformplugin_kde/qguiplatformplugin_kde.cpp | 37 ++++++++++------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/qguiplatformplugin_kde/qguiplatformplugin_kde.cpp b/qguiplatformplugin_kde/qguiplatformplugin_kde.cpp index ff4aaa62..d2c98347 100644 --- a/qguiplatformplugin_kde/qguiplatformplugin_kde.cpp +++ b/qguiplatformplugin_kde/qguiplatformplugin_kde.cpp @@ -48,22 +48,18 @@ static QString qt2KdeFilter(const QString &f) QString filter; QTextStream str(&filter, QIODevice::WriteOnly); const QStringList list(f.split(";;").replaceInStrings("/", "\\/")); - QStringList::const_iterator it(list.begin()), - end(list.end()); bool first=true; - for(; it!=end; ++it) - { - int ob=(*it).lastIndexOf('('), - cb=(*it).lastIndexOf(')'); + foreach(const QString it, list) { + int ob = it.lastIndexOf('('), cb = it.lastIndexOf(')'); - if(-1!=cb && ob0 && - ('('==(*it)[pos-1] || ' '==(*it)[pos-1]) && - (*it).length()>=kde.length()+pos && - (')'==(*it)[pos+kde.length()] || ' '==(*it)[pos+kde.length()])) + foreach(const QString it, list) { + pos = it.indexOf(kde); + if(pos != -1 && pos > 0 && + (it[pos-1] == '(' || it[pos-1] == ' ') && + it.length() >= (kde.length() + pos) && + (it[pos+kde.length()] == ')' || it[pos+kde.length()] == ' ')) { - *sel=*it; + *sel=it; return; } + } } } @@ -160,9 +156,8 @@ public: virtual QStringList keys() const { return QStringList() << QLatin1String("kde"); } virtual QString styleName() { - const QString defaultStyle = KStyle::defaultStyle(); const KConfigGroup pConfig(KGlobal::config(), "General"); - return pConfig.readEntry("widgetStyle", defaultStyle); + return pConfig.readEntry("widgetStyle", KStyle::defaultStyle()); } virtual QPalette palette() { -- 2.11.0