What "C/C++ type" ( int, char,QStringe etc ...? ) is "pos()"?
-
This post is deleted!
-
This post is deleted!
@AnneRanch said in What "type" is "pos()"?:
event->pos();
Of what type is event and what Qt version do you use? If you know the type of event and your Qt version you can search the Qt documentation for it.
-
@AnneRanch said in What "type" is "pos()"?:
event->pos();
Of what type is event and what Qt version do you use? If you know the type of event and your Qt version you can search the Qt documentation for it.
This post is deleted! -
Hi @AnneRanch,
As @Christian-Ehrlicher replied, it depends on what type
eventis, and the version of Qt.Given you're naming the result
dragStartPosition, I'm guessingeventis either derived fromQPointerEvent,QMouseEvent, orQDropEvent(includingQDragEnterEvent). For all of those,*::pos()returnsQPointon Qt5, but in Qt6 the function is*::position()instead, and returnsQPointF. ie#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) const QPoint dragStartPosition = event->pos(); #else const QPointF dragStartPosition = event->position(); #endifTo be any more specific than that, you'll need to tell use what type
eventis, and the Qt version.Cheers.
PS You could also use
auto.