forked from qt-creator/qt-creator
Use less nullptr for empty flags
Change-Id: Ic4eafdc8f204a432a752a97593380609a408a7de Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -139,8 +139,8 @@ void DockWidgetTitleButton::paintEvent(QPaintEvent *)
|
|||||||
opt.init(this);
|
opt.init(this);
|
||||||
opt.state |= QStyle::State_AutoRaise;
|
opt.state |= QStyle::State_AutoRaise;
|
||||||
opt.icon = icon();
|
opt.icon = icon();
|
||||||
opt.subControls = nullptr;
|
opt.subControls = {};
|
||||||
opt.activeSubControls = nullptr;
|
opt.activeSubControls = {};
|
||||||
opt.features = QStyleOptionToolButton::None;
|
opt.features = QStyleOptionToolButton::None;
|
||||||
opt.arrowType = Qt::NoArrow;
|
opt.arrowType = Qt::NoArrow;
|
||||||
int size = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
|
int size = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ QLayoutItem *FlowLayout::takeAt(int index)
|
|||||||
|
|
||||||
Qt::Orientations FlowLayout::expandingDirections() const
|
Qt::Orientations FlowLayout::expandingDirections() const
|
||||||
{
|
{
|
||||||
return nullptr;
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FlowLayout::hasHeightForWidth() const
|
bool FlowLayout::hasHeightForWidth() const
|
||||||
|
|||||||
@@ -1037,7 +1037,7 @@ bool BaseTreeModel::hasChildren(const QModelIndex &idx) const
|
|||||||
Qt::ItemFlags BaseTreeModel::flags(const QModelIndex &idx) const
|
Qt::ItemFlags BaseTreeModel::flags(const QModelIndex &idx) const
|
||||||
{
|
{
|
||||||
if (!idx.isValid())
|
if (!idx.isValid())
|
||||||
return nullptr;
|
return {};
|
||||||
TreeItem *item = itemForIndex(idx);
|
TreeItem *item = itemForIndex(idx);
|
||||||
return item ? item->flags(idx.column())
|
return item ? item->flags(idx.column())
|
||||||
: (Qt::ItemIsEnabled|Qt::ItemIsSelectable);
|
: (Qt::ItemIsEnabled|Qt::ItemIsSelectable);
|
||||||
|
|||||||
@@ -99,13 +99,13 @@ public:
|
|||||||
auto title = QCoreApplication::translate("ClangPchProgressManager",
|
auto title = QCoreApplication::translate("ClangPchProgressManager",
|
||||||
"Creating PCHs",
|
"Creating PCHs",
|
||||||
"PCH stands for precompiled header");
|
"PCH stands for precompiled header");
|
||||||
Core::ProgressManager::addTask(promise.future(), title, "pch creation", nullptr);
|
Core::ProgressManager::addTask(promise.future(), title, "pch creation", {});
|
||||||
}};
|
}};
|
||||||
ClangPchManager::ProgressManager dependencyCreationProgressManager{
|
ClangPchManager::ProgressManager dependencyCreationProgressManager{
|
||||||
[](QFutureInterface<void> &promise) {
|
[](QFutureInterface<void> &promise) {
|
||||||
auto title = QCoreApplication::translate("ClangPchProgressManager",
|
auto title = QCoreApplication::translate("ClangPchProgressManager",
|
||||||
"Creating Dependencies");
|
"Creating Dependencies");
|
||||||
Core::ProgressManager::addTask(promise.future(), title, "dependency creation", nullptr);
|
Core::ProgressManager::addTask(promise.future(), title, "dependency creation", {});
|
||||||
}};
|
}};
|
||||||
ClangBackEnd::ProjectPartsStorage<Sqlite::Database> projectPartsStorage{database};
|
ClangBackEnd::ProjectPartsStorage<Sqlite::Database> projectPartsStorage{database};
|
||||||
PchManagerClient pchManagerClient{pchCreationProgressManager, dependencyCreationProgressManager};
|
PchManagerClient pchManagerClient{pchCreationProgressManager, dependencyCreationProgressManager};
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ QtCreatorSearchHandle::QtCreatorSearchHandle(Core::SearchResult *searchResult)
|
|||||||
: searchResult(searchResult)
|
: searchResult(searchResult)
|
||||||
{
|
{
|
||||||
auto title = QCoreApplication::translate("QtCreatorSearchHandle", "Clang Query");
|
auto title = QCoreApplication::translate("QtCreatorSearchHandle", "Clang Query");
|
||||||
Core::ProgressManager::addTask(promise.future(), title, "clang query", nullptr);
|
Core::ProgressManager::addTask(promise.future(), title, "clang query", {});
|
||||||
}
|
}
|
||||||
|
|
||||||
void QtCreatorSearchHandle::addResult(const QString &fileName,
|
void QtCreatorSearchHandle::addResult(const QString &fileName,
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ void OpenEditorsWidget::handleActivated(const QModelIndex &index)
|
|||||||
// work around a bug in itemviews where the delegate wouldn't get the QStyle::State_MouseOver
|
// work around a bug in itemviews where the delegate wouldn't get the QStyle::State_MouseOver
|
||||||
QPoint cursorPos = QCursor::pos();
|
QPoint cursorPos = QCursor::pos();
|
||||||
QWidget *vp = viewport();
|
QWidget *vp = viewport();
|
||||||
QMouseEvent e(QEvent::MouseMove, vp->mapFromGlobal(cursorPos), cursorPos, Qt::NoButton, nullptr, nullptr);
|
QMouseEvent e(QEvent::MouseMove, vp->mapFromGlobal(cursorPos), cursorPos, Qt::NoButton, {}, {});
|
||||||
QCoreApplication::sendEvent(vp, &e);
|
QCoreApplication::sendEvent(vp, &e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ public:
|
|||||||
: Utils::StaticTreeItem(text)
|
: Utils::StaticTreeItem(text)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
Qt::ItemFlags flags(int) const { return 0; }
|
Qt::ItemFlags flags(int) const { return {}; }
|
||||||
QVariant data(int column, int role) const
|
QVariant data(int column, int role) const
|
||||||
{
|
{
|
||||||
if (role == Qt::ForegroundRole) {
|
if (role == Qt::ForegroundRole) {
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ TextEditor::TabSettings CppCodeStyleSettings::currentGlobalTabSettings()
|
|||||||
static void configureOverviewWithCodeStyleSettings(CPlusPlus::Overview &overview,
|
static void configureOverviewWithCodeStyleSettings(CPlusPlus::Overview &overview,
|
||||||
const CppCodeStyleSettings &settings)
|
const CppCodeStyleSettings &settings)
|
||||||
{
|
{
|
||||||
overview.starBindFlags = CPlusPlus::Overview::StarBindFlags(nullptr);
|
overview.starBindFlags = {};
|
||||||
if (settings.bindStarToIdentifier)
|
if (settings.bindStarToIdentifier)
|
||||||
overview.starBindFlags |= CPlusPlus::Overview::BindToIdentifier;
|
overview.starBindFlags |= CPlusPlus::Overview::BindToIdentifier;
|
||||||
if (settings.bindStarToTypeName)
|
if (settings.bindStarToTypeName)
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ QVariant SourceFilesHandler::headerData(int section,
|
|||||||
Qt::ItemFlags SourceFilesHandler::flags(const QModelIndex &index) const
|
Qt::ItemFlags SourceFilesHandler::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (index.row() >= m_fullNames.size())
|
if (index.row() >= m_fullNames.size())
|
||||||
return nullptr;
|
return {};
|
||||||
QFileInfo fi(m_fullNames.at(index.row()));
|
QFileInfo fi(m_fullNames.at(index.row()));
|
||||||
return fi.isReadable() ? QAbstractItemModel::flags(index) : Qt::ItemFlags({});
|
return fi.isReadable() ? QAbstractItemModel::flags(index) : Qt::ItemFlags({});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1178,7 +1178,7 @@ bool WatchModel::setData(const QModelIndex &idx, const QVariant &value, int role
|
|||||||
Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
|
Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const
|
||||||
{
|
{
|
||||||
if (!idx.isValid())
|
if (!idx.isValid())
|
||||||
return nullptr;
|
return {};
|
||||||
|
|
||||||
const WatchItem *item = nonRootItemForIndex(idx);
|
const WatchItem *item = nonRootItemForIndex(idx);
|
||||||
if (!item)
|
if (!item)
|
||||||
|
|||||||
@@ -178,7 +178,7 @@ QVariant FlatModel::data(const QModelIndex &index, int role) const
|
|||||||
Qt::ItemFlags FlatModel::flags(const QModelIndex &index) const
|
Qt::ItemFlags FlatModel::flags(const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
if (!index.isValid())
|
if (!index.isValid())
|
||||||
return nullptr;
|
return {};
|
||||||
// We claim that everything is editable
|
// We claim that everything is editable
|
||||||
// That's slightly wrong
|
// That's slightly wrong
|
||||||
// We control the only view, and that one does the checks
|
// We control the only view, and that one does the checks
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ FunctionGraphicsTextItem::FunctionGraphicsTextItem(const QString &text,
|
|||||||
, m_previousViewportDimension(0)
|
, m_previousViewportDimension(0)
|
||||||
{
|
{
|
||||||
setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
setFlag(QGraphicsItem::ItemIgnoresTransformations);
|
||||||
setAcceptedMouseButtons(nullptr); // do not steal focus from parent item
|
setAcceptedMouseButtons({}); // do not steal focus from parent item
|
||||||
setToolTip(text);
|
setToolTip(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user