forked from qt-creator/qt-creator
QmlDesigner: Fix clazy warnings
Prefer initializer lists. Change-Id: Ibbbe146a55b057176a0f88cc1a5d48c15d5f2038 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -53,7 +53,7 @@ QColor Theme::evaluateColorAtThemeInstance(const QString &themeColorName)
|
||||
}
|
||||
|
||||
qWarning() << Q_FUNC_INFO << "error while evaluating" << themeColorName;
|
||||
return QColor();
|
||||
return {};
|
||||
}
|
||||
|
||||
Theme *Theme::instance()
|
||||
|
@@ -46,10 +46,10 @@ void BindingIndicatorGraphicsItem::paint(QPainter *painter, const QStyleOptionGr
|
||||
|
||||
QRectF BindingIndicatorGraphicsItem::boundingRect() const
|
||||
{
|
||||
return QRectF(m_bindingLine.x1(),
|
||||
return {m_bindingLine.x1(),
|
||||
m_bindingLine.y1(),
|
||||
m_bindingLine.x2() - m_bindingLine.x1() + 3,
|
||||
m_bindingLine.y2() - m_bindingLine.y1() + 3);
|
||||
m_bindingLine.y2() - m_bindingLine.y1() + 3};
|
||||
}
|
||||
|
||||
void BindingIndicatorGraphicsItem::updateBindingIndicator(const QLineF &bindingLine)
|
||||
|
@@ -186,22 +186,22 @@ void ResizeController::hide()
|
||||
|
||||
static QPointF topCenter(const QRectF &rect)
|
||||
{
|
||||
return QPointF(rect.center().x(), rect.top());
|
||||
return {rect.center().x(), rect.top()};
|
||||
}
|
||||
|
||||
static QPointF leftCenter(const QRectF &rect)
|
||||
{
|
||||
return QPointF(rect.left(), rect.center().y());
|
||||
return {rect.left(), rect.center().y()};
|
||||
}
|
||||
|
||||
static QPointF rightCenter(const QRectF &rect)
|
||||
{
|
||||
return QPointF(rect.right(), rect.center().y());
|
||||
return {rect.right(), rect.center().y()};
|
||||
}
|
||||
|
||||
static QPointF bottomCenter(const QRectF &rect)
|
||||
{
|
||||
return QPointF(rect.center().x(), rect.bottom());
|
||||
return {rect.center().x(), rect.bottom()};
|
||||
}
|
||||
|
||||
|
||||
|
@@ -48,7 +48,7 @@ void ResizeHandleItem::setHandlePosition(const QPointF & globalPosition, const Q
|
||||
|
||||
QRectF ResizeHandleItem::boundingRect() const
|
||||
{
|
||||
return QRectF(- 5., - 5., 9., 9.);
|
||||
return {- 5., - 5., 9., 9.};
|
||||
}
|
||||
|
||||
void ResizeHandleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem * /* option */, QWidget * /* widget */)
|
||||
|
@@ -289,7 +289,7 @@ QLineF Snapper::createSnapLine(Qt::Orientation orientation,
|
||||
if (orientation == Qt::Horizontal) {
|
||||
double lowerX(qMin(lowerLimit, double(itemRect.left())));
|
||||
double upperX(qMax(upperLimit, double(itemRect.right())));
|
||||
return QLineF(lowerX, snapLine, upperX, snapLine);
|
||||
return {lowerX, snapLine, upperX, snapLine};
|
||||
} else {
|
||||
double lowerY(qMin(lowerLimit, double(itemRect.top())));
|
||||
double upperY(qMax(upperLimit, double(itemRect.bottom())));
|
||||
@@ -461,7 +461,7 @@ static QLineF mergedHorizontalLine(const QList<QLineF> &lineList)
|
||||
}
|
||||
|
||||
double y(lineList.constFirst().y1());
|
||||
return QLineF(minimumX, y, maximumX, y);
|
||||
return {minimumX, y, maximumX, y};
|
||||
}
|
||||
|
||||
static QLineF mergedVerticalLine(const QList<QLineF> &lineList)
|
||||
@@ -479,7 +479,7 @@ static QLineF mergedVerticalLine(const QList<QLineF> &lineList)
|
||||
}
|
||||
|
||||
double x(lineList.constFirst().x1());
|
||||
return QLineF(x, minimumY, x, maximumY);
|
||||
return {x, minimumY, x, maximumY};
|
||||
}
|
||||
|
||||
static QList<QLineF> mergedHorizontalLines(const QList<QLineF> &lineList)
|
||||
|
@@ -55,7 +55,7 @@ IconCheckboxItemDelegate::IconCheckboxItemDelegate(QObject *parent,
|
||||
QSize IconCheckboxItemDelegate::sizeHint(const QStyleOptionViewItem & /*option*/,
|
||||
const QModelIndex & /*modelIndex*/) const
|
||||
{
|
||||
return QSize(15, 20);
|
||||
return {15, 20};
|
||||
}
|
||||
|
||||
static bool isChecked(const QModelIndex &modelIndex)
|
||||
|
@@ -260,7 +260,7 @@ QModelIndex NavigatorTreeModel::index(int row, int column,
|
||||
const QModelIndex &parent) const
|
||||
{
|
||||
if (!m_view->model())
|
||||
return QModelIndex();
|
||||
return {};
|
||||
|
||||
if (!hasIndex(row, column, parent))
|
||||
return QModelIndex();
|
||||
@@ -288,7 +288,7 @@ QVariant NavigatorTreeModel::headerData(int, Qt::Orientation, int) const
|
||||
QModelIndex NavigatorTreeModel::parent(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
return QModelIndex();
|
||||
return {};
|
||||
|
||||
const ModelNode modelNode = modelNodeForIndex(index);
|
||||
|
||||
|
@@ -213,7 +213,7 @@ QColor GradientModel::getColor(int index) const
|
||||
return stop.modelValue("color").value<QColor>();
|
||||
}
|
||||
qWarning() << Q_FUNC_INFO << "invalid color index";
|
||||
return QColor();
|
||||
return {};
|
||||
}
|
||||
|
||||
qreal GradientModel::getPosition(int index) const
|
||||
|
@@ -71,7 +71,7 @@ QColor convertColorFromString(const QString &s)
|
||||
uchar r = fromHex(s, 3);
|
||||
uchar g = fromHex(s, 5);
|
||||
uchar b = fromHex(s, 7);
|
||||
return QColor(r, g, b, a);
|
||||
return {r, g, b, a};
|
||||
} else {
|
||||
QColor rv(s);
|
||||
return rv;
|
||||
|
@@ -60,7 +60,7 @@ int StatesEditorModel::count() const
|
||||
QModelIndex StatesEditorModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
if (m_statesEditorView.isNull())
|
||||
return QModelIndex();
|
||||
return {};
|
||||
|
||||
|
||||
int internalNodeId = 0;
|
||||
|
@@ -778,7 +778,7 @@ QRectF NodeInstanceView::sceneRect() const
|
||||
if (rootNodeInstance().isValid())
|
||||
return rootNodeInstance().boundingRect();
|
||||
|
||||
return QRectF();
|
||||
return {};
|
||||
}
|
||||
|
||||
QList<ModelNode> filterNodesForSkipItems(const QList<ModelNode> &nodeList)
|
||||
@@ -945,7 +945,7 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
|
||||
|
||||
ClearSceneCommand NodeInstanceView::createClearSceneCommand() const
|
||||
{
|
||||
return ClearSceneCommand();
|
||||
return {};
|
||||
}
|
||||
|
||||
CompleteComponentCommand NodeInstanceView::createComponentCompleteCommand(const QList<NodeInstance> &instanceList) const
|
||||
|
@@ -69,7 +69,7 @@ QColor colorFromString(const QString &s, bool *ok)
|
||||
uchar g = fromHex(s, 5);
|
||||
uchar b = fromHex(s, 7);
|
||||
if (ok) *ok = true;
|
||||
return QColor(r, g, b, a);
|
||||
return {r, g, b, a};
|
||||
} else {
|
||||
QColor rv(s);
|
||||
if (ok) *ok = rv.isValid();
|
||||
@@ -82,7 +82,7 @@ QPointF pointFFromString(const QString &s, bool *ok)
|
||||
if (s.count(QLatin1Char(',')) != 1) {
|
||||
if (ok)
|
||||
*ok = false;
|
||||
return QPointF();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool xGood, yGood;
|
||||
@@ -105,7 +105,7 @@ QRectF rectFFromString(const QString &s, bool *ok)
|
||||
if (s.count(QLatin1Char(',')) != 2 || s.count(QLatin1Char('x')) != 1) {
|
||||
if (ok)
|
||||
*ok = false;
|
||||
return QRectF();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool xGood, yGood, wGood, hGood;
|
||||
@@ -132,7 +132,7 @@ QSizeF sizeFFromString(const QString &s, bool *ok)
|
||||
if (s.count(QLatin1Char('x')) != 1) {
|
||||
if (ok)
|
||||
*ok = false;
|
||||
return QSizeF();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool wGood, hGood;
|
||||
@@ -155,7 +155,7 @@ QVector3D vector3DFromString(const QString &s, bool *ok)
|
||||
if (s.count(QLatin1Char(',')) != 2) {
|
||||
if (ok)
|
||||
*ok = false;
|
||||
return QVector3D();
|
||||
return {};
|
||||
}
|
||||
|
||||
bool xGood, yGood, zGood;
|
||||
|
@@ -455,7 +455,7 @@ QPointF QmlItemNode::instanceScenePosition() const
|
||||
else if (modelNode().hasParentProperty() && QmlItemNode::isValidQmlItemNode(modelNode().parentProperty().parentModelNode()))
|
||||
return QmlItemNode(modelNode().parentProperty().parentModelNode()).instanceSceneTransform().map(nodeInstance().position());
|
||||
|
||||
return QPointF();
|
||||
return {};
|
||||
}
|
||||
|
||||
QPointF QmlItemNode::instancePosition() const
|
||||
|
@@ -498,7 +498,7 @@ QRectF PathItem::instanceBoundingRect() const
|
||||
if (formEditorItem())
|
||||
return formEditorItem()->qmlItemNode().instanceBoundingRect();
|
||||
|
||||
return QRectF();
|
||||
return {};
|
||||
}
|
||||
|
||||
void PathItem::readControlPoints()
|
||||
|
Reference in New Issue
Block a user