From 3a4871fcd0c736ee090aa3c31e990b4b30cd898d Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Mon, 5 Jun 2017 19:47:25 +0300 Subject: [PATCH] SonarQube warnings. --HG-- branch : develop --- src/app/tape/dialogs/dialogmdatabase.cpp | 39 +++++++++---------- src/libs/qmuparser/qmuparserbase.cpp | 5 ++- src/libs/qmuparser/qmuparserbytecode.cpp | 5 ++- src/libs/qmuparser/qmuparsercallback.cpp | 17 ++++---- .../vpropertyexplorer/vpropertyexplorer.pro | 2 +- 5 files changed, 37 insertions(+), 31 deletions(-) diff --git a/src/app/tape/dialogs/dialogmdatabase.cpp b/src/app/tape/dialogs/dialogmdatabase.cpp index aa1c68539..20c912aaa 100644 --- a/src/app/tape/dialogs/dialogmdatabase.cpp +++ b/src/app/tape/dialogs/dialogmdatabase.cpp @@ -177,7 +177,7 @@ QString DialogMDataBase::ImgTag(const QString &number) const bool ok = renderer.load(filePath); if (ok) { - const QScreen *screen = QApplication::screens().at(0); + const QScreen *screen = QGuiApplication::screens().at(0); if (screen) { const QSize defSize = renderer.defaultSize(); @@ -223,30 +223,27 @@ void DialogMDataBase::changeEvent(QEvent *event) //--------------------------------------------------------------------------------------------------------------------- bool DialogMDataBase::eventFilter(QObject *target, QEvent *event) { - if (target == ui->treeWidget) + if (target == ui->treeWidget && event->type() == QEvent::KeyPress) { - if (event->type() == QEvent::KeyPress) + QKeyEvent *keyEvent = static_cast(event); + switch(keyEvent->key()) { - QKeyEvent *keyEvent = static_cast(event); - switch(keyEvent->key()) + case Qt::Key_Up: { - case Qt::Key_Up: - { - const QModelIndex model = ui->treeWidget->indexAbove(ui->treeWidget->currentIndex()); - QTreeWidgetItem *item = ui->treeWidget->itemAbove(ui->treeWidget->currentItem()); - ShowDescription(item, model.column()); - break; - } - case Qt::Key_Down: - { - const QModelIndex model = ui->treeWidget->indexBelow(ui->treeWidget->currentIndex()); - QTreeWidgetItem *item = ui->treeWidget->itemBelow(ui->treeWidget->currentItem()); - ShowDescription(item, model.column()); - break; - } - default: - break; + const QModelIndex model = ui->treeWidget->indexAbove(ui->treeWidget->currentIndex()); + QTreeWidgetItem *item = ui->treeWidget->itemAbove(ui->treeWidget->currentItem()); + ShowDescription(item, model.column()); + break; } + case Qt::Key_Down: + { + const QModelIndex model = ui->treeWidget->indexBelow(ui->treeWidget->currentIndex()); + QTreeWidgetItem *item = ui->treeWidget->itemBelow(ui->treeWidget->currentItem()); + ShowDescription(item, model.column()); + break; + } + default: + break; } } return QDialog::eventFilter(target, event); diff --git a/src/libs/qmuparser/qmuparserbase.cpp b/src/libs/qmuparser/qmuparserbase.cpp index 98f32085e..a91b17744 100644 --- a/src/libs/qmuparser/qmuparserbase.cpp +++ b/src/libs/qmuparser/qmuparserbase.cpp @@ -143,7 +143,10 @@ QmuParserBase::~QmuParserBase() */ QmuParserBase& QmuParserBase::operator=(const QmuParserBase &a_Parser) { - Assign(a_Parser); + if (this != &a_Parser) + { + Assign(a_Parser); + } return *this; } diff --git a/src/libs/qmuparser/qmuparserbytecode.cpp b/src/libs/qmuparser/qmuparserbytecode.cpp index 0bc204bd3..244aba2dd 100644 --- a/src/libs/qmuparser/qmuparserbytecode.cpp +++ b/src/libs/qmuparser/qmuparserbytecode.cpp @@ -64,7 +64,10 @@ QmuParserByteCode::QmuParserByteCode(const QmuParserByteCode &a_ByteCode) */ QmuParserByteCode& QmuParserByteCode::operator=(const QmuParserByteCode &a_ByteCode) { - Assign(a_ByteCode); + if (this != &a_ByteCode) + { + Assign(a_ByteCode); + } return *this; } diff --git a/src/libs/qmuparser/qmuparsercallback.cpp b/src/libs/qmuparser/qmuparsercallback.cpp index b7a4639b9..bea76bdd7 100644 --- a/src/libs/qmuparser/qmuparsercallback.cpp +++ b/src/libs/qmuparser/qmuparsercallback.cpp @@ -313,13 +313,16 @@ QmuParserCallback::QmuParserCallback (const QmuParserCallback &a_Fun ) //--------------------------------------------------------------------------------------------------------------------- QmuParserCallback &QmuParserCallback::operator=(const QmuParserCallback &a_Fun) { - m_pFun = a_Fun.m_pFun; - m_iArgc = a_Fun.m_iArgc; - m_bAllowOpti = a_Fun.m_bAllowOpti; - m_iCode = a_Fun.m_iCode; - m_iType = a_Fun.m_iType; - m_iPri = a_Fun.m_iPri; - m_eOprtAsct = a_Fun.m_eOprtAsct; + if (this != &a_Fun) + { + m_pFun = a_Fun.m_pFun; + m_iArgc = a_Fun.m_iArgc; + m_bAllowOpti = a_Fun.m_bAllowOpti; + m_iCode = a_Fun.m_iCode; + m_iType = a_Fun.m_iType; + m_iPri = a_Fun.m_iPri; + m_eOprtAsct = a_Fun.m_eOprtAsct; + } return *this; } diff --git a/src/libs/vpropertyexplorer/vpropertyexplorer.pro b/src/libs/vpropertyexplorer/vpropertyexplorer.pro index 966b098c6..4b4981e3d 100644 --- a/src/libs/vpropertyexplorer/vpropertyexplorer.pro +++ b/src/libs/vpropertyexplorer/vpropertyexplorer.pro @@ -8,7 +8,7 @@ include(../../../common.pri) # Library use widgets -QT += widgets +QT += core widgets # We don't need gui library. QT -= gui