version 2.0.0_alpha

Important! All QtWraps macros renamed!
Qt 6 support
Graphic export feature
qad_types cross-Qt small changes
This commit is contained in:
2021-03-05 13:05:23 +03:00
parent add26cf9ad
commit 7b011ed242
46 changed files with 815 additions and 219 deletions

View File

@@ -14,14 +14,6 @@
const QString _BlockView_Mime_ = "_BlockView_copypaste_";
template <typename T> QSet<T> QList2QSet(const QList<T> & l) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
return QSet<T>(l.begin(), l.end());
#else
return QSet<T>::fromList(l);
#endif
}
BlockView::BlockView(QWidget * parent): QGraphicsView(parent), tmp_bus(true) {
_init();
}
@@ -218,7 +210,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
}
if (me->buttons().testFlag(Qt::LeftButton )) btncnt++;
if (me->buttons().testFlag(Qt::RightButton)) btncnt++;
if (me->buttons().testFlag(Qt::MidButton )) btncnt++;
if (me->buttons().testFlag(QT_MID_BUTTON )) btncnt++;
mm_cancel = btncnt >= 2;
match_bus = bus_from = 0;
hpin = 0;
@@ -266,7 +258,7 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
mm_drag = moved = false;
screen_point = me->screenPos();
scene_point = me->scenePos();
if ((me->button() == Qt::MidButton) || (me->button() == Qt::RightButton)) {
if ((me->button() == QT_MID_BUTTON) || (me->button() == Qt::RightButton)) {
thumbShow();
restartTimer(timer_thumb, thumb_hide_delay);
return true;
@@ -525,10 +517,10 @@ bool BlockView::eventFilter(QObject * o, QEvent * e) {
case QEvent::GraphicsSceneMouseRelease:
if (me->buttons().testFlag(Qt::LeftButton)) btncnt++;
if (me->buttons().testFlag(Qt::RightButton)) btncnt++;
if (me->buttons().testFlag(Qt::MidButton)) btncnt++;
if (me->buttons().testFlag(QT_MID_BUTTON)) btncnt++;
cur_bus = 0;
mm_cancel = btncnt > 0;
if (mm_cancel || (me->button() == Qt::MidButton) || (me->button() == Qt::RightButton)) {
if (mm_cancel || (me->button() == QT_MID_BUTTON) || (me->button() == Qt::RightButton)) {
mm_ci = 0;
return true;
}
@@ -665,19 +657,19 @@ void BlockView::timerEvent(QTimerEvent * e) {
void BlockView::wheelEvent(QWheelEvent * e) {
if (!navigation) return;
if (wheel_zoom || e->modifiers().testFlag(Qt::ControlModifier)) {
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
double scl = 1. - e->angleDelta().y() / 500.;
#else
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
double scl = 1. - e->delta() / 500.;
#else
double scl = 1. - e->angleDelta().y() / 500.;
#endif
if (!is_nav_anim || (nav_anim.state() != QPropertyAnimation::Running))
nav_target = _nav();
QRectF r = nav_target;
double vw = viewport()->width(), vh = viewport()->height();
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
double cx = double(e->position().x()) / vw, cy = double(e->position().y()) / vh;
#else
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
double cx = double(e->pos().x()) / vw, cy = double(e->pos().y()) / vh;
#else
double cx = double(e->position().x()) / vw, cy = double(e->position().y()) / vh;
#endif
double pw = r.width(), ph = r.height();
r.setWidth(r.width() * scl);
@@ -692,7 +684,7 @@ void BlockView::wheelEvent(QWheelEvent * e) {
void BlockView::mousePressEvent(QMouseEvent * event) {
press_point = event->pos();
if (event->buttons().testFlag(Qt::MidButton) || event->buttons().testFlag(Qt::RightButton)) {
if (event->buttons().testFlag(QT_MID_BUTTON) || event->buttons().testFlag(Qt::RightButton)) {
setCursor(Qt::ClosedHandCursor);
//sel_rect.hide();
if (sel_rect.scene())
@@ -723,7 +715,7 @@ void BlockView::scrolled() {
void BlockView::mouseMoveEvent(QMouseEvent * event) {
if (!event) return;
if (navigation) {
if (event->buttons().testFlag(Qt::MidButton) || event->buttons().testFlag(Qt::RightButton)) {
if (event->buttons().testFlag(QT_MID_BUTTON) || event->buttons().testFlag(Qt::RightButton)) {
QPoint dp = (press_point - event->pos());
horizontalScrollBar()->setValue(horizontalScrollBar()->value() + dp.x());
verticalScrollBar()->setValue(verticalScrollBar()->value() + dp.y());
@@ -740,7 +732,7 @@ void BlockView::mouseMoveEvent(QMouseEvent * event) {
void BlockView::mouseDoubleClickEvent(QMouseEvent * event) {
if (event->buttons().testFlag(Qt::MidButton) || event->buttons().testFlag(Qt::RightButton)) {
if (event->buttons().testFlag(QT_MID_BUTTON) || event->buttons().testFlag(Qt::RightButton)) {
fitInView();
return;
}