Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.4k Posts
  • Bring Window to the 2nd Monitor

    Unsolved
    5
    1 Votes
    5 Posts
    449 Views
    C
    You're right, thanks. Running with paramter "-platform xcb" works. (Then, of course, it is no longer Wayland)
  • Segfault after moving project from Ubuntu 22.04 to RHEL 8.10

    Unsolved
    9
    0 Votes
    9 Posts
    561 Views
    D
    Hi all, The issue is now resolved. The project I was porting required glibc 2.29, whereas RHEL 8.10 only supports up to glibc 2.28. When I installed Qt using the online installer, it was expecting 2.29, rather than the system provided version. I couldn't find any precompiled Qt libraries for my version of RHEL, so I rebuilt Qt from source using the system provided version of glibc, and now there is no crash. Thanks for the responses!
  • Can't get roundJoin to work in qml.

    Unsolved
    1
    0 Votes
    1 Posts
    114 Views
    No one has replied
  • how to access signals from diferrent qml pages of different directories

    Unsolved
    3
    0 Votes
    3 Posts
    256 Views
    C
    you should import modules, not directories. Question : are those directories part of one single module ? Or different modules ? in first case, they all just should be declared in your CMakeLists.txt in the qt_add_qml_module directive, optionnaly a qmldir file in each directory if you load from source dir instead of resources (hot reloader for example) and you shouldn't have to import anything, as it's same module. in second case you have to import module in caller's CMakeLists.txt first via classically via target_link_directories and target_link_libraries before you can import in QML.
  • 0 Votes
    4 Posts
    760 Views
    Aleksey_KA
    QTBUG-136489
  • Qt5 Cmake project create qmldir

    Unsolved
    2
    0 Votes
    2 Posts
    249 Views
    S
    The QML files and the qmldir file must be placed inside a module folder, e.g., qml/MyModule/. The qmldir file must be added to the .qrc resource file along with all the QML files it references. The qmldir file must include: A module declaration: module MyModule A list of all QML types with version and filename: Example: MyItem 1.0 MyItem.qml In C++, you must call engine.addImportPath("qrc:/qml"); This tells the QML engine to look for modules inside the .qrc resource system. In your qml.qrc, you must include all files in the correct relative path: <file>qml/MyModule/qmldir</file> <file>qml/MyModule/MyItem.qml</file> Use the module in QML with the correct name and version, as defined in qmldir: import MyModule 1.0 Filenames in qmldir must match exactly (case-sensitive) with the actual file names. CMake must include the .qrc file using qt5_add_resources() and link against Qt5::Qml and Qt5::Quick.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • OpacityMask reduces Image quality

    Unsolved
    5
    0 Votes
    5 Posts
    465 Views
    C
    @Shankarlinga-M sorry for the late reply and thank you. Indeed, I found that the issue is related to the fact that the Screen.DevicePixelRatio is rounded up. When I set the display scaling to 120% the value of Screen.DevicePixelRatio is set to 2 instead of 1.2. Replacing Screen.DevicePixelRatio in the code with 1.2 makes the image look fine. I found also an other thread about this issue https://forum.qt.io/topic/160425/wayland-and-fractional-screen-scaling-reported-as-integer-by-wayland-info-and-q-screen/3
  • Canvas memory leak

    Unsolved
    2
    0 Votes
    2 Posts
    278 Views
    J
    Please create a bugreport over at https://bugreports.qt.io
  • 0 Votes
    10 Posts
    652 Views
    JoeCFDJ
    @Arpitha said in Facing issue in disabling up and down arrow buttons on user selecting 2 values, please hlep me to fix this.: console.info(" ARPITHA " +(flightsDataManager.selectedEffModel.getNavigationRestricted)) if NavigatioRestricted is defined inside selectedEffModel, the access is like the following console.info(" ARPITHA " + flightsDataManager.selectedEffModel. NavigatioRestricted ) //not sure how NavigatioRestricted is defined. and func getNavigationRestricted call is not needed. You need to show some code here and read some basic doc about binding of qml and c++ class.
  • Ctrl+Click on QML Object in QtCreator 15 opens QML file from build tmp directory

    Unsolved
    5
    0 Votes
    5 Posts
    609 Views
    ekkescornerE
    perhaps this bug https://bugreports.qt.io/browse/QTBUG-131920 fixed in 6.8.2 / 6.9.0
  • Edge barrier and real mouse coordinate off

    Unsolved
    1
    0 Votes
    1 Posts
    100 Views
    No one has replied
  • QML Mouse drag laggy

    Unsolved qml draghandler mousearea
    6
    0 Votes
    6 Posts
    802 Views
    Z
    I v solve this problem: insert this 2 line code in main.cpp before create QGuiApplication object: qputenv("QSG_RENDER_LOOP", "basic" ); QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL);
  • qmlRegisterType still usable?

    Unsolved
    7
    1 Votes
    7 Posts
    2k Views
    jsulmJ
    @Groundbounce said in qmlRegisterType still usable?: How do you connect C++ and QML? Like explained in the documentation: https://doc.qt.io/qt-6/qtqml-cppintegration-overview.html QtCompany will for sure not ditch C++ as QML is only for UI and some logic in the UI. Everything else is still C++.
  • 0 Votes
    8 Posts
    1k Views
    S
    import QtQuick 2.15 import QtQuick.Window 2.15 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.15 Window { id: mainWindow visible: true width: 850 height: 360 minimumWidth: 350 minimumHeight: 620 title: "Flight Plan Dashboard" color: "#1e2130" property bool isHorizontal: width >= 700 ColumnLayout { anchors.fill: parent anchors.margins: 10 spacing: 10 GridLayout { id: mainContentGrid Layout.fillWidth: true Layout.fillHeight: true flow: isHorizontal ? GridLayout.LeftToRight : GridLayout.TopToBottom columns: isHorizontal ? 3 : 1 rows: isHorizontal ? 1 : 3 // Flight Plan Panel Rectangle { Layout.fillWidth: !isHorizontal Layout.preferredWidth: isHorizontal ? mainWindow.width * 0.25 : -1 Layout.preferredHeight: isHorizontal ? mainWindow.height - 20 : 100 color: "#282c3e" radius: 5 ColumnLayout { anchors.fill: parent anchors.margins: 12 spacing: 6 Text { text: "Flight Plan 1.0" font.pixelSize: 14 font.bold: true color: "white" } Text { text: "26 Nov 06:43Z" font.pixelSize: 12 color: "#a0a0a0" } Text { text: "KRISTINA-SOLI" font.pixelSize: 14 font.bold: true color: "white" Layout.topMargin: 4 } Text { text: "4047154622*79502/0B" font.pixelSize: 12 color: "#a0a0a0" } Item { Layout.fillHeight: true } } } // Crew Panel Rectangle { Layout.fillWidth: !isHorizontal Layout.preferredWidth: isHorizontal ? mainWindow.width * 0.35 : -1 Layout.preferredHeight: isHorizontal ? mainWindow.height - 20 : 180 color: "#282c3e" radius: 5 ColumnLayout { anchors.fill: parent anchors.margins: 12 spacing: 6 Text { text: "Crew" font.pixelSize: 14 font.bold: true color: "white" } RowLayout { spacing: 6 Text { text: "Flight Deck" font.pixelSize: 12 color: "#a0a0a0" } Rectangle { Layout.preferredWidth: 20 Layout.preferredHeight: 20 radius: 10 color: "#4a5064" Text { anchors.centerIn: parent text: "2" color: "white" font.pixelSize: 10 } } Text { text: "Cabin" font.pixelSize: 12 color: "#a0a0a0" Layout.leftMargin: 8 } Rectangle { Layout.preferredWidth: 20 Layout.preferredHeight: 20 radius: 10 color: "#4a5064" Text { anchors.centerIn: parent text: "4" color: "white" font.pixelSize: 10 } } } Repeater { model: isHorizontal ? 2 : 3 delegate: Rectangle { Layout.fillWidth: true Layout.preferredHeight: 30 color: "transparent" border.color: "#444" border.width: 1 radius: 4 Layout.topMargin: 4 RowLayout { anchors.fill: parent anchors.margins: 6 spacing: 8 Rectangle { Layout.preferredWidth: 20 Layout.preferredHeight: 20 radius: 10 color: "#4a5064" Text { anchors.centerIn: parent text: "👤" color: "white" font.pixelSize: 12 } } Text { text: { if (index === 0) return "CRAIG M GIFFORD"; if (index === 1) return "COLIN P ZIMMERM..."; if (index === 2) return "CHRISTY L ALLEN"; return ""; } color: "white" font.pixelSize: 12 } } } } Item { Layout.fillHeight: true } } } // Aircraft Status Panel with FMS INIT & FA ColumnLayout { Layout.fillWidth: !isHorizontal Layout.preferredWidth: isHorizontal ? mainWindow.width * 0.4 - 30 : -1 Layout.preferredHeight: isHorizontal ? mainWindow.height - 20 : -1 spacing: 6 Rectangle { Layout.fillWidth: true Layout.preferredHeight: 200 color: "#282c3e" radius: 5 ColumnLayout { anchors.fill: parent anchors.margins: 12 spacing: 6 Text { text: "Aircraft Status" font.pixelSize: 14 font.bold: true color: "white" } Text { text: "N542DE / DL375" font.pixelSize: 14 font.bold: true color: "white" Layout.topMargin: 4 } Text { text: "A21N" font.pixelSize: 12 color: "#a0a0a0" } Item { Layout.fillHeight: true } } } RowLayout { Layout.fillWidth: true spacing: 10 Rectangle { Layout.fillWidth: true Layout.preferredHeight: (mainWindow.width * 0.4 - 50) / 3 color: "#343747" radius: 4 Text { anchors.centerIn: parent text: "FMS INIT" color: "white" font.pixelSize: 12 } } Rectangle { Layout.fillWidth: true Layout.preferredHeight: (mainWindow.width * 0.4 - 50) / 3 color: "#343747" radius: 4 Text { anchors.centerIn: parent text: "FA" color: "white" font.pixelSize: 12 } } } } } } }
  • 0 Votes
    3 Posts
    746 Views
    KaguroK
    Hi! This is my problrem too any advice? :(
  • question marks on serial monitor raspberry pi and arduino Serial communication problem.

    Unsolved
    2
    0 Votes
    2 Posts
    290 Views
    SGaistS
    Hi and welcome to devnet, Where are you using Qt in your system ? As per your code, I would say never so it would be better if you explained exactly what runs where and what exactly are you using.
  • ColumnLayout sizing policy and TableView maximum height limitation problem

    Solved
    2
    0 Votes
    2 Posts
    295 Views
    A
    Solution was mostly there and fix appeared very simple: move anchors margins from _fillHeight property calculations to readonly property bool _fillHeight: { let bottom = mapToItem(applicationWindow.contentItem, 0, implicitHeight).y; return bottom > applicationWindow.height } frame.implicitHeight property: implicitHeight: frameColumn.implicitHeight + defaultPixelHeight * 4 Now everything works and looks fine! No errors or binding loops.
  • How do the "QML" and "QMLScene" tools differ?

    Solved
    2
    0 Votes
    2 Posts
    259 Views
    RokeJulianLockhartR
    @RokeJulianLockhart, interest.qt-project.narkive.com/p4tyYKC9 states: The QML tool is a bit more flexible, makes fewer assumptions (e.g. it doesn’t use a QApplication by default, so you don’t end up loading the widgets module into memory if you don’t need it) and is meant as the long-term replacement for qmlscene. QML can be used for non-graphical purposes if your root object is a plain QObject, not an Item or Window; that’s only practical with the qml tool, not qmlscene. It is more directly analogous to other language interpreters like python and perl (which also do not load graphical libraries unless you import the relevant modules in your script), and you can even use the shebang mechanism, so that qml files can be marked executable and run from the command line. You can configure your window system to use it as the default application with which to run any file with the qml extension (e.g. when double-clicking a qml file in your file manager/finder), if you like. (QTBUG-33659 is a request to set up that association when you install the SDK, but that never got done AFAIK. It requires someone with Qt Installer expertise, I think.) So you could nearly forget about qmlscene, except that it has a few handy command-line options that qml still doesn’t.
  • QQuickWebEngineProfile warning advising to use WebEngineProfilePrototype

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