Skip to content

QML and Qt Quick

Looking for The Bling Thing(tm)? Post here!
20.0k Topics 77.3k Posts
  • Manage focus between multiple displays on Linux Wayland

    Unsolved
    4
    0 Votes
    4 Posts
    336 Views
    SGaistS
    That's something worth discussing. I currently don't know the details of the Wayland protocols and how to leverage them from Qt for your situation.
  • PySide6-QtQuick & QML problem generating an executable with NUITKA

    Unsolved
    4
    0 Votes
    4 Posts
    518 Views
    SGaistS
    Hi, Which version of PySide6 would that be ? Which version of Nuitka ? On which OS ? Also, while the logs nuitka might mention webengine, are you sure it's actually included ? I did a test on macOS and ended up with a 84MB binary which is not that surprising accounting for the QtQuick stuff plus QtCore and QtGui.
  • picture locations

    Unsolved
    12
    0 Votes
    12 Posts
    722 Views
    G
    I don't understand why something so essential is such a mystery. The documentation page presents a sample fise: [code] <RCC> <qresource prefix="/"> <file>images/copy.png</file> <file>images/cut.png</file> <file>images/new.png</file> <file>images/open.png</file> <file>images/paste.png</file> <file>images/save.png</file> </qresource> </RCC> [/code] It then proceeds to say, one would assume with reference to the above: The Qt Resource System The Qt resource system is a platform-independent mechanism for shipping resource files in an application. Use it if your application always needs a certain set of files (like icons, translation files, images), and you don't want to use system-specific means to package and locate these resources. Most commonly, the resource files are embedded into your application executable, or in libraries and plugins that are loaded by the application executable. Alternatively, the resource files can also be stored in an external resource file. The resource system is based on tight cooperation between Qt's rcc resource compiler, the build system, and the Qt runtime API. Note: Currently, the Qt resource system does not make use of any system-specific capabilities for handling resources, such as the ones on Windows, macOS, and iOS. This might change in a future Qt release. The Qt Resource Compiler (rcc) The Resource Compiler (rcc) command line tool reads resource files and generates either a C++ or Python source file, or an .rcc file. The list of files and related metadata is passed to rcc in the form of a Qt Resource Collection File. By default, rcc will generate C++ source code that is then compiled as part of an executable or library. The -g python option generates Python source code instead. The -binary option generates a binary archive that is by convention saved in an .rcc file and can be loaded at runtime. Note: While it is possible to run rcc from the command line, this is typically best left to a build system. See also the sections about qmake and CMake below. Qt Resource Collection File (.qrc) A .qrc file is an XML document that enumerates local files to be included as runtime resources. It serves as input to rcc. Here's an example .qrc file: <RCC> <qresource prefix="/"> <file>images/copy.png</file> <file>images/cut.png</file> <file>images/new.png</file> <file>images/open.png</file> <file>images/paste.png</file> <file>images/save.png</file> </qresource> </RCC> Each <file> element in the XML identifies a file in the application's source tree. The path is resolved relative to the directory containing the .qrc file. [quote] The path is also used by default to identify the file's content at runtime. That is, the file titlebarLeft.png will be available in the resource system as :/res/titlebarLeft.png or qrc:/res/titlebarLeft.png. To override this default run-time name, see Prefixes and Aliases. [/quote] titlebarLeft.png is not in the file example, I know it's nitpicky but it does not instill confidence. Further it is not made clear which instructions are being given for the QT creator IDE where one would assume that lots of setup is done for you, that is the point of an IDE as well as presumably for use of the library on it's own in whatever environment the programmer chooses.
  • QML Debug error finding file

    Unsolved
    1
    0 Votes
    1 Posts
    91 Views
    No one has replied
  • Dependency injection in C++ class registered with QML_SINGLETON

    Unsolved c++ qml qml singleton
    13
    0 Votes
    13 Posts
    3k Views
    A
    Hey @eternal_void , I just got back to using Qt for another project. This is new account (I was @talksik), but here are my findings in a similar post after a ton of research and coming up with a custom solution not really mentioned anywhere: https://forum.qt.io/post/821291
  • Custom C++ QML element with arguments

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    A
    This has been a question of mine for over a year. I resorted to having a factory class that has methods to instantiate various view models (and pass in dependencies) and return the pointer to that view model. This factory would be exposed to QML via singleton or contextProperty at the start of my program. Any QML view can decide which view models it wants and doesn't deal with dependency injection. Here is an example: class ViewModelFactory : public QObject { Q_OBJECT QML_ELEMENT QML_SINGLETON public: Q_INVOKABLE HomeViewModel* createHomeViewModel(QObject* parent = nullptr) { // Inject dependencies from ApplicationModels auto& appModels = ApplicationModels::instance(); return new HomeViewModel(appModels.smartHomeService(), appModels.userService(), parent); } }; Now, the above example makes ApplicationModels a singleton and passes it to the view model, but you could imagine a world where the factory can manage the dependencies without them being singletons. It took a lot of thinking and I gathered this approach by looking at how QtWidgets does things: a very hierarchical object structure where the MainWindow class would contain everything within it and proctor instantiation, DI, and more. QML just has access to what is publicly exposed by the ApplicationModel/factory, and no longer needs access to dependencies for ViewModels to use their desired view model. Note: I have not tested this yet (my fear being that I do NOT know the impact of calling factory methods on init of a Qml component)
  • OpenSSL with QML Image source. Self signed ca-certificate

    Solved
    8
    1 Votes
    8 Posts
    2k Views
    A
    The error you're encountering ("QML Image: SSL handshake failed") typically happens when there's a problem establishing a secure connection between the QML application and the server you're trying to connect to. This is often caused by issues with SSL certificates, the server's configuration, or network problems. To resolve this error, you can try the following steps: Check SSL/TLS Configuration: Ensure that the server you're connecting to has a valid SSL certificate. If you're using a self-signed certificate, it may not be trusted by the system. Make sure the certificate is correctly installed. Update QML/Qt and SSL Libraries: Sometimes, outdated libraries can cause compatibility issues. Make sure you're using the latest version of QML, Qt, and SSL libraries (OpenSSL). Verify Network and Proxy Settings: If you're behind a proxy or firewall, ensure the settings are properly configured and not blocking the SSL handshake. Trust Certificates: If the certificate isn't recognized by the system, you may need to manually add the certificate to the trust store. Enable Debugging: You can enable debugging in Qt to get more information about the SSL handshake failure. Set the following environment variable before running your application: ini Copy Edit QT_DEBUG_PLUGINS=1 For more detailed information and troubleshooting, you can refer to the following resources: Qt SSL documentation OpenSSL documentation Common SSL handshake errors Let me know if you need more help!
  • Sync QQuickPaintedItem and QML painting

    Solved
    3
    0 Votes
    3 Posts
    251 Views
    -
    Ah, didn't read this. Thanks for the hint...
  • QML SelectionRectangle behavior change

    Unsolved
    1
    0 Votes
    1 Posts
    120 Views
    No one has replied
  • Correct way to deploy QML plugin with support of QDS

    Unsolved
    1
    0 Votes
    1 Posts
    207 Views
    No one has replied
  • STM32MP157C QT Quick portrait orientation

    Unsolved
    1
    0 Votes
    1 Posts
    111 Views
    No one has replied
  • 0 Votes
    3 Posts
    259 Views
    P
    [image: e7e95ae0-e17e-44c2-b1d7-bfe4b1435410.jpg] The complete picture looks like this
  • Bug in qt 5.15.2: Button.checkable = false is gettin ignored

    Unsolved
    2
    0 Votes
    2 Posts
    187 Views
    MarkkyboyM
    Checkable and checked are not components of Button QML. A similar question here; https://forum.qt.io/topic/36479/solved-button-checkable-and-checked-not-working albeit a different answer/outcome from my response. Regardless, I still myself, cannot use checkable or checked with Button.
  • Disabling Online Tile Requests in Qt 5.12 for Offline Map Functionality

    Solved
    3
    0 Votes
    3 Posts
    241 Views
    S
    @SGaist Thank you so much!
  • How to horizontally center an item in a ColumnLayout in a StackLayout?

    Unsolved
    2
    0 Votes
    2 Posts
    203 Views
    M
    It turns out wrapping the child Layout in an Item does the trick. Don't know why and whether this is the best solution import QtQuick import QtQuick.Controls import QtQuick.Layouts Window { height: 300 width: 240 visible: true StackLayout { anchors.fill: parent Item { Layout.fillWidth: true Layout.fillHeight: true ColumnLayout { anchors.fill: parent Rectangle { color: "red" Layout.preferredWidth: 100 Layout.preferredHeight: 50 Layout.alignment: Qt.AlignHCenter // Center within ColumnLayout } // other items } } // other items } }
  • 0 Votes
    6 Posts
    365 Views
    jsulmJ
    @VITORdk said in Error: ":\Qt\6.7.3\android_arm64_v8a\include\QtCore\qnamespace.:24:1: error: error: Parse error at "__attribute__"": So I reduced my file to an empty file You can't compile an empty file. Also, I guess your project consists of more than just an empty file. Please provide more information, else nobody knows what you're doing and what the problem is. Did you try to create a new widget project in QtCreator and build it for Android?
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • How to dynamically insert a Node in View3d using cpp in qt5 qt quick 3d

    Unsolved
    1
    0 Votes
    1 Posts
    120 Views
    No one has replied
  • MapPolygon border color doesnt change on update

    Unsolved
    1
    0 Votes
    1 Posts
    77 Views
    No one has replied
  • No word suggestions on Android in TextEdit

    Solved
    6
    1 Votes
    6 Posts
    410 Views
    M
    Fixed in 6.8.2