QtDialog: fix clang-tidy warnings

This commit is contained in:
Daniel Pfeifer 2016-09-05 22:12:36 +02:00 committed by Brad King
parent bfdf1322e7
commit 62c5f9afc3
9 changed files with 51 additions and 33 deletions

View File

@ -64,7 +64,8 @@ QVariant AddCacheEntry::value() const
QWidget* w = this->StackedWidget->currentWidget();
if (qobject_cast<QLineEdit*>(w)) {
return static_cast<QLineEdit*>(w)->text();
} else if (qobject_cast<QCheckBox*>(w)) {
}
if (qobject_cast<QCheckBox*>(w)) {
return static_cast<QCheckBox*>(w)->isChecked();
}
return QVariant();

View File

@ -29,18 +29,19 @@
#include "cmSystemTools.h" // IWYU pragma: keep
static const char* cmDocumentationName[][2] = { { 0,
static const char* cmDocumentationName[][2] = { { CM_NULLPTR,
" cmake-gui - CMake GUI." },
{ 0, 0 } };
{ CM_NULLPTR, CM_NULLPTR } };
static const char* cmDocumentationUsage[][2] = {
{ 0, " cmake-gui [options]\n"
{ CM_NULLPTR, " cmake-gui [options]\n"
" cmake-gui [options] <path-to-source>\n"
" cmake-gui [options] <path-to-existing-build>" },
{ 0, 0 }
{ CM_NULLPTR, CM_NULLPTR }
};
static const char* cmDocumentationOptions[][2] = { { 0, 0 } };
static const char* cmDocumentationOptions[]
[2] = { { CM_NULLPTR, CM_NULLPTR } };
#if defined(Q_OS_MAC)
static int cmOSXInstall(std::string dir);

View File

@ -41,7 +41,7 @@
QCMakeThread::QCMakeThread(QObject* p)
: QThread(p)
, CMakeInstance(NULL)
, CMakeInstance(CM_NULLPTR)
{
}
@ -57,7 +57,7 @@ void QCMakeThread::run()
emit this->cmakeInitialized();
this->exec();
delete this->CMakeInstance;
this->CMakeInstance = NULL;
this->CMakeInstance = CM_NULLPTR;
}
CMakeSetupDialog::CMakeSetupDialog()

View File

@ -3,6 +3,8 @@
#ifndef COMPILERS_HPP
#define COMPILERS_HPP
#include <cmConfigure.h>
#include <QWidget>
#include <ui_Compilers.h>
@ -11,7 +13,7 @@ class Compilers : public QWidget, public Ui::Compilers
{
Q_OBJECT
public:
Compilers(QWidget* p = NULL)
Compilers(QWidget* p = CM_NULLPTR)
: QWidget(p)
{
this->setupUi(this);

View File

@ -129,8 +129,9 @@ bool StartCompilerSetup::crossCompilerSetup() const
void StartCompilerSetup::onSelectionChanged(bool on)
{
if (on)
if (on) {
selectionChanged();
}
}
void StartCompilerSetup::onGeneratorChanged(QString const& name)
@ -144,12 +145,15 @@ void StartCompilerSetup::onGeneratorChanged(QString const& name)
int StartCompilerSetup::nextId() const
{
if (compilerSetup())
if (compilerSetup()) {
return NativeSetup;
if (crossCompilerSetup())
}
if (crossCompilerSetup()) {
return CrossSetup;
if (crossCompilerToolChainFile())
}
if (crossCompilerToolChainFile()) {
return ToolchainSetup;
}
return -1;
}
@ -515,7 +519,8 @@ QString FirstConfigure::getCCompiler() const
{
if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getCCompiler();
} else if (this->crossCompilerSetup()) {
}
if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getCCompiler();
}
return QString();
@ -525,7 +530,8 @@ QString FirstConfigure::getCXXCompiler() const
{
if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getCXXCompiler();
} else if (this->crossCompilerSetup()) {
}
if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getCXXCompiler();
}
return QString();
@ -535,7 +541,8 @@ QString FirstConfigure::getFortranCompiler() const
{
if (this->compilerSetup()) {
return this->mNativeCompilerSetupPage->getFortranCompiler();
} else if (this->crossCompilerSetup()) {
}
if (this->crossCompilerSetup()) {
return this->mCrossCompilerSetupPage->getFortranCompiler();
}
return QString();

View File

@ -13,6 +13,8 @@
#ifndef QCMake_h
#define QCMake_h
#include <cmConfigure.h>
#include "cmake.h"
#ifdef _MSC_VER
@ -71,7 +73,7 @@ class QCMake : public QObject
{
Q_OBJECT
public:
QCMake(QObject* p = 0);
QCMake(QObject* p = CM_NULLPTR);
~QCMake();
public slots:
/// load the cache file in a directory

View File

@ -33,7 +33,7 @@ public:
}
protected:
bool filterAcceptsRow(int row, const QModelIndex& p) const
bool filterAcceptsRow(int row, const QModelIndex& p) const CM_OVERRIDE
{
QStringList strs;
const QAbstractItemModel* m = this->sourceModel();
@ -87,7 +87,7 @@ public:
protected:
bool ShowAdvanced;
bool filterAcceptsRow(int row, const QModelIndex& p) const
bool filterAcceptsRow(int row, const QModelIndex& p) const CM_OVERRIDE
{
const QAbstractItemModel* m = this->sourceModel();
QModelIndex idx = m->index(row, 0, p);
@ -160,7 +160,8 @@ QModelIndex QCMakeCacheView::moveCursor(CursorAction act,
// want home/end to go to begin/end of rows, not columns
if (act == MoveHome) {
return this->model()->index(0, 1);
} else if (act == MoveEnd) {
}
if (act == MoveEnd) {
return this->model()->index(this->model()->rowCount() - 1, 1);
}
return QTreeView::moveCursor(act, mod);
@ -538,15 +539,16 @@ void QCMakeCacheModelDelegate::setFileDialogFlag(bool f)
this->FileDialogFlag = f;
}
QWidget* QCMakeCacheModelDelegate::createEditor(QWidget* p,
const QStyleOptionViewItem&,
QWidget* QCMakeCacheModelDelegate::createEditor(
QWidget* p, const QStyleOptionViewItem& /*option*/,
const QModelIndex& idx) const
{
QModelIndex var = idx.sibling(idx.row(), 0);
int type = var.data(QCMakeCacheModel::TypeRole).toInt();
if (type == QCMakeProperty::BOOL) {
return NULL;
} else if (type == QCMakeProperty::PATH) {
return CM_NULLPTR;
}
if (type == QCMakeProperty::PATH) {
QCMakePathEditor* editor =
new QCMakePathEditor(p, var.data(Qt::DisplayRole).toString());
QObject::connect(editor, SIGNAL(fileDialogExists(bool)), this,
@ -645,7 +647,7 @@ QSize QCMakeCacheModelDelegate::sizeHint(const QStyleOptionViewItem& option,
QStyleOptionButton opt;
opt.QStyleOption::operator=(option);
sz = sz.expandedTo(
style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, NULL)
style->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, CM_NULLPTR)
.size());
return sz;

View File

@ -67,7 +67,7 @@ void QCMakeFilePathEditor::chooseFile()
this->fileDialogExists(true);
path =
QFileDialog::getOpenFileName(this, title, info.absolutePath(), QString(),
NULL, QFileDialog::DontResolveSymlinks);
CM_NULLPTR, QFileDialog::DontResolveSymlinks);
this->fileDialogExists(false);
if (!path.isEmpty()) {
@ -99,7 +99,7 @@ void QCMakePathEditor::chooseFile()
// use same QDirModel for all completers
static QDirModel* fileDirModel()
{
static QDirModel* m = NULL;
static QDirModel* m = CM_NULLPTR;
if (!m) {
m = new QDirModel();
}
@ -107,7 +107,7 @@ static QDirModel* fileDirModel()
}
static QDirModel* pathDirModel()
{
static QDirModel* m = NULL;
static QDirModel* m = CM_NULLPTR;
if (!m) {
m = new QDirModel();
m->setFilter(QDir::AllDirs | QDir::Drives | QDir::NoDotAndDotDot);

View File

@ -13,6 +13,8 @@
#ifndef QCMakeWidgets_h
#define QCMakeWidgets_h
#include <cmConfigure.h>
#include <QComboBox>
#include <QCompleter>
#include <QLineEdit>
@ -43,7 +45,7 @@ class QCMakePathEditor : public QCMakeFileEditor
{
Q_OBJECT
public:
QCMakePathEditor(QWidget* p = NULL, const QString& var = QString());
QCMakePathEditor(QWidget* p = CM_NULLPTR, const QString& var = QString());
void chooseFile();
};
@ -52,7 +54,8 @@ class QCMakeFilePathEditor : public QCMakeFileEditor
{
Q_OBJECT
public:
QCMakeFilePathEditor(QWidget* p = NULL, const QString& var = QString());
QCMakeFilePathEditor(QWidget* p = CM_NULLPTR,
const QString& var = QString());
void chooseFile();
};