{"slug": "qt-fortran-questions", "title": "Qt-fortran questions", "summary": "A developer used Anthropic's Claude to generate Qt-fortran, a Fortran binding to Qt's geometry and vector types, runnable via `pixi run example geometry`. The binding exposes Qt types including QPoint, QPointF, QSize, QSizeF, QMargins, QRect, QRectF, QLineF, QVector2D, QVector3D, QVector4D and QQuaternion, each with public components, structure constructors and Qt methods, plus operators such as `+` and `-` for points, sizes and margins and `rect + margins`/`rect - margins`. The release also adds QMatrix4x4 methods `translate(QVector3D)`, `scale(QVector3D)`, `rotate(angle, QVector3D)`, `rotate(QQuaternion)` and `lookAt(eye, center, up)`, along with `map(QVector3D)` and `map(QVector4D)`, and a new `mapVector` for vectors.", "body_md": "I just had Claude add it:\n\nRun `pixi run example geometry` to see an example:\n\nOverloads are listed by the name you call: for example, `painter%drawLine(p1, p2)`.\n\n`use qt`)\nAll have public components, structure constructors and Qt’s methods.\n\n`qt_geometry`)\n| Type | Components | Extra constructors | Methods | \n|---|---|---|---|\n| `QPoint` | `x, y` |  | `isNull` ,`manhattanLength` ,`transposed` ,`toPointF` | \n| `QPointF` | `x, y` | `QPointF(QPoint)` | `isNull` ,`manhattanLength` ,`transposed` ,`toPoint` | \n| `QSize` | `width, height` |  | `isNull` ,`isEmpty` ,`isValid` ,`transposed` ,`expandedTo` ,`boundedTo` ,`scaled(size [, mode])` ,`grownBy` ,`shrunkBy` ,`toSizeF` | \n| `QSizeF` | `width, height` | `QSizeF(QSize)` | `isNull` ,`isEmpty` ,`isValid` ,`transposed` ,`expandedTo` ,`boundedTo` ,`scaled` ,`toSize` | \n| `QMargins` | `left, top, right, bottom` |  | `isNull` | \n| `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` | \n| `QRectF` | `x, y, width, height` | `QRectF(topLeft, size)` ,`QRectF(topLeft, bottomRight)` ,`QRectF(QRect)` | same as `QRect` without the margins methods, plus`toRect` and`toAlignedRect` | \n| `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` | \n\n`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`)\n| Type | Components | Extra constructors | Methods | \n|---|---|---|---|\n| `QVector2D` | `x, y` | `QVector2D(array)` ,`QVector2D(QPoint)` ,`QVector2D(QPointF)` | `isNull` ,`length` ,`lengthSquared` ,`normalized` ,`normalize` ,`distanceToPoint` ,`distanceToLine` ,`toVector3D([z])` ,`toVector4D` ,`toPoint` ,`toPointF` ,`toArray` | \n| `QVector3D` | `x, y, z` | `QVector3D(array)` ,`QVector3D(vector2d [, z])` | same as `QVector2D` , plus`distanceToPlane(point, normal)` or`distanceToPlane(p1, p2, p3)` ,`toVector2D` ,`toVector4D([w])` | \n| `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` | \n| `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` | \n\n`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)`\n**`QWidget`**, inherited by every widget:\n\n`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`\n`QLayout`:` contentsMargins() → QMargins`, `setContentsMargins(QMargins)`\n\n`QMenu`:` popup(QPoint)`, `exec(QPoint) → QAction`\n\n`QtfPaintCell`:` rect() → QRect`\n\n`QPainter`:\n\n`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)`\n`QPainterPath`:\n\n`moveTo(QPointF)`, `lineTo(QPointF)`, `addRect(QRectF)`, `addEllipse(QRectF)`, `containsPoint(QPointF)`` currentPosition() → QPointF`, `pointAtPercent(t) → QPointF`, `boundingRect() → QRectF`\n`QTransform`:` map(QPointF) → QPointF`, `mapRect(QRectF) → QRectF`\n\n`QFontMetrics`:` boundingRect(text) → QRect`, `size(flags, text) → QSize`\n\n`QImage`, `QPixmap`:` size() → QSize`\n\n`QWindow`:\n\n`position() → QPoint`, `setPosition(QPoint)`` geometry() → QRect`, `mapToGlobal(QPoint)`, `mapFromGlobal(QPoint)`\n`QScreen`:` geometry()`, `availableGeometry() → QRect`; `size() → QSize`; `physicalSize() → QSizeF`\n\n`QDrag`:` setHotSpot(QPoint)`\n\n**Events:**\n\n`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)`\n\n**Free function:** `QCursor_pos() → QPoint`\n\nAll the existing scalar versions (`move(x, y)`, `drawLine(x1, y1, x2, y2)`, `mapX`/` mapY`, and so on) are unchanged.", "url": "https://wpnews.pro/news/qt-fortran-questions", "canonical_source": "https://fortran-lang.discourse.group/t/qt-fortran-questions/11300#post_2", "published_at": "2026-11-13 01:11:46+00:00", "updated_at": "2026-11-13 01:49:57.328318+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Claude", "Qt", "Qt-fortran", "QPoint", "QRect", "QVector3D", "QQuaternion", "QMatrix4x4"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/qt-fortran-questions", "markdown": "https://wpnews.pro/news/qt-fortran-questions.md", "text": "https://wpnews.pro/news/qt-fortran-questions.txt", "jsonld": "https://wpnews.pro/news/qt-fortran-questions.jsonld"}}