Skip to content

Qt 6

This is where all Qt 6 related questions belong

821 Topics 4.0k Posts
  • Read before posting in this category!

    Pinned Locked
    3
    6 Votes
    3 Posts
    3k Views
    SGaistS

    And now (incomplete at the time of this post): https://wiki.qt.io/New_Features_in_Qt_6.2

  • 0 Votes
    5 Posts
    28 Views
    Pl45m4P

    @pedisChen said in When calling the Shared Libraries (DLL) created by QT6, the main program will crash:

    My dll file was built with QT6, and then I created another project with QT6 and tried to call it

    You don't "call" DLLs, you link them.

    Then I added the generated file to my project directory, but it's still the same.

    This is not what @J-Hilk was talking about.
    If you export/deploy your qt widget library, you need to ship it with all the other libs your library needs.

    @pedisChen said in When calling the Shared Libraries (DLL) created by QT6, the main program will crash:

    I think it is because the dll lacks of an QT event loop mechanism. so I added an init function in dll,and need to call the init function first , defined like this:

    QCoreApplication a(argc, argv); return a.exec();

    A library doesn't necessarily need that.
    A Qt library can be a QWidget, just a colletion of functions or something else...
    None of these need their own QCoreApplication, when used in other Qt apps.
    (They do in general in order to work, but at least not their own. The main loop from the app to which your library is linked to, is fine).

    See this example:
    If you look at the code, there is no main.cpp or additional QApplication involved.
    But one is needed to use the library widget in your main app.

    https://doc.qt.io/qt-6/qtdesigner-customwidgetplugin-example.html Code: https://code.qt.io/cgit/qt/qttools.git/tree/examples/designer/customwidgetplugin?h=6.8

    Edit:

    @pedisChen said in When calling the Shared Libraries (DLL) created by QT6, the main program will crash:

    This worked, but it would always block the main program. Then I planned to use QThread to create a new process in the dll to run a.exec(), but it failed and the new process task could not run.I dont know why...

    In what way do you use your library? Or how do you intend to use it in some application?
    How does your library work? Do you export a single widget, which uses QTCPSocket in your library?

    Another observation:

    If you don't have an event loop in your main application (when no Qt involved in main app), you obviously can't create a QThread which then should host the QApplication instance... QThread is a wrapper for std::thread and is a QObject itself. Therefore it also needs a QApplication to work properly.
    Use a plain std::thread instead.

  • ROS2 not added in QT6

    Solved
    12
    0 Votes
    12 Posts
    110 Views
    serkan_trS

    Thank you for the information.

  • Qt Graphs. Building 2d plot using c++ only.

    Unsolved
    1
    0 Votes
    1 Posts
    20 Views
    No one has replied
  • GPL License and Qt Application Manager

    Unsolved
    3
    0 Votes
    3 Posts
    91 Views
    K

    Thanks Pl45m4 !

    I think it will be more reliable if I directly ask to Qt.

  • 0 Votes
    11 Posts
    12k Views
    B

    "sudo apt-get install libgl1-mesa-dev" also worked for me with the error "failed to find required Qt component 'Gui' "
    (Ubuntu 24.04 LTS)

  • Configuring and building Qt for QNX

    Unsolved
    2
    0 Votes
    2 Posts
    193 Views
    J

    We need to set the Qt6HostInfo_DIR as a cmake parameter like -DQt6HostInfo_DIR=/home/...

  • Qt6, TextField not work in Android

    Unsolved
    4
    0 Votes
    4 Posts
    189 Views
    O

    Is Qt a balloon? Working with Qt on Android has been a struggle for a year. I downloaded Qt 6.8, and this issue still hasn't been resolved. Can you believe it? It'll be 2025. Qt 6.8 has been released, and we still can't use input on Android? I used to enjoy developing with Qt, but I'm starting to wonder if I learned it for nothing.

    I'm using Qt 6.8 and I've created an Android application for testing, which includes a TextField. When I click on the TextField, the keyboard comes over the input, and I can't see what is being typed.

  • Error during build from source (AutoMOC)

    Solved
    7
    0 Votes
    7 Posts
    144 Views
    A

    if you want to benefit from an LTS, even with free version of Qt, you have to use the latest minor release available, that is 6.5.6, which brings some bugfixes and security patches.
    If you use 6.5.0, you won't benefit those fixes that have been introduced from 6.5.1 to 6.5.6.
    And it's the same for any version, not only LTS.

    @Christian-Ehrlicher said in Error during build from source (AutoMOC):

    There is no advantage for a non-paying customer to stick at a LTS version at all.

    I personnaly prefer using the latest LTS over latest version when I don't need the new features as new features also come along with potential new bugs and security issues.

    Use the pre-compiled binaries from the Qt online installer - much easier to use and no problems during compilation.

    I agree, self-building is not needed.

  • 0 Votes
    5 Posts
    149 Views
    JonBJ

    @JuFu
    I do not believe that a "crash" error when running your program can be anything like or have any relation to a "crash" from a compiler. They are two totally different issues.
    I do not believe you cannot obtain a "stack trace" if your program crashes at runtime. Try running it from inside a debugger.

  • QTouchEvents::TouchPoint class migration from Qt5 to Qt6

    Unsolved
    2
    0 Votes
    2 Posts
    95 Views
    VRoninV

    I found the source of the change but there is not much more colour on the reasoning behind it. The setters were explicitly moved in the private API so constructors look like your only option (unless you want to use the private headers)

  • moc-generated code error at Qt6 when not at Qt5

    Solved
    18
    0 Votes
    18 Posts
    390 Views
    J.HilkJ

    @JonB non of our customers use Linux, only reason why we support macOS is because its my development environment and its only a few steps more to deploy for it as well ;)

  • Could not find a configuration file

    Unsolved
    8
    0 Votes
    8 Posts
    288 Views
    jsulmJ

    @Kais-Ahmad Are you by any chance mixing MSVC and MinGW? MinGW Qt build requires GLibC.

  • Painting a QVideoFrame on a QVideoWidget with QT6

    Solved
    5
    0 Votes
    5 Posts
    947 Views
    F

    For those who are digging the depths of the internet to do this in Python, I figured out a way. It looks like the Python docs are wrong and/or ambiguous: "The video frame can then be used to read out the data of those frames and handle them further. When using QPainter, the QVideoFrame can be drawing using the paint() method in QVideoSink ."

    I'm not a professional programmer so this may be ugly/non-conforming for some people but this works:

    You can set the QMediaCaptureSession's video sink to your custom sink, and also make a QVideoWidget to display the frames. Then, take that custom sink, and connect some Slot method to the videoFrameChanged Signal, and inside that method do what you need to the frame, and then you can take that frame and use QVideoWidget.videoSink().setVideoFrame(the frame you just modified) and it works like a charm.

    Please respond if this is unclear.

    PS: mods/admins if this is in the wrong place please let me know.

  • 0 Votes
    3 Posts
    108 Views
    Pl45m4P

    @Damned-Ananas

    The code you show does not work as the three QLabels are not part of any layout.
    So setting

    hLayout->setStretch(0, 1); hLayout->setStretch(1, 1); hLayout->setStretch(2, 4);

    does not affect the labels, unless you are doing something else which you did not show.

    And, as @JonB said above, until the layouts are applied and the widget is shown, you can't trust the widget's geometry you receive from geometry(), width() or height() as these values are generic/default values based on your settings and not how the widget actually looks when being rendered in some window or parent widget.

    So please show your complete/actual code (and/or try what @JonB suggested)

  • 0 Votes
    2 Posts
    207 Views
    M

    Hello,
    Unfortunately, there's no direct way to determine if your fragment shader is running within a Qt application or environment using built-in preprocessor directives or variables.
    Understanding the Limitations
    Shader Isolation: Shaders operate in a relatively isolated environment, with limited access to the surrounding application context.
    Platform-Specific Information: Information about the application environment is typically handled at a higher level, outside the shader's scope.

  • Windows11 native appearance question

    Unsolved
    2
    0 Votes
    2 Posts
    240 Views
    I

    I also have the same issue, and cannot find anyone else complaining. I don't have a solution for you though.

    I recently transitioned from 6.6.1 to 6.7.2. And the "windows11" style in light mode looks hideous. There is less contrast throughout the application, making it difficult to navigate. Some bits are nice, but most are bad. The silver lining is that dark mode is better than the previous Fusion style, especially checkboxes. In light mode, I'm setting the style to "windowsvista" to achieve 6.6.1 look for now.

  • Qt to Sql connection

    Unsolved
    3
    0 Votes
    3 Posts
    107 Views
    JonBJ

    @Chakravarthi-N
    Same as it has always been. Have you started by reading SQL Programming and Connecting to Databases?

  • Bluetooth not working In Qt 6

    Unsolved
    6
    0 Votes
    6 Posts
    257 Views
    M

    @JonB @Q-Master @Qt-Enthusiast @Qt-embedded-developer I have this configuration use for msvc compiler and i have run different project that perfectly run with this configuration

    image.png

  • Question for Qt6.2 - Qt.labs.platform Dialog

    Unsolved
    6
    0 Votes
    6 Posts
    805 Views
    J

    because the qt.labs.platform has the Dialog as well, need to specifically use Dialog control in QtQuick.Controls