Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.1k Topics 77.7k Posts
  • The deployment device "" is invalid qt android

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    Q
    @jsulm thanks for your answer actually my android's developer option was enable but not now i enable this and this worked
  • Scenegraph examples, some missing QML module not found, is it a bug?

    Unsolved
    1
    0 Votes
    1 Posts
    142 Views
    No one has replied
  • Custom type registered in QML and QVariant

    Moved Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    raven-worxR
    @Pieter-Cardoen the qml engine only support this types: https://doc.qt.io/qt-5/qtqml-cppintegration-data.html if you want to support a custom type you will have to convert it to one of those. before you can process them in QML. For example a struct can be converted to a QVariantMap, or a custom class must interhit QObject and use the meta object system (properties, invokabkle methods, etc.)
  • Component objects cannot declare new properties

    Moved Solved
    2
    0 Votes
    2 Posts
    2k Views
    KroMignonK
    @pingal said in Component objects cannot declare new properties: But if I add Button element as below, it gives me the mentioned error in the application output AFAIK, Component can hold only 1 root object (eg. Item, Rectangle, Row ect.). It is same a creating a QML file for a component (cf. https://doc.qt.io/qt-5/qml-qtqml-component.html) You should change your code to: Component { id: itemDelegate Item { Button { .. } Row { Rectangle {..} Rectangle {..} Rectangle {..} Rectangle {..} } } }
  • 0 Votes
    1 Posts
    881 Views
    No one has replied
  • can't find my qmlRegisteredType on rootObject() children

    Solved
    10
    0 Votes
    10 Posts
    1k Views
    D
    @kshegunov Yes, indeed, it makes sense, thanks :)
  • How do you make an original keyboard ?

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    A
    @morita hi Morita, I want to create my layout and I have the same error as you had, so my question is, did you solve the problem? because I have a fresh Qt6 installation and I can use Virtual Keyboard with Input panel, but when I want to use Key, NumberKey, or BaseKey it gives me the same errors that you had? so I would be grateful if you can guide me.
  • How to ensure Popup is visible inside a QML Map

    Solved qml map openstreetmaps
    2
    0 Votes
    2 Posts
    637 Views
    M
    After looking for a while, I finally came across these two functions: mapToItem and mapFromItem. So, I first need to map the current item point to the map item coordinate system. Then, I must check the point is inside the map viewport. If not, I have to adjust the coordinate, and after that, I map the point back to the current item coordinate system. Popup width and height seem to decrease when approaching bottom and right borders, so I had to use contentHeight, contentWidth and padding properties to get the real popup size. And I had to initialize the popup x and y to a value different of zero to allow mouse event to pass on the blue dot. Here is the working code, for those who may need it. import QtQuick 2.11 import QtQuick.Controls 2.4 import QtLocation 5.11 import QtPositioning 5.11 import QtQuick.Window 2.11 Window { id: root; width: 800; height: 600; Plugin { id: mapPlugin; name: "osm"; } ListModel { id: myModel ListElement { latitude: 48.2351164; longitude: 6.8986936; name: "The point on the center"; } ListElement { latitude: 48.235111272600186; longitude: 6.9007217756551995; name: "The point on the right"; } ListElement { latitude: 48.23512783507458; longitude: 6.896574932520792; name: "The point on the left"; } ListElement { latitude: 48.23614708436043; longitude: 6.898623901851295; name: "The point on the top"; } ListElement { latitude: 48.23417574713512; longitude: 6.898641104398024; name: "The point on the bottom"; } } Map { id: map anchors.fill: parent plugin: mapPlugin center: QtPositioning.coordinate(48.2351164, 6.8986936) zoomLevel: 19 MapItemView { model: myModel delegate: MapQuickItem { anchorPoint.x: myRect.width / 2 anchorPoint.y: myRect.height / 2 width: myRect.width height: myRect.height coordinate: QtPositioning.coordinate(model.latitude, model.longitude) sourceItem: Rectangle { id: myRect readonly property int radius: 10 width: radius * 2 height: radius * 2 color: "transparent" Canvas { id: myCanvas anchors.fill: parent property alias textVisible: myPopup.visible onPaint: { var width = myRect.width; var height = myRect.height; var centreX = width / 2; var centreY = height / 2; var ctx = getContext("2d"); ctx.reset(); ctx.fillStyle = "blue"; ctx.globalAlpha = 1; ctx.beginPath(); ctx.moveTo(centreX, centreY); ctx.arc(centreX, centreY, myRect.radius, 0, Math.PI * 2, false); ctx.closePath(); ctx.fill(); } MouseArea { x: 0; y: 0; width: myRect.radius * 2 height: myRect.radius * 2 acceptedButtons: Qt.LeftButton hoverEnabled: true onPositionChanged: { myCanvas.textVisible = true; // absolute position in map coordinate system var absPos = mapToItem(map, mouse.x, mouse.y); // margin between mouse pointer and the popup var cursorMargin = 10; // extra margin for right and bottom side var bottomRightSideExtraMargin = 10; // add the cursor margin to the position var absPopupX = absPos.x + cursorMargin; var absPopupY = absPos.y + cursorMargin; // adjust if the popup is out of view on the bottom or right sides if (absPos.x + myPopup.contentWidth + myPopup.leftPadding + myRect.radius * 2 + bottomRightSideExtraMargin > root.width) { absPopupX = root.width - (myPopup.contentWidth + myPopup.leftPadding + cursorMargin + bottomRightSideExtraMargin); } if (absPos.y + myPopup.contentHeight + myPopup.topPadding + myRect.radius * 2 + bottomRightSideExtraMargin > root.height) { absPopupY = root.height - (myPopup.contentHeight + myPopup.topPadding + cursorMargin + bottomRightSideExtraMargin); } // convert back to the current item coordinate system var popupPos = mapFromItem(map, absPopupX, absPopupY); myPopup.x = popupPos.x; myPopup.y = popupPos.y; } onExited: { myCanvas.textVisible = false; } } } Popup { id: myPopup // original offset to allow mouse hover x: 20; y: 20; visible: false Label { text: model.name; horizontalAlignment: Text.AlignHCenter; } } } } } } }
  • How to preload the child.qml files while loading the main.qml file

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    J.HilkJ
    @James-A like @kshegunov said, Loader is the way to go, make sure to set the asynchronous property to true
  • QML receive signals when not visible?

    Unsolved
    2
    0 Votes
    2 Posts
    199 Views
    dheerendraD
    As long as objects exists you must receive the signals. Either objects do not exist at all or signals are not sent. You can give the objectName to each of the objects in QML & see which objects don't respond.
  • How to load Mesh data from QtQuick3D model in c++?

    Unsolved
    1
    0 Votes
    1 Posts
    215 Views
    No one has replied
  • How to convert Gstreamer pipeline into UDP URI Schema?

    Unsolved
    3
    0 Votes
    3 Posts
    429 Views
    JoeCFDJ
    @januarKai said in How to convert Gstreamer pipeline into UDP URI Schema?: QtMultimedia https://stackoverflow.com/questions/64478851/how-to-display-stream-video-frames-in-qt-app-using-gstreamer-receive-from-udp-so you can also Qt gstreamer which may need to be built with your installed Qt.
  • How to use QImage to load a file with name "#.png"?

    Solved
    7
    0 Votes
    7 Posts
    1k Views
    N
    Solved, I use "replace(QChar('#'), "%23")" to every path QString source: "file:///D:/#.png" not working encodeURIComponent not working
  • How to create a framelesswindow and can resize the window's size?

    Unsolved
    7
    1 Votes
    7 Posts
    4k Views
    GrecKoG
    Call it on onPressed instead and you will be able to resize the window by dragging
  • Using pointer in C++ model for QML

    Unsolved
    3
    0 Votes
    3 Posts
    862 Views
    J
    @JorisC said in Using pointer in C++ model for QML: return QVariant(item.serie); //PROBLEM HERE because item.serie is a pointer .... and cannot be handle with QVARIANT You can use return QVariant::fromValue(item.serie);
  • adding a button on QT/QML drop down/combobox item item

    Unsolved
    2
    0 Votes
    2 Posts
    623 Views
    fcarneyF
    https://doc.qt.io/qt-5/qml-qtquick-controls2-control.html#contentItem-prop
  • Do Javascript strings support unicode characters if not what is an easy way around it

    Unsolved
    2
    0 Votes
    2 Posts
    254 Views
    JKSHJ
    Do Javascript strings support unicode characters Yes: http://speakingjs.com/es5/ch24.html
  • Draggable Listview

    Unsolved
    6
    0 Votes
    6 Posts
    531 Views
    fcarneyF
    @St-Stanislav said in Draggable Listview: But mouse wheel is inactive. I just checked my listviews and mouse wheel doesn't seem to work. I honestly don't know if they worked before or not. Do they work with Interactive set to true? The problem with QML is the newer objects are designed around tablet/phone paradigm. So it is not always good fit for desktop. Or it takes extra work. Please let us know what you find out implementing mouse scroll wheel in a list with interactive off.
  • The Qml taskbar is restored to the display state

    Unsolved
    1
    0 Votes
    1 Posts
    140 Views
    No one has replied
  • Qt5Core.dll, Qt5Gui.dll, Qt5Network.dll not found error

    Unsolved
    3
    0 Votes
    3 Posts
    5k Views
    M
    Thanks now its working