QmlDesigner & friends: Fix various new warnings

Change-Id: Ia5e3d47e70e1881e70652f090ccc61543535df4e
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Christian Kandeler
2020-11-18 15:36:39 +01:00
parent a1ff9d170f
commit 7aec256087
6 changed files with 16 additions and 15 deletions

View File

@@ -132,6 +132,9 @@ bool IconRenderer::eventFilter(QObject *watched, QEvent *event)
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (watched == m_quickView && event->type() == QEvent::Expose) if (watched == m_quickView && event->type() == QEvent::Expose)
QTimer::singleShot(0, this, &IconRenderer::createIcon); QTimer::singleShot(0, this, &IconRenderer::createIcon);
#else
Q_UNUSED(watched)
Q_UNUSED(event)
#endif #endif
return false; return false;
} }

View File

@@ -40,7 +40,7 @@ public:
DefaultAction(const QString &description); DefaultAction(const QString &description);
// virtual function instead of slot // virtual function instead of slot
virtual void actionTriggered(bool enable) {} virtual void actionTriggered(bool enable) { Q_UNUSED(enable) }
void setSelectionContext(const SelectionContext &selectionContext); void setSelectionContext(const SelectionContext &selectionContext);
protected: protected:

View File

@@ -280,6 +280,7 @@ void DynamicPropertiesModel::bindingRemoved(const BindingProperty &bindingProper
void DynamicPropertiesModel::selectionChanged(const QList<ModelNode> &selectedNodes) void DynamicPropertiesModel::selectionChanged(const QList<ModelNode> &selectedNodes)
{ {
Q_UNUSED(selectedNodes)
m_handleDataChanged = false; m_handleDataChanged = false;
resetModel(); resetModel();
m_handleDataChanged = true; m_handleDataChanged = true;

View File

@@ -134,11 +134,6 @@ void RotationTool::keyPressEvent(QKeyEvent * event)
event->setAccepted(false); event->setAccepted(false);
return; return;
} }
double moveStep = 1.0;
if (event->modifiers().testFlag(Qt::ShiftModifier))
moveStep = 10.0;
} }
void RotationTool::keyReleaseEvent(QKeyEvent * keyEvent) void RotationTool::keyReleaseEvent(QKeyEvent * keyEvent)

View File

@@ -281,7 +281,7 @@ bool NavigatorTreeView::viewportEvent(QEvent *event)
if (m_previewToolTip && m_previewToolTip->isVisible()) { if (m_previewToolTip && m_previewToolTip->isVisible()) {
auto *he = static_cast<QHoverEvent *>(event); auto *he = static_cast<QHoverEvent *>(event);
QModelIndex index = indexAt(he->pos()); QModelIndex index = indexAt(he->pos());
if (!index.isValid() || index.internalId() != m_previewToolTipNodeId) { if (!index.isValid() || index.internalId() != quintptr(m_previewToolTipNodeId)) {
m_previewToolTip->hide(); m_previewToolTip->hide();
m_previewToolTipNodeId = -1; m_previewToolTipNodeId = -1;
} else { } else {

View File

@@ -42,8 +42,10 @@ Utils::SmallStringView createText(int size)
} }
void CreateSmallStringLiteral(benchmark::State& state) { void CreateSmallStringLiteral(benchmark::State& state) {
while (state.KeepRunning()) while (state.KeepRunning()) {
constexpr auto string = Utils::SmallStringLiteral("very very very long long long text"); constexpr auto string = Utils::SmallStringLiteral("very very very long long long text");
Q_UNUSED(string)
}
} }
BENCHMARK(CreateSmallStringLiteral); BENCHMARK(CreateSmallStringLiteral);
@@ -168,7 +170,7 @@ void Size(benchmark::State& state) {
while (state.KeepRunning()) while (state.KeepRunning())
benchmark::DoNotOptimize(text.size()); benchmark::DoNotOptimize(text.size());
} }
BENCHMARK(LongSize); BENCHMARK(Size);
void generateRandomString(char *data, const int length) void generateRandomString(char *data, const int length)
{ {
@@ -200,7 +202,7 @@ void Collection_CreateQByteArrays(benchmark::State& state)
QVector<QByteArray> values; QVector<QByteArray> values;
values.reserve(entryCount); values.reserve(entryCount);
for (int i = 0; i < entryCount; i++) for (int i = 0; i < int(entryCount); i++)
values.append(generateRandomQByteArray()); values.append(generateRandomQByteArray());
} }
} }
@@ -214,7 +216,7 @@ void Collection_SortQByteArrays(benchmark::State& state)
QVector<QByteArray> values; QVector<QByteArray> values;
values.reserve(entryCount); values.reserve(entryCount);
for (int i = 0; i < entryCount; i++) for (int i = 0; i < int(entryCount); i++)
values.append(generateRandomQByteArray()); values.append(generateRandomQByteArray());
state.ResumeTiming(); state.ResumeTiming();
@@ -234,7 +236,7 @@ void Collection_FilterQByteArrays(benchmark::State& state)
QVector<QByteArray> filteredValues; QVector<QByteArray> filteredValues;
filteredValues.reserve(entryCount); filteredValues.reserve(entryCount);
for (int i = 0; i < entryCount; i++) for (int i = 0; i < int(entryCount); i++)
values.append(generateRandomQByteArray()); values.append(generateRandomQByteArray());
auto startsWithA = [] (const QByteArray &byteArray) { auto startsWithA = [] (const QByteArray &byteArray) {
@@ -267,7 +269,7 @@ void Collection_CreateSmallStrings(benchmark::State& state)
Utils::SmallStringVector values; Utils::SmallStringVector values;
values.reserve(entryCount); values.reserve(entryCount);
for (int i = 0; i < entryCount; i++) for (int i = 0; i < int(entryCount); i++)
values.push_back(generateRandomSmallString()); values.push_back(generateRandomSmallString());
} }
} }
@@ -281,7 +283,7 @@ void Collection_SortSmallStrings(benchmark::State& state)
Utils::SmallStringVector values; Utils::SmallStringVector values;
values.reserve(entryCount); values.reserve(entryCount);
for (int i = 0; i < entryCount; i++) for (int i = 0; i < int(entryCount); i++)
values.push_back(generateRandomSmallString()); values.push_back(generateRandomSmallString());
state.ResumeTiming(); state.ResumeTiming();
@@ -301,7 +303,7 @@ void Collection_FilterSmallStrings(benchmark::State& state)
Utils::SmallStringVector filteredValues; Utils::SmallStringVector filteredValues;
filteredValues.reserve(entryCount); filteredValues.reserve(entryCount);
for (int i = 0; i < entryCount; i++) for (int i = 0; i < int(entryCount); i++)
values.push_back(generateRandomSmallString()); values.push_back(generateRandomSmallString());
auto startsWithA = [] (const Utils::SmallString &byteArray) { auto startsWithA = [] (const Utils::SmallString &byteArray) {