Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • How do you make an original keyboard ?

    Solved
    8
    0 Votes
    8 Posts
    982 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
    571 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
    184 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
    206 Views
    No one has replied
  • How to convert Gstreamer pipeline into UDP URI Schema?

    Unsolved
    3
    0 Votes
    3 Posts
    407 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
    3k 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
    840 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
    610 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
    233 Views
    JKSHJ
    Do Javascript strings support unicode characters Yes: http://speakingjs.com/es5/ch24.html
  • Draggable Listview

    Unsolved
    6
    0 Votes
    6 Posts
    515 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
    133 Views
    No one has replied
  • Qt5Core.dll, Qt5Gui.dll, Qt5Network.dll not found error

    Unsolved
    3
    0 Votes
    3 Posts
    4k Views
    M
    Thanks now its working
  • Screen artifacts, not getting cleared until window is resized

    Unsolved
    3
    1 Votes
    3 Posts
    418 Views
    J.HilkJ
    @Demolishun so I tested the "still causing issue" version you posted, and no issue for me on 5.15.7 but its on macOS, if that makes a difference [image: 02d3df57-bc9e-4631-a0a6-e97ba46ae513.png]
  • mouse area pin mode

    Unsolved
    2
    0 Votes
    2 Posts
    242 Views
    F
    I am not getting your problem. Are you looking for something like this to print x and y when there is a position change. onPositionChanged: { console.log("x:"+ mouse.x+ " y:"+mouse.y) }
  • How to recieve dynamic variable from qml with QT webchannel in html side?

    Unsolved
    1
    0 Votes
    1 Posts
    135 Views
    No one has replied
  • High CPU usage with basic QML animation

    Unsolved
    6
    0 Votes
    6 Posts
    3k Views
    H
    Here is a bug report: https://bugreports.qt.io/browse/QTBUG-99525 Please vote/watch it if you face the same problem.
  • console.log formatting

    Unsolved
    3
    0 Votes
    3 Posts
    525 Views
    D
    OK thanks. The qt docs strongly imply that QML supports Javascript, but I guess it's a subset.
  • Rescaling right axis in QtQuick ChartView rescales the left one and vice-versa

    Unsolved
    1
    0 Votes
    1 Posts
    151 Views
    No one has replied