diff --git a/sample/CustomFrame-Dynamic/customwindow/qcustomtitlebar.h b/sample/CustomFrame-Dynamic/customwindow/qcustomtitlebar.h index ee95763..b34260f 100644 --- a/sample/CustomFrame-Dynamic/customwindow/qcustomtitlebar.h +++ b/sample/CustomFrame-Dynamic/customwindow/qcustomtitlebar.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -30,9 +30,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -40,6 +42,19 @@ #include #include +#ifndef EV_GLOBAL_MACRO + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + #define EV_GLOBAL_X(event) event->globalX() + #define EV_GLOBAL_Y(event) event->globalY() + #define EV_GLOBAL_POS(event) event->globalPos() + #else + #define EV_GLOBAL_X(event) event->globalPosition().toPoint().x() + #define EV_GLOBAL_Y(event) event->globalPosition().toPoint().y() + #define EV_GLOBAL_POS(event) event->globalPosition().toPoint() + #endif + #define EV_GLOBAL_MACRO +#endif + namespace QCustomAttrs { enum WindowButton { Minimize = 0x01, diff --git a/sample/CustomFrame-Dynamic/customwindow/qcustomwindow.h b/sample/CustomFrame-Dynamic/customwindow/qcustomwindow.h index a111112..777d797 100644 --- a/sample/CustomFrame-Dynamic/customwindow/qcustomwindow.h +++ b/sample/CustomFrame-Dynamic/customwindow/qcustomwindow.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 4 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/sample/CustomFrame-Static/customwindow/qcustomtitlebar.cpp b/sample/CustomFrame-Static/customwindow/qcustomtitlebar.cpp index a6e3b85..64a8ec8 100644 --- a/sample/CustomFrame-Static/customwindow/qcustomtitlebar.cpp +++ b/sample/CustomFrame-Static/customwindow/qcustomtitlebar.cpp @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -118,12 +118,12 @@ void QCustomTitleBar::setWindowButtonEnabled(QCustomAttrs::WindowButton btn, boo } void QCustomTitleBar::mouseMoveEvent(QMouseEvent *event){ - if (event->buttons() & Qt::LeftButton) emit changeWindowPositionRequest(event->globalPos()); + if (event->buttons() & Qt::LeftButton) emit changeWindowPositionRequest(EV_GLOBAL_POS(event)); QWidget::mouseMoveEvent(event); } void QCustomTitleBar::mousePressEvent(QMouseEvent *event){ - if (event->button() & Qt::LeftButton) emit startWindowMoveRequest(event->globalPos()); + if (event->button() & Qt::LeftButton) emit startWindowMoveRequest(EV_GLOBAL_POS(event)); QWidget::mousePressEvent(event); } diff --git a/sample/CustomFrame-Static/customwindow/qcustomtitlebar.h b/sample/CustomFrame-Static/customwindow/qcustomtitlebar.h index 6fd2c42..b9540ff 100644 --- a/sample/CustomFrame-Static/customwindow/qcustomtitlebar.h +++ b/sample/CustomFrame-Static/customwindow/qcustomtitlebar.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -22,9 +22,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -32,6 +34,19 @@ #include #include +#ifndef EV_GLOBAL_MACRO + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + #define EV_GLOBAL_X(event) event->globalX() + #define EV_GLOBAL_Y(event) event->globalY() + #define EV_GLOBAL_POS(event) event->globalPos() + #else + #define EV_GLOBAL_X(event) event->globalPosition().toPoint().x() + #define EV_GLOBAL_Y(event) event->globalPosition().toPoint().y() + #define EV_GLOBAL_POS(event) event->globalPosition().toPoint() + #endif + #define EV_GLOBAL_MACRO +#endif + namespace QCustomAttrs { enum WindowButton { Minimize = 0x01, diff --git a/sample/CustomFrame-Static/customwindow/qcustomwindow.cpp b/sample/CustomFrame-Static/customwindow/qcustomwindow.cpp index f72149a..71cafc6 100644 --- a/sample/CustomFrame-Static/customwindow/qcustomwindow.cpp +++ b/sample/CustomFrame-Static/customwindow/qcustomwindow.cpp @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -118,7 +118,7 @@ bool QCustomWindow::eventFilter(QObject *, QEvent *event){ case QEvent::MouseMove: if (this->cOpStatus & OperationType::CUSTOM_RESIZE) customMouseMoveEvent(static_cast(event)); - else if (!this->isMoving()) redefineCursor(static_cast(event)->globalPos()); + else if (!this->isMoving()) redefineCursor(EV_GLOBAL_POS(static_cast(event))); break; default: break; } @@ -126,12 +126,12 @@ bool QCustomWindow::eventFilter(QObject *, QEvent *event){ } void QCustomWindow::mousePressEvent(QMouseEvent *event){ - this->redefineCursor(event->globalPos()); + this->redefineCursor(EV_GLOBAL_POS(event)); if (event->button() & Qt::LeftButton && this->mLock){ if (!this->forceCustomResize && this->windowHandle()->startSystemResize(this->mLock)) this->cOpStatus = OperationType::SYSTEM_RESIZE; else { - QPoint posCursor = event->globalPos(); + QPoint posCursor = EV_GLOBAL_POS(event); if (this->mLock & Qt::TopEdge) posCursor.ry() -= this->y(); if (this->mLock & Qt::LeftEdge) posCursor.rx() -= this->x(); if (this->mLock & Qt::RightEdge) posCursor.rx() -= (this->x() + this->width()); @@ -144,12 +144,12 @@ void QCustomWindow::mousePressEvent(QMouseEvent *event){ void QCustomWindow::mouseReleaseEvent(QMouseEvent *event){ this->cOpStatus = OperationType::NONE; - this->redefineCursor(event->globalPos()); + this->redefineCursor(EV_GLOBAL_POS(event)); QWidget::mouseReleaseEvent(event); } void QCustomWindow::customMouseMoveEvent(QMouseEvent *event){ - int gX = event->globalX(), gY = event->globalY(); + int gX = EV_GLOBAL_X(event), gY = EV_GLOBAL_Y(event); QPoint tL = this->geometry().topLeft(), bR = this->geometry().bottomRight(); bool cRH = bR.x() - tL.x() > this->minimumWidth(); diff --git a/sample/CustomFrame-Static/customwindow/qcustomwindow.h b/sample/CustomFrame-Static/customwindow/qcustomwindow.h index a59c583..0ba591f 100644 --- a/sample/CustomFrame-Static/customwindow/qcustomwindow.h +++ b/sample/CustomFrame-Static/customwindow/qcustomwindow.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 30 of August of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include diff --git a/src/QCustomWindow-Dynamic/qcustomtitlebar.cpp b/src/QCustomWindow-Dynamic/qcustomtitlebar.cpp index a6e3b85..64a8ec8 100644 --- a/src/QCustomWindow-Dynamic/qcustomtitlebar.cpp +++ b/src/QCustomWindow-Dynamic/qcustomtitlebar.cpp @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -118,12 +118,12 @@ void QCustomTitleBar::setWindowButtonEnabled(QCustomAttrs::WindowButton btn, boo } void QCustomTitleBar::mouseMoveEvent(QMouseEvent *event){ - if (event->buttons() & Qt::LeftButton) emit changeWindowPositionRequest(event->globalPos()); + if (event->buttons() & Qt::LeftButton) emit changeWindowPositionRequest(EV_GLOBAL_POS(event)); QWidget::mouseMoveEvent(event); } void QCustomTitleBar::mousePressEvent(QMouseEvent *event){ - if (event->button() & Qt::LeftButton) emit startWindowMoveRequest(event->globalPos()); + if (event->button() & Qt::LeftButton) emit startWindowMoveRequest(EV_GLOBAL_POS(event)); QWidget::mousePressEvent(event); } diff --git a/src/QCustomWindow-Dynamic/qcustomtitlebar.h b/src/QCustomWindow-Dynamic/qcustomtitlebar.h index ee95763..b34260f 100644 --- a/src/QCustomWindow-Dynamic/qcustomtitlebar.h +++ b/src/QCustomWindow-Dynamic/qcustomtitlebar.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -30,9 +30,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -40,6 +42,19 @@ #include #include +#ifndef EV_GLOBAL_MACRO + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + #define EV_GLOBAL_X(event) event->globalX() + #define EV_GLOBAL_Y(event) event->globalY() + #define EV_GLOBAL_POS(event) event->globalPos() + #else + #define EV_GLOBAL_X(event) event->globalPosition().toPoint().x() + #define EV_GLOBAL_Y(event) event->globalPosition().toPoint().y() + #define EV_GLOBAL_POS(event) event->globalPosition().toPoint() + #endif + #define EV_GLOBAL_MACRO +#endif + namespace QCustomAttrs { enum WindowButton { Minimize = 0x01, diff --git a/src/QCustomWindow-Dynamic/qcustomwindow.cpp b/src/QCustomWindow-Dynamic/qcustomwindow.cpp index f72149a..71cafc6 100644 --- a/src/QCustomWindow-Dynamic/qcustomwindow.cpp +++ b/src/QCustomWindow-Dynamic/qcustomwindow.cpp @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -118,7 +118,7 @@ bool QCustomWindow::eventFilter(QObject *, QEvent *event){ case QEvent::MouseMove: if (this->cOpStatus & OperationType::CUSTOM_RESIZE) customMouseMoveEvent(static_cast(event)); - else if (!this->isMoving()) redefineCursor(static_cast(event)->globalPos()); + else if (!this->isMoving()) redefineCursor(EV_GLOBAL_POS(static_cast(event))); break; default: break; } @@ -126,12 +126,12 @@ bool QCustomWindow::eventFilter(QObject *, QEvent *event){ } void QCustomWindow::mousePressEvent(QMouseEvent *event){ - this->redefineCursor(event->globalPos()); + this->redefineCursor(EV_GLOBAL_POS(event)); if (event->button() & Qt::LeftButton && this->mLock){ if (!this->forceCustomResize && this->windowHandle()->startSystemResize(this->mLock)) this->cOpStatus = OperationType::SYSTEM_RESIZE; else { - QPoint posCursor = event->globalPos(); + QPoint posCursor = EV_GLOBAL_POS(event); if (this->mLock & Qt::TopEdge) posCursor.ry() -= this->y(); if (this->mLock & Qt::LeftEdge) posCursor.rx() -= this->x(); if (this->mLock & Qt::RightEdge) posCursor.rx() -= (this->x() + this->width()); @@ -144,12 +144,12 @@ void QCustomWindow::mousePressEvent(QMouseEvent *event){ void QCustomWindow::mouseReleaseEvent(QMouseEvent *event){ this->cOpStatus = OperationType::NONE; - this->redefineCursor(event->globalPos()); + this->redefineCursor(EV_GLOBAL_POS(event)); QWidget::mouseReleaseEvent(event); } void QCustomWindow::customMouseMoveEvent(QMouseEvent *event){ - int gX = event->globalX(), gY = event->globalY(); + int gX = EV_GLOBAL_X(event), gY = EV_GLOBAL_Y(event); QPoint tL = this->geometry().topLeft(), bR = this->geometry().bottomRight(); bool cRH = bR.x() - tL.x() > this->minimumWidth(); diff --git a/src/QCustomWindow-Dynamic/qcustomwindow.h b/src/QCustomWindow-Dynamic/qcustomwindow.h index a111112..777d797 100644 --- a/src/QCustomWindow-Dynamic/qcustomwindow.h +++ b/src/QCustomWindow-Dynamic/qcustomwindow.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 4 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -37,6 +38,7 @@ #include #include #include +#include #include #include #include diff --git a/src/QCustomWindow-Static/qcustomtitlebar.cpp b/src/QCustomWindow-Static/qcustomtitlebar.cpp index a6e3b85..64a8ec8 100644 --- a/src/QCustomWindow-Static/qcustomtitlebar.cpp +++ b/src/QCustomWindow-Static/qcustomtitlebar.cpp @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -118,12 +118,12 @@ void QCustomTitleBar::setWindowButtonEnabled(QCustomAttrs::WindowButton btn, boo } void QCustomTitleBar::mouseMoveEvent(QMouseEvent *event){ - if (event->buttons() & Qt::LeftButton) emit changeWindowPositionRequest(event->globalPos()); + if (event->buttons() & Qt::LeftButton) emit changeWindowPositionRequest(EV_GLOBAL_POS(event)); QWidget::mouseMoveEvent(event); } void QCustomTitleBar::mousePressEvent(QMouseEvent *event){ - if (event->button() & Qt::LeftButton) emit startWindowMoveRequest(event->globalPos()); + if (event->button() & Qt::LeftButton) emit startWindowMoveRequest(EV_GLOBAL_POS(event)); QWidget::mousePressEvent(event); } diff --git a/src/QCustomWindow-Static/qcustomtitlebar.h b/src/QCustomWindow-Static/qcustomtitlebar.h index 6fd2c42..b9540ff 100644 --- a/src/QCustomWindow-Static/qcustomtitlebar.h +++ b/src/QCustomWindow-Static/qcustomtitlebar.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -22,9 +22,11 @@ #include #include #include +#include #include #include #include +#include #include #include #include @@ -32,6 +34,19 @@ #include #include +#ifndef EV_GLOBAL_MACRO + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + #define EV_GLOBAL_X(event) event->globalX() + #define EV_GLOBAL_Y(event) event->globalY() + #define EV_GLOBAL_POS(event) event->globalPos() + #else + #define EV_GLOBAL_X(event) event->globalPosition().toPoint().x() + #define EV_GLOBAL_Y(event) event->globalPosition().toPoint().y() + #define EV_GLOBAL_POS(event) event->globalPosition().toPoint() + #endif + #define EV_GLOBAL_MACRO +#endif + namespace QCustomAttrs { enum WindowButton { Minimize = 0x01, diff --git a/src/QCustomWindow-Static/qcustomwindow.cpp b/src/QCustomWindow-Static/qcustomwindow.cpp index f72149a..71cafc6 100644 --- a/src/QCustomWindow-Static/qcustomwindow.cpp +++ b/src/QCustomWindow-Static/qcustomwindow.cpp @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 5 of September of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -118,7 +118,7 @@ bool QCustomWindow::eventFilter(QObject *, QEvent *event){ case QEvent::MouseMove: if (this->cOpStatus & OperationType::CUSTOM_RESIZE) customMouseMoveEvent(static_cast(event)); - else if (!this->isMoving()) redefineCursor(static_cast(event)->globalPos()); + else if (!this->isMoving()) redefineCursor(EV_GLOBAL_POS(static_cast(event))); break; default: break; } @@ -126,12 +126,12 @@ bool QCustomWindow::eventFilter(QObject *, QEvent *event){ } void QCustomWindow::mousePressEvent(QMouseEvent *event){ - this->redefineCursor(event->globalPos()); + this->redefineCursor(EV_GLOBAL_POS(event)); if (event->button() & Qt::LeftButton && this->mLock){ if (!this->forceCustomResize && this->windowHandle()->startSystemResize(this->mLock)) this->cOpStatus = OperationType::SYSTEM_RESIZE; else { - QPoint posCursor = event->globalPos(); + QPoint posCursor = EV_GLOBAL_POS(event); if (this->mLock & Qt::TopEdge) posCursor.ry() -= this->y(); if (this->mLock & Qt::LeftEdge) posCursor.rx() -= this->x(); if (this->mLock & Qt::RightEdge) posCursor.rx() -= (this->x() + this->width()); @@ -144,12 +144,12 @@ void QCustomWindow::mousePressEvent(QMouseEvent *event){ void QCustomWindow::mouseReleaseEvent(QMouseEvent *event){ this->cOpStatus = OperationType::NONE; - this->redefineCursor(event->globalPos()); + this->redefineCursor(EV_GLOBAL_POS(event)); QWidget::mouseReleaseEvent(event); } void QCustomWindow::customMouseMoveEvent(QMouseEvent *event){ - int gX = event->globalX(), gY = event->globalY(); + int gX = EV_GLOBAL_X(event), gY = EV_GLOBAL_Y(event); QPoint tL = this->geometry().topLeft(), bR = this->geometry().bottomRight(); bool cRH = bR.x() - tL.x() > this->minimumWidth(); diff --git a/src/QCustomWindow-Static/qcustomwindow.h b/src/QCustomWindow-Static/qcustomwindow.h index a59c583..0ba591f 100644 --- a/src/QCustomWindow-Static/qcustomwindow.h +++ b/src/QCustomWindow-Static/qcustomwindow.h @@ -4,7 +4,7 @@ # Developer: Mauro Mascarenhas de Araújo # Contact: mauro.mascarenhas@nintersoft.com # Licence: Mozilla Public Licence 2.0 -# Date: 30 of August of 2021 +# Date: 31 of October of 2021 # # Licence notice # @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -29,6 +30,7 @@ #include #include #include +#include #include #include #include