Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.2k Topics 455.1k Posts
  • 3 Votes
    29 Posts
    30k Views
    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.
  • 0 Votes
    6 Posts
    96 Views
    @KH-219Design Thanks for your response. I've tried this and it appears to work everywhere that I need it to, so I am planning to move forward with your solution. I should note, there does appear to be one limitation with this solution: calling beginResetModel() and endResetModel() not only updates the model/view but also deselects all items. I would guess that this is because resetting the model also resets the selection model. This should be fine in my use case, but just wanted to note it for anyone else who might read this.
  • Exclusive menu item check-mark not working

    Unsolved about 6 hours ago
    0 Votes
    1 Posts
    17 Views
    No one has replied
  • 0 Votes
    5 Posts
    53 Views
    @mvsri said in Qt Mysql [Mysql Server has gone away] and Silent failures after query exec(): db2 = QSqlDatabase::addDatabase("QMYSQL", connectionName); It looks like this db2, and where you use it in other methods, is a member variable of your DatabaseConnector class? You really are not supposed to do this, and we always point this out. It may not be related to your problem of disconnection over time, but you should still alter your code to comply. https://doc.qt.io/qt-6/qsqldatabase.html#details Warning: It is highly recommended that you do not keep a copy of the QSqlDatabase around as a member of a class, as this will prevent the instance from being correctly cleaned up on shutdown. If you need to access an existing QSqlDatabase, it should be accessed with database(). If you chose to have a QSqlDatabase member variable, this needs to be deleted before the QCoreApplication instance is deleted, otherwise it may lead to undefined behavior.
  • 0 Votes
    8 Posts
    173 Views
    Best strategy is to design your application from the get go to be testable. When designing Every class, every module, every component you should think "how do I make this testable". The good news when you make things "testable" you also get other "abilities" for free since highly testable components are also a) independent and decoupled b) have high cohesion and simple dependencies c) reusable d) have a coherent API c) have better thought out errors and bug conditions, invariants and pre/post conditions. Then you test your components using whatever (unit) testing framework you like. For UI testing you can also use some UI testing tools such as cucumber or other similar tools
  • 0 Votes
    3 Posts
    57 Views
    Please try to call 'setMask' to round borders in 'resizeEvent' and 'changeEvent -> QEvent::WindowStateChange event' too.
  • Using file association on macOS

    Solved about 19 hours ago
    0 Votes
    3 Posts
    33 Views
    Thank you lots David
  • 0 Votes
    10 Posts
    5k Views
    @Sikander-Rafiq said in InnoSetup / Windows Restart Manager / Native Event Filter problem.: @SGaist I have created another thread mentioning QT versions and all code stuff. You can find this thread here https://forum.qt.io/topic/162123/unable-to-launch-qt-desktop-app-from-qt-service-tubidy-using-qprocess Thanks for sharing the link. I happen to have the same issues, I’ll check it out, launching a Qt desktop app from a service using QProcess sounds tricky, especially with display/session permissions. Curious to see what you’ve tried so far..
  • Crashes on macOS ARM using Sockets

    Unsolved 5 Aug 2024, 13:24
    0 Votes
    3 Posts
    155 Views
    Did you ever find a solution? I'm having the same problem.
  • Qt Styling QTreeWidget : Remove Focus on Icons

    Solved 9 days ago
    0 Votes
    7 Posts
    138 Views
    Hello, I tried a bit and I found the solution class NoTintIconDelegate : public QStyledItemDelegate { public: explicit NoTintIconDelegate(QObject *parent = nullptr) : QStyledItemDelegate(parent) {} void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override { QStyleOptionViewItem opt = option; initStyleOption(&opt, index); // Prepare the painter painter->save(); // Draw the background and selection if (opt.state & QStyle::State_Selected) { painter->fillRect(opt.rect, QColor("#4d78cc")); painter->setPen(opt.palette.highlightedText().color()); } else { painter->fillRect(opt.rect, QColor("#21252b")); painter->setPen(opt.palette.text().color()); } // Draw the text QString text = index.data(Qt::DisplayRole).toString(); QRect textRect = opt.rect.adjusted(20, 0, 0, 0); // Adjust for icon space painter->drawText(textRect, Qt::AlignVCenter | Qt::TextSingleLine, text); // Draw the icon manually without tinting QIcon icon = qvariant_cast<QIcon>(index.data(Qt::DecorationRole)); if (!icon.isNull()) { QPixmap pixmap = icon.pixmap(opt.decorationSize); painter->drawPixmap(opt.rect.left() + 2, opt.rect.top() + (opt.rect.height() - opt.decorationSize.height()) / 2, pixmap); } painter->restore(); } QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override { QSize size = QStyledItemDelegate::sizeHint(option, index); size.setWidth(size.width() + 20); // Add space for icon return size; } }; and then : treeView->setItemDelegate(new NoTintIconDelegate(this)); Have a nice day !
  • App crashed when deployed on another PC

    Unsolved 4 days ago
    0 Votes
    8 Posts
    118 Views
    I reinstalled Qt and opencv on my PC 2, debugged my code, it turns out that a file was not correctly loaded so the app crashed.
  • Using QNetworkAccessManager to download a big file.

    Unsolved 15 Apr 2025, 15:25
    0 Votes
    8 Posts
    239 Views
    Yes First row of the standard http Is Protocol URL version\r\n So we can have only 2 space It Is nice protocol simple but powerfull.
  • Qt6 Multimedia Streaming

    Unsolved 5 days ago
    0 Votes
    7 Posts
    89 Views
    @Molecular4943 you can try Opencv. With opencv you will have control over the frames. I use it to stream cameras url.I think it also support rstp
  • QtSensor Plugin - supporting multiple types

    Unsolved qsensor 4 days ago
    0 Votes
    2 Posts
    33 Views
    Hi, I am not aware of any but from a quick look at the documentation, you can create one factory that returns different sensors. I think you just have to register each passing the same factory.
  • QMediaPlayer mp3 playback stalled

    Unsolved 7 days ago
    0 Votes
    10 Posts
    160 Views
    @nova_xo I am not sure either. But be aware that some delay is often needed in the pipeline for state or position change. Good you found the solution. I use raw gstreamer code and can find out where waiting is exactly needed. You may need to guess a bit with Qt.
  • 0 Votes
    3 Posts
    925 Views
    @evorop said in How to debug projects prepared by libtool (autotools) at Qt Creator?: But... How realize "libtool --mode=execute gdb hell" at the Qt Creator for correct debug at visual grafic interface. The same question... I found this topic... But I can't apply bash script with name libtoolgdb #!/bin/bash exec libtool --mode=execute /usr/bin/gdb "$@" [image: b329bf04-5e69-4d30-adc0-a37e19458901.png]
  • Dselect QListWidget item

    Unsolved 4 days ago
    0 Votes
    2 Posts
    47 Views
    Ad 1: To recognise a mouse press in an empty area, install an event filter and handle QEvent::MouseButtonPress. Pass the mouse event's point to itemAt() and clear the selection, if it returns nullptr. You can do the same with QEvent::FocusOut, to handle a click outside the list view. Mind that this may not work, in case the list widget is a focus proxy (it isn't by default). Ad 2: The list view is populated programmatically. Just call clearSelection() when this has been done. Ad 3: Read the height after the list widget has been populated. Add the desired height margin and use QWidget::setMinimumHeight().
  • html in qt widget?

    Unsolved 4 days ago
    0 Votes
    2 Posts
    41 Views
    QTextDocument supports HTML4 markup, you can read this: https://doc.qt.io/qt-6/richtext-html-subset.html The simplest way to show html content in Qt Widget would be using QLabel's setText or QTextEdit's setHtml method. If the html code is more complicated than just rich text, or you need some html features that QTextDocument doesn't support, then you can use QWebEngineView in Qt WebEngine module.
  • QProcess signal out of order ?

    Unsolved 5 days ago
    0 Votes
    6 Posts
    100 Views
    Actually, I expected that one more signal would occur if the readyReadStandardOutput was processing while the process finished. The odd thing was there was a second readyReadStandardOutput signal happening. Although I have checked with the guy doing the actual work, and the second one always returns an empty string when readAllStandardOutput is called.
  • PCAN-LAN integration in QTSerialBus

    Unsolved 1 Oct 2021, 14:10
    0 Votes
    3 Posts
    129 Views
    @fcol95 While the use case sounds interesting I currently don't have access to such devices and therefore cannot work on an integration. Regards