Skip to content

Qt 6

This is where all Qt 6 related questions belong

854 Topics 4.2k Posts
  • Qt 6 undefined reference to `qMain(int, char**)'

    Unsolved
    14
    0 Votes
    14 Posts
    2k Views
    Q

    I have encountered the same error with a library I'm using (SDL2). I don't know whether it is the same library that is causing the issue, but for SDL2 I need to put up a macro to tell it that main() is being handled elsewhere (by QT):

    #include <QApplication> #define SDL_MAIN_HANDLED #include <SDL2/SDL.h>

    Hope it helps!

  • Why is this happening?Please help!

    Unsolved
    2
    0 Votes
    2 Posts
    224 Views
    SGaistS

    Hi and welcome to devnet,

    Without more details about what you are trying to do, it's impossible to answer.
    Are you trying to build that file manually ?
    Are you using a project management system ?
    If so, is it qmake ? cmake ? Something else ?
    If one of the two formers, read the QApplication class documentation. You have at the top the instructions on how to make it available with both these tools.

  • 0 Votes
    18 Posts
    1k Views
    pedisChenP

    @Pl45m4 Thank you for your reply. I tried. here is my example code:

    Version A

    void start_app(void) { int argc = 0; char*argv[] = {nullptr}; QCoreApplication a(argc, argv); a.exec(); } void init_dll() { std::thread th(start_app); h.detach(); }

    I use QLibrary to resolve "init_dll" function and run it.This time the main program is not blocked, no crash down occured .But the signal slot did not work, and QTCPSocket cannot be used.

    Version B

    void start_app(void) { int argc = 0; char*argv[] = {nullptr}; QCoreApplication a(argc, argv); a.exec(); } void init_dll() { start_app(); }

    when I call "init_dll" function in DLLs,the main program will be blocked from running, but the QTCPSocket and signal slots function is workable.

    How can I modify the DLL code so it doesn't block the main program's execution and still allows using QTcpSocket and other Qt components that depend on the event loop(QCoreApplication)?

  • ROS2 not added in QT6

    Solved
    12
    0 Votes
    12 Posts
    893 Views
    serkan_trS

    Thank you for the information.

  • GPL License and Qt Application Manager

    Unsolved
    3
    0 Votes
    3 Posts
    313 Views
    K

    Thanks Pl45m4 !

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

  • Configuring and building Qt for QNX

    Unsolved
    2
    0 Votes
    2 Posts
    353 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
    486 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
    884 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
    550 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
    240 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
    1k 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
    1k 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
    1k 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
    302 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
    319 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
    1 Votes
    2 Posts
    732 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
    205 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
    485 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
    1k Views
    J

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

  • Is there any change in the licensing from qt5 to qt6?

    Unsolved
    2
    0 Votes
    2 Posts
    333 Views
    jsulmJ

    @Vishal-Kumar said in Is there any change in the licensing from qt5 to qt6?:

    Is there any change happened to qt6 opensource licensing which might cause an issue later ?

    As far as I know there are no changes since Qt 5.6 (where LGPL was changes to v3).