# Qt-fortran questions

> Source: <https://fortran-lang.discourse.group/t/qt-fortran-questions/11300#post_2>
> Published: 2026-11-13 01:11:46+00:00

I just had Claude add it:

Run `pixi run example geometry` to see an example:

Overloads are listed by the name you call: for example, `painter%drawLine(p1, p2)`.

`use qt`)
All have public components, structure constructors and Qt’s methods.

`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` | 

`QPointF_dotProduct`, `QLineF_fromPolar`` QLineF_NoIntersection`, `QLineF_BoundedIntersection`, `QLineF_UnboundedIntersection`, `Qt_IgnoreAspectRatio`, `Qt_KeepAspectRatio`, `Qt_KeepAspectRatioByExpanding``+` and `-` (including unary minus) for points, sizes and margins; `rect + margins` and `rect - margins``*` and `/` by a number; for the integer types `==` and `/=`` 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` | 

`QVector2D_dotProduct`, `QVector3D_dotProduct`, `QVector3D_crossProduct`, `QVector3D_normal(v1, v2)` or `QVector3D_normal(v1, v2, v3)`, `QVector4D_dotProduct`` QQuaternion_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`` QVector3D` (rotates the vector)`QMatrix4x4` additions`translate(QVector3D)`, `scale(QVector3D)`, `rotate(angle, QVector3D)`, `rotate(QQuaternion)`, `lookAt(eye, center, up)` with `map(QVector3D)` and `map(QVector4D)`` mapVector(v(3) or QVector3D)` is new: it applies the 3x3 part only, with no translation`matrix * QVector4D`, `matrix * QVector3D`` QVector3D_project(obj, modelView, projection, viewport)` and `QVector3D_unproject(win, modelView, projection, viewport)`
**`QWidget`**, inherited by every widget:

`pos() → QPoint`, `size() → QSize`` geometry()`, `frameGeometry()`, `rect()`, `contentsRect() → QRect`` sizeHint()`, `minimumSize()`, `maximumSize() → QSize`` contentsMargins() → QMargins``setGeometry(QRect)`` move(QPoint)`, `resize(QSize)`, `setMinimumSize(QSize)`, `setMaximumSize(QSize)`, `setFixedSize(QSize)`, `setContentsMargins(QMargins)`` mapToGlobal`, `mapFromGlobal`, `mapToParent`, `mapFromParent` (all `QPoint → 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)` and `drawLine(QLineF)`` drawRect(QRectF)``drawEllipse(QRectF)` and `drawEllipse(center, rx, ry)`` drawText(QPointF, text)` and `drawText(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`:

`position() → QPoint`, `setPosition(QPoint)`` geometry() → QRect`, `mapToGlobal(QPoint)`, `mapFromGlobal(QPoint)`
`QScreen`:` geometry()`, `availableGeometry() → QRect`; `size() → QSize`; `physicalSize() → QSizeF`

`QDrag`:` setHotSpot(QPoint)`

**Events:**

`QMouseEvent`: `position()`, `globalPosition() → QPointF`` QWheelEvent`: `position() → QPointF`, `angleDelta()`, `pixelDelta() → QPoint`` QResizeEvent`: `size()`, `oldSize() → QSize`` QContextMenuEvent`: `pos()`, `globalPos() → QPoint`` QDropEvent`: `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.
