mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
Remove conditional Qt5 code
This commit is contained in:
parent
6b39fda03c
commit
7fde61997c
@ -15,10 +15,6 @@
|
||||
#include <QtGlobal>
|
||||
#include <complex>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
||||
using namespace QtCharts;
|
||||
#endif
|
||||
|
||||
class QComboBox;
|
||||
class QTableWidget;
|
||||
class QLineEdit;
|
||||
|
@ -762,11 +762,6 @@ int main(int argc, char *argv[])
|
||||
QucsSettings.maxUndo = 20;
|
||||
QucsSettings.NodeWiring = 0;
|
||||
|
||||
#if QT_VERSION < 0x060000
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling,true);
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps,true);
|
||||
#endif
|
||||
|
||||
// initially center the application
|
||||
QApplication a(argc, argv);
|
||||
//QDesktopWidget *d = a.desktop();
|
||||
|
@ -1141,17 +1141,12 @@ void Q3ScrollView::mouseMoveEvent(QMouseEvent *e)
|
||||
#ifndef QT_NO_WHEELEVENT
|
||||
void Q3ScrollView::wheelEvent(QWheelEvent *e)
|
||||
{
|
||||
#if QT_VERSION >= 0x050f00
|
||||
QPoint pe(e->globalPosition().x(),e->globalPosition().y());
|
||||
QPoint pg = viewport()->mapFromGlobal(pe);
|
||||
QPointF pgf(pg.x(),pg.y());
|
||||
QWheelEvent ce(pgf,
|
||||
e->globalPosition(), e->pixelDelta(), e->angleDelta(),
|
||||
e->buttons(), e->modifiers(), e->phase(), e->inverted());
|
||||
#else
|
||||
QWheelEvent ce(viewport()->mapFromGlobal(e->globalPos()),
|
||||
e->globalPos(), e->delta(), e->buttons(), e->modifiers());
|
||||
#endif
|
||||
viewportWheelEvent(&ce);
|
||||
if (!ce.isAccepted()) {
|
||||
if (e->angleDelta().x() != 0 && horizontalScrollBar())
|
||||
@ -1508,11 +1503,7 @@ bool Q3ScrollView::eventFilter(QObject *obj, QEvent *e)
|
||||
if (disabled)
|
||||
return false;
|
||||
if (d->drag_autoscroll) {
|
||||
#if QT_VERSION >= 0x060000
|
||||
QPoint vp = ((QDragMoveEvent*) e)->position().toPoint();
|
||||
#else
|
||||
QPoint vp = ((QDragMoveEvent*) e)->pos();
|
||||
#endif
|
||||
QRect inside_margin(autoscroll_margin, autoscroll_margin,
|
||||
visibleWidth() - autoscroll_margin * 2,
|
||||
visibleHeight() - autoscroll_margin * 2);
|
||||
@ -1752,13 +1743,8 @@ void Q3ScrollView::viewportResizeEvent(QResizeEvent * /* event */)
|
||||
*/
|
||||
void Q3ScrollView::viewportMousePressEvent(QMouseEvent* e)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPosition(), e->button(), e->buttons(), e->modifiers());
|
||||
#else
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPos(), e->button(), e->buttons(), e->modifiers());
|
||||
#endif
|
||||
contentsMousePressEvent(&ce);
|
||||
if (!ce.isAccepted())
|
||||
e->ignore();
|
||||
@ -1774,13 +1760,8 @@ void Q3ScrollView::viewportMousePressEvent(QMouseEvent* e)
|
||||
*/
|
||||
void Q3ScrollView::viewportMouseReleaseEvent(QMouseEvent* e)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPosition(), e->button(), e->buttons(), e->modifiers());
|
||||
#else
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPos(), e->button(), e->buttons(), e->modifiers());
|
||||
#endif
|
||||
contentsMouseReleaseEvent(&ce);
|
||||
if (!ce.isAccepted())
|
||||
e->ignore();
|
||||
@ -1796,13 +1777,8 @@ void Q3ScrollView::viewportMouseReleaseEvent(QMouseEvent* e)
|
||||
*/
|
||||
void Q3ScrollView::viewportMouseDoubleClickEvent(QMouseEvent* e)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPosition(), e->button(), e->buttons(), e->modifiers());
|
||||
#else
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPos(), e->button(), e->buttons(), e->modifiers());
|
||||
#endif
|
||||
contentsMouseDoubleClickEvent(&ce);
|
||||
if (!ce.isAccepted())
|
||||
e->ignore();
|
||||
@ -1818,13 +1794,8 @@ void Q3ScrollView::viewportMouseDoubleClickEvent(QMouseEvent* e)
|
||||
*/
|
||||
void Q3ScrollView::viewportMouseMoveEvent(QMouseEvent* e)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPosition(), e->button(), e->buttons(), e->modifiers());
|
||||
#else
|
||||
QMouseEvent ce(e->type(), viewportToContents(e->pos()),
|
||||
e->globalPos(), e->button(), e->buttons(), e->modifiers());
|
||||
#endif
|
||||
contentsMouseMoveEvent(&ce);
|
||||
if (!ce.isAccepted())
|
||||
e->ignore();
|
||||
@ -1842,15 +1813,9 @@ void Q3ScrollView::viewportMouseMoveEvent(QMouseEvent* e)
|
||||
*/
|
||||
void Q3ScrollView::viewportDragEnterEvent(QDragEnterEvent* e)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QDragEnterEvent de(viewportToContents(e->position().toPoint()),
|
||||
e->possibleActions(),e->mimeData(),
|
||||
e->buttons(),e->modifiers());
|
||||
#else
|
||||
QDragEnterEvent de(viewportToContents(e->pos()),
|
||||
e->possibleActions(),e->mimeData(),
|
||||
e->mouseButtons(),e->keyboardModifiers());
|
||||
#endif
|
||||
//e->setPoint(viewportToContents(e->pos()));
|
||||
contentsDragEnterEvent(&de);
|
||||
if (de.isAccepted()) e->accept();
|
||||
@ -1868,15 +1833,9 @@ void Q3ScrollView::viewportDragEnterEvent(QDragEnterEvent* e)
|
||||
*/
|
||||
void Q3ScrollView::viewportDragMoveEvent(QDragMoveEvent* e)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QDragMoveEvent de(viewportToContents(e->position().toPoint()),
|
||||
e->possibleActions(),e->mimeData(),
|
||||
e->buttons(),e->modifiers());
|
||||
#else
|
||||
QDragMoveEvent de(viewportToContents(e->pos()),
|
||||
e->possibleActions(),e->mimeData(),
|
||||
e->mouseButtons(),e->keyboardModifiers());
|
||||
#endif
|
||||
//e->setPoint(viewportToContents(e->pos()));
|
||||
contentsDragMoveEvent(&de);
|
||||
if (de.isAccepted()) e->accept();
|
||||
@ -1907,15 +1866,9 @@ void Q3ScrollView::viewportDragLeaveEvent(QDragLeaveEvent* e)
|
||||
*/
|
||||
void Q3ScrollView::viewportDropEvent(QDropEvent* e)
|
||||
{
|
||||
#if QT_VERSION >= 0x060000
|
||||
QDropEvent de(viewportToContents(e->position().toPoint()),
|
||||
e->possibleActions(),e->mimeData(),
|
||||
e->buttons(),e->modifiers());
|
||||
#else
|
||||
QDropEvent de(viewportToContents(e->pos()),
|
||||
e->possibleActions(),e->mimeData(),
|
||||
e->mouseButtons(),e->keyboardModifiers());
|
||||
#endif
|
||||
//e->setPoint(viewportToContents(e->pos()));
|
||||
contentsDropEvent(&de);
|
||||
if (de.isAccepted()) e->accept();
|
||||
@ -1946,17 +1899,12 @@ void Q3ScrollView::viewportWheelEvent(QWheelEvent* e)
|
||||
be sent to the focus widget if the widget-under-mouse doesn't want
|
||||
the event itself.
|
||||
*/
|
||||
#if QT_VERSION >= 0x050f00
|
||||
QPoint pe(e->globalPosition().x(),e->globalPosition().y());
|
||||
QPoint pg = viewport()->mapFromGlobal(pe);
|
||||
QPointF pgf(pg.x(),pg.y());
|
||||
QWheelEvent ce(pgf,
|
||||
e->globalPosition(), e->pixelDelta(), e->angleDelta(),
|
||||
e->buttons(), e->modifiers(), e->phase(), e->inverted());
|
||||
#else
|
||||
QWheelEvent ce(viewport()->mapFromGlobal(e->globalPos()),
|
||||
e->globalPos(), e->delta(), e->buttons(), e->modifiers());
|
||||
#endif
|
||||
contentsWheelEvent(&ce);
|
||||
if (ce.isAccepted())
|
||||
e->accept();
|
||||
|
@ -89,9 +89,6 @@
|
||||
|
||||
QucsApp::QucsApp()
|
||||
{
|
||||
#if QT_VERSION_MAJOR == 5
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
|
||||
#endif
|
||||
|
||||
windowTitle = misc::getWindowTitle();
|
||||
setWindowTitle(windowTitle);
|
||||
|
@ -2340,15 +2340,9 @@ void Schematic::contentsWheelEvent(QWheelEvent *Event)
|
||||
// zoom factor scaled according to the wheel delta, to accommodate
|
||||
// values different from 60 (slower or faster zoom)
|
||||
double scaleCoef = pow(1.1, verticalWheelAngleDelta / 60.0);
|
||||
#if QT_VERSION >= 0x050f00
|
||||
const QPoint pointer{
|
||||
static_cast<int>(Event->position().x()),
|
||||
static_cast<int>(Event->position().y())};
|
||||
#else
|
||||
const QPoint pointer{
|
||||
Event->pos().x(),
|
||||
Event->pos().y()};
|
||||
#endif
|
||||
zoomAroundPoint(scaleCoef, pointer);
|
||||
}
|
||||
// Scroll vertically
|
||||
@ -2557,13 +2551,8 @@ void Schematic::contentsDropEvent(QDropEvent *Event)
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
auto ev_pos = Event->position();
|
||||
QPoint inModel = contentsToModel(ev_pos.toPoint());
|
||||
#else
|
||||
auto ev_pos = Event->pos();
|
||||
QPoint inModel = contentsToModel(ev_pos);
|
||||
#endif
|
||||
//QMouseEvent e(QEvent::MouseButtonPress, ev_pos, Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
|
||||
|
||||
QMouseEvent e(QEvent::MouseButtonPress, ev_pos, mapToGlobal(ev_pos), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
|
||||
@ -2641,11 +2630,7 @@ void Schematic::contentsNativeGestureZoomEvent( QNativeGestureEvent* Event) {
|
||||
a_App->editText->setHidden(true); // disable edit of component property
|
||||
|
||||
const auto factor = 1.0 + Event->value();
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||
const auto pointer = mapFromGlobal(Event->globalPosition().toPoint());
|
||||
#else
|
||||
const auto pointer = mapFromGlobal(Event->globalPos());
|
||||
#endif
|
||||
zoomAroundPoint(factor,pointer);
|
||||
}
|
||||
|
||||
@ -2658,7 +2643,6 @@ void Schematic::contentsDragMoveEvent(QDragMoveEvent *Event)
|
||||
return;
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
auto ev_pos = Event->position();
|
||||
/*QMouseEvent e(QEvent::MouseMove,
|
||||
Event->position(),
|
||||
@ -2666,10 +2650,6 @@ void Schematic::contentsDragMoveEvent(QDragMoveEvent *Event)
|
||||
Qt::NoButton,
|
||||
Qt::NoModifier);*/
|
||||
QMouseEvent e(QEvent::MouseButtonPress, ev_pos, mapToGlobal(ev_pos), Qt::LeftButton, Qt::NoButton, Qt::NoModifier);
|
||||
|
||||
#else
|
||||
QMouseEvent e(QEvent::MouseMove, Event->pos(), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
|
||||
#endif
|
||||
a_App->view->MMoveElement(this, &e);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user