1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Qt6 Port position related functions

GIT_SILENT

Signed-off-by: Juraj Oravec <jurajoravec@mailo.com>
This commit is contained in:
Juraj Oravec 2023-12-17 02:09:35 +01:00
parent 01e1fa61b4
commit e7d9ecaa3a
Signed by: SGOrava
GPG Key ID: 13660A3F1D9F093B
9 changed files with 32 additions and 32 deletions

View File

@ -304,9 +304,9 @@ void BookmarksToolbar::dragEnterEvent(QDragEnterEvent* e)
void BookmarksToolbar::dragMoveEvent(QDragMoveEvent *e)
{
int eventX = e->pos().x();
BookmarksToolbarButton* button = buttonAt(e->pos());
m_dropPos = e->pos();
int eventX = e->position().toPoint().x();
BookmarksToolbarButton* button = buttonAt(e->position().toPoint());
m_dropPos = e->position().toPoint();
m_dropRow = m_layout->indexOf(button);
if (button) {
bool res = eventX - button->x() < button->x() + button->width() -eventX;

View File

@ -63,7 +63,7 @@ void DesktopNotification::mousePressEvent(QMouseEvent* e)
}
if (e->buttons() == Qt::LeftButton) {
m_dragPosition = e->globalPos() - frameGeometry().topLeft();
m_dragPosition = e->globalPosition().toPoint() - frameGeometry().topLeft();
e->accept();
}
}
@ -71,7 +71,7 @@ void DesktopNotification::mousePressEvent(QMouseEvent* e)
void DesktopNotification::mouseMoveEvent(QMouseEvent* e)
{
if (e->buttons() & Qt::LeftButton) {
move(e->globalPos() - m_dragPosition);
move(e->globalPosition().toPoint() - m_dragPosition);
e->accept();
}
}

View File

@ -45,7 +45,7 @@ QPoint QmlMouseEvent::globalPos() const
if (!m_mouseEvent) {
return QPoint(-1, -1);
}
return m_mouseEvent->globalPos();
return m_mouseEvent->globalPosition().toPoint();
}
int QmlMouseEvent::globalX() const
@ -53,7 +53,7 @@ int QmlMouseEvent::globalX() const
if (!m_mouseEvent) {
return -1;
}
return m_mouseEvent->globalX();
return m_mouseEvent->globalPosition().toPoint().x();
}
int QmlMouseEvent::globalY() const
@ -61,7 +61,7 @@ int QmlMouseEvent::globalY() const
if (!m_mouseEvent) {
return -1;
}
return m_mouseEvent->globalY();
return m_mouseEvent->globalPosition().toPoint().y();
}
QPointF QmlMouseEvent::localPos() const
@ -69,7 +69,7 @@ QPointF QmlMouseEvent::localPos() const
if (!m_mouseEvent) {
return QPointF(-1, -1);
}
return m_mouseEvent->localPos();
return m_mouseEvent->position();
}
QPoint QmlMouseEvent::pos() const
@ -85,7 +85,7 @@ QPointF QmlMouseEvent::screenPos() const
if (!m_mouseEvent) {
return QPointF(-1, -1);
}
return m_mouseEvent->screenPos();
return m_mouseEvent->globalPosition();
}
int QmlMouseEvent::source() const
@ -101,7 +101,7 @@ QPointF QmlMouseEvent::windowPos() const
if (!m_mouseEvent) {
return QPointF(-1, -1);
}
return m_mouseEvent->windowPos();
return m_mouseEvent->scenePosition();
}
int QmlMouseEvent::x() const
@ -109,7 +109,7 @@ int QmlMouseEvent::x() const
if (!m_mouseEvent) {
return -1;
}
return m_mouseEvent->x();
return m_mouseEvent->position().toPoint().x();
}
int QmlMouseEvent::y() const
@ -117,7 +117,7 @@ int QmlMouseEvent::y() const
if (!m_mouseEvent) {
return -1;
}
return m_mouseEvent->y();
return m_mouseEvent->position().toPoint().y();
}
void QmlMouseEvent::clear()

View File

