跳到內容

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.2k 主題 77.8k 貼文
  • Windows - qt_add_qml_module failed to load the plugin

    Solved
    5
    0 評價
    5 貼文
    764 瀏覽
    Q
    @dheerendra can you show some demo source? I don't konw how to write qml plugin and use the component in app.qml, thank you .
  • 此主題已被刪除!

    Unsolved
    1
    0 評價
    1 貼文
    33 瀏覽
    尚無回覆
  • Qt6.8 + CMake : <Unknown File>: No module named "IMClient" found

    Solved
    6
    0 評價
    6 貼文
    863 瀏覽
    JKSHJ
    Hi, and welcome! @Lopher said in Qt6.8 + CMake : <Unknown File>: No module named "IMClient" found: I'm uncertain whether this is a sustainable solution and if it aligns with proper practices." For the cleanest solution: Use qt_standard_project_setup(REQUIRES 6.8) in your top-level CMakeLists.txt -- this automatically applies QTP0001 and QTP0004, so you don't need to set them manually Don't set a custom RESOURCE_PREFIX Don't call addImportPath() Don't put your QML files on a specific place on disk -- let your app load it from the embedded resources instead Give your main *.qml file a name that starts with an uppercase letter (so Login.qml, not login.qml) Now, you can call engine.loadFromModule("IMClientQml", "Login"); Note: The whole point of introducing QTP0001 was to avoid the need for RESOURCE_PREFIX and addImportPath() For further troubleshooting, call the following and inspect the output: qDebug() << "Import paths:" << engine.importPaths(); qDebug("### Resources ###"); QDirIterator qrc(":", QDirIterator::Subdirectories); while(qrc.hasNext()) qDebug() << qrc.next();
  • Qt6.8 + CMake: QML components cannot find qrc resources built by qt_add_resources

    Solved
    2
    0 評價
    2 貼文
    167 瀏覽
    Christian EhrlicherC
    @Lopher said in Qt6.8 + CMake: QML components cannot find qrc resources built by qt_add_resources: Cannot open: qrc:/icons/close.svg Because they are not there as you can see here: qt_add_resources(IMClientResources "IMClientSvg" PREFIX "/icons" FILES resources/images/close.svg They are in :/icons/resources/images/close.svg
  • Qt SVG : Dynamic Modification

    Unsolved
    24
    0 評價
    24 貼文
    5k 瀏覽
    EskilE
    The new svgtoqml tool and VectorImage component might be interesting for this. This will convert the SVG to QML code. The rendering will then be hardware-accelerated (being just Qt Quick under the hood). In addition, since it generates a tree of Qt Quick items with object names based on the IDs given in the source file, it is possible to traverse it using JavaScript and change properties on specific items as the original post here requested. Some more details can be found in these blogs if you are interested: https://www.qt.io/blog/vector-graphics-in-qt-6.8 https://www.qt.io/blog/animated-vector-graphics-in-qt-6.10
  • Is there no real way to create a dynamically linked library with signals / slots using cmake?

    Solved
    7
    0 評價
    7 貼文
    456 瀏覽
    SGaistS
    @DesiVideoGamer hi, Your class does not: inherit from QObject include the Q_OBJECT macro Hence there's no reason for moc to be doing anything.
  • QML Plugin Load Error

    Unsolved
    8
    0 評價
    8 貼文
    949 瀏覽
    dheerendraD
    https://forum.qt.io/topic/158541/windows-qt_add_qml_module-failed-to-load-the-plugin This may help
  • Plugin error while loading in application uisng cmake

    已鎖定 Unsolved
    2
    0 評價
    2 貼文
    309 瀏覽
    jsulmJ
    @Rangantha-B-V No need to ask same question twice (https://forum.qt.io/topic/163207/qml-plugin-load-error/4?_=1757653705393). In that other thread - did you react to the comment from @JKSH ?
  • 0 評價
    2 貼文
    185 瀏覽
    Axel SpoerlA
    onStatusChanged has been removed in Qt 6. The software is packaged with an outdated version of Qt, while the user environment obviously provides a recent version. You need to port the app to Qt 6...
  • TableView and HorizontalHeaderView column widths do not match, even with syncView property set

    Solved
    2
    0 評價
    2 貼文
    346 瀏覽
    Aleksey_KA
    ✅ Solution: Force layout recalculation after width changes To ensure layout syncs correctly, you need to explicitly trigger layout updates when the TableView or HorizontalHeaderView resizes. Fix: Add onWidthChanged: tableView.forceLayout() in both the TableView and the HorizontalHeaderView. 🔧 Updated code: TableView { id: tableView columnWidthProvider: function (column) { // Your width logic } onWidthChanged: tableView.forceLayout() } HorizontalHeaderView { id: header syncView: tableView onWidthChanged: tableView.forceLayout() } ✅ Even in HorizontalHeaderView, you call **tableView.forceLayout()**, not header.forceLayout(). 🧠 Why this works columnWidthProvider often runs before tableView.width is fully initialized or updated. forceLayout() triggers Qt to re-run layout and width calculations with correct sizing. syncView can now properly sync header and table widths based on the final layout pass. ✅ Result Now the header and table stay in perfect sync, even when: Resizing the window Stretching a specific column to take remaining space Changing content dynamically
  • QSyntaxHighlighter with TextEdit, format is not reflecting in TextEdit qml.

    Unsolved
    2
    0 評價
    2 貼文
    554 瀏覽
    SGaistS
    Hi, Which version of Qt are you using ? On which OS ? I tested your code on macOS with 6.7.2 and it's working properly.
  • How to expose a normal function to QML?

    11
    0 評價
    11 貼文
    1k 瀏覽
    SavizS
    @JKSH said in How to expose a normal function to QML?: Do you need to expose every single C function directly to your GUI? Perhaps you could design your wrapper class as an abstraction layer that exposes fewer but higher-level methods to QML, while these higher-level functions each call multiple lower-level C functions. You are absolutely right that not all functions need to be exposed to the GUI layer. However, there are still a significant number of functions that do need to be invoked directly from the GUI. For that reason, I believe your proposed solution of creating a controller or wrapper unit with automated C++ generation is indeed the best approach. That said, I’ll continue researching to see if there are any alternative technologies that might be a better fit for my situation.
  • AM62x/Qt app renders fine after fresh flash, breaks after later redeploys

    已移動 Unsolved
    4
    0 評價
    4 貼文
    455 瀏覽
    N
    Hi @JKSH ,It works for me. I disabled the pipeline cache by adding: QCoreApplication::setAttribute(Qt::AA_DisableShaderDiskCache); to main.cpp.
  • Application AbracaDABra cmake brings up tons QML-errors

    Unsolved
    1
    0 評價
    1 貼文
    205 瀏覽
    尚無回覆
  • Best Approach for Displaying Multiple Camera Streams in Qt 6.9.1 with Microservices

    Unsolved
    11
    0 評價
    11 貼文
    3k 瀏覽
    G
    @Ronel_qtmaster Yes currently we are trying to use gpu and reduce the cpu load Below is the gstreamer pipeline i'm trying by using d3d11 QString( "rtspsrc location=%1 latency=0 protocols=tcp name=src " "src. ! rtph264depay ! h264parse ! tee name=t " "t. ! queue ! d3d11h264dec ! d3d11convert ! d3d11download " "! video/x-raw,format=RGB " "! appsink name=appsink emit-signals=true sync=false max-buffers=2 drop=true" ) and we are encoding and decoding to jpeg using turbojpeg library. Do you have any suggestions on using gpu or gstreamer pipeline We are also thinking of trying to send the h264 encoded data and stream that also.
  • 此主題已被刪除!

    Unsolved
    0
    0 評價
    0 貼文
    1 瀏覽
    尚無回覆
  • App UI is freezing after returning from Windows Lock screen.

    Unsolved
    1
    1 評價
    1 貼文
    178 瀏覽
    尚無回覆
  • Map - api key requared

    Solved
    4
    0 評價
    4 貼文
    1k 瀏覽
    JoeCFDJ
    The code in the video does not work. Not sure how he made the video. The tile address was typed to tite wrongly and the format was not correct either. The following code works for Qt5&6 QML without marker "API Key required". import QtQuick //2.15 for Qt5 import QtLocation //5.15 for Qt5 import QtPositioning //5.15 for Qt5 Window { width: Qt.platform.os == "android" ? Screen.width : 512 height: Qt.platform.os == "android" ? Screen.height : 512 visible: true title: map.center + " zoom " + map.zoomLevel.toFixed(3) + " min " + map.minimumZoomLevel + " max " + map.maximumZoomLevel Plugin { id: mapPlugin name: "osm" PluginParameter { name: "osm.mapping.providersrepository.disabled" value: true //fpr Qt5 value: "true" } PluginParameter { name: "osm.mapping.custom.host" value: "https://tile.openstreetmap.org/%z/%x/%y.png" } } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(59.91, 10.75) // Oslo zoomLevel: 14 activeMapType: map.supportedMapTypes[map.supportedMapTypes.length - 1] property geoCoordinate startCentroid PinchHandler { id: pinch target: null onActiveChanged: if (active) { map.startCentroid = map.toCoordinate(pinch.centroid.position, false) } onScaleChanged: (delta) => { map.zoomLevel += Math.log2(delta) map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position) } onRotationChanged: (delta) => { map.bearing -= delta map.alignCoordinateToPoint(map.startCentroid, pinch.centroid.position) } grabPermissions: PointerHandler.TakeOverForbidden } WheelHandler { id: wheel // workaround for QTBUG-87646 / QTBUG-112394 / QTBUG-112432: // Magic Mouse pretends to be a trackpad but doesn't work with PinchHandler // and we don't yet distinguish mice and trackpads on Wayland either acceptedDevices: Qt.platform.pluginName === "cocoa" || Qt.platform.pluginName === "wayland" ? PointerDevice.Mouse | PointerDevice.TouchPad : PointerDevice.Mouse rotationScale: 1/120 property: "zoomLevel" } DragHandler { id: drag target: null onTranslationChanged: (delta) => map.pan(-delta.x, -delta.y) } Shortcut { enabled: map.zoomLevel < map.maximumZoomLevel sequence: StandardKey.ZoomIn onActivated: map.zoomLevel = Math.round(map.zoomLevel + 1) } Shortcut { enabled: map.zoomLevel > map.minimumZoomLevel sequence: StandardKey.ZoomOut onActivated: map.zoomLevel = Math.round(map.zoomLevel - 1) } } }
  • qt_add_qml_module with absolute QML file paths causes qmlcachegen error

    Unsolved
    3
    0 評價
    3 貼文
    375 瀏覽
    L
    @JKSH said in qt_add_qml_module with absolute QML file paths causes qmlcachegen error: The expectation is to have a CMakeLists.txt file in the same folder as your *.qml files. You can then link that folder to the rest of your project using add_subdirectory(). Thank you. This approach is correct. Placing the *.qml files in the src directory is indeed more appropriate. I just wanted to see how to write the CMake configuration when separating QML and C++ code.
  • 此主題已被刪除!

    Unsolved
    4
    0 評價
    4 貼文
    2k 瀏覽