QVector4D,QVector3D, QPoint are not exposed in qt-fortran.
I just had Claude add it:
Run pixi run example geometry to see an example:
New API from the geometry updates
Overloads are listed by the name you call: for example, painter%drawLine(p1, p2).
New value types (pure Fortran, use qt)
All have public components, structure constructors and Qt’s methods.
Integer and floating-point 2D (qt_geometry)
| Type | Components | Extra constructors | Methods |
|---|---|---|---|
QPoint |
x, y |
isNull, manhattanLength, transposed, toPointF |
|
QPointF |
x, y |
QPointF(QPoint) |
isNull, manhattanLength, transposed, toPoint |
QSize |
width, height |
isNull, isEmpty, isValid, transposed, expandedTo, boundedTo, scaled(size [, mode]), grownBy, shrunkBy, toSizeF |
|
QSizeF |
width, height |
QSizeF(QSize) |
isNull, isEmpty, isValid, transposed, expandedTo, boundedTo, scaled, toSize |
QMargins |
left, top, right, bottom |
isNull |
|
QRect |
x, y, width, height |
QRect(topLeft, size), QRect(topLeft, bottomRight) |
left, top, right, bottom, topLeft, topRight, bottomLeft, bottomRight, center, size, isNull, isEmpty, isValid, normalized, contains(point or rect [, proper]), intersects, intersected, united, translated(dx, dy or point), adjusted, marginsAdded, marginsRemoved, moveTo, moveCenter, toRectF |
QRectF |
x, y, width, height |
QRectF(topLeft, size), QRectF(topLeft, bottomRight), QRectF(QRect) |
same as QRect without the margins methods, plus toRect and toAlignedRect |
QLineF |
x1, y1, x2, y2 |
QLineF(p1, p2) |
p1, p2, dx, dy, isNull, length, setLength, angle, setAngle, angleTo, center, pointAt, unitVector, normalVector, intersects(line [, point]), translated |
- Free functions:
QPointF_dotProduct,QLineF_fromPolar - Constants:
QLineF_NoIntersection,QLineF_BoundedIntersection,QLineF_UnboundedIntersection,Qt_IgnoreAspectRatio,Qt_KeepAspectRatio,Qt_KeepAspectRatioByExpanding - Operators:
+and-(including unary minus) for points, sizes and margins;rect + marginsandrect - margins*and/by a number; for the integer types*also takes an integer, and results are rounded as Qt does==and/=
Vectors and quaternions (qt_vectors)
| Type | Components | Extra constructors | Methods |
|---|---|---|---|
QVector2D |
x, y |
QVector2D(array), QVector2D(QPoint), QVector2D(QPointF) |
isNull, length, lengthSquared, normalized, normalize, distanceToPoint, distanceToLine, toVector3D([z]), toVector4D, toPoint, toPointF, toArray |
QVector3D |
x, y, z |
QVector3D(array), QVector3D(vector2d [, z]) |
same as QVector2D, plus distanceToPlane(point, normal) or distanceToPlane(p1, p2, p3), toVector2D, toVector4D([w]) |
QVector4D |
x, y, z, w |
QVector4D(array), QVector4D(vector3d [, w]), QVector4D(vector2d [, z, w]) |
isNull, length, lengthSquared, normalized, normalize, toVector2D, toVector2DAffine, toVector3D, toVector3DAffine, toPoint, toPointF, toArray |
QQuaternion |
scalar, x, y, z (identity by default) |
QQuaternion(scalar, vector3d), QQuaternion(vector4d) |
isNull, isIdentity, vector, length, lengthSquared, normalized, normalize, conjugated, inverted, rotatedVector, getAxisAndAngle, toEulerAngles, toRotationMatrix, toVector4D |
- Free functions:
QVector2D_dotProduct,QVector3D_dotProduct,QVector3D_crossProduct,QVector3D_normal(v1, v2)orQVector3D_normal(v1, v2, v3),QVector4D_dotProductQQuaternion_dotProduct,QQuaternion_fromAxisAndAngle(axis, angle)or(x, y, z, angle),QQuaternion_fromEulerAngles(pitch, yaw, roll)or(vector3d)QQuaternion_fromRotationMatrix,QQuaternion_fromAxes,QQuaternion_fromDirection,QQuaternion_rotationTo,QQuaternion_slerp,QQuaternion_nlerp
- Operators:
+and-*and/by a number, or component-wise with another vector- quaternion
*quaternion (composes rotations), and quaternion*QVector3D(rotates the vector) ==and/=(to within a relative 1e-12)
QMatrix4x4 additions
- New overloads:
translate(QVector3D),scale(QVector3D),rotate(angle, QVector3D),rotate(QQuaternion),lookAt(eye, center, up)withQVector3Ds map(QVector3D)andmap(QVector4D)mapVector(v(3) or QVector3D)is new: it applies the 3x3 part only, with no translation- Operators:
matrix * QVector4D,matrix * QVector3D - Free functions:
QVector3D_project(obj, modelView, projection, viewport)andQVector3D_unproject(win, modelView, projection, viewport)
New methods on existing classes
QWidget, inherited by every widget:
- Getters:
pos() → QPoint,size() → QSizegeometry(),frameGeometry(),rect(),contentsRect() → QRectsizeHint(),minimumSize(),maximumSize() → QSizecontentsMargins() → QMargins
- New setter:
setGeometry(QRect) - New overloads of existing setters:
move(QPoint),resize(QSize),setMinimumSize(QSize),setMaximumSize(QSize),setFixedSize(QSize),setContentsMargins(QMargins) - Mapping:
mapToGlobal,mapFromGlobal,mapToParent,mapFromParent(allQPoint → QPoint);mapTo(ancestor, QPoint),mapFrom(ancestor, QPoint) childAt(QPoint) → QWidget
QLayout: contentsMargins() → QMargins, setContentsMargins(QMargins)
QMenu: popup(QPoint), exec(QPoint) → QAction
QtfPaintCell: rect() → QRect
QPainter:
drawPoint(QPointF)drawLine(p1, p2)anddrawLine(QLineF)drawRect(QRectF)drawEllipse(QRectF)anddrawEllipse(center, rx, ry)drawText(QPointF, text)anddrawText(QRectF, flags, text)fillRect(QRectF, color),setClipRect(QRectF)
QPainterPath:
moveTo(QPointF),lineTo(QPointF),addRect(QRectF),addEllipse(QRectF),containsPoint(QPointF)currentPosition() → QPointF,pointAtPercent(t) → QPointF,boundingRect() → QRectF
QTransform: map(QPointF) → QPointF, mapRect(QRectF) → QRectF
QFontMetrics: boundingRect(text) → QRect, size(flags, text) → QSize
QImage, QPixmap: size() → QSize
QWindow:
size() → QSize,resize(QSize)position() → QPoint,setPosition(QPoint)geometry() → QRect,setGeometry(QRect)mapToGlobal(QPoint),mapFromGlobal(QPoint)
QScreen: geometry(), availableGeometry() → QRect; size() → QSize; physicalSize() → QSizeF
QDrag: setHotSpot(QPoint)
Events:
QMouseEvent:position(),globalPosition() → QPointFQWheelEvent:position() → QPointF,angleDelta(),pixelDelta() → QPointQResizeEvent:size(),oldSize() → QSizeQContextMenuEvent:pos(),globalPos() → QPointQDropEvent:position() → QPointF
QOpenGLShaderProgram: setUniformValue(name, x, y) (vec2), and setUniformValue(name, QVector2D, QVector3D or QVector4D)
Free function: QCursor_pos() → QPoint
All the existing scalar versions (move(x, y), drawLine(x1, y1, x2, y2), mapX/mapY, and so on) are unchanged.
