summaryrefslogtreecommitdiffstats
path: root/Source/QtDialog/QCMakeWidgets.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/QCMakeWidgets.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/QCMakeWidgets.cxx')
-rw-r--r--Source/QtDialog/QCMakeWidgets.cxx58
1 files changed, 25 insertions, 33 deletions
diff --git a/Source/QtDialog/QCMakeWidgets.cxx b/Source/QtDialog/QCMakeWidgets.cxx
index 7803ef3..4b3eb34 100644
--- a/Source/QtDialog/QCMakeWidgets.cxx
+++ b/Source/QtDialog/QCMakeWidgets.cxx
@@ -19,23 +19,24 @@
#include <QToolButton>
QCMakeFileEditor::QCMakeFileEditor(QWidget* p, const QString& var)
- : QLineEdit(p), Variable(var)
+ : QLineEdit(p)
+ , Variable(var)
{
this->ToolButton = new QToolButton(this);
this->ToolButton->setText("...");
this->ToolButton->setCursor(QCursor(Qt::ArrowCursor));
- QObject::connect(this->ToolButton, SIGNAL(clicked(bool)),
- this, SLOT(chooseFile()));
+ QObject::connect(this->ToolButton, SIGNAL(clicked(bool)), this,
+ SLOT(chooseFile()));
}
QCMakeFilePathEditor::QCMakeFilePathEditor(QWidget* p, const QString& var)
- : QCMakeFileEditor(p, var)
+ : QCMakeFileEditor(p, var)
{
this->setCompleter(new QCMakeFileCompleter(this, false));
}
QCMakePathEditor::QCMakePathEditor(QWidget* p, const QString& var)
- : QCMakeFileEditor(p, var)
+ : QCMakeFileEditor(p, var)
{
this->setCompleter(new QCMakeFileCompleter(this, true));
}
@@ -57,24 +58,21 @@ void QCMakeFilePathEditor::chooseFile()
QString path;
QFileInfo info(this->text());
QString title;
- if(this->Variable.isEmpty())
- {
+ if (this->Variable.isEmpty()) {
title = tr("Select File");
- }
- else
- {
+ } else {
title = tr("Select File for %1");
title = title.arg(this->Variable);
- }
+ }
this->fileDialogExists(true);
- path = QFileDialog::getOpenFileName(this, title, info.absolutePath(),
- QString(), NULL, QFileDialog::DontResolveSymlinks);
+ path =
+ QFileDialog::getOpenFileName(this, title, info.absolutePath(), QString(),
+ NULL, QFileDialog::DontResolveSymlinks);
this->fileDialogExists(false);
- if(!path.isEmpty())
- {
+ if (!path.isEmpty()) {
this->setText(QDir::fromNativeSeparators(path));
- }
+ }
}
void QCMakePathEditor::chooseFile()
@@ -82,43 +80,38 @@ void QCMakePathEditor::chooseFile()
// choose a file and set it
QString path;
QString title;
- if(this->Variable.isEmpty())
- {
+ if (this->Variable.isEmpty()) {
title = tr("Select Path");
- }
- else
- {
+ } else {
title = tr("Select Path for %1");
title = title.arg(this->Variable);
- }
+ }
this->fileDialogExists(true);
path = QFileDialog::getExistingDirectory(this, title, this->text(),
- QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
+ QFileDialog::ShowDirsOnly |
+ QFileDialog::DontResolveSymlinks);
this->fileDialogExists(false);
- if(!path.isEmpty())
- {
+ if (!path.isEmpty()) {
this->setText(QDir::fromNativeSeparators(path));
- }
+ }
}
// use same QDirModel for all completers
static QDirModel* fileDirModel()
{
static QDirModel* m = NULL;
- if(!m)
- {
+ if (!m) {
m = new QDirModel();
- }
+ }
return m;
}
static QDirModel* pathDirModel()
{
static QDirModel* m = NULL;
- if(!m)
- {
+ if (!m) {
m = new QDirModel();
m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);
- }
+ }
return m;
}
@@ -133,4 +126,3 @@ QString QCMakeFileCompleter::pathFromIndex(const QModelIndex& idx) const
{
return QDir::fromNativeSeparators(QCompleter::pathFromIndex(idx));
}
-