提交 d8c70031 编写于 作者: 丁劲犇's avatar 丁劲犇 😸

Qt6 deprecated issues.

上级 fb12c783
/* -*- c++ -*- */
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
......@@ -30,7 +30,7 @@
#include "bookmarks.h"
#include <stdio.h>
#include <wchar.h>
#include <algorithm>
const QColor TagInfo::DefaultColor(Qt::lightGray);
const QString TagInfo::strUntagged("Untagged");
Bookmarks* Bookmarks::m_pThis = 0;
......@@ -155,7 +155,7 @@ bool Bookmarks::save()
QTextStream stream(&file);
stream << QString("# Tag name").leftJustified(20) + "; " +
QString(" color") << endl;
QString(" color") << Qt::endl;
QSet<TagInfo*> usedTags;
for (int iBookmark = 0; iBookmark < m_BookmarkList.size(); iBookmark++)
......@@ -171,16 +171,16 @@ bool Bookmarks::save()
for (QSet<TagInfo*>::iterator i = usedTags.begin(); i != usedTags.end(); i++)
{
TagInfo& info = **i;
stream << info.name.leftJustified(20) + "; " + info.color.name() << endl;
stream << info.name.leftJustified(20) + "; " + info.color.name() << Qt::endl;
}
stream << endl;
stream << Qt::endl;
stream << QString("# Frequency").leftJustified(12) + "; " +
QString("Name").leftJustified(25)+ "; " +
QString("Modulation").leftJustified(20) + "; " +
QString("Bandwidth").rightJustified(10) + "; " +
QString("Tags") << endl;
QString("Tags") << Qt::endl;
for (int i = 0; i < m_BookmarkList.size(); i++)
{
......@@ -199,7 +199,7 @@ bool Bookmarks::save()
line.append(tag.name);
}
stream << line << endl;
stream << line << Qt::endl;
}
file.close();
......@@ -212,9 +212,9 @@ QList<BookmarkInfo> Bookmarks::getBookmarksInRange(qint64 low, qint64 high)
{
BookmarkInfo info;
info.frequency=low;
QList<BookmarkInfo>::const_iterator lb = qLowerBound(m_BookmarkList, info);
QList<BookmarkInfo>::const_iterator lb = std::lower_bound(m_BookmarkList.begin(), m_BookmarkList.end(),info);
info.frequency=high;
QList<BookmarkInfo>::const_iterator ub = qUpperBound(m_BookmarkList, info);
QList<BookmarkInfo>::const_iterator ub = std::upper_bound(m_BookmarkList.begin(), m_BookmarkList.end(),info);
QList<BookmarkInfo> found;
......
/* -*- c++ -*- */
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
......@@ -74,7 +74,7 @@ QVariant BookmarksTableModel::data ( const QModelIndex & index, int role ) const
{
BookmarkInfo& info = *m_Bookmarks[index.row()];
if(role==Qt::BackgroundColorRole)
if(role==Qt::BackgroundRole)
{
QColor bg(info.GetColor());
bg.setAlpha(0x60);
......@@ -160,7 +160,7 @@ bool BookmarksTableModel::setData(const QModelIndex &index, const QVariant &valu
Qt::ItemFlags BookmarksTableModel::flags ( const QModelIndex& index ) const
{
Qt::ItemFlags flags = 0;
Qt::ItemFlags flags = Qt::NoItemFlags;
switch(index.column())
{
......
/* -*- c++ -*- */
/* -*- c++ -*- */
/*
* Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
* http://gqrx.dk/
......@@ -269,7 +269,7 @@ void BookmarksTagList::AddTag(QString name, Qt::CheckState checkstate, QColor co
// Column 0
item = new QTableWidgetItem();
item->setFlags(Qt::ItemIsEnabled);
item->setBackgroundColor(color);
item->setBackground(color);
setItem(i, 0, item);
}
......
/*
/*
* Frequency controller widget (originally from CuteSDR)
*
* This file is part of gqrx sdr.
......@@ -93,6 +93,14 @@ bool CFreqCtrl::inRect(QRect &rect, QPoint &point)
else
return false;
}
bool CFreqCtrl::inRect(QRect &rect, QPointF &point)
{
if ((point.x() < rect.right()) && (point.x() > rect.x()) &&
(point.y() < rect.bottom()) && (point.y() > rect.y()))
return true;
else
return false;
}
static int fmax_to_numdigits(qint64 fmax)
{
......@@ -463,8 +471,8 @@ void CFreqCtrl::mousePressEvent(QMouseEvent *event)
void CFreqCtrl::wheelEvent(QWheelEvent *event)
{
QPoint pt = event->pos();
int numDegrees = event->delta() / 8;
QPointF pt = event->position();
int numDegrees = (event->angleDelta().x() +event->angleDelta().y() ) / 8;
int numSteps = numDegrees / 15;
for (int i = m_DigStart; i < m_NumDigits; i++)
......
/*
/*
* Frequency controller widget (originally from CuteSDR)
*/
#pragma once
......@@ -80,6 +80,7 @@ private:
void moveCursorLeft();
void moveCursorRight();
bool inRect(QRect &rect, QPoint &point);
bool inRect(QRect &rect, QPointF &point);
bool m_UpdateAll;
bool m_ExternalKeyActive;
......
......@@ -404,13 +404,13 @@ void CPlotter::mouseMoveEvent(QMouseEvent* event)
}
else if (XAXIS == m_CursorCaptured)
{
if (event->buttons() & (Qt::LeftButton | Qt::MidButton))
if (event->buttons() & (Qt::LeftButton | Qt::MiddleButton))
{
setCursor(QCursor(Qt::ClosedHandCursor));
// pan viewable range or move center frequency
int delta_px = m_Xzero - pt.x();
qint64 delta_hz = delta_px * m_Span / m_OverlayPixmap.width();
if (event->buttons() & Qt::MidButton)
if (event->buttons() & Qt::MiddleButton)
{
m_CenterFreq += delta_hz;
m_DemodCenterFreq += delta_hz;
......@@ -709,7 +709,7 @@ void CPlotter::mousePressEvent(QMouseEvent * event)
m_GrabPosition = 1;
drawOverlay();
}
else if (event->buttons() == Qt::MidButton)
else if (event->buttons() == Qt::MiddleButton)
{
// set center freq
m_CenterFreq = roundFreq(freqFromX(pt.x()), m_ClickResolution);
......@@ -827,10 +827,10 @@ void CPlotter::zoomOnXAxis(double level)
// Called when a mouse wheel is turned
void CPlotter::wheelEvent(QWheelEvent * event)
{
QPoint pt = event->pos();
QPointF pt = event->position();
pt.setX(pt.x() / pixRatio()+.5);
pt.setY(pt.y() / pixRatio()+.5);
int numDegrees = event->delta() / 8;
int numDegrees = (event->angleDelta().x() + event->angleDelta().y()) / 8;
int numSteps = numDegrees / 15; /** FIXME: Only used for direction **/
/** FIXME: zooming could use some optimisation **/
......@@ -838,7 +838,7 @@ void CPlotter::wheelEvent(QWheelEvent * event)
{
// Vertical zoom. Wheel down: zoom out, wheel up: zoom in
// During zoom we try to keep the point (dB or kHz) under the cursor fixed
double zoom_fac = event->delta() < 0 ? 1.1 : 0.9;
double zoom_fac = numDegrees < 0 ? 1.1 : 0.9;
double ratio = (double)pt.y() / (double)m_OverlayPixmap.height();
double db_range = m_PandMaxdB - m_PandMindB;
double y_range = (double)m_OverlayPixmap.height();
......@@ -857,7 +857,7 @@ void CPlotter::wheelEvent(QWheelEvent * event)
}
else if (m_CursorCaptured == XAXIS)
{
zoomStepX(event->delta() < 0 ? 1.1 : 0.9, pt.x());
zoomStepX(numDegrees < 0 ? 1.1 : 0.9, pt.x());
}
else if (event->modifiers() & Qt::ControlModifier)
{
......@@ -1351,7 +1351,7 @@ void CPlotter::drawOverlay()
QFontMetrics metrics(m_Font);
QPainter painter(&m_OverlayPixmap);
painter.initFrom(this);
painter.begin(this);
painter.setFont(m_Font);
// solid background
......@@ -1362,7 +1362,7 @@ void CPlotter::drawOverlay()
#define VER_MARGIN 5
// X and Y axis areas
m_YAxisWidth = metrics.width("XXXX") + 2 * HOR_MARGIN;
m_YAxisWidth = metrics.horizontalAdvance("XXXX") + 2 * HOR_MARGIN;
m_XAxisYCenter = h - metrics.height()/2;
int xAxisHeight = metrics.height() + 2 * VER_MARGIN;
int xAxisTop = h - xAxisHeight;
......@@ -1384,7 +1384,7 @@ void CPlotter::drawOverlay()
x = xFromFreq(bookmarks[i].frequency);
#if defined(_WIN16) || defined(_WIN32) || defined(_WIN64)
int nameWidth = fm.width(bookmarks[i].name);
int nameWidth = fm.horizontalAdvance(bookmarks[i].name);
#else
int nameWidth = fm.boundingRect(bookmarks[i].name).width();
#endif
......@@ -1397,7 +1397,7 @@ void CPlotter::drawOverlay()
level = 0;
tagEnd[level] = x + nameWidth + slant - 1;
m_BookmarkTags.append(qMakePair<QRect, qint64>(QRect(x, level * levelHeight, nameWidth + slant, fontHeight), bookmarks[i].frequency));
m_BookmarkTags.append(qMakePair(QRect(x, level * levelHeight, nameWidth + slant, fontHeight), bookmarks[i].frequency));
QColor color = QColor(bookmarks[i].GetColor());
color.setAlpha(0x60);
......@@ -1437,7 +1437,7 @@ void CPlotter::drawOverlay()
QString label;
label.setNum(double((StartFreq + m_Span) / m_FreqUnits), 'f', m_FreqDigits);
calcDivSize(StartFreq, StartFreq + m_Span,
qMin(w/(metrics.width(label) + metrics.width("O")), HORZ_DIVS_MAX),
qMin(w/(metrics.horizontalAdvance(label) + metrics.horizontalAdvance("O")), HORZ_DIVS_MAX),
m_StartFreqAdj, m_FreqPerDiv, m_HorDivs);
pixperdiv = (double)w * (double) m_FreqPerDiv / (double) m_Span;
adjoffset = pixperdiv * double (m_StartFreqAdj - StartFreq) / (double) m_FreqPerDiv;
......@@ -1455,7 +1455,7 @@ void CPlotter::drawOverlay()
painter.setPen(QColor(PLOTTER_TEXT_COLOR));
for (int i = 0; i <= m_HorDivs; i++)
{
int tw = metrics.width(m_HDivText[i]);
int tw = metrics.horizontalAdvance(m_HDivText[i]);
x = (int)((double)i*pixperdiv + adjoffset);
if (x > m_YAxisWidth)
{
......@@ -1494,7 +1494,7 @@ void CPlotter::drawOverlay()
// draw amplitude values (y axis)
int dB = m_PandMaxdB;
m_YAxisWidth = metrics.width("-120 ");
m_YAxisWidth = metrics.horizontalAdvance("-120 ");
painter.setPen(QColor(PLOTTER_TEXT_COLOR));
for (int i = 0; i < m_VerDivs; i++)
{
......
#include "uhd_device_win32.h"
#include "uhd_device_win32.h"
#include <QThread>
#include <QDebug>
#include <QCoreApplication>
......@@ -262,8 +262,8 @@ quint64 uhd_device::set_center_freq(const quint64 freq_in_hz)
/*.target_freq =*/ (double)freq_in_hz,
/*.rf_freq_policy =*/ UHD_TUNE_REQUEST_POLICY_AUTO,
/*.rf_freq =*/ 0,
/*.dsp_freq_policy = */UHD_TUNE_REQUEST_POLICY_MANUAL,
/*.dsp_freq =*/ srate/2,
/*.dsp_freq_policy = */UHD_TUNE_REQUEST_POLICY_AUTO,
/*.dsp_freq =*/ 0,
/*.args =*/ 0
};
UHD_DO(uhd_usrp_set_rx_freq(usrp, &rx_tune_request, m_channel, &rx_tune_result));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册