summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/AddCacheEntry.cxx
diff options
context:
space:
mode:
authorKitware Robot <kwrobot@kitware.com>2016-05-16 14:34:04 (GMT)
committerBrad King <brad.king@kitware.com>2016-05-16 20:05:19 (GMT)
commitd9fd2f5402eeaa345691313658e02b51038f570b (patch)
treedca71b9a7e267f4c6300da3eb770415381726785 /Source/QtDialog/AddCacheEntry.cxx
parent82df6deaafb36cbbfd450202bb20b320f637751a (diff)
downloadCMake-d9fd2f5402eeaa345691313658e02b51038f570b.zip
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.gz
CMake-d9fd2f5402eeaa345691313658e02b51038f570b.tar.bz2
Revise C++ coding style using clang-format
Run the `Utilities/Scripts/clang-format.bash` script to update all our C++ code to a new style defined by `.clang-format`. Use `clang-format` version 3.8. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit.
Diffstat (limited to 'Source/QtDialog/AddCacheEntry.cxx')
-rw-r--r--Source/QtDialog/AddCacheEntry.cxx64
1 files changed, 29 insertions, 35 deletions
diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx
index efb2b65..dc7a4b0 100644
--- a/Source/QtDialog/AddCacheEntry.cxx
+++ b/Source/QtDialog/AddCacheEntry.cxx
@@ -17,21 +17,23 @@
static const int NumTypes = 4;
static const int DefaultTypeIndex = 0;
-static const QByteArray TypeStrings[NumTypes] =
- { "BOOL", "PATH", "FILEPATH", "STRING" };
-static const QCMakeProperty::PropertyType Types[NumTypes] =
- { QCMakeProperty::BOOL, QCMakeProperty::PATH,
- QCMakeProperty::FILEPATH, QCMakeProperty::STRING};
+static const QByteArray TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH",
+ "STRING" };
+static const QCMakeProperty::PropertyType Types[NumTypes] = {
+ QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH,
+ QCMakeProperty::STRING
+};
AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
- const QStringList& varTypes)
- : QWidget(p), VarNames(varNames), VarTypes(varTypes)
+ const QStringList& varTypes)
+ : QWidget(p)
+ , VarNames(varNames)
+ , VarTypes(varTypes)
{
this->setupUi(this);
- for(int i=0; i<NumTypes; i++)
- {
+ for (int i = 0; i < NumTypes; i++) {
this->Type->addItem(TypeStrings[i]);
- }
+ }
QWidget* cb = new QCheckBox();
QWidget* path = new QCMakePathEditor();
QWidget* filepath = new QCMakeFilePathEditor();
@@ -46,10 +48,10 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames,
this->setTabOrder(path, filepath);
this->setTabOrder(filepath, string);
this->setTabOrder(string, this->Description);
- QCompleter *completer = new QCompleter(this->VarNames, this);
+ QCompleter* completer = new QCompleter(this->VarNames, this);
this->Name->setCompleter(completer);
- connect(completer, SIGNAL(activated(const QString&)),
- this, SLOT(onCompletionActivated(const QString&)));
+ connect(completer, SIGNAL(activated(const QString&)), this,
+ SLOT(onCompletionActivated(const QString&)));
}
QString AddCacheEntry::name() const
@@ -60,14 +62,11 @@ QString AddCacheEntry::name() const
QVariant AddCacheEntry::value() const
{
QWidget* w = this->StackedWidget->currentWidget();
- if(qobject_cast<QLineEdit*>(w))
- {
+ if (qobject_cast<QLineEdit*>(w)) {
return static_cast<QLineEdit*>(w)->text();
- }
- else if(qobject_cast<QCheckBox*>(w))
- {
+ } else if (qobject_cast<QCheckBox*>(w)) {
return static_cast<QCheckBox*>(w)->isChecked();
- }
+ }
return QVariant();
}
@@ -79,36 +78,31 @@ QString AddCacheEntry::description() const
QCMakeProperty::PropertyType AddCacheEntry::type() const
{
int idx = this->Type->currentIndex();
- if(idx >= 0 && idx < NumTypes)
- {
+ if (idx >= 0 && idx < NumTypes) {
return Types[idx];
- }
+ }
return Types[DefaultTypeIndex];
}
QString AddCacheEntry::typeString() const
{
int idx = this->Type->currentIndex();
- if(idx >= 0 && idx < NumTypes)
- {
+ if (idx >= 0 && idx < NumTypes) {
return TypeStrings[idx];
- }
+ }
return TypeStrings[DefaultTypeIndex];
}
-void AddCacheEntry::onCompletionActivated(const QString &text)
+void AddCacheEntry::onCompletionActivated(const QString& text)
{
int idx = this->VarNames.indexOf(text);
- if (idx != -1)
- {
+ if (idx != -1) {
QString vartype = this->VarTypes[idx];
- for (int i = 0; i < NumTypes; i++)
- {
- if (TypeStrings[i] == vartype)
- {
- this->Type->setCurrentIndex(i);
- break;
- }
+ for (int i = 0; i < NumTypes; i++) {
+ if (TypeStrings[i] == vartype) {
+ this->Type->setCurrentIndex(i);
+ break;
}
}
+ }
}