Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • 3 Votes
    29 Posts
    34k 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.
  • How to force a style sheet recalculation

    18 Oct 2010, 09:26
    0 Votes
    21 Posts
    28k Views
    @ogoffart you're my hero, I had discovered a weird effect on Qt6.9.1 (and later also on some older Qt6 versions), sending an empty or invalid string to setStyleSheet() didn't always clear the previously set stylesheet, but your proposed solution perfectly works, always! Thanks man!
  • How to create delegates that are always editable?

    Unsolved 10 days ago
    0 Votes
    5 Posts
    74 Views
    @SGaist Thanks for your answer. I'll look into editorEvent(). I found another answer online that mentions QAbstractItemView.openPersistentEditor(). Beyond performance considerations, would there be a strong reason not to use this method? (The lists I'm working with would have, at most, hundreds of items. Usually it's less than a hundred, so performance isn't the strongest consideration.)
  • 0 Votes
    7 Posts
    415 Views
    AFAIK, qml uses QSettings under the hood so it should behave in the same fashion. Damn... I remember experiencing these caching issues while developing but not how I "fixed" it...
  • 0 Votes
    2 Posts
    36 Views
    No one has replied
  • Don't play mp3

    Unsolved about 17 hours ago
    0 Votes
    2 Posts
    68 Views
    @Mihaill Add error handling to your code to see whether there are any errors (https://doc.qt.io/archives/qt-5.15/qmediaplayer.html#error-1) Also connect a slot to https://doc.qt.io/archives/qt-5.15/qmediaplayer.html#stateChanged and see which state changes you have. I hope m_player is not a local variable which gets destroyed when its scope is gone... "Then I get eoor:" - I don't see any errors related to audio playback.
  • 0 Votes
    4 Posts
    108 Views
    As you said I don't think QSinglePointEvent::exclusivePointGrabber is what you need. That leaves you with having to write platform specific solution for each platform you want to support. You could also try to upstream that to Qt if you want, I think that it makes sense to have APIs for that. Some related issues: https://bugreports.qt.io/browse/QTBUG-113795 and https://bugreports.qt.io/browse/QTBUG-116493
  • QWidget with graphicseffect and render method

    Unsolved 3 days ago
    0 Votes
    4 Posts
    72 Views
    @denistu After I read the source code, I found that when a widget with QGraphicsEffect executes the render method, the internal call to QGraphicsEffect's draw method will call the sourceWidget's render method again. However, there's an internal judgment in the render method that causes the sourceWidget to return. So, you can see that using the target widget's render method directly doesn't work. So, all we have to do is figure out a way to call the widget's render method indirectly.We can set a container widget as the parent widget for the widget and just call the container widget's render method. That'll execute the render methods of all child widgets.I hope this helps. void QWidget::render(QPainter *painter, const QPoint &targetOffset, const QRegion &sourceRegion, RenderFlags renderFlags) { .... Q_D(QWidget); const bool inRenderWithPainter = d->extra && d->extra->inRenderWithPainter; const QRegion toBePainted = !inRenderWithPainter ? d->prepareToRender(sourceRegion, renderFlags) : sourceRegion; if (toBePainted.isEmpty()) return; if (!d->extra) d->createExtra(); d->extra->inRenderWithPainter = true; .... } https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qwidget.cpp#n5316 QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, QGraphicsEffect::PixmapPadMode mode) const { .... // call render() again, so would retrun and the pixmap is only transpant with nothings. m_widget->render(&pixmap, pixmapOffset, QRegion(), QWidget::DrawChildren); .... } https://code.qt.io/cgit/qt/qtbase.git/tree/src/widgets/kernel/qwidget.cpp#n6040
  • How to make Widget always show in QTableView

    Solved a day ago
    0 Votes
    2 Posts
    37 Views
    i got it!! tableview->openPersistentEditor(model->index(0,0); tableview->openPersistentEditor(model->index(0,1); tableview->openPersistentEditor(model->index(0,2); tableview->openPersistentEditor(model->index(0,3);
  • 5 Votes
    5 Posts
    83 Views
    They are separate issues, but no. I dont think external links within the qt docs is a good idea, for some of the reasons stated in the JIRA ticket. I'd also be happier to see an easier process to download and locally host the API documentation. (I'm all about minimizing dependence on the web/cloud) When I've tried to build and host locally I always ended with many broken links, but haven't tried since around 5.3
  • Startup 6.9.1 A LOT Slower than 6.8.1

    Unsolved a day ago
    0 Votes
    2 Posts
    34 Views
    @Dariusz said in Startup 6.9.1 A LOT Slower than 6.8.1: my apps starts A LOT slower, I'm talking about 60-80 second start up in debug mode comparing to 5-15 That sounds very abnormal. I haven't seen anything like this myself, but if you can simplify your project into a reproducer, please create a bug report at https://bugreports.qt.io/secure/Dashboard.jspa, attach your reproducer, and add [Reg 6.8.1 -> 6.9.1] to your report title to highlight that it is a recent regression.
  • Is there a more efficient way to decoding JSON from QWebSocket?

    Unsolved 4 days ago
    0 Votes
    19 Posts
    308 Views
    @JKSH said in Is there a more efficient way to decoding JSON from QWebSocket?: No. UTF-8 text should not be treated as an array of bytes! I never suggested to do Unicode text processing using a QByteArray. An UTF-8 encoded string is quite literally an array of bytes, and I think there is no better suited Qt container for storing those at the moment. It is perfectly fine and safe to pass UTF-8 encoded strings between APIs in QByteArrays. Even the return type of QString::toUtf8() suggests that QByteArray is currently the Qt's type of choice to store UTF-8 strings. So I'm little hard-pressed to accept that reading and writing UTF-8 text using QByteArray on a QWebSocket would be somehow bad API and had to be avoided, while at the same time using QByteArray seems totally fine for passing UTF-8 strings in many other parts of Qt. I'm not even sure what added value over QByteArray does QUtf8String provide? Except maybe some sort of type tagging - way of saying that this not just any byte array, but an utf-8 encoded char array. Any kind of UTF-8 string processing (except trivials like concatenation) requires decoding into some evenly sized char type array anyway. But that debate is off-topic.
  • Gui from xml in c++

    Solved 6 Oct 2020, 05:25
    1 Votes
    17 Posts
    4k Views
    The original post asked how to generate a working UI at runtime from a specification for the UI written in XML. This is common in many commercial and open-source simulation platforms including those used primarily for games. Not easy in 1997.. Maybe easier today, in 2025. search for "Immediate Mode GUI library" TLDR: An early example of such a UI is present in the open-source Flight Simulator, FlightGear. It is entirely driven in runtime by XML, and includes the usual UI elements Menus, Keymaps, Dialogs and the usual suspects for dialog widgets. Flightgear was started in 1997. So the idea of an XML-driven menu system was quite new. Flightgear at that time used PLIB for its UI. In its next branch, it will be converting away from PLIB to a separate internal GUI library. The FlightGear's source code is hosted on GitLab. The current implementation does not use QT for the in-simulation UI. The UI seen once the simulator is running is generated on the fly. Many menu items and dialogs are specific to particular aircraft and their corresponding cockpit components and are supplied as part of an aircraft specification. Aircraft are developed and maintained separately from the Simulation program. See flightgear.org for more information.
  • Using QML in ERP like programs?

    Unsolved a day ago
    0 Votes
    3 Posts
    47 Views
    Dear mrdebug, Thanks for your valuable answer. There was one thinking like me. Regards, Mucip:)
  • QT AreaSeries is not stable

    Unsolved a day ago
    0 Votes
    1 Posts
    19 Views
    No one has replied
  • Add tooltip to windowTitle

    Unsolved 2 days ago
    0 Votes
    4 Posts
    114 Views
    @DanMQt As @Pl45m4 has written. Furthermore I have never seen a Windows or Linux app which has a tooltip when hovering the window title, so I don't know why you would think this is standard. Up to you whether you want to do the extra work to achieve it.
  • Qt Development QLineEdit Cursor Color

    Unsolved 2 days ago
    0 Votes
    2 Posts
    39 Views
    @byrAlpha Hi, You can try this. https://stackoverflow.com/questions/68769475/how-to-set-the-color-of-caret-blinking-cursor-in-qlineedit
  • QScatterSeries + QChartView scaling issue

    Unsolved 2 days ago
    0 Votes
    1 Posts
    23 Views
    No one has replied
  • How to know user select item by mouse move?

    Solved 3 days ago
    0 Votes
    4 Posts
    82 Views
    @JonB THAKN YOU! You save me !
  • Transitioning from QGLWidget to QOpenGLWidget issue.

    Unsolved opengl 4 days ago
    0 Votes
    6 Posts
    93 Views
    I have gotten a new sample from the library vendor, and it does use paintGL. We were working off a sample from 12 years ago as our base and apparently they have updated a lot since then. I am trying to fit their new implementation in and see how it works. Thanks for the feedback