Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Detect when webcam is unplugged

    Unsolved
    14
    0 Votes
    14 Posts
    5k Views
    M
    Hey Chris, this is a common issue with QCameraViewfinder. The viewfinder freezing on the last frame when the camera disconnects is pretty standard behavior. Here are a few approaches you can try: You can connect to the QCamera's stateChanged signal and watch for when it goes to QCamera::UnloadedState or QCamera::UnavailableState. That's usually the most reliable way to detect disconnection. Another option is to monitor the QCamera's statusChanged signal for QCamera::UnavailableStatus. This specifically tells you when the camera becomes unavailable. If those don't work perfectly for your case, you could implement a simple watchdog timer that checks if the frame has been updated recently. If no new frames arrive for a certain period (like 2-3 seconds), you can assume the camera disconnected like Michigan county map. Here's a basic example of watching the state: cpp connect(camera, &QCamera::stateChanged, this, [this](QCamera::State state) { if (state == QCamera::UnloadedState || state == QCamera::UnavailableState) { // Show your error display here showCameraError(); } }); The watchdog approach might be more reliable though, since sometimes the state changes can be a bit delayed depending on the camera driver. Hope this helps you get the detection working!
  • QString::localeAwareCompare() incorrect for å, ä and ö in Swedish

    Unsolved
    8
    1 Votes
    8 Posts
    471 Views
    AndyBriceA
    Apparently, QString::localeAwareCompare() doesn't take account of the default locale. That wasn't obvious to me from reading the documentation.
  • Strange delay of keyboard input

    Unsolved
    8
    0 Votes
    8 Posts
    434 Views
    H
    @Kent-Dorfman said in Strange delay of keyboard input: You had a malformed connect() statement Why malformed? Used form allowed in docs. @Kent-Dorfman said in Strange delay of keyboard input: The framework is fine for general user interfaces but not for high framerate game development Is Qt Quick more suitable for it, or has same delays?
  • Problem with getting a keyPressEvent for arrow keys

    Unsolved
    4
    0 Votes
    4 Posts
    113 Views
    SGaistS
    Are you using a custom Qt build ? One thing you can do is check the Qt Logging Category. There are multiple used in Qt's own code.
  • MSIX (for Windos App Store) can't find entry point

    Solved
    6
    0 Votes
    6 Posts
    272 Views
    SGaistS
    Thanks !
  • Still trying to Deploy... using windeployqt.exe

    Solved
    18
    0 Votes
    18 Posts
    7k Views
    Pl45m4P
    @montanaviking said in Still trying to Deploy... using windeployqt.exe: It's 2025 and I have the same problem with Windows 10 and Qt6.10 I really do wish this were automated in Qtcreator Can Visual Studio or VSCode or any other IDE do this?! Qtcreator must know where all the required dll files are or it couldn't run the user-developed app either. QtC only knows if the paths were set beforehand... This is what your "kit" does. If you mis-configure your kit... QtC knows nothing... how should it know?!
  • QThread cannot be stop after QCamera->start()

    Unsolved
    11
    0 Votes
    11 Posts
    671 Views
    Pl45m4P
    @QtTester I also don't understand why you are using ugly GOTO statements?! They are bad in 99.9% of all situations, especially in event driven programs. While there are some extremly niche use cases to use them at all, yours is not one of them. Just put the fail code where your jump instruction is... emit the signal and return. Then you also don't need to jump to some end.
  • MacOS and sandbox mode using CMake

    Unsolved
    1
    0 Votes
    1 Posts
    44 Views
    No one has replied
  • QWidget not resizing because of Q3DScatter

    Solved
    13
    0 Votes
    13 Posts
    731 Views
    JonBJ
    @Joe-Smith Interesting :) If you find that easier to do in code why use the Designer at all?! It seems to us that either you are best doing it all in code or all in Designer, it seems an odd choice not to do what can be done in Designer including layouts while you are there and can see it. But up to you. At any rate widgets need layouts on them before you place further widgets onto them.
  • server qt block devices to Vietnamese ?

    Unsolved
    7
    0 Votes
    7 Posts
    169 Views
    hskoglundH
    Glad to hear! Another detail I remember now: the problems only occurred when connecting to the fiber network (3bb) If I instead surfed via my laptop and phone (Truecall or AIS) then it all worked fine. But that way was more expensive :-(
  • How to create a drop shadow effect in Qt Quick

    Unsolved
    2
    0 Votes
    2 Posts
    169 Views
    T
    Any update?
  • Weird stuff with QVariant::toBool()

    Solved
    6
    0 Votes
    6 Posts
    132 Views
    PerdrixP
    Problem is now fixed...
  • Touchscreen QPushButton does not emit released()

    Unsolved
    15
    1 Votes
    15 Posts
    1k Views
    V
    A litle late for @bigguiness, but for others, I though I would point out https://doc.qt.io/qt-6/qtouchevent.html#mouse-events-and-touch-event-synthesizing. If the widgets do not accept the QTouchEvents, then the QMouseEvents are synthesized (if thats enabled). In general for a touch screen, there are no MouseEvents (well, unless you plug in a mouse too ;-) ). Also, if you make a second touch on an area outside your original button, the touch events are subject to "grouping" https://doc.qt.io/qt-6/qtouchevent.html#touch-point-grouping
  • can qt piechart show percentage instead of value?

    Unsolved
    2
    0 Votes
    2 Posts
    84 Views
    JonBJ
    @piercashuang It would help if you said what chart drawing module you are using?! See https://doc.qt.io/qt-6/qpieslice.html#percentage-prop and https://stackoverflow.com/a/44512580/489865.
  • Windeployqt exclusion of binaries

    Unsolved
    1
    0 Votes
    1 Posts
    74 Views
    No one has replied
  • No suitable kits found when using QT creator for raspberry pi

    Unsolved
    3
    0 Votes
    3 Posts
    132 Views
    R
    I fixed it, I went to options > python then hit generate kit
  • How to load "symbolic" icons respecting the dark/light mode?

    Unsolved
    2
    0 Votes
    2 Posts
    113 Views
    I
    Your question isn't entirely clear. If I understand, you are placing a status icon (with QSystemTrayIcon presumably?), and want to know how to set it up so that the system tray applet can automatically recolor it based on the system theme mode?
  • Laying out items/widgets without stretching/spacing

    Solved
    12
    0 Votes
    12 Posts
    838 Views
    JoeCFDJ
    @JonB you can use setAlignment(Qt::AlignLeft or Qt::AlignRight or Qt::AlignCenter or Qt::AlignTop ...) for different layouts. Sometimes this may not work as you need. Spacer can help a bit more when this setting does not work. Try different chatbots(so many nowadays) if the answers are not good enough. I have not use ChatGPT for quite some time. Also do not trust the replies from the chatbots 100%. Never rely on one chatbot like ChatGPT which often replies with junks. I use setAlignment in my apps. But I still tried grok and deepseek for you with "how to align widgets to left only in qhboxlayout in qt" Only deepseek gives this answer. Method 1: Using setAlignment() on the layout
  • Pfx certificate file and Microsoft Store

    Unsolved
    2
    0 Votes
    2 Posts
    77 Views
    I
    If you bundle your applications as a MSIX file, Microsoft will sign them for you after you submit them to the store. If you want to publish a traditional installer, you need to sign it yourself. PFX certificates are no longer issued for code signing by trusted CAs, only cloud signing or HSM is allowed (when you buy a new certificate, you can get a small security token shipped to you that holds the private key for the certificate). I don't know what your idea of "low price" is, but $300-$500 is about what those things cost. There are CAs that subsidize most of the cost for Open Source projects.
  • Problem with location of resources (svg icons) in subdir project with cmake

    Solved
    7
    0 Votes
    7 Posts
    133 Views
    S
    Well, for future reference, I solved the thing by adding the images' folder to the app subdir, not to the gui subdir where these resources are mandatory. <project root> ├── CMakeLists.txt └── src ├── app │ ├── images │ │ ├── document-new.svg │ │ └── document-open.svg │ ├── CMakeLists.txt │ └── main.cpp ├── core │ ├── CMakeLists.txt │ ├── core.cpp │ └── core.h └── gui ├── CMakeLists.txt ├── mainwindow.cpp └── mainwindow.h and editing the corresponding CMakeLists.txt file with the qt_add_resources function! I had tried it before, but without quoting the <RESOURCE NAME> ("app_images" in my case) and that was probably the reason the PREFIX "/" was throwing an error. qt_add_executable(myapp main.cpp) qt_add_resources(myapp "app_images" PREFIX "/" FILES images/document-new.svg images/document-open.svg ) target_link_libraries(mayapp PRIVATE Qt6::Widgets core gui) set_target_properties(myapp PROPERTIES WIN32_EXECUTABLE ON MACOSX_BUNDLE ON ) This way, there is no need to write a resources (.qrc) file on app subdir