Skip to content

Qt 6

This is where all Qt 6 related questions belong

816 Topics 3.9k Posts
QtWS25 Call for Papers
  • Qt 6.2.2 start new android activity

    Unsolved
    2
    0 Votes
    2 Posts
    333 Views
    No one has replied
  • Setting up Visual Studio 2019 for creating QT6 projects

    Unsolved
    7
    1 Votes
    7 Posts
    4k Views
    Q

    One previously(Qt5.11.2) added working correctly. Even without activating it Visual Studio picking and using it. Is there any cache to remove?
    Unable to add new qt version in Qt VS Tools.

    --- qmake(10408): started C:\QT\QT5.12.5\5.12.5\MSVC2017_64\bin\qmake.exe
    --- qmake: Querying persistent properties
    --- qmake(10408): exit code 0 (62.66 msecs)

    vcvars: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat
    cl: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.30.30705\bin\HostX64\x64\cl.exe
    --- qmake(9236): started C:\QT\QT5.12.5\5.12.5\MSVC2017_64\bin\qmake.exe
    --- qmake: Working Directory: C:\Users\xxxxxxxx\AppData\Local\Temp\js2muf1m.fqe
    --- qmake: Arguments: QMAKE_INCDIR_QT=$(QTDIR)\include QMAKE_LIBDIR=$(QTDIR)\lib QMAKE_MOC=$(QTDIR)\bin\moc.exe QMAKE_QMAKE=$(QTDIR)\bin\qmake.exe -o "js2muf1m.fqe.vcxproj" -tp vc -Wnone "js2muf1m.fqe.pro"
    Info: creating stash file C:\Users\xxxxxxxx\AppData\Local\Temp\js2muf1m.fqe.qmake.stash
    ASSERT: "uint(i) < uint(size())" in file c:\users\qt\work\qt\qtbase\include\qtcore../../src/corelib/tools/qstring.h, line 936
    --- qmake(9236): exit code -1073740791 (2293.29 msecs)

    Error reading VS project settings

    Stacktrace:
    at QtVsTools.Core.VersionInformation..ctor(String qtDirIn)
    at QtVsTools.Core.VersionInformation.Get(String qtDir)
    at QtVsTools.Options.QtVersionsPage.SaveSettingsToStorage() in C:\dev\source\qtlabs\vstools\QtVsTools.Package\Options\QtVersionsPage.cs:line 93

  • Why has not anyone application template?

    Solved
    3
    0 Votes
    3 Posts
    160 Views
    T

    @kkoehne You are right,thank you!

  • How to use a DLL on Qt 6 with MSVC 2019 64bit compiler?

    Solved
    6
    0 Votes
    6 Posts
    454 Views
    D

    oh and @raven-worx thank you too

  • 0 Votes
    6 Posts
    551 Views
    D

    @Dmitriano reported this as a bug.

  • 0 Votes
    1 Posts
    237 Views
    No one has replied
  • Qt 6.2 + CMake + extending QML with a C++ class

    Solved
    21
    1 Votes
    21 Posts
    4k Views
    P

    So for clarity for anyone with the same question, the following CMakeLists.txt makes the class Person available to QML via import People, by packaging it behind the scenes as Peopleplugin.

    cmake_minimum_required(VERSION 3.16) project(MyProject VERSION 0.1 LANGUAGES CXX) set(CMAKE_AUTOMOC ON) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(Qt6 6.2 COMPONENTS Quick REQUIRED) qt_add_executable(appMyProject main.cpp ) qt_add_qml_module(appMyProject URI MyProject VERSION 1.0 QML_FILES main.qml ) qt_add_qml_module(People URI People VERSION 1.0 SOURCES Person.h Person.cpp ) target_include_directories(Peopleplugin PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ) target_compile_definitions(appMyProject PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>) target_link_libraries(appMyProject PRIVATE Qt6::Quick People)

    and for those eagle-eyed, main.qml was buggy and should be:

    import QtQuick import People Window { width: 640 height: 480 visible: true Text { text: personBob.name + " wears size " + personBob.shoeSize + " shoes." } Person { id: personBob name: "Bob Jones" shoeSize: 12 } }

    The C++ class Person is derived from QObject:

    #include <QObject> #include <QtQml/qqml.h> class Person : public QObject { Q_OBJECT Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged) Q_PROPERTY(int shoeSize READ shoeSize WRITE setShoeSize NOTIFY shoeSizeChanged) QML_ELEMENT ...

    main.cpp is as autogenerated when creating a new Qt Quick 6.2 project in Qt Creator and makes no mention of Person or the People plugin.

    Other C++ classes can #include "Person.h" and make use of the Person class.

  • Qt 6.2.2 and MinGW 9.0.0 does not deliver a Fortran Compiler

    Unsolved
    16
    0 Votes
    16 Posts
    1k Views
    F

    @Crisian-Adam-0 This is HUGELY APPRECIATED by our community.

    I have not tested this yet but I sure will !!!

    I do not like cross-posting but I will copy-and-paste your notes into our community.

    Our Announcement: https://groups.io/g/JTSDK/message/1884

    Thanks again. I cannot put a solved to this until this is formally addressed by the Qt Maintainers.

  • QT6.2.1 moc.exe includes wrong directory

    Solved
    4
    0 Votes
    4 Posts
    1k Views
    I

    I found a workaround. In the batch process I added the path of QT\MinGW... at the first entry and removed the Path C:\MinGW.
    It works but I am not satisfied. It's the question of time till the next developer runs into the same issue. The path should be explicitely configurable in QT.

  • The QT program developed under win10 runs incorrectly on win7

    Unsolved
    26
    0 Votes
    26 Posts
    3k Views
    B

    Hi @hskoglund
    I will follow your advice.
    Thanks again for your help @JonB and @hskoglund

  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    23 Views
    No one has replied
  • 0 Votes
    12 Posts
    627 Views
    posktomtenP

    A little improved
    Language example.zip

  • 0 Votes
    1 Posts
    638 Views
    No one has replied
  • nested QtConcurrent::map runs into deadlock

    Unsolved
    4
    0 Votes
    4 Posts
    296 Views
    Christian EhrlicherC

    @Heike said in nested QtConcurrent::map runs into deadlock:

    So the fix has been merged in, but isn't fixed properly then, correct?

    Please provide a minimal, compilable example to reproduce the issue then. Best directly in the bug report. But please update to latest (6.2.2 I guess) before.

  • QT6 Suse Linux

    Unsolved
    2
    0 Votes
    2 Posts
    178 Views
    jsulmJ

    @Chauche https://doc.qt.io/qt-5/linux.html

  • Qt6 does not display the entire menu

    Unsolved
    5
    0 Votes
    5 Posts
    214 Views
    posktomtenP

    That was good! Then we can hope that there will be an update.

  • 0 Votes
    2 Posts
    102 Views
    SGaistS

    Hi,

    Sounds a good start for a bug report yes. Maybe even a patch :-)

    There might have been some changes between the GStreamer used to rewrite Qt Multimedia 6 and the one of your system.

  • 0 Votes
    2 Posts
    166 Views
    kshegunovK

    Well, I forgot about this a little bit, but I'm adding the solution anyway for future reference.

    After some reading through the documentation and experimenting, it appears that dynamically registering a foreign class to a qml module declared as above isn't possible (nor encouraged, nor supported, as per the docs). The "old" way of plugin whatever you want into the registered QML namespace doesn't work anymore.

    The proper solution is to wrap the class as described in the docs and use that wrapper to expose it to the QML engine. Like follows (Tsc::Engine is what I'm attempting to inject):

    Header:

    #include <QQmlEngine> #include <QJSEngine> struct EngineForeign { Q_GADGET QML_FOREIGN(Tsc::Engine) QML_SINGLETON QML_NAMED_ELEMENT(Engine) public: static Tsc::Engine * create(QQmlEngine *, QJSEngine *); static QJSEngine * currentJsEngine; };

    Source:

    #include "TscQml.h" QJSEngine * EngineForeign::currentJsEngine = nullptr; Tsc::Engine * EngineForeign::create(QQmlEngine *, QJSEngine * jsEngine) { Tsc::Engine * engine = Tsc::Engine::instance(); Q_ASSERT(engine->thread() == jsEngine->thread()); Q_ASSERT(!currentJsEngine || currentJsEngine == jsEngine); currentJsEngine = jsEngine; QJSEngine::setObjectOwnership(engine, QJSEngine::CppOwnership); return engine; } #include "moc_TscQml.cpp"

    After that everything works as expected and I can see and use it in QML:

    import QtQuick import QtQuick.Controls import Tsc ApplicationWindow { width: 640 height: 480 visible: true title: qsTr("Hello World") Rectangle { anchors.fill: parent color: 'red' Connections { target: Engine.simulation function onAdvanced() { console.log('advanced') } } } }

    Notably, this must be done for the singleton itself only. simulation is a QObject and a registered property (Q_PROPERTY) of the Tsc::Engine instance, which hasn't been wrapped nor does it appear necessary for this class to be exposed explicitly to the QML engine.

  • 0 Votes
    6 Posts
    773 Views
    SGaistS

    See for example QTextCurso::setCharFormat.

  • 0 Votes
    3 Posts
    394 Views
    G

    @Gojir4 thank you so much