Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • Trying to apply LayoutMirroring property on Slider, but it is not working

    Unsolved
    1
    0 Votes
    1 Posts
    123 Views
    No one has replied
  • GridLayout fill content bottom to top

    Unsolved qml gridlayout flow bottomtotop
    8
    0 Votes
    8 Posts
    2k Views
    U
    Hi! With GridView you can set verticalLayoutDirection: GridView.BottomToTop and it populates items from bottom to up, works fine. However with GridLayout there seems to be no such property. One hack to achieve this behaviour with GridLayout would be to rotate the GridLayout component by 180 degrees and counter rotate its children accordingly. You can also use LayoutMirroring property to control left-to-right right-to-left behavior. Depending on what you are trying to achieve this might be a workaround for you. Here's example code, (click on window to switch between top-to-bottom and bottom-to-top): import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Layouts Window { width: 640 height: 480 visible: true title: qsTr("Hello World") GridLayout { LayoutMirroring.enabled: grid.rotation == 180 id: grid columns: 3 anchors.fill: parent rotation: 0 Text { text: "Three"; font.bold: true; rotation: grid.rotation } Text { text: "words"; color: "red"; rotation: grid.rotation } Text { text: "in"; font.underline: true; rotation: grid.rotation } Text { text: "a"; font.pixelSize: 20; rotation: grid.rotation } Text { text: "row"; font.strikeout: true; rotation: grid.rotation } } MouseArea { anchors.fill: parent onClicked: { if (grid.rotation == 0) grid.rotation = 180 else grid.rotation = 0 } } } Regards, Ulrich
  • Matplotlib in QML application

    Unsolved
    6
    0 Votes
    6 Posts
    497 Views
    SGaistS
    Can you provide a minimal requirements.txt to reproduce your environment ? Using conda with PyQt5 and matplotlib I have in import error but the package is found.
  • How to emit Signal from nested QML page (by Loader) to python

    Unsolved qtquick signal & slot
    3
    0 Votes
    3 Posts
    849 Views
    GrecKoG
    You don't. C++ shouldn't connect to QML signals. Expose a slot/invokable function in a Python object that is accessible from QML and call that slot in QML.
  • 0 Votes
    1 Posts
    406 Views
    No one has replied
  • Unable to run the "QML Recorder Example" demo on Mac

    Solved
    13
    0 Votes
    13 Posts
    951 Views
    R
    Well, it looks like if I click "Run in terminal" it runs correctly as per this: https://bugreports.qt.io/browse/QTCREATORBUG-23880
  • (Static kit only) Qt Quick emulation layer crashed with QtQuick.Controls imported

    Solved
    2
    0 Votes
    2 Posts
    329 Views
    B
    Fixed. I did this by doing those steps: In maintenance tool I downloaded Mingw64 and Mingw64 for 5.15.2 and for "Tools". I did an static mingw build using this powershell script: https://wiki.qt.io/Building_a_static_Qt_for_Windows_using_MinGW I saw that the script is changing qmake.conf files in mkspecs folder. I ran this MSVC script to make MSVC Static build and after unzipping QtBase I modified qmake.conf in mkspecs/winrt-x64-msvc2019 and in mkspecs/win32-msvc. QMAKE_LFLAGS += -static QMAKE_CFLAGS_RELEASE -= -O2 QMAKE_CFLAGS_RELEASE += -Os DEFINES += QT_STATIC_BUILD Then the qt setup and qt build command, when build is finished I modified the (THIS TIME IN PREFIX LOCATION / LOCATION WHERE QT STATIC IS INSTALLED) qmake.conf in mkspecs/winrt-x64-msvc2019 and in mkspecs/win32-msvc CONFIG += static Run Qt Creator and the Designer is fine.
  • can i use Rviz in Qt Quick?

    Unsolved
    3
    0 Votes
    3 Posts
    527 Views
    E
    @walterfsnow do you mean this is not possible?
  • Unable to hide spinbox default indicators

    Unsolved
    2
    0 Votes
    2 Posts
    181 Views
    No one has replied
  • How to load contents of file from resources for TextArea 'text' property?

    Unsolved
    3
    0 Votes
    3 Posts
    977 Views
    R
    OK I did come up with a solution for now, but don't know if it's the best one: I just added a QMLUtil C++ class (derived from QObject) with a method Q_INVOKABLE QString readFile(const QString& path);. This just uses QFile::readAll() to read the file and return the contents as a QString. I then passed an instance of this to QML engine in main() with: QMLUtil qmlUtil; QQmlApplicationEngine.rootContext()->setContextProperty("QMLUtil", &qmlUtil); and can use it in my TextArea: text: visible ? QMLUtil.readFile(":myapp/file.html") : "" (Note need to use QFile's file path syntax with : prefix instead of qrc:/.) Pretty simple (doesn't do much with errors, just throws an exception or returns empty string), and would probably have some issues if the file were very large, but seems to work for now. If there was a pure Javascript solution, that would be better for some of my other QML/JS-only projects however. Let me know if you have other ideas on how to do this! Thanks
  • Need help releasing a QT binary that uses QML with C++.

    Solved
    16
    0 Votes
    16 Posts
    1k Views
    B
    As it turns out, there was no issue. The application was doing exactly what it was told to do. The QML CPP implementation was looking for a JSON file. When in an event the application could not find the file, it should print something to console and exit. In this case, the pathing of the file was incorrect so it just exited without saying anything in the console. It has been resolved. Thank you all for your help.
  • 0 Votes
    1 Posts
    139 Views
    No one has replied
  • Mediaplayer plays RTSP stream from camera, how to restore connection after break?

    Solved
    3
    0 Votes
    3 Posts
    1k Views
    isstarI
    Ok. This solution works: onPlaybackStateChanged: { if(playbackState == 0) { source = "" source = "rtsp://192.168.88.179:554/user=admin_password=_channel=0_stream=0.sdp?real_stream" mediaPlayer.play(); } } Also, it works without source = "", if I use another login-password pare at every reconnect. It generates "source change" event too. Now I have to find a way to fasten the playbackState reaction on actual loss of connection.
  • Prevent overlap in Column with scaled

    Solved
    3
    0 Votes
    3 Posts
    545 Views
    M
    Thank you. Answer was so simple. I'm still getting used to the flexibility and power of binding to properties.
  • TableView is overlapping TabBar

    Unsolved
    1
    0 Votes
    1 Posts
    177 Views
    No one has replied
  • 0 Votes
    3 Posts
    1k Views
    R
    @GrecKo It does, but it seems to be a read-only reflection of the viewport set for the video frame objects that are coming through the videoSink. When I attempt to assign to it, I get the QML error: Invalid property assignment: "sourceRect" is a read-only property. The docs do not appear to reflect the fact that sourceRect is read-only. I am using Qt 6.3. Looking at the source for VideoOutput (https://github.com/qt/qtmultimedia/blob/37c2d097eb5dd8671cc752dc920da11d66105905/src/multimediaquick/qquickvideooutput_p.h#L41), we can see that the Q_PROPERTY for sourceRect is read-only in both the 6.3 and dev branches. I have had the thought of attempting to manually set the viewport of the QVideoFrameFormat of the frames coming through the VideoOutput's videoSink, but I haven't created a working solution for that strategy yet.
  • module "QtCharts" is not installed

    Unsolved
    11
    0 Votes
    11 Posts
    2k Views
    A
    @jsulm I think you are right actually I'm gonna find out how now ahha But thanks for your help!
  • QML Mouse interaction with WebAssembly

    Unsolved
    2
    0 Votes
    2 Posts
    287 Views
    lorn.potterL
    That example is working for me using Qt 6.3.1 and 6.4 webassembly. Did you self build 6.3.1 or using the binary release?
  • Component.onCompleted with console.log not working, why please?

    Solved
    6
    1 Votes
    6 Posts
    1k Views
    JoeCFDJ
    @Mlibu said in Component.onCompleted with console.log not working, why please?: QT_FORCE_STDERR_LOGGING Good for you. I do not have this setting on Linux and am able to see log output in qt creator. Your output is not error message. This setting is kind of odd.
  • Elide in QML Textfield

    Unsolved
    2
    0 Votes
    2 Posts
    414 Views
    JoeCFDJ
    https://forum.qt.io/topic/92006/elide-text-in-textfield/3 could be old.