Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.5k Posts
  • CMake error with Q_NAMESPACE and Q_ENUM_NS

    Unsolved
    13
    0 Votes
    13 Posts
    2k Views
    X
    I just found out that if I copy the two enums from the DeckLinkAPI.h file and put them in a new file ( only the enums ) and include that file like this #pragma once #include <QObject> namespace DLink { Q_NAMESPACE // #include "DeckLinkAPI.h" #include "DeckLinkEnumWrapper.h" Q_ENUM_NS( _BMDDisplayMode); Q_ENUM_NS( _BMDPixelFormat); }; and then everything compiles and works. I guess the DeckLinkAPI.h file has something that prevents a successful compilation, since this is an external file I don't know how to solve it other than what I did above, any one have an idea?
  • Error CAN Bus example implementation in QtCreator 4.14.1 Based on Qt 5.15.2

    Solved
    10
    0 Votes
    10 Posts
    635 Views
    I
    Thanks guys @jsulm & @mpergand it works now! i've been using a wrong bitratebox.h bitratebox.cpp files now i take the right ones from the site : [image: 17053271-209f-4e8d-a82e-be7336647858.png]
  • Can I instantiate new objects in QObject constructors?

    Unsolved
    3
    0 Votes
    3 Posts
    392 Views
    N
    @ChrisW67 Where I added the comments with the offending code. I had to set the parents of some of the objects because it actually did not cleanup when the objects were destroyed, contrary to expectations. One of the error was on me because my game class wasn't properly destructed (and isn't a Qt object).
  • QT Creator Deployment For Windows

    Unsolved
    7
    0 Votes
    7 Posts
    862 Views
    J.HilkJ
    @yldzmuhammed quite literally like I wrote earlier. for example I have a batch file to connect network drives the the windows explorer. That is located on my desktop. So I add QMAKE_POST_LINK += CMD /c CALL "C:\Users\jhilk\Desktop\Connect_Network_Drives.cmd" anywhere in my pro file: QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets CONFIG += c++11 # You can make your code fail to compile if it uses deprecated APIs. # In order to do so, uncomment the following line. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 SOURCES += \ main.cpp \ mainwindow.cpp HEADERS += \ mainwindow.h FORMS += \ mainwindow.ui QMAKE_POST_LINK += CMD /c CALL "C:\Users\jhilk\Desktop\Connect_Network_Drives.cmd" # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target and once each rebuild, that batch file is executed.
  • QListWidget.setStyleSheet

    Solved
    13
    0 Votes
    13 Posts
    11k Views
    JonBJ
    @oncewealthy Hello and welcome. I don't know what your issue is, but for sure it has nothing to do with the setStyleSheet() that this topic is about. Please open your own new topic if you have questions about linking.
  • Qt 6.3.1 Cannot Find <directory>: Permission Denied

    Unsolved
    10
    0 Votes
    10 Posts
    3k Views
    S
    @SimonSchroeder I think I now have the solution. My problem was: Running CMake in project libzip, issues errors that make it look as though the user needs to set path type variables, ZLIB_LIBRARY and ZLIB_LIBRARY_DIR. If you set these variables to a path like I did, you then get the errors "cannot find...permission denied"etc. The libzip CMake file has , find package ZLIB. I didnt notice that findZLIB.cmake is actually a CMake file that is installed in the Qt directories i.e. in my case, not provided by the github clone in my root project! c:/Qt/Tools/CMake^4/share/cmake-3.23/Modules FindZLIB.cmake tells you: Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. #[=======================================================================[.rst: FindZLIB Find the native ZLIB includes and library. IMPORTED Targets ^^^^^^^^^^^^^^^^ .. versionadded:: 3.1 This module defines :prop_tgt:IMPORTED target ZLIB::ZLIB, if ZLIB has been found. Result Variables ^^^^^^^^^^^^^^^^ This module defines the following variables: :: ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. ZLIB_LIBRARIES - List of libraries when using zlib. ZLIB_FOUND - True if zlib found. :: ZLIB_VERSION_STRING - The version of zlib found (x.y.z) ZLIB_VERSION_MAJOR - The major version of zlib ZLIB_VERSION_MINOR - The minor version of zlib ZLIB_VERSION_PATCH - The patch version of zlib ZLIB_VERSION_TWEAK - The tweak version of zlib .. versionadded:: 3.4 Debug and Release variants are found separately. Backward Compatibility ^^^^^^^^^^^^^^^^^^^^^^ The following variable are provided for backward compatibility :: ZLIB_MAJOR_VERSION - The major version of zlib ZLIB_MINOR_VERSION - The minor version of zlib ZLIB_PATCH_VERSION - The patch version of zlib Hints ^^^^^ A user may set ZLIB_ROOT to a zlib installation root to tell this module where to look. Once you set ZLIB_ROOT to the path where you have the dependencies (.dll and headers) (I set it to D:/ctest) then the CMake parses find and then you can successfully build.
  • How to reuse editor widget for custom item delegate

    Unsolved
    5
    0 Votes
    5 Posts
    585 Views
    N
    I think this is possibly a bug of Qt and have filed a report at https://bugreports.qt.io/browse/QTBUG-105231.
  • What can I do if I want to blocked waiting for QModbusReply

    Solved
    3
    0 Votes
    3 Posts
    378 Views
    C
    I modify the code as your suggestion,it works well,thanks a lot
  • 0 Votes
    4 Posts
    694 Views
    SGaistS
    The trick of the mouse to rotate is that the rendering is rotated independently from the item itself. As for the movement, unless I am mistaken, it's always moving "horizontally" with respect to the item rotation rotation. Much like when you are walking, you are going forward, when you rotate you still go forward but with a different angle than before.
  • .exe exited with code -1073741521

    Unsolved
    3
    0 Votes
    3 Posts
    241 Views
    B
    Thank you, I will check it!
  • Adjusting policy of QTableView to its content not working

    Unsolved
    16
    0 Votes
    16 Posts
    3k Views
    E
    Under Qt 5.12.11, the bug does not exist. So I took a look at the QAbstractScrollArea::sizeHint code of this version and compared it with the implementation used in recent versions of Qt and found that setting verticalScrollBarPolicy to "ScrollBarAlwaysOff" the "AdjustToContents" adjustment policy works. The default value was "ScrollBarAsNeeded", in fact we can see that this value is not handled but since in Qt 5.12.11 we only compare the vertical|horizontal]scrollBarPolicy to Qt::ScrollBarAlwaysOn it prevents this bug from appearing. The version used in the Qt github master branch : QSize QAbstractScrollArea::sizeHint() const { Q_D(const QAbstractScrollArea); if (d->sizeAdjustPolicy == QAbstractScrollArea::AdjustIgnored) return QSize(256, 192); if (!d->sizeHint.isValid() || d->sizeAdjustPolicy == QAbstractScrollArea::AdjustToContents) { const int f = 2 * d->frameWidth; const QSize frame( f, f ); const bool vbarHidden = d->vbar->isHidden() || d->vbarpolicy == Qt::ScrollBarAlwaysOff; const bool hbarHidden = d->hbar->isHidden() || d->hbarpolicy == Qt::ScrollBarAlwaysOff; const QSize scrollbars(vbarHidden ? 0 : d->vbar->sizeHint().width(), hbarHidden ? 0 : d->hbar->sizeHint().height()); d->sizeHint = frame + scrollbars + viewportSizeHint(); } return d->sizeHint; } The version used in Qt 5.12.11 : QSize QAbstractScrollArea::sizeHint() const { Q_D(const QAbstractScrollArea); if (d->sizeAdjustPolicy == QAbstractScrollArea::AdjustIgnored) return QSize(256, 192); if (!d->sizeHint.isValid() || d->sizeAdjustPolicy == QAbstractScrollArea::AdjustToContents) { const int f = 2 * d->frameWidth; const QSize frame( f, f ); const QSize scrollbars(d->vbarpolicy == Qt::ScrollBarAlwaysOn ? d->vbar->sizeHint().width() : 0, d->hbarpolicy == Qt::ScrollBarAlwaysOn ? d->hbar->sizeHint().height() : 0); d->sizeHint = frame + scrollbars + viewportSizeHint(); } return d->sizeHint; } Can someone update the status of this ticket : https://bugreports.qt.io/browse/QTBUG-101874 in any case, this method must be rewritten and it may not be obvious to handle the "ScrollBarAsNeeded" case at first glance
  • How to run CAN Bus example in QtCreator ?

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    I
    Thanks @mpergand i'm gonna try to implement this example CAN Bus example | Qt Serial Bus 5.15.2 (https://code.qt.io/cgit/qt/qtserialbus.git/tree/examples/serialbus/can?h=5.15.2) i hope it works
  • Infinite wait when stopping QThread event loop and then calling wait

    Unsolved
    30
    0 Votes
    30 Posts
    9k Views
    jsulmJ
    @embeddedmz_2 said in Infinite wait when stopping QThread event loop and then calling wait: if your program behaves differently from one version of Qt to another, it is a bug in Qt. Not necesserily...
  • Qt 6 / Multimedia / Hardware Video Decoding / Windows

    Unsolved
    1
    1 Votes
    1 Posts
    815 Views
    No one has replied
  • Checkable list/check boxes in QTextEdit - PySide6

    Unsolved
    2
    0 Votes
    2 Posts
    271 Views
    T
    I tried taking the current html of the editor and and adding markdown code to it and set the new string to the editor as markdown. Something like the following: editor.setMarkdown(self.ed.toMarkdown() + "- [ ] check") This works as intended but obviously, processing the whole string every time you need check box is not efficient.
  • No suitable kits found / Invalid Qt Version

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    J
    @JKSH said in No suitable kits found / Invalid Qt Version: Hover over the yellow exclamation marks in the "Kits" tab then. What do you see now? Oh, in this case I see that there are some warnings: Warning: No debugger set up Warning: CMake tools is unconfigured, CMake generator will be ignored Warning: CMake configuration has a path with qmake binary set, even though the kit has no valid Qt version Debugger: Not recognized engine using: .../Qt/Tools/mingw1120_64/bin/gdb.exe
  • Style QToolButton set with QWidgetAction - PySide6

    Unsolved
    1
    0 Votes
    1 Posts
    137 Views
    No one has replied
  • Error with the IDE not being able to recongnize qt_add_qml_module

    Solved
    6
    0 Votes
    6 Posts
    1k Views
    SGaistS
    Great ! Then please mark the thread as solved using the "Topic Tools" button or the three dotted menu beside the answer that you deem correct so that other forum users may know a solution has been found :-)
  • How to fix points index when make some polygon

    Unsolved
    2
    0 Votes
    2 Posts
    194 Views
    SGaistS
    Hi, That's an OpenCV question and you should bring that to their forum. What your code does not show is how you manage that box variable and whether its content changes between your cv::line calls.
  • Set tick position and tick name of axis X on Qt chart.

    Unsolved
    6
    0 Votes
    6 Posts
    3k Views
    A.A.SEZENA
    setTickType, setTickAnchor, setTickInterval, setTickCount... Examine and use these assignments. I can say that you will achieve the result by adjusting the values ​​you want in each chart renewal.