@ -641,7 +641,7 @@ void TabBar::dragEnterEvent(QDragEnterEvent* event)
void TabBar::dragMoveEvent(QDragMoveEvent *event)
{
const int index = tabAt(event->pos());
const int index = tabAt(event->position().toPoint());
const QMimeData* mime = event->mimeData();
if (index == -1) {
@ -649,7 +649,7 @@ void TabBar::dragMoveEvent(QDragMoveEvent *event)
return;
}
switch (tabDropAction(event->pos(), tabRect(index), !mime->hasFormat(MIMETYPE))) {
switch (tabDropAction(event->position().toPoint(), tabRect(index), !mime->hasFormat(MIMETYPE))) {
case PrependTab:
showDropIndicator(index, BeforeTab);
break;
@ -684,7 +684,7 @@ void TabBar::dropEvent(QDropEvent* event)
auto *sourceTabBar = qobject_cast<TabBar*>(event->source());
int index = tabAt(event->pos());
int index = tabAt(event->position().toPoint());
if (index == -1) {
if (mime->hasUrls()) {
const auto urls = mime->urls();
@ -704,7 +704,7 @@ void TabBar::dropEvent(QDropEvent* event)
} else {
LoadRequest req;
WebTab* tab = m_tabWidget->webTab(index);
TabDropAction action = tabDropAction(event->pos(), tabRect(index), !mime->hasFormat(MIMETYPE));
TabDropAction action = tabDropAction(event->position().toPoint(), tabRect(index), !mime->hasFormat(MIMETYPE));
if (mime->hasUrls()) {
req = mime->urls().at(0);
} else if (mime->hasText()) {

View File

@ -70,14 +70,14 @@ void ClickableLabel::mouseReleaseEvent(QMouseEvent* ev)
{
if (ev->button() == Qt::LeftButton && rect().contains(ev->pos())) {
if (ev->modifiers() == Qt::ControlModifier) {
Q_EMIT middleClicked(ev->globalPos());
Q_EMIT middleClicked(ev->globalPosition().toPoint());
}
else {
Q_EMIT clicked(ev->globalPos());
Q_EMIT clicked(ev->globalPosition().toPoint());
}
}
else if (ev->button() == Qt::MiddleButton && rect().contains(ev->pos())) {
Q_EMIT middleClicked(ev->globalPos());
Q_EMIT middleClicked(ev->globalPosition().toPoint());
}
else {
QLabel::mouseReleaseEvent(ev);

View File

@ -1136,7 +1136,7 @@ void WebView::_mouseReleaseEvent(QMouseEvent *event)
case Qt::RightButton:
if (s_forceContextMenuOnMouseRelease) {
QContextMenuEvent ev(QContextMenuEvent::Mouse, event->pos(), event->globalPos(), event->modifiers());
QContextMenuEvent ev(QContextMenuEvent::Mouse, event->pos(), event->globalPosition().toPoint(), event->modifiers());
_contextMenuEvent(&ev);
event->accept();
}

View File

@ -212,7 +212,7 @@ void TabbedWebView::_mouseMoveEvent(QMouseEvent *event)
if (m_window->fullScreenNavigationVisible()) {
m_window->hideNavigationWithFullScreen();
}
else if (event->y() < 5) {
else if (event->position().toPoint().y() < 5) {
m_window->showNavigationWithFullScreen();
}
}

View File

@ -110,17 +110,17 @@ bool AutoScroller::mouseMove(QObject* obj, QMouseEvent* event)
int xlength = 0;
int ylength = 0;
if (rect.left() > event->globalPos().x()) {
xlength = event->globalPos().x() - rect.left();
if (rect.left() > event->globalPosition().toPoint().x()) {
xlength = event->globalPosition().toPoint().x() - rect.left();
}
else if (rect.right() < event->globalPos().x()) {
xlength = event->globalPos().x() - rect.right();
else if (rect.right() < event->globalPosition().toPoint().x()) {
xlength = event->globalPosition().toPoint().x() - rect.right();
}
if (rect.top() > event->globalPos().y()) {
ylength = event->globalPos().y() - rect.top();
if (rect.top() > event->globalPosition().toPoint().y()) {
ylength = event->globalPosition().toPoint().y() - rect.top();
}
else if (rect.bottom() < event->globalPos().y()) {
ylength = event->globalPos().y() - rect.bottom();
else if (rect.bottom() < event->globalPosition().toPoint().y()) {
ylength = event->globalPosition().toPoint().y() - rect.bottom();
}
m_frameScroller->startScrolling(xlength, ylength);
@ -157,7 +157,7 @@ bool AutoScroller::mouseRelease(QObject* obj, QMouseEvent* event)
Q_UNUSED(obj)
if (m_indicator->isVisible()) {
if (!indicatorGlobalRect().contains(event->globalPos())) {
if (!indicatorGlobalRect().contains(event->globalPosition().toPoint())) {
stopScrolling();
}
return true;

View File

@ -294,7 +294,7 @@ bool TabTreeView::viewportEvent(QEvent *event)
case QEvent::HoverMove: {
auto *he = static_cast<QHoverEvent*>(event);
updateIndex(m_hoveredIndex);
m_hoveredIndex = indexAt(he->pos());
m_hoveredIndex = indexAt(he->position().toPoint());
updateIndex(m_hoveredIndex);
break;
}