Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.7k Topics 457.9k Posts
  • My built and deployed Qt application does not start.

    Solved
    6
    0 Votes
    6 Posts
    249 Views
    K
    I made the following changes to each file: CMakeLists.txt Deleted qt_policy(SET QTP0001 NEW) Added REQUIRES 6.5 to the qt_standard_project_setup argument main.cpp Added using namespace Qt::Literals::StringLiterals; after include. Changed url(u"qrc:/QmlCppExample/main.qml"_qs) to url("qrc:/qt/qml/QmlCppExample/main.qml"_s) For this, I referred to the following: https://www.qt.io/blog/whats-new-for-qml-modules-in-6.5 Console log for cmake configure > cmake --preset msvc-x64-debug Preset CMake variables: CMAKE_BUILD_TYPE="Debug" CMAKE_CXX_COMPILER="cl" CMAKE_INSTALL_PREFIX:PATH="E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug" CMAKE_PREFIX_PATH="D:\Qt\6.9.3\msvc2022_64" -- The CXX compiler identification is MSVC 19.38.33134.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: D:/ProgramFiles/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.38.33130/bin/Hostx64/x64/cl.exe - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Looking for C++ include pthread.h -- Looking for C++ include pthread.h - not found -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) -- -- -- deploy_script :E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/build/debug/.qt/deploy_qml_app_appqml_cpp_example_f260af503d.cmake -- -- -- Configuring done -- Generating done -- Build files have been written to: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/build/debug Console log for cmake build and install > cmake --build build\debug --target install [19/20] Install the project...-- Install configuration: "Debug" -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/bin/appqml-cpp-example.exe -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/qtquick2plugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQml/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQml/qmlplugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQml/Models/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQml/Models/modelsplugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQml/WorkerScript/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQml/WorkerScript/workerscriptplugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Controls/Basic/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Templates/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Templates/qtquicktemplates2plugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Controls/impl/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Controls/impl/qtquickcontrols2implplugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Controls/Basic/impl/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Controls/Basic/impl/qtquickcontrols2basicstyleimplplugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Shapes/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/QtQuick/Shapes/qmlshapesplugind.dll -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/Qt/labs/qmlmodels/qmldir -- Installing: E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/qml/Qt/labs/qmlmodels/labsmodelsplugind.dll -- Writing E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/bin/qt.conf -- Running Qt deploy tool for E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/build/debug/appqml-cpp-example.exe in working directory 'E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug' 'D:/Qt/6.9.3/msvc2022_64/bin/windeployqt.exe' 'E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/build/debug/appqml-cpp-example.exe' '--dir' '.' '--libdir' 'bin' '--plugindir' 'plugins' '--qml-deploy-dir' 'qml' '--translationdir' 'translations' '--force' '--qtpaths' 'D:/Qt/6.9.3/msvc2022_64/bin/qtpaths6.exe' 'qml/QtQuick/qtquick2plugind.dll' 'qml/QtQml/qmlplugind.dll' 'qml/QtQml/Models/modelsplugind.dll' 'qml/QtQml/WorkerScript/workerscriptplugind.dll' 'qml/QtQuick/Controls/Basic/qtquickcontrols2basicstyleplugind.dll' 'qml/QtQuick/Templates/qtquicktemplates2plugind.dll' 'qml/QtQuick/Controls/impl/qtquickcontrols2implplugind.dll' 'qml/QtQuick/Controls/Basic/impl/qtquickcontrols2basicstyleimplplugind.dll' 'qml/QtQuick/Shapes/qmlshapesplugind.dll' 'qml/Qt/labs/qmlmodels/labsmodelsplugind.dll' E:\work\024_Qt\QtAcademy\how-to-expose-c-to-qml\build\debug\appqml-cpp-example.exe 64 bit, debug executable [QML] Adding in plugin type generic for module: Qt6Gui Adding in plugin type iconengines for module: Qt6Gui Adding Qt6Svg for qsvgicond.dll from plugin type: iconengines Adding in plugin type imageformats for module: Qt6Gui Adding in plugin type networkinformation for module: Qt6Network Adding in plugin type platforms for module: Qt6Gui Adding in plugin type qmltooling for module: Qt6Qml Adding in plugin type tls for module: Qt6Network Skipping plugin qopensslbackendd.dll. Use -force-openssl or specify -openssl-root if you want to use it. Direct dependencies: Qt6Core Qt6Gui Qt6LabsQmlModels Qt6Network Qt6OpenGL Qt6Qml Qt6QmlMeta Qt6QmlModels Qt6QmlWorkerScript Qt6Quick Qt6QuickControls2 Qt6QuickControls2Basic Qt6QuickControls2BasicStyleImpl Qt6QuickControls2Impl Qt6QuickShapes Qt6QuickTemplates2 All dependencies : Qt6Core Qt6Gui Qt6LabsQmlModels Qt6Network Qt6OpenGL Qt6Qml Qt6QmlMeta Qt6QmlModels Qt6QmlWorkerScript Qt6Quick Qt6QuickControls2 Qt6QuickControls2Basic Qt6QuickControls2BasicStyleImpl Qt6QuickControls2Impl Qt6QuickShapes Qt6QuickTemplates2 To be deployed : Qt6Core Qt6Gui Qt6LabsQmlModels Qt6Network Qt6OpenGL Qt6Qml Qt6QmlMeta Qt6QmlModels Qt6QmlWorkerScript Qt6Quick Qt6QuickControls2 Qt6QuickControls2Basic Qt6QuickControls2BasicStyleImpl Qt6QuickControls2Impl Qt6QuickShapes Qt6QuickTemplates2 Qt6Svg Updating Qt6Cored.dll. Updating Qt6Guid.dll. Updating Qt6LabsQmlModelsd.dll. Updating Qt6Networkd.dll. Updating Qt6OpenGLd.dll. Updating Qt6Qmld.dll. Updating Qt6QmlMetad.dll. Updating Qt6QmlModelsd.dll. Updating Qt6QmlWorkerScriptd.dll. Updating Qt6Quickd.dll. Updating Qt6QuickControls2d.dll. Updating Qt6QuickControls2Basicd.dll. Updating Qt6QuickControls2BasicStyleImpld.dll. Updating Qt6QuickControls2Impld.dll. Updating Qt6QuickShapesd.dll. Updating Qt6QuickTemplates2d.dll. Updating Qt6Svgd.dll. Updating opengl32sw.dll. Updating d3dcompiler_47.dll. Updating dxcompiler.dll. Updating dxil.dll. Updating concrt140d.dll. Updating msvcp140_1d.dll. Updating msvcp140_2d.dll. Updating msvcp140d.dll. Updating msvcp140d_atomic_wait.dll. Updating msvcp140d_codecvt_ids.dll. Updating vccorlib140d.dll. Updating vcruntime140_1d.dll. Updating vcruntime140_threadsd.dll. Updating vcruntime140d.dll. Creating directory E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/plugins/generic. Updating qtuiotouchplugind.dll. Creating directory E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/plugins/iconengines. Updating qsvgicond.dll. Creating directory E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/plugins/imageformats. Updating qgifd.dll. Updating qicod.dll. Updating qjpegd.dll. Updating qsvgd.dll. Creating directory E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/plugins/networkinformation. Updating qnetworklistmanagerd.dll. Creating directory E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/plugins/platforms. Updating qwindowsd.dll. Creating directory E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/plugins/qmltooling. Updating qmldbg_debuggerd.dll. Updating qmldbg_inspectord.dll. Updating qmldbg_locald.dll. Updating qmldbg_messagesd.dll. Updating qmldbg_natived.dll. Updating qmldbg_nativedebuggerd.dll. Updating qmldbg_previewd.dll. Updating qmldbg_profilerd.dll. Updating qmldbg_quickprofilerd.dll. Updating qmldbg_serverd.dll. Updating qmldbg_tcpd.dll. Creating directory E:/work/024_Qt/QtAcademy/how-to-expose-c-to-qml/install/debug/plugins/tls. Updating qcertonlybackendd.dll. Updating qschannelbackendd.dll. Creating translations... Creating qt_ar.qm... Creating qt_bg.qm... Creating qt_ca.qm... Creating qt_cs.qm... Creating qt_da.qm... Creating qt_de.qm... Creating qt_en.qm... Creating qt_es.qm... Creating qt_fa.qm... Creating qt_fi.qm... Creating qt_fr.qm... Creating qt_gd.qm... Creating qt_he.qm... Creating qt_hr.qm... Creating qt_hu.qm... Creating qt_it.qm... Creating qt_ja.qm... Creating qt_ka.qm... Creating qt_ko.qm... Creating qt_lg.qm... Creating qt_lv.qm... Creating qt_nl.qm... Creating qt_nn.qm... Creating qt_pl.qm... Creating qt_pt_BR.qm... Creating qt_ru.qm... Creating qt_sk.qm... Creating qt_sv.qm... Creating qt_tr.qm... Creating qt_uk.qm... Creating qt_zh_CN.qm... Creating qt_zh_TW.qm... I finally got it to run. [image: 9c56ecc9-de94-4227-ba95-0acc6dbba702.png] Thank you for your comments so far. I would like to close this topic as resolved.
  • Output message from Qt 6.10.0 when debugging code

    Unsolved
    5
    0 Votes
    5 Posts
    179 Views
    PerdrixP
    I develop under Visual Studio for my application normally, and had set the application manifest for High DPI awareness. It appears that if you do this and then call SetProcessDpiAwarenessContext() it will fail as above. Totally weird! What's embarrassing is I already reported this here some long while ago and had forgotten!!! https://forum.qt.io/topic/141236/unexpected-message-in-debug-log Blush! David
  • How to add a QCompleter to a Qtreeview

    Unsolved
    2
    0 Votes
    2 Posts
    81 Views
    jeremy_kJ
    @electric-dev said in How to add a QCompleter to a Qtreeview: completar=["ABB","auto","avellana","asturia"] completer = QCompleter(completar) ... completer.setModel(QFileSystemModel(completer)) ... self.my_model=QStandardItemModel(self,completer) self.setModel(self.my_model) These three sections of code are mutually incompatible. QCompleter supports a single model at a time. In addition, the completer needs to be set on an input widget such as QLineEdit, or queried as described in the documentation.
  • 0 Votes
    2 Posts
    81 Views
    JKSHJ
    Hi @jason1122, and welcome! Do you still see the memory leak with Qt 6.10.0?
  • Can not upload files to QT Forum

    Solved
    8
    1 Votes
    8 Posts
    255 Views
    A
    I copy pasted it.
  • Create a secure Grpc Channel without specifying certificates

    Unsolved
    11
    0 Votes
    11 Posts
    2k Views
    J
    @talksik Thanks for that answer. I spent a few hours trying to figure out why my QGrpc client wouldn't connect using SSL. Calling the below on my SSLConfiguration fixed it. setAllowedNextProtocols({ "h2" }). I agree the documentation isn't great for this, which is a shame.
  • how to add description properties

    Unsolved
    9
    0 Votes
    9 Posts
    696 Views
    T
    @hskoglund I just tried using these 2 in our .pro file . The Qt Creator editor didnt recognize them (not color coded like other keywords in the pro file) and when I built the copyright was still not in the exe details. Did these show up in a Qt 6. version or were they available in Qt 5.12.11 (what we're currently on) Google said they should be available in 5 though.
  • QAbstractListModel with base and derived class

    Solved
    5
    0 Votes
    5 Posts
    124 Views
    JonBJ
    @Redman said in QAbstractListModel with base and derived class: I do not see the benefit here. Please elaborate. To me it looks the same, just switched positions of A and B property lookup. 100% yes. And as I wrote as a consequence: This would avoid doing two data lookups and would allow for a genuine null value in either case. So two benefits :)
  • QT5.9 Dialog stays on all workspace

    Unsolved
    5
    0 Votes
    5 Posts
    154 Views
    F
    @jsulm The problem was solved, I mainly want to know the reason. Thank you~~
  • Nested ScrollView

    Unsolved
    2
    0 Votes
    2 Posts
    113 Views
    Ronel_qtmasterR
    @nilsl Your code is a bit wrong. As you want to implement Nested ScrollView, the second scrollview shouldn't be inside ListView's delegate. It has nothing to do with the Listview ,nor it's delegate. In fact Listview itself has scrolling behaviour.Try something like this import QtQuick 6.0 import QtQuick.Controls 6.0 ApplicationWindow { visible: true width: 640 height: 480 title: "Nested ScrollView Example" // Outer ScrollView for vertical scrolling ScrollView { anchors.fill: parent clip: true contentHeight: column.height Column { id: column width: parent.width // Example content for the outer scroll view Rectangle { width: parent.width height: 200 color: "lightgray" Text { text: "Outer Scrollable Content" anchors.centerIn: parent } } Rectangle { width: parent.width height: 100 color: "lightblue" Text { text: "More Outer Content" anchors.centerIn: parent } } // Inner ScrollView for horizontal scrolling ScrollView { width: parent.width height: 150 contentWidth: 1000 // Make it wider than the parent horizontalAlignment: ScrollView.AlignLeft Row { spacing: 10 Rectangle { width: 200 height: 100 color: "lightgreen" } Rectangle { width: 200 height: 100 color: "lightcoral" } Rectangle { width: 200 height: 100 color: "lightsalmon" } Rectangle { width: 200 height: 100 color: "lightpink" } } } Rectangle { width: parent.width height: 300 color: "lightyellow" Text { text: "Final Outer Content" anchors.centerIn: parent } } } } }
  • install QT 6.6.0 / Macos Monterey

    Unsolved
    2
    0 Votes
    2 Posts
    64 Views
    SGaistS
    Hi, One possible way might be the aqtinstall project.
  • QSqlTableModel Network Performance

    Solved
    17
    0 Votes
    17 Posts
    877 Views
    Z
    Thanks again for all the replies here; circling back to mark this as solved. I ended up implementing a custom QAbstractTableModel based on the ModifiedRow class in the QSqlTableModel source code. The local data is populated via a QSqlQuery with setForwardOnly set to true. void CachedSqlTableModel::select() { if(m_select.isEmpty() || m_tableName.isEmpty()){ qDebug() << "Invalid select statement"; return; } //Initialize query QSqlQuery query; query.setForwardOnly(true); query.prepare(selectStatement()); query.exec(); if(query.isActive()){ beginResetModel(); //Reset data structure m_cache.clear(); //Populate header data m_record = query.record(); //Populate table data while(query.next()){ m_cache.push_back(CachedRow(CachedRow::Update, query.record())); } endResetModel(); } else { m_error = query.lastError(); } All of the related cached database operations are executed in the exact same way as the code in the QSqlTableModel database handlers. virtual bool updateRowInTable(int row, const QSqlRecord &values); virtual bool insertRowIntoTable(const QSqlRecord &values); virtual bool deleteRowFromTable(int row); A big thank you to @Kent-Dorfman for the additional insights here. I implemented all of the suggestions above (stored procedures, transactions, indexing, limiting datasets, etc.) and there is a noticeable speed difference on all fronts.
  • QFileDialog::getOpenFileName Fails to Display Dialog with Native macOS

    Unsolved
    5
    1 Votes
    5 Posts
    612 Views
    SGaistS
    Quoting the reasons from the ticket: The app is missing a bundle identifier, which apparently affects whether the OS shows native file dialogs. Set MACOSX_BUNDLE_GUI_IDENTIFIER to fix this. The reason qt_add_executable works is because it automatically sets MACOSX_BUNDLE_GUI_IDENTIFIER if not set.
  • How to make a round corner for the qwebengineview?

    Unsolved
    14
    0 Votes
    14 Posts
    408 Views
    JonBJ
    @Bonnie said in How to make a round corner for the qwebengineview?: Just because someone posts frequently it doesn't necessarily mean he/she is good :) I wasn't expecting good, these are just basics... You are (always) good! :)
  • is there a Qt +CMAKE +qmake Setup for Dummies out there?

    Unsolved
    6
    0 Votes
    6 Posts
    186 Views
    jsulmJ
    @bitbasher said in is there a Qt +CMAKE +qmake Setup for Dummies out there?: in Windows if you must use the path all the way to the cmake folder before the cmake.exe is found Not if you add C:\Qt\6.10.0\mingw64\lib\cmake\bin to PATH...
  • how to link libclang and libtooling to QT project

    Unsolved
    6
    0 Votes
    6 Posts
    151 Views
    jsulmJ
    @jdenv said in how to link libclang and libtooling to QT project: main.o: undefined reference to symbol '_ZN5clang14FrontendAction13EndSourceFileEv' Looks like one of the clang libraries is missing
  • Issue with QLabel and wordwrap

    Solved
    27
    0 Votes
    27 Posts
    2k Views
    F
    I stumbled upon this thread while looking for a solution about such unwanted word wrap, and I am pretty sure the following post on StackOverflow is about the exact same issue and has a few potential manual workaround for it : https://stackoverflow.com/questions/31535143/how-to-prevent-qlabel-from-unnecessary-word-wrapping I wish this would be fixed in Qt core instead though, as the current behavior definitely does not look like the intended behavior for that case...
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • QTableWidget

    Unsolved
    4
    0 Votes
    4 Posts
    712 Views
    M
    Well thanks @VRonin as it provided the solution that was unsolvable before. Here is a summary of my problem and how this solved it for the record. When using a dark stylesheet (dark.qss) the top-left corner button remains untargettable with styling. Calling findChild(QAbstractButton) and forcing a stylesheet in code helped for a moment, but the white square came back on resize, theme change, or first show. Root cause seemed to be Qt treats that corner button as part of the table header, not as a normal button. Header pieces are styled with the selector QHeaderView::section. The corner is a special header piece called QTableCornerButton::section. If you never tell Qt what colour that piece should be, it falls back to the system’s light colour even in dark mode which seems to be white. After hacking workarounds in the code and doing all sorts, I was still unable to resolve it permanently until approaching it treating the top-left select-all button as a header, not a button. Styling it with QTableWidget QTableCornerButton::section in my QSS and that was pretty much it. In my case adding this into my dark.qss theme file: /* Dark-theme top-left corner (select-all button) */ QTableWidget QTableCornerButton::section { background-color: #2b2b2b; /* same as table background */ border: 1px solid #555555; /* same as table border */ border-bottom: 2px solid #777777; /* optional – matches header underline */ } also adding into the python script: app.setStyle("Fusion") and loading the stylesheet after the style is set. a simple example as a test was: import sys from PySide6.QtWidgets import QApplication, QTableWidget from pathlib import Path app = QApplication(sys.argv) app.setStyle("Fusion") # ---- dark.qss (only the relevant part) ---- qss = """ QTableWidget { background-color: #2b2b2b; color: #e0e0e0; } QHeaderView::section { background-color: #2b2b2b; color: #e0e0e0; border: 1px solid #555555; } QTableWidget QTableCornerButton::section { background-color: #2b2b2b; border: 1px solid #555555; border-bottom: 2px solid #777777; } """ app.setStyleSheet(qss) w = QTableWidget(5, 3) w.show() app.exec() I hope that helps anyone running into this problem which clearly still exists in 2025 and until I found the info in the link shared by Vronin I was struggling to solve.
  • How to use qt_generate_deploy_qml_app_script?

    Unsolved
    3
    0 Votes
    3 Posts
    1k Views
    L
    For me it was because when I switched to a 6.8 kit, the "deployment configuration" quietly got set to "Automatic Application Manager Deploy Configuration". As far as I know, I have no need for Application Manager (and evidently, like you, don't even have it installed). I also don't know why it happened for this project and not another, but perhaps because this one is a QtQuick application? I just changed the configuration back to "Deploy Configuration" (which has No Deploy Steps) and all is well. You can find these settings by clicking on "Projects" in the left hand button pane in the Qt Creator window. [image: e47f7762-eb4c-434e-b793-8405a5fbc3d6.png]