mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +08:00
fix: dropped Qt511 support and fixed chart margin
This commit is contained in:
parent
dbd19865a6
commit
ea6f3e4f7a
@ -1 +1 @@
|
|||||||
3478
|
3490
|
||||||
|
@ -261,16 +261,9 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||||||
int yAxisWidth = 0;
|
int yAxisWidth = 0;
|
||||||
|
|
||||||
for (const QString &label : speedLabels)
|
for (const QString &label : speedLabels)
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
if (fontMetrics.horizontalAdvance(label) > yAxisWidth)
|
if (fontMetrics.horizontalAdvance(label) > yAxisWidth)
|
||||||
yAxisWidth = fontMetrics.horizontalAdvance(label);
|
yAxisWidth = fontMetrics.horizontalAdvance(label);
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (fontMetrics.width(label) > yAxisWidth)
|
|
||||||
yAxisWidth = fontMetrics.width(label);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
for (const QString &label : speedLabels) {
|
for (const QString &label : speedLabels) {
|
||||||
@ -299,7 +292,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set antialiasing for graphs
|
// Set antialiasing for graphs
|
||||||
painter.setRenderHints(QPainter::Antialiasing | QPainter::HighQualityAntialiasing);
|
painter.setRenderHints(QPainter::Antialiasing);
|
||||||
// draw graphs
|
// draw graphs
|
||||||
rect.adjust(3, 0, 0, 0); // Need, else graphs cross left gridline
|
rect.adjust(3, 0, 0, 0); // Need, else graphs cross left gridline
|
||||||
const double yMultiplier = (niceScale.arg == 0.0) ? 0.0 : (static_cast<double>(rect.height()) / niceScale.sizeInBytes());
|
const double yMultiplier = (niceScale.arg == 0.0) ? 0.0 : (static_cast<double>(rect.height()) / niceScale.sizeInBytes());
|
||||||
@ -325,17 +318,9 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||||||
int legendWidth = 0;
|
int legendWidth = 0;
|
||||||
|
|
||||||
for (const auto &property : asConst(m_properties)) {
|
for (const auto &property : asConst(m_properties)) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
|
|
||||||
if (fontMetrics.horizontalAdvance(property.name) > legendWidth)
|
if (fontMetrics.horizontalAdvance(property.name) > legendWidth)
|
||||||
legendWidth = fontMetrics.horizontalAdvance(property.name);
|
legendWidth = fontMetrics.horizontalAdvance(property.name);
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
if (fontMetrics.width(property.name) > legendWidth)
|
|
||||||
legendWidth = fontMetrics.width(property.name);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
legendHeight += 1.5 * fontMetrics.height();
|
legendHeight += 1.5 * fontMetrics.height();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -346,11 +331,7 @@ void SpeedPlotView::paintEvent(QPaintEvent *)
|
|||||||
i = 0;
|
i = 0;
|
||||||
|
|
||||||
for (const auto &property : asConst(m_properties)) {
|
for (const auto &property : asConst(m_properties)) {
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 11, 0))
|
|
||||||
int nameSize = fontMetrics.horizontalAdvance(property.name);
|
int nameSize = fontMetrics.horizontalAdvance(property.name);
|
||||||
#else
|
|
||||||
int nameSize = fontMetrics.width(property.name);
|
|
||||||
#endif
|
|
||||||
double indent = 1.5 * (i++) * fontMetrics.height();
|
double indent = 1.5 * (i++) * fontMetrics.height();
|
||||||
painter.setPen(property.pen);
|
painter.setPen(property.pen);
|
||||||
painter.drawLine(legendTopLeft + QPointF(0, indent + fontMetrics.height()),
|
painter.drawLine(legendTopLeft + QPointF(0, indent + fontMetrics.height()),
|
||||||
|
@ -217,7 +217,7 @@ MainWindow::MainWindow(QWidget *parent):
|
|||||||
//
|
//
|
||||||
// For charts
|
// For charts
|
||||||
speedChartView = new SpeedWidget(this);
|
speedChartView = new SpeedWidget(this);
|
||||||
speedChartView->setContentsMargins(10, 10, 10, 10);
|
//speedChartView->setContentsMargins(1, 1, 1, 1);
|
||||||
speedChart->addWidget(speedChartView);
|
speedChart->addWidget(speedChartView);
|
||||||
//
|
//
|
||||||
// Find and start if there is an auto-connection
|
// Find and start if there is an auto-connection
|
||||||
|
Loading…
Reference in New Issue
Block a user