提交 6472d068 编写于 作者: D dev

Qt5 old version compablity

上级 55fc0d96
...@@ -35,6 +35,11 @@ const QColor TagInfo::DefaultColor(Qt::lightGray); ...@@ -35,6 +35,11 @@ const QColor TagInfo::DefaultColor(Qt::lightGray);
const QString TagInfo::strUntagged("Untagged"); const QString TagInfo::strUntagged("Untagged");
Bookmarks* Bookmarks::m_pThis = 0; Bookmarks* Bookmarks::m_pThis = 0;
#if QT_VERSION < 0x051500
#define ENDL endl
#else
#define ENDL Qt::endl
#endif
Bookmarks::Bookmarks() Bookmarks::Bookmarks()
{ {
TagInfo tag(TagInfo::strUntagged); TagInfo tag(TagInfo::strUntagged);
...@@ -155,7 +160,7 @@ bool Bookmarks::save() ...@@ -155,7 +160,7 @@ bool Bookmarks::save()
QTextStream stream(&file); QTextStream stream(&file);
stream << QString("# Tag name").leftJustified(20) + "; " + stream << QString("# Tag name").leftJustified(20) + "; " +
QString(" color") << Qt::endl; QString(" color") << ENDL;
QSet<TagInfo*> usedTags; QSet<TagInfo*> usedTags;
for (int iBookmark = 0; iBookmark < m_BookmarkList.size(); iBookmark++) for (int iBookmark = 0; iBookmark < m_BookmarkList.size(); iBookmark++)
...@@ -171,16 +176,16 @@ bool Bookmarks::save() ...@@ -171,16 +176,16 @@ bool Bookmarks::save()
for (QSet<TagInfo*>::iterator i = usedTags.begin(); i != usedTags.end(); i++) for (QSet<TagInfo*>::iterator i = usedTags.begin(); i != usedTags.end(); i++)
{ {
TagInfo& info = **i; TagInfo& info = **i;
stream << info.name.leftJustified(20) + "; " + info.color.name() << Qt::endl; stream << info.name.leftJustified(20) + "; " + info.color.name() << ENDL;
} }
stream << Qt::endl; stream << ENDL;
stream << QString("# Frequency").leftJustified(12) + "; " + stream << QString("# Frequency").leftJustified(12) + "; " +
QString("Name").leftJustified(25)+ "; " + QString("Name").leftJustified(25)+ "; " +
QString("Modulation").leftJustified(20) + "; " + QString("Modulation").leftJustified(20) + "; " +
QString("Bandwidth").rightJustified(10) + "; " + QString("Bandwidth").rightJustified(10) + "; " +
QString("Tags") << Qt::endl; QString("Tags") << ENDL;
for (int i = 0; i < m_BookmarkList.size(); i++) for (int i = 0; i < m_BookmarkList.size(); i++)
{ {
...@@ -199,7 +204,7 @@ bool Bookmarks::save() ...@@ -199,7 +204,7 @@ bool Bookmarks::save()
line.append(tag.name); line.append(tag.name);
} }
stream << line << Qt::endl; stream << line << ENDL;
} }
file.close(); file.close();
......
...@@ -471,7 +471,11 @@ void CFreqCtrl::mousePressEvent(QMouseEvent *event) ...@@ -471,7 +471,11 @@ void CFreqCtrl::mousePressEvent(QMouseEvent *event)
void CFreqCtrl::wheelEvent(QWheelEvent *event) void CFreqCtrl::wheelEvent(QWheelEvent *event)
{ {
#if QT_VERSION >=0x051500
QPointF pt = event->position(); QPointF pt = event->position();
#else
QPoint pt = event->pos();
#endif
int numDegrees = (event->angleDelta().x() +event->angleDelta().y() ) / 8; int numDegrees = (event->angleDelta().x() +event->angleDelta().y() ) / 8;
int numSteps = numDegrees / 15; int numSteps = numDegrees / 15;
......
...@@ -827,7 +827,11 @@ void CPlotter::zoomOnXAxis(double level) ...@@ -827,7 +827,11 @@ void CPlotter::zoomOnXAxis(double level)
// Called when a mouse wheel is turned // Called when a mouse wheel is turned
void CPlotter::wheelEvent(QWheelEvent * event) void CPlotter::wheelEvent(QWheelEvent * event)
{ {
#if QT_VERSION >=0x051500
QPointF pt = event->position(); QPointF pt = event->position();
#else
QPoint pt = event->pos();
#endif
pt.setX(pt.x() / pixRatio()+.5); pt.setX(pt.x() / pixRatio()+.5);
pt.setY(pt.y() / pixRatio()+.5); pt.setY(pt.y() / pixRatio()+.5);
int numDegrees = (event->angleDelta().x() + event->angleDelta().y()) / 8; int numDegrees = (event->angleDelta().x() + event->angleDelta().y()) / 8;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册