Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Connection signals for dynamically created widgets

    Solved c++ signal & slot desktop
    11
    0 Votes
    11 Posts
    3k Views
    D
    @JonB said in Connection signals for dynamically created widgets: Bit it does not! QGraphicsItems do not inherit QObject, only QGraphicsObjects do. You're right! I got confused when going up the inheritance tree in the documentation, I clicked on "inherited by QGraphicsObject" at some point thinking it was "inherits" instead. I didn't specify in a written manner that my StateWidget was a QGraphicsEllipseItem as I had added the declaration of the class in the first message. I changed the class to inherit QObject as well though and it worked! class StateWidget : public QObject, public QGraphicsEllipseItem { ... } The order of inheritance is important too. The "Test n" below comes from the AutomatLab::StateParams function so the signal is properly forwarded to the main UI instance! [image: 973931d7-e484-4597-8d82-5c6be4cefda8.png] Thank you for your help!
  • query.execBatch() does nothing

    Solved
    5
    0 Votes
    5 Posts
    2k Views
    SavizS
    @Christian-Ehrlicher I agree. I think it is better to be explicit and convert to correct data types so that the driver does not complain. Here is the corrected code and it works: QVariantList patientIDs; QVariantList treatmentIDs; for (const QVariant &item : newTreatments) { patientIDs.append(m_PatientDataMap["patient_id"].toULongLong()); treatmentIDs.append(item.toULongLong()); } queryInsert.addBindValue(patientIDs); queryInsert.addBindValue(treatmentIDs); Thank you for your help.
  • Crash on menuBar() after setMenuWidget()

    Unsolved
    4
    0 Votes
    4 Posts
    2k Views
    Christian EhrlicherC
    @Paddle said in Crash on menuBar() after setMenuWidget(): QMenuBar* menuBar = getMainWindow()->menuBar(); Use a debugger and see where it crashes. Since getMainWindow() is your own function I would guess it returns a nullptr.
  • How to add custom delimited completion to QLineEdit using QCompleter ?

    Unsolved
    5
    0 Votes
    5 Posts
    3k Views
    D
    Okay, now I have got something to work with a custom QWidget and QListWidget. I am showing the QWidget as a popup whenever I need it to show suggestions on a QLineEdit. Only issue now is that the QLineEdit blinking cursor doesn't show up whenever the popup is open. I have changed the FocusPolicy of the popup widget but still no luck. Is there any way to get the cursor back to the QLineEdit ?
  • Best app object hierarchy pattern for QUndoStack/QUndoCommand

    Unsolved
    2
    0 Votes
    2 Posts
    489 Views
    SGaistS
    Hi, The answer depends partly on what your application does. For example, a text editor will have an undo stack per document. Same for a painting application. Taking the painting application example, would you need one global stack for the document or one per tool you are using ? Both. There's no single universal answer to your question as it depends highly about the operations you are doing, how far does undoing go, etc.
  • qt.qpa.plugin: Could not find the Qt platform plugin "windows" in ""

    Unsolved
    4
    0 Votes
    4 Posts
    3k Views
    jsulmJ
    @K-a-r-l-l-z-y Please provide more information: how did you deploy your app? On Windows you should use https://doc.qt.io/qt-6/windows-deployment.html
  • i have a error in my coding please help me to resolve

    Unsolved
    10
    0 Votes
    10 Posts
    5k Views
    SGaistS
    @muhammad15 On the importance of naming things correctly and using typing in Python: preview_dialog.paintRequested.connect(custom_print) The paintRequested signal has a QPrinter parameter not a QPainter. So declaring def custom_print(printer: QPrinter): Would have already helped you understand where your issue came from.
  • Qt WebEngine running on Windows11 with Touch screen crashed

    Unsolved
    5
    0 Votes
    5 Posts
    2k Views
    C
    I solved the problem by using the import QtWebEngine.ControlsDelegates in the main.qml. This also creates the directory .\qml\QtWebEngine\ControlsDelegates during the build. This directory contains the QML modules TouchHandle.qml and TouchSelectionMenu.qml. This prevents the application from crashing.
  • convert cv::Mat into QPixmap

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    BondrusiekB
    @JacobNovitsky hi, you can see also this article: https://asmaloney.com/2013/11/code/converting-between-cvmat-and-qimage-or-qpixmap/ maybe it helps you.
  • How to automatically maximize a subWindw in a QMdiArea

    Unsolved
    2
    0 Votes
    2 Posts
    809 Views
    JonBJ
    @Audetto https://www.qtcentre.org/threads/41101-QMdiArea-and-adding-sub-window try using setWindowState(Qt::WindowMaximized) on the sub window instance it self : m_mdiArea->addSubWindow(Editor)->setWindowState(Qt::WindowMaximized) ; That worked in Qt in 2006, so I imagine it's the same two decades later...? :)
  • is Qt Widgets Designer the same as Qt Designer?

    Solved qtdesigner qtcreator
    2
    0 Votes
    2 Posts
    496 Views
    C
    Effectively, yes. Your linked page is referring to an embedded version of the standalone Qt Designer application present in Qt Creator as "Qt Widgets Designer". They both produce .ui files describing a UI.
  • Use qss to custom QSlider.

    Unsolved
    6
    0 Votes
    6 Posts
    922 Views
    B
    @sven1991 Besides the good suggestions from @JonB and @hskoglund , I also feel that your animation looks more like a QProgressBar than a QSlider. Why would you need a slider with transparent handle and sub-page? But even with QProgressBar, the radius problem is still as the same as QSlider.
  • Qt5.15.2 app fails to build after building copy in Qt6.

    Unsolved
    7
    0 Votes
    7 Posts
    806 Views
    C
    Shadow build directories. Here is the CMake version for a simple program: identical source, two different binaries, no cross-contamination. chrisw@newton:/tmp/dummy$ ls src/ CMakeLists.txt main.cpp chrisw@newton:/tmp/dummy$ mkdir qt5_build qt6_build chrisw@newton:/tmp/dummy$ cd qt5_build/ chrisw@newton:/tmp/dummy/qt5_build$ CMAKE_PREFIX_PATH=/home/chrisw/Qt/5.15.2/gcc_64/ cmake ../src -- The CXX compiler identification is GNU 13.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Configuring done (0.1s) -- Generating done (0.0s) -- Build files have been written to: /tmp/dummy/qt5_build chrisw@newton:/tmp/dummy/qt5_build$ make [ 0%] Built target test_autogen_timestamp_deps [ 20%] Automatic MOC and UIC for target test [ 20%] Built target test_autogen [ 40%] Building CXX object CMakeFiles/test.dir/test_autogen/mocs_compilation.cpp.o [ 60%] Building CXX object CMakeFiles/test.dir/main.cpp.o [ 80%] Linking CXX executable test [100%] Built target test chrisw@newton:/tmp/dummy/qt5_build$ ldd test | grep Qt libQt5Core.so.5 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libQt5Core.so.5 (0x000073a612600000) libicui18n.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicui18n.so.56 (0x000073a611600000) libicuuc.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicuuc.so.56 (0x000073a611000000) libicudata.so.56 => /home/chrisw/Qt/5.15.2/gcc_64/lib/libicudata.so.56 (0x000073a60f400000) chrisw@newton:/tmp/dummy/qt5_build$ cd ../qt6_build/ chrisw@newton:/tmp/dummy/qt6_build$ CMAKE_PREFIX_PATH=/home/chrisw/Qt/6.8.1/gcc_64/ cmake ../src -- The CXX compiler identification is GNU 13.3.0 -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ - skipped -- Detecting CXX compile features -- Detecting CXX compile features - done -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success -- Found Threads: TRUE -- Performing Test HAVE_STDATOMIC -- Performing Test HAVE_STDATOMIC - Success -- Found WrapAtomic: TRUE -- Configuring done (0.3s) -- Generating done (0.0s) -- Build files have been written to: /tmp/dummy/qt6_build chrisw@newton:/tmp/dummy/qt6_build$ make [ 0%] Built target test_autogen_timestamp_deps [ 20%] Automatic MOC and UIC for target test [ 20%] Built target test_autogen [ 40%] Building CXX object CMakeFiles/test.dir/test_autogen/mocs_compilation.cpp.o [ 60%] Building CXX object CMakeFiles/test.dir/main.cpp.o [ 80%] Linking CXX executable test [100%] Built target test chrisw@newton:/tmp/dummy/qt6_build$ ldd test | grep Qt libQt6Core.so.6 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libQt6Core.so.6 (0x00007c84dd200000) libicui18n.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicui18n.so.73 (0x00007c84dc600000) libicuuc.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicuuc.so.73 (0x00007c84dc200000) libicudata.so.73 => /home/chrisw/Qt/6.8.1/gcc_64/lib/libicudata.so.73 (0x00007c84da200000)
  • 0 Votes
    3 Posts
    619 Views
    Pl45m4P
    @markleo said in Apart from the modules provided by the official website, are there any other third - party Qt modules? If so, is there a central repository similar to npmjs.org?: third - party Qt modules What are third-party Qt modules?! Modules not made by Qt devs and published in the official Qt releases are not "Qt"... Since Qt is still just a C++ GUI framework and still not its own programming language like JavaScript, there are thousands of projects made by users/contributors on GitHub and similar sites, which work with or add something to Qt... custom widgets, functions or just code snippets... Edit: What @ChrisW67 is referring to is what I meant..."extensions" like QxORM can be integrated because of Qt's C++ API... but so does every C++ library work with your C++ project
  • 0 Votes
    2 Posts
    287 Views
    Q
    This issue has been resolved in version 6.8! Thank you for your attention!
  • QColorDialog broken becaus of new Windows 11 style spin buttons

    Unsolved colordialog style
    9
    0 Votes
    9 Posts
    1k Views
    Christian EhrlicherC
    @csab6597 said in QColorDialog broken becaus of new Windows 11 style spin buttons: Well ok, I definitely expected the final fix to be resizing the spin buttons such that they stack vertically again, as it was before 6.7. No, the windows11 style places them the way it is. So we will now have different spin buttons per operating system, I don't see a problem here - windows 11 looks different than macos, kde or gnome. If you want the same style for every os then hard-code it to fusion style.
  • How to detect spawning and destruction of windows?

    Unsolved
    2
    0 Votes
    2 Posts
    247 Views
    S
    I think you can do this with a so called shell hook library. https://learn.microsoft.com/en-us/windows/win32/winmsg/about-hooks See the part about monitoring messages. When a new window is created a WM_CREATE message is posted to the window's event queue.
  • Render a widget on top of others at runtime

    Unsolved
    4
    0 Votes
    4 Posts
    447 Views
    GrecKoG
    @Pl45m4 said in Render a widget on top of others at runtime: What do you mean by "on top"? As separate window? What's the point of the stacked widget then? Why don't you just switch the stacked widget page to show your game widget?! From what I understand this is meant as a non-modal popup/overlay. Everything doesn't have to be in the same plane in a UI, overlap is sometime wanted. @franco-amato How is m_gameWindow created? If you want to show it on top of m_ui->mainContainer, just create it with mainContainer as the parent. Don't add it to a layout or the QStackedWidget. The mapTo shouldn't be necessary since its position would be relative to its parent. raise shouldn't be needed if its added the the container last.
  • QPixMap management

    Unsolved
    6
    0 Votes
    6 Posts
    482 Views
    JonBJ
    @JacobNovitsky Images are shown on QLabels. Use those as the widgets you add to the FlowLayout.
  • when building qt,qtwebengine can not be build.how shoud I slove this problem?

    Solved
    4
    0 Votes
    4 Posts
    760 Views
    Y
    @Cobra91151 thank you,I have reinstalled some dependencies according to the steps on the official Qt website, and this issue has been resolved. Thank you very much. The main missing component was the LLVM that you mentioned.