Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.9k Topics 459.4k Posts
Qt 6.11 is out! See what's new in the release blog
  • Reporting inappropriate content on the forums

    Pinned Locked spam
    29
    4 Votes
    29 Posts
    38k Views
    A
    Thank you for the report. I have banned the user, which got rid of the spam posting. Not a loss, as this user did not post any other content on the site. Just deleting this one posting was not possible. Thanks for reporting this.
  • Pixel perfect drawing with QCanvasPainter - is it possible on scaled desktop?

    Unsolved
    3
    0 Votes
    3 Posts
    86 Views
    martin_kyM
    @necertainly said in Pixel perfect drawing with QCanvasPainter - is it possible on scaled desktop?: Or you explicitly render in device pixel coordinates How is this possible, though? To my knowledge there is no API in QCanvasPainter that allows me to pass device pixel coordinates. Query the actual devicePixelRatio from the paint device instead of hardcoding 1.5 Sure, it's only hardcoded for sake of clarity. 1.5 is what devicePixelRatioF() returns as well. Snap coordinates to device pixels after scaling, not before QCP does the scaling internally, so it's not really possible for me to "snap coordinates to device pixels after scaling not before". I can only pass reverse-scaled coordinates to QCP to counteract its scaling, which I'm trying to do, but clearly not achieving very well. What I'd like, is ideally to be able to turn off scaling in QCP completely, or at least to know the exact scaling formula. snap to integer pixel centers That's not how GPU accelerated graphics works. At least not on D3D, which Qt uses on Windows. Device pixel centers are not at integer coordinates - https://learn.microsoft.com/en-us/windows/win32/direct3d10/d3d10-graphics-programming-guide-resources-coordinates Disable antialiasing when drawing hairlines That works. Somewhat. But only when the canvas has an even-numbered size. When the canvas size is odd, something happens that makes the pixels shift - the farther they are from origin. I realize, that I accumulate some error in the loop. But A) the float type is still precise enough for my case, and B) the error is the same at x = 600, no matter whether the canvas width is 640 or 641 (logical) pixels. Yet, in the second case, the pixels are drawn 1px off. Imagine that you resize the window. It produces horrible flickering. It flickers whether AA is on or off - the only difference is that with AA it's blurred. Now, why would it flicker, if I draw exactly the same lines at exactly the same (logical) pixel coordinates? This surely smells like a bug in QCanvasWidget or QCanvasPainter. [image: 3ab2d0e0-d002-4b83-9b5f-6c7cae2dfe03.png]
  • Good practices for memory gestion

    Unsolved c++
    2
    0 Votes
    2 Posts
    74 Views
    SGaistS
    Hi, Without having dived in your source code, I think one key difference to take into account: Python is garbage collected while C++ is not. Also, deleting an object in C++ does not mean that the memory is immediately released to the OS. It may happen at different times depending on your application memory usage pattern, OS etc.
  • Windows compilation problem

    Unsolved
    9
    1 Votes
    9 Posts
    443 Views
    P
    @Christian-Ehrlicher: If " ->" means "and up", that's unusual, and it means 6.11.0 would contain both mingw-builds x86_64-11.2.0-release-posix-seh-rt_v9-rev3 and mingw-builds 13.1.0-202407240918mingw1310. In any case, unless you are saying that one of these contains MinGW 13, I do not see your point.
  • MariaDB / QMySqlDriver connection without SSL got 2026 error

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    goldenhawkingG
    @Christian-Ehrlicher Got it. Quick sidebar: Let’s be real—MySQL just hasn’t had PostgreSQL’s cultural mindshare these past few years in the tech ecosystem.
  • Trying to configure qtbase on macOS-26.3

    Solved
    7
    0 Votes
    7 Posts
    261 Views
    jsulmJ
    @gav451 You can mark it as solved then
  • Getting QSqlError "Driver not loaded"

    Solved
    11
    0 Votes
    11 Posts
    221 Views
    D
    @Christian-Ehrlicher said in Getting QSqlError "Driver not loaded": @DiBosco said in Getting QSqlError "Driver not loaded": just the mariadb libs. Even this is not needed - you only need to compile the Qt sql plugin. The rest is already available as binary. Yep, that's all I did. Sounds like I described it poorly. Am still intruiged as to why this has to be done on Windows, but not on Linux (or at least my Linux distro).
  • Can QDir filter by filename length ?

    Unsolved
    3
    0 Votes
    3 Posts
    79 Views
    S
    You could use QDir::setNameFilters (https://doc.qt.io/qt-6/qdir.html#setNameFilters). The documentation mentions that you can use * and ? wildcards. If you don't know this: ? filters exactly one character. So, to filter for a specific length, just use that number of question marks as name filter.
  • Running application with user privillegions.

    Unsolved
    24
    0 Votes
    24 Posts
    632 Views
    S
    There is a reason why you can't just run anything with root privileges. And under normal circumstance you should not try to circumvent it. The most important question is if you really need to run something as root (while your own software is not started with root privileges). Qt does not provide anything special to run a process as root. You need to use OS functionality to run an elevated process (you can use QProcess to start sudo or use any of the other methods mentioned before). In the case of sudo it is up to you to ask the user for the password and hand it to sudo. But, even this is a bad idea because it is really easy to leak the password for an attacker.
  • Signal when QTableWidget scroll hits the end of the table?

    Unsolved
    9
    0 Votes
    9 Posts
    204 Views
    JonBJ
    @jeremy_k Oh, wow, I'm sorry! I understand you now, it's already set to do that! Didn't know, thanks.
  • TreeView not updating after a dataChanged signal

    Solved
    12
    0 Votes
    12 Posts
    2k Views
    O
    Just want to share some debugging tips for the issue: Step 1: Put the debug output inside data method of your implementation the QAbstractItemModel class, like QVariant TestViewModel::data(const QModelIndex &index, int role) const { qDebug() << "data" << index.row() << index.column() << role; ... } Then make sure you are updating the cell with same index adding the same output before emiting dataChanged signal.
  • QLineEdit Undo / Redo Shortcut Text Disappearing

    Solved
    8
    0 Votes
    8 Posts
    193 Views
    JonBJ
    @zenzero-2001 Good stuff. You should mark (from the vertical ... item at bottom right of the post) your own last post as the "correct" solution to this issue, for others.
  • Build Qt 6.11, "skip" ignored (not working)

    Unsolved
    5
    0 Votes
    5 Posts
    215 Views
    P
    @hollow knight I’ve run into something similar with Qt 6.11—seems like the -skip option isn’t behaving the same way as in earlier versions. It might be related to changes in the build system or how modules are handled now. Have you tried using the new configure flags or checking the official docs for any updates on this?I’ve run into something similar with Qt 6.11—seems like the -skip option isn’t behaving the same way as in earlier versions. It might be related to changes in the build system or how modules are handled now. Have you tried using the new configure flags or checking the official docs for any updates on this?
  • QWebEngineView and http headers (specifically "referer" header)

    Unsolved
    9
    0 Votes
    9 Posts
    1k Views
    Joe von HabsburgJ
    @sairun said in QWebEngineView and http headers (specifically "referer" header): The only problem is the interaction between QWebEngineView and openstreemap servers. You can try my steps. Create your web files (html, js, css) create express server and pubish your html load(QUrl("http://localhost/")); (if express port 80, else http://localhost:xxxx/ ) optional use pm2 for run express for each time your computer run.
  • Help with Qt6/QtLocation

    Solved
    13
    0 Votes
    13 Posts
    565 Views
    Joe von HabsburgJ
    Update the fraphics driver solved before my problem MAP. But I am not sure is it the correct solution? And you can set some settings on NVIDIA APP. I'm glad you were able to solve your problem :)
  • QFrame subclass with round corners and a custom titlebar

    Unsolved
    3
    0 Votes
    3 Posts
    173 Views
    A
    @hskoglund hey, thanks for the response. Not sure how that helps my situation though. I want round corners for the main window, not the sliders. I have already achieved that just through stylesheets. Didn't have to overlay two sliders.
  • 0 Votes
    12 Posts
    382 Views
    M
    I have the development packages for Qt5 and Qt6. As you mentioned it works when I remove Qt5 from the following statement in CMakeLists.txt. #find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets) #find_package(QT NAMES Qt6 REQUIRED COMPONENTS Widgets) find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets) The first and third line result in a Qt5 build. The second line results in a Qt6 build. The "Qt version" field in my kit seems to have no influence. I set the value to "None". The issue is resolved. However in a weird way.
  • Qt 6.6.0 OpcUA Debug

    Unsolved
    2
    0 Votes
    2 Posts
    204 Views
    sbelaS
    Ok! I have found out! Just for my reference! When I want to build Qt 6.11 (6.10... ) OPC UA Debug with embedded open62541 on Windows with mscv as the compiler and opened the CMakeLists.txt from Src/qtopcua directory with QtCreator 19.0 (but for 18 too) cmake says that there is no valid configuration and fals back to default: Release The problem is that I am a CMake beginner, but I have found out that if I use: 'Desktop Qt 6.11.0 MSVC2022 64bit' from the 'Kits' and there the 'CMake generator' is set to 'NMake Makefiles JOM' than I always end up with a Release build. But if I change the CMake generator to : 'Ninja Multi-Config' and in the 'Projects' tab I change the 'CMAKE_GENERATOR' parameter to 'Ninja Multi-Config' and hit the button 'Re-configure with Initial Parameters' than I will have a configuration with 'RelWithDebInfo;Debug' After this I build to project. After the project is built in the debug build directory there will be a cmake_install.cmake file. In my installation the Qt is in C:\Qt folder so in a command line I execute the following command: c:\Qt\Tools\CMake_64\bin\cmake -DBUILD_TYPE=Debug -P cmake_install.cmake And after that I will have the debug library installed. After I have finished this I have to set the CMake generator in the 'Kits' back to 'NMake Makefiles JOM' to be able compile my projects with MSVC. That is this simple.
  • Using QFontDialog

    Unsolved
    4
    0 Votes
    4 Posts
    154 Views
    SGaistS
    Hi, Please provide a minimal compilable example that shows that behavior.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    6 Views
    No one has replied