Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port to qt6 #656

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions DSView/pv/dialogs/deviceoptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ChannelLabel::ChannelLabel(IChannelCheck *check, QWidget *parent, int chanIndex)
lb->setFont(font);

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;
int h = fh + _box->height() + 2;
setFixedSize(w, h);
Expand Down Expand Up @@ -395,7 +395,7 @@ void DeviceOptions::logic_probes(QVBoxLayout &layout)
enable_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);
disable_all_probes->setMaximumWidth(bt_width);

Expand Down
6 changes: 3 additions & 3 deletions DSView/pv/dock/measuredock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ void MeasureDock::build_dist_pannel()
int dex = 0;
QLabel cal_lb;
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)
{
Expand Down Expand Up @@ -380,7 +380,7 @@ void MeasureDock::build_edge_pannel()
int dex = 0;
QLabel cal_lb;
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)
{
Expand Down Expand Up @@ -767,7 +767,7 @@ void MeasureDock::cursor_update()

QLabel cal_lb;
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 cursor_dex = 0;
Expand Down
4 changes: 2 additions & 2 deletions DSView/pv/dock/triggerdock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
#include <QApplication>
#include <math.h>
#include <libsigrok.h>
#include <QRegExp>
#include <QRegExpValidator>
#include <QRegularExpression>
#include <QRegularExpressionValidator>
#include "../config/appconfig.h"
#include "../deviceagent.h"
#include "../view/logicsignal.h"
Expand Down
11 changes: 7 additions & 4 deletions DSView/pv/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <QJsonArray>
#include <functional>

#include <QDesktopWidget>
//#include <QDesktopWidget>

#include "mainwindow.h"

Expand Down Expand Up @@ -537,12 +537,15 @@ namespace pv
(void)x;
(void)y;

QDesktopWidget *desktop = QApplication::desktop();
int curMonitor = desktop->screenNumber(this);
//QDesktopWidget *desktop = QApplication::desktop();
//int curMonitor = desktop->screenNumber(this);
QScreen *currentScreen = this->window()->screen();
QList<QScreen *> screens = QGuiApplication::screens();
int curMonitor = screens.indexOf(currentScreen);

#ifdef _WIN32
#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
QPixmap pixmap = QPixmap::grabWidget(parentWidget());
#endif
Expand Down