mirror of
https://github.com/DreamSourceLab/DSView.git
synced 2025-01-23 13:42:55 +08:00
fix: Unable to compile with qt6
This commit is contained in:
parent
03ae94031f
commit
d411b502f2
@ -68,7 +68,7 @@ ChannelLabel::ChannelLabel(IChannelCheck *check, QWidget *parent, int chanIndex)
|
|||||||
lb->setFont(font);
|
lb->setFont(font);
|
||||||
|
|
||||||
int fh = lb->fontMetrics().height();
|
int fh = lb->fontMetrics().height();
|
||||||
int w = lb->fontMetrics().width(lb->text()) + 5;
|
int w = lb->fontMetrics().horizontalAdvance(lb->text()) + 5;
|
||||||
w = w < 30 ? 30 : w;
|
w = w < 30 ? 30 : w;
|
||||||
int h = fh + _box->height() + 2;
|
int h = fh + _box->height() + 2;
|
||||||
setFixedSize(w, h);
|
setFixedSize(w, h);
|
||||||
@ -395,7 +395,7 @@ void DeviceOptions::logic_probes(QVBoxLayout &layout)
|
|||||||
enable_all_probes->setFont(font);
|
enable_all_probes->setFont(font);
|
||||||
disable_all_probes->setFont(font);
|
disable_all_probes->setFont(font);
|
||||||
|
|
||||||
int bt_width = enable_all_probes->fontMetrics().width(enable_all_probes->text()) + 20;
|
int bt_width = enable_all_probes->fontMetrics().horizontalAdvance(enable_all_probes->text()) + 20;
|
||||||
enable_all_probes->setMaximumWidth(bt_width);
|
enable_all_probes->setMaximumWidth(bt_width);
|
||||||
disable_all_probes->setMaximumWidth(bt_width);
|
disable_all_probes->setMaximumWidth(bt_width);
|
||||||
|
|
||||||
|
@ -257,7 +257,7 @@ void MeasureDock::build_dist_pannel()
|
|||||||
int dex = 0;
|
int dex = 0;
|
||||||
QLabel cal_lb;
|
QLabel cal_lb;
|
||||||
cal_lb.setFont(font);
|
cal_lb.setFont(font);
|
||||||
int bt_w = cal_lb.fontMetrics().width("22") + 8;
|
int bt_w = cal_lb.fontMetrics().horizontalAdvance("22") + 8;
|
||||||
|
|
||||||
for (auto &o : _dist_row_list)
|
for (auto &o : _dist_row_list)
|
||||||
{
|
{
|
||||||
@ -380,7 +380,7 @@ void MeasureDock::build_edge_pannel()
|
|||||||
int dex = 0;
|
int dex = 0;
|
||||||
QLabel cal_lb;
|
QLabel cal_lb;
|
||||||
cal_lb.setFont(font);
|
cal_lb.setFont(font);
|
||||||
int bt_w = cal_lb.fontMetrics().width("22") + 8;
|
int bt_w = cal_lb.fontMetrics().horizontalAdvance("22") + 8;
|
||||||
|
|
||||||
for (auto &o : _edge_row_list)
|
for (auto &o : _edge_row_list)
|
||||||
{
|
{
|
||||||
@ -767,7 +767,7 @@ void MeasureDock::cursor_update()
|
|||||||
|
|
||||||
QLabel cal_lb;
|
QLabel cal_lb;
|
||||||
cal_lb.setFont(font);
|
cal_lb.setFont(font);
|
||||||
int bt_w = cal_lb.fontMetrics().width("22") + 8;
|
int bt_w = cal_lb.fontMetrics().horizontalAdvance("22") + 8;
|
||||||
|
|
||||||
int index = 1;
|
int index = 1;
|
||||||
int cursor_dex = 0;
|
int cursor_dex = 0;
|
||||||
|
@ -35,8 +35,15 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <libsigrok.h>
|
#include <libsigrok.h>
|
||||||
#include <QRegExp>
|
|
||||||
#include <QRegExpValidator>
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
#include <QRegularExpression>
|
||||||
|
#include <QRegularExpressionValidator>
|
||||||
|
#else
|
||||||
|
#include <QRegExp>
|
||||||
|
#include <QRegExpValidator>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../config/appconfig.h"
|
#include "../config/appconfig.h"
|
||||||
#include "../deviceagent.h"
|
#include "../deviceagent.h"
|
||||||
#include "../view/logicsignal.h"
|
#include "../view/logicsignal.h"
|
||||||
|
@ -44,7 +44,10 @@
|
|||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
|
//include with qt5
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
@ -537,25 +540,27 @@ namespace pv
|
|||||||
(void)x;
|
(void)x;
|
||||||
(void)y;
|
(void)y;
|
||||||
|
|
||||||
QDesktopWidget *desktop = QApplication::desktop();
|
|
||||||
int curMonitor = desktop->screenNumber(this);
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(desktop->winId(), x, y, w, h);
|
QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(QApplication::desktop->winId(), x, y, w, h);
|
||||||
#else
|
#else
|
||||||
QPixmap pixmap = QPixmap::grabWidget(parentWidget());
|
QPixmap pixmap = QPixmap::grabWidget(parentWidget());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
x += MainFrame::Margin;
|
x += MainFrame::Margin;
|
||||||
y += MainFrame::Margin;
|
y += MainFrame::Margin;
|
||||||
w -= MainFrame::Margin * 2;
|
w -= MainFrame::Margin * 2;
|
||||||
h -= MainFrame::Margin * 2;
|
h -= MainFrame::Margin * 2;
|
||||||
QPixmap pixmap = QGuiApplication::screens().at(curMonitor)->grabWindow(winId(), x, y, w, h);
|
|
||||||
|
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(winId(), x, y, w, h);
|
||||||
|
#else
|
||||||
|
QDesktopWidget *desktop = QApplication::desktop();
|
||||||
|
int curMonitor = desktop->screenNumber(this);
|
||||||
|
QPixmap pixmap = QGuiApplication::screens().at(curMonitor)->grabWindow(winId(), x, y, w, h);
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
QPixmap pixmap = QGuiApplication::screens().at(curMonitor)->grabWindow(winId());
|
QPixmap pixmap = QGuiApplication::primaryScreen()->grabWindow(winId());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
QString format = "png";
|
QString format = "png";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user