e2b4771 2026-09-04
cmake
qml
src
CMakeLists.txt 4.4 KB
COPYING 34.3 KB
COPYING.LESSER 7.5 KB
LICENSE 7.5 KB
README.md 3.1 KB

Qml6Stretch

loooong components

Installs into your Qt6 installation (QT_INSTALL_QML and friends), so consuming projects only need find_package:

  • <qt>/qml/Qml6Stretch/ - the importable Qml6Stretch QML module (libqml6stretchplugin.so, qmldir, qml6stretch.qmltypes)
  • <qt>/lib/libqml6stretch.so.<version>
  • <qt>/include/qml6stretch/*.h - #include <qml6stretch/stretchflickable_p.h>
  • <qt>/lib/cmake/Qml6Stretch/ - CMake package config for find_package()

Building

cmake -S . -B build -DCMAKE_PREFIX_PATH=/path/to/Qt/6.x.y/gcc_64
cmake --build build -j
cmake --install build

The install prefix defaults to that Qt's prefix; the QML module destination comes from qmake -query QT_INSTALL_QML on the qmake belonging to that Qt (not whatever qmake6 is first on PATH). Pass -DCMAKE_INSTALL_PREFIX=... to install elsewhere, -DQT_QML_INSTALL_INTO_QT=OFF for a plain standalone <prefix>/qml layout, or -DQT_QMAKE_EXECUTABLE=... to pin the qmake.

Consuming it from CMake

find_package(Qml6Stretch REQUIRED CONFIG)

qt_add_qml_module(myapp
    URI App
    VERSION 1.0
    QML_FILES qml/Main.qml
)

target_link_libraries(myapp PRIVATE Qml6Stretch::qml6stretch)

No IMPORT_PATH, QML_IMPORT_PATH or compile definitions needed: the module lives in Qt's own import directory, so import Qml6Stretch resolves for qmllint, qmlls and the QML engine at runtime. (Qml6Stretch_QML_DIR is still set by the package config, for non-default install layouts.)

Usage from QML

import QtQuick
import Qml6Stretch

Rectangle {
    anchors.fill: parent
    color: "black"

    StretchListView {
        id: list
        anchors.fill: parent
        model: rowModel
        delegate: rowDelegate
        spacing: 8

        // optional: tune the rubber-band feel
        dragResistanceRange: 600
        dragOvershootMax: 50
    }

    ListModel {
        id: rowModel
        ListElement { label: "Item 1"; bgColor: "#00B4D8" }
        ListElement { label: "Item 2"; bgColor: "#07AFD5" }
        // ...
    }

    Component {
        id: rowDelegate
        Rectangle {
            required property string label
            required property color bgColor

            width: list.width
            height: 128
            radius: 12
            color: bgColor

            Text {
                anchors.centerIn: parent
                text: label
                color: "white"
            }
        }
    }
}

Or use StretchFlickable directly, like Flickable:

import QtQuick
import Qml6Stretch

StretchFlickable {
    anchors.fill: parent
    contentWidth: width
    contentHeight: column.height
    clip: true
    boundsBehavior: StretchFlickable.DragOverBounds
    dragResistanceRange: 600
    dragOvershootMax: 50

    Column {
        id: column
        width: parent.width
        // ... your content ...
    }
}

License

Qml6Stretch is licensed under the GNU Lesser General Public License v3.0 (LGPL-3.0). It is derived from Qt's own QQuickFlickable/QQuickTimeLine sources (LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only), and is distributed here under the LGPL-3.0 option.