some minor `QtCharts` usage cleanups (#4890)
This commit is contained in:
parent
61e8b84578
commit
0b8af4fff7
|
@ -459,9 +459,9 @@ jobs:
|
|||
./cppcheck $selfcheck_options --cppcheck-build-dir=b1 --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
|
||||
# check gui with qt settings
|
||||
mkdir b2
|
||||
./cppcheck $selfcheck_options --cppcheck-build-dir=b2 -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cppcheck $selfcheck_options --cppcheck-build-dir=b2 -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
# self check test and tools
|
||||
./cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1
|
||||
# triage
|
||||
./cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp || ec=1
|
||||
./cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp || ec=1
|
||||
exit $ec
|
|
@ -75,7 +75,7 @@ jobs:
|
|||
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
|
||||
ec=0
|
||||
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
|
||||
exit $ec
|
||||
|
|
|
@ -68,7 +68,7 @@ jobs:
|
|||
- name: Self check (unusedFunction)
|
||||
if: false # TODO: fails with preprocessorErrorDirective - see #10667
|
||||
run: |
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
env:
|
||||
DISABLE_VALUEFLOW: 1
|
||||
UNUSEDFUNCTION_ONLY: 1
|
||||
|
@ -89,7 +89,7 @@ jobs:
|
|||
# TODO: find a way to report unmatched suppressions without need to add information checks
|
||||
- name: Self check (unusedFunction / no test)
|
||||
run: |
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
./cppcheck -q --template=selfcheck --error-exitcode=1 --library=cppcheck-lib --library=qt -D__CPPCHECK__ -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.notest/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr
|
||||
env:
|
||||
DISABLE_VALUEFLOW: 1
|
||||
UNUSEDFUNCTION_ONLY: 1
|
||||
|
@ -115,7 +115,7 @@ jobs:
|
|||
- name: Self check (unusedFunction / corpus / no test / callgrind)
|
||||
run: |
|
||||
# TODO: fix -rp so the suppressions actually work
|
||||
valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr 2>callgrind.log || (cat callgrind.log && false)
|
||||
valgrind --tool=callgrind ./cppcheck --template=selfcheck --error-exitcode=0 --library=cppcheck-lib --library=qt -D__GNUC__ -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --enable=unusedFunction --exception-handling -rp=. --project=cmake.output.corpus/compile_commands.json --suppressions-list=.selfcheck_unused_suppressions --inline-suppr 2>callgrind.log || (cat callgrind.log && false)
|
||||
cat callgrind.log
|
||||
callgrind_annotate --auto=no > callgrind.annotated.log
|
||||
head -50 callgrind.annotated.log
|
||||
|
|
|
@ -61,7 +61,7 @@ jobs:
|
|||
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=0 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
|
||||
ec=0
|
||||
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Igui/temp -Igui gui/*.cpp gui/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Itools/triage/temp -Igui tools/triage/*.cpp tools/triage/temp/*.cpp || ec=1
|
||||
exit $ec
|
||||
|
|
|
@ -73,7 +73,7 @@ jobs:
|
|||
selfcheck_options="-q -j$(nproc) --std=c++11 --template=selfcheck --showtime=top5 -D__CPPCHECK__ --error-exitcode=1 --inline-suppr --suppressions-list=.selfcheck_suppressions --library=cppcheck-lib -Ilib -Iexternals/simplecpp/ -Iexternals/tinyxml2/ --inconclusive --enable=style,performance,portability,warning,missingInclude,internal --exception-handling --debug-warnings"
|
||||
ec=0
|
||||
./cmake.output/bin/cppcheck $selfcheck_options --addon=naming.json -DCHECK_INTERNAL cli lib || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQT_VERSION=0x050000 -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt --addon=naming.json -Icmake.output/gui -Igui gui/*.cpp cmake.output/gui/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -Icli test/*.cpp tools/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
|
||||
./cmake.output/bin/cppcheck $selfcheck_options -DQ_MOC_OUTPUT_REVISION=67 -DQT_CHARTS_LIB --library=qt -Icmake.output/tools/triage -Igui tools/triage/*.cpp cmake.output/tools/triage/*.cpp || ec=1
|
||||
exit $ec
|
||||
|
|
|
@ -55,7 +55,6 @@ CheckOptions:
|
|||
endif()
|
||||
target_link_libraries(cppcheck-gui ${QT_CORE_LIB} ${QT_GUI_LIB} ${QT_WIDGETS_LIB} ${QT_PRINTSUPPORT_LIB} ${QT_HELP_LIB} ${QT_NETWORK_LIB})
|
||||
if(WITH_QCHART)
|
||||
target_compile_definitions (cppcheck-gui PRIVATE HAVE_QCHART)
|
||||
target_link_libraries(cppcheck-gui ${QT_CHARTS_LIB})
|
||||
endif()
|
||||
if (BUILD_CORE_DLL)
|
||||
|
|
|
@ -214,7 +214,6 @@ contains(QMAKE_CXX, clang++) {
|
|||
|
||||
contains(HAVE_QCHART, [yY][eE][sS]) {
|
||||
QT += charts
|
||||
DEFINES += HAVE_QCHART
|
||||
} else {
|
||||
message("Charts disabled - to enable it pass HAVE_QCHART=yes to qmake.")
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@
|
|||
#include <QTextDocument>
|
||||
#include <QWidget>
|
||||
|
||||
#ifdef HAVE_QCHART
|
||||
#ifdef QT_CHARTS_LIB
|
||||
#include <QAbstractSeries>
|
||||
#include <QChartView>
|
||||
#include <QDateTimeAxis>
|
||||
|
@ -44,8 +44,11 @@
|
|||
#include <QValueAxis>
|
||||
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
using namespace QtCharts;
|
||||
QT_CHARTS_USE_NAMESPACE
|
||||
#endif
|
||||
|
||||
static QLineSeries *numberOfReports(const QString &fileName, const QString &severity);
|
||||
static QChartView *createChart(const QString &statsFile, const QString &tool);
|
||||
#endif
|
||||
|
||||
static const QString CPPCHECK("cppcheck");
|
||||
|
@ -76,7 +79,7 @@ void StatsDialog::setProject(const ProjectFile* projectFile)
|
|||
mUI->mIncludePaths->setText(projectFile->getIncludeDirs().join(";"));
|
||||
mUI->mDefines->setText(projectFile->getDefines().join(";"));
|
||||
mUI->mUndefines->setText(projectFile->getUndefines().join(";"));
|
||||
#ifndef HAVE_QCHART
|
||||
#ifndef QT_CHARTS_LIB
|
||||
mUI->mTabHistory->setVisible(false);
|
||||
#else
|
||||
QString statsFile;
|
||||
|
@ -356,8 +359,8 @@ void StatsDialog::setStatistics(const CheckStatistics *stats)
|
|||
mUI->mLblInformation->setText(QString("%1").arg(stats->getCount(CPPCHECK,ShowTypes::ShowInformation)));
|
||||
}
|
||||
|
||||
#ifdef HAVE_QCHART
|
||||
QChartView *StatsDialog::createChart(const QString &statsFile, const QString &tool)
|
||||
#ifdef QT_CHARTS_LIB
|
||||
QChartView *createChart(const QString &statsFile, const QString &tool)
|
||||
{
|
||||
QChart *chart = new QChart;
|
||||
chart->addSeries(numberOfReports(statsFile, tool + "-error"));
|
||||
|
@ -399,7 +402,7 @@ QChartView *StatsDialog::createChart(const QString &statsFile, const QString &to
|
|||
return chartView;
|
||||
}
|
||||
|
||||
QLineSeries *StatsDialog::numberOfReports(const QString &fileName, const QString &severity) const
|
||||
QLineSeries *numberOfReports(const QString &fileName, const QString &severity)
|
||||
{
|
||||
QLineSeries *series = new QLineSeries();
|
||||
series->setName(severity);
|
||||
|
|
|
@ -29,17 +29,6 @@ namespace Ui {
|
|||
class StatsDialog;
|
||||
}
|
||||
|
||||
#ifdef HAVE_QCHART
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
namespace QtCharts {
|
||||
#endif
|
||||
class QChartView;
|
||||
class QLineSeries;
|
||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/// @addtogroup GUI
|
||||
/// @{
|
||||
|
||||
|
@ -81,15 +70,6 @@ public:
|
|||
private slots:
|
||||
void copyToClipboard();
|
||||
void pdfExport();
|
||||
#ifdef HAVE_QCHART
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
QChartView *createChart(const QString &statsFile, const QString &tool);
|
||||
QLineSeries *numberOfReports(const QString &fileName, const QString &severity) const;
|
||||
#else
|
||||
QtCharts::QChartView *createChart(const QString &statsFile, const QString &tool);
|
||||
QtCharts::QLineSeries *numberOfReports(const QString &fileName, const QString &severity) const;
|
||||
#endif
|
||||
#endif
|
||||
private:
|
||||
Ui::StatsDialog *mUI;
|
||||
const CheckStatistics *mStatistics;
|
||||
|
|
Loading…
Reference in New Issue