Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Qt::BlockingQueuedConnection not blocking, according to thread sanitizer

    Unsolved
    6
    0 Votes
    6 Posts
    150 Views
    Christian EhrlicherC
    @bobthebuilder said in Qt::BlockingQueuedConnection not blocking, according to thread sanitizer: void copyData() { m_main_data_copy = m_worker_object->m_processed_data; } The thread sanitizer is correct here - you access data from one thread in another without proper locking. It does not know (how should it) that the other thread is sleeping during this operation. From my pov this approach is faulty by design - don't use a blocking connection but store the data e.g. in std::shared_ptr<std::vector<double>>, pass this to your signal and work on a new instance. So no blocking is needed at all and the sanitizer won't blame and it also will work without some Qt magic.
  • Add include directories from sub_directory to main application. How?

    Solved
    7
    0 Votes
    7 Posts
    100 Views
    Christian EhrlicherC
    @bogong said in Add include directories from sub_directory to main application. How?: What is 'correct'? See https://cmake.org/cmake/help/latest/command/target_include_directories.html on how to use target_include_directories() and properly set the include dirs for your libraries. Nothing more to do.
  • How to create delegates that are always editable?

    Unsolved
    6
    0 Votes
    6 Posts
    128 Views
    SGaistS
    It still means that you will have a hundred of widgets at least depending on how you implement your editor opened all the time. That still burns resources for not much benefit.
  • how to solve the problem that using the filedialog component in the qml partion.

    Unsolved
    2
    0 Votes
    2 Posts
    58 Views
    SGaistS
    Hi, You should provide a minimal reproducer example so people will be able to try on their machine. Qt version as well as OS should be provided.
  • Build SQL driver plugin - debug version for MariaDB to be used in VS 2022

    Solved
    4
    0 Votes
    4 Posts
    82 Views
    SGaistS
    Great ! Since you have it working now, please mark the thread as solved using the "Topic Tool" button or the three dotted menu beside the answer you deem correct so other forum users may know a solution has been found :-)
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Right click not working in form designer

    Unsolved
    15
    0 Votes
    15 Posts
    1k Views
    R
    It seems that this is still an issue in Qt Creator/Designer, version 17.0.0 on Linux Ubuntu 22.04. I can select multiple controls in the designer, but I can only add them to a layout in the Object Inspector because right-clicking on the selected controls shows no context menu. (Edit: I'm not sure if this happens all the time or only under special circumstances -- will try to set up a small test.) Has anyone submitted a bug report about this yet?
  • Qlipper not working: 'std::bad_alloc'

    Unsolved
    3
    0 Votes
    3 Posts
    51 Views
    M
    Thanks! Is there maybe another Qt clipboard manager I can use under LXQt, in case I can't fix Qlipper?
  • How to force a style sheet recalculation

    21
    0 Votes
    21 Posts
    28k Views
    W
    @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!
  • Qt App Preferences Being Restored From A Cached Copy? (QSettings)

    Unsolved
    7
    0 Votes
    7 Posts
    423 Views
    SGaistS
    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
    77 Views
    No one has replied
  • QWidget with graphicseffect and render method

    Solved
    4
    0 Votes
    4 Posts
    87 Views
    HansonH
    @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
    2
    0 Votes
    2 Posts
    42 Views
    qazaq408Q
    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);
  • Who would like to see doc.qt.io generate links to cppreference.com ?

    Unsolved
    5
    5 Votes
    5 Posts
    88 Views
    Kent-DorfmanK
    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
    2
    0 Votes
    2 Posts
    39 Views
    JKSHJ
    @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
    19
    0 Votes
    19 Posts
    419 Views
    martin_kyM
    @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
    17
    1 Votes
    17 Posts
    4k Views
    P
    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
    3
    0 Votes
    3 Posts
    60 Views
    MucipM
    Dear mrdebug, Thanks for your valuable answer. There was one thinking like me. Regards, Mucip:)
  • QT AreaSeries is not stable

    Unsolved
    1
    0 Votes
    1 Posts
    21 Views
    No one has replied
  • Add tooltip to windowTitle

    Unsolved
    4
    0 Votes
    4 Posts
    120 Views
    JonBJ
    @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.