From ea6f3e4f7a810e28ef0953fe593de26faf41f5ea Mon Sep 17 00:00:00 2001 From: Qv2ray-Bot <59914293+Qv2ray-Bot@users.noreply.github.com> Date: Sat, 1 Feb 2020 09:06:21 +0800 Subject: [PATCH] fix: dropped Qt511 support and fixed chart margin --- Build.Counter | 2 +- src/components/speedchart/speedplotview.cpp | 21 +-------------------- src/ui/w_MainWindow.cpp | 2 +- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/Build.Counter b/Build.Counter index f49d075f..4c7065af 100644 --- a/Build.Counter +++ b/Build.Counter @@ -1 +1 @@ -3478 +3490 diff --git a/src/components/speedchart/speedplotview.cpp b/src/components/speedchart/speedplotview.cpp index c08a851c..79faaa3e 100644 --- a/src/components/speedchart/speedplotview.cpp +++ b/src/components/speedchart/speedplotview.cpp @@ -261,16 +261,9 @@ void SpeedPlotView::paintEvent(QPaintEvent *) int yAxisWidth = 0; for (const QString &label : speedLabels) -#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) if (fontMetrics.horizontalAdvance(label) > yAxisWidth) yAxisWidth = fontMetrics.horizontalAdvance(label); -#else - - if (fontMetrics.width(label) > yAxisWidth) - yAxisWidth = fontMetrics.width(label); - -#endif int i = 0; for (const QString &label : speedLabels) { @@ -299,7 +292,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *) } // Set antialiasing for graphs - painter.setRenderHints(QPainter::Antialiasing | QPainter::HighQualityAntialiasing); + painter.setRenderHints(QPainter::Antialiasing); // draw graphs rect.adjust(3, 0, 0, 0); // Need, else graphs cross left gridline const double yMultiplier = (niceScale.arg == 0.0) ? 0.0 : (static_cast(rect.height()) / niceScale.sizeInBytes()); @@ -325,17 +318,9 @@ void SpeedPlotView::paintEvent(QPaintEvent *) int legendWidth = 0; for (const auto &property : asConst(m_properties)) { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) - if (fontMetrics.horizontalAdvance(property.name) > legendWidth) legendWidth = fontMetrics.horizontalAdvance(property.name); -#else - - if (fontMetrics.width(property.name) > legendWidth) - legendWidth = fontMetrics.width(property.name); - -#endif legendHeight += 1.5 * fontMetrics.height(); } @@ -346,11 +331,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *) i = 0; for (const auto &property : asConst(m_properties)) { -#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)) int nameSize = fontMetrics.horizontalAdvance(property.name); -#else - int nameSize = fontMetrics.width(property.name); -#endif double indent = 1.5 * (i++) * fontMetrics.height(); painter.setPen(property.pen); painter.drawLine(legendTopLeft + QPointF(0, indent + fontMetrics.height()), diff --git a/src/ui/w_MainWindow.cpp b/src/ui/w_MainWindow.cpp index c5713ed7..054ec2e4 100644 --- a/src/ui/w_MainWindow.cpp +++ b/src/ui/w_MainWindow.cpp @@ -217,7 +217,7 @@ MainWindow::MainWindow(QWidget *parent): // // For charts speedChartView = new SpeedWidget(this); - speedChartView->setContentsMargins(10, 10, 10, 10); + //speedChartView->setContentsMargins(1, 1, 1, 1); speedChart->addWidget(speedChartView); // // Find and start if there is an auto-connection