Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • How to update QIcon on palette change?

    Unsolved
    4
    0 Votes
    4 Posts
    350 Views
    JonBJ
    @schrute At a guess then you need to tell it that the model data has changed for the decoration role, so that it redraws?
  • QTimeEdit

    Unsolved
    7
    0 Votes
    7 Posts
    567 Views
    JonBJ
    @Perdrix Sorry, it was an "IIRC", I would not know which project it was in or whether I still have it.
  • QCombobox Enable and disable items based selection of item.

    Unsolved qcombobox
    7
    0 Votes
    7 Posts
    2k Views
    M
    @JonB I am new with qt. I am not able to implement this, any working sample code will be helpful for me. Thanks in advance for help. Thanks, Mahesh
  • Turkish and Trad. Chinese translation for plurals

    Unsolved
    4
    0 Votes
    4 Posts
    391 Views
    PerdrixP
    @kkoehne I bow to your superior knowledge regarding Turkish - I don't know the answer for Chinese. Google translate suggests at least 2 forms for Chinese: 使用了 1 個處理器 (Shǐyòngle 1 gè chǔlǐ qì) 使用 2 個處理器 (Shǐyòng 2 gè chǔlǐ qì) 使用 5 個處理器 (Shǐyòng 5 gè chǔlǐ qì) However that didn't back translate well, the best I came up with was this: %n 個處理器正在使用中 (%n Gè chǔlǐ qì zhèngzài shǐyòng zhōng) which translates back to English as "%n processor(s) is/are in use" David
  • Are there easy way to see which signal&slot connected in qtcreator?

    Unsolved
    2
    0 Votes
    2 Posts
    165 Views
    sierdzioS
    @masa4 said in Are there easy way to see which signal&slot connected in qtcreator?: Are there anything like, i will hover over my slot name and i will see which signals will start this slot, and same for signals. Currently i am going to mainwidget and skimming connect functions to see this info. Are there any built in or external plugin for it? Not exacly what you look for but you can right click on a signal / slot and select "Find references to symbol under cursor".
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Signal/slot across threads - remove duplicate events in event loop

    9
    0 Votes
    9 Posts
    14k Views
    S
    Allow me to revive this topic, since more than a decade later it is still as relevant as ever. @andre said in Signal/slot across threads - remove duplicate events in event loop: In the past, I have throttled the delivery of update messages from a worker to the GUI thread to at most two per second, and that worked very well for me. This isn't a proper solution, because it relies on a wild guess about the time needed for the consumer to consume. One day you'll have your code run on a machine on which the GUI thread takes more than 0.5 s to process a request, and boom, unbounded queue growth. If the receiver is the GUI thread (and thus the events that you send there are just to refresh the GUI), the proper way is to have the GUI thread reply to the worker thread with ACKs. In the worker class: Have a boolean variable called "SignalRequested" or something like that. It doesn't even have to be atomic. Have a slot that will assert this boolean, called "RequestSignal" or something like that. Inside the producer loop, check this boolean, and if it's true, reset it back to false and emit the signal. In the GUI class: Invoke the RequestSignal slot on the worker during startup. Wherever you receive the signal from the worker, refresh the UI and start a single-shot timer connected to the RequestSignal slot on the worker. The timer's interval will determine the GUI's refresh rate. There you go, an effective solution that'll guarantee at most a single undelivered signal at all times. If the receiver is not the GUI thread, the only proper way is to make your own queue (at least until Qt provides us with means to control its internal one). Write a RingBuffer class (check Wikipedia for examples). Instantiate it with the type of your event. Protect this instance with a mutex. Add a WaitCondition. Implement the classic producer/consumer pattern. Voila: now, in the Producer thread, you can actually assess the situation whenever you are going to add an event to the queue and do some meaningful things if the queue grows too much - issue a warning, drop the event, etc., instead of blindly shoving events into the queue and hoping for the best.
  • Difference between write() and QFile.write()?

    Unsolved
    4
    0 Votes
    4 Posts
    500 Views
    JonBJ
    @akikaede said in Difference between write() and QFile.write()?: files written by QFile cannot be played by smplayer, and file written by Linux write() played well There should be no difference. Compare the generated files byte-by-byte.
  • How to implement boundingRect() when zooming?

    Unsolved
    2
    1 Votes
    2 Posts
    330 Views
    D
    That is a very good queston. I am facing exactly the same issue where the painting doesn't transform via painter.resetTransform() but my boundingRect() from the custom QGraphicsItem transforms / changes when changing the scene zoom level. src/QALibs/Recorder/GraphicsLine.py from PyQt5.QtWidgets import QGraphicsItem class GraphicsLine(QGraphicsItem): ... def paint(self, painter: QPainter, option, widget): painter.resetTransform() # Painted items stay untransformed / unchanged no matter which zoom level on the scene ... def boundingRect(self): # How to avoid boundingRect() changes on zoom
  • Qt main loop

    Solved
    19
    0 Votes
    19 Posts
    4k Views
    S
    @agmar said in Qt main loop: it would be nice to have something print out at supersonic speed This is why your while(1) loop is wrong. Qt is event driven, like others have said already. QSerialPort has a signal that fires immediately when something arrives on the serial port (as "immediate" as possible). This signal needs to be connected to a slot that does the output. There is no noticeable delay in this approach. If you use cout for output, you need to make sure to flush the output immediately. Otherwise the buffer needs to be filled up before if flushes on its own. That indeed would be a delay.
  • How to build postgreSQL on M1 Mac for QT 6.4.0

    Unsolved
    3
    0 Votes
    3 Posts
    315 Views
    A
    @Christian-Ehrlicher Thank you so much.
  • QWebEngineView. Different PDF results on different OS

    Solved
    2
    0 Votes
    2 Posts
    205 Views
    C
    @0x5FB5 Look to me that Windows has different fonts available, and is selecting something different.
  • cout and cin redirect in qtextEdit

    Unsolved
    2
    0 Votes
    2 Posts
    244 Views
    jsulmJ
    @VIKASKUMAR Can you explain why you want to put input from std::cin into a QTextEdit. You should describe your use case better. Putting text into QTextEdit is simple: https://doc.qt.io/qt-6/qtextedit.html#append or https://doc.qt.io/qt-6/qtextedit.html#setText And please don't double post! Your other post is same, right? https://forum.qt.io/topic/142990/input-and-output-are-displayed-in-the-terminals-by-my-c-code-they-should-be-shown-in-qt-textedit-please?_=1676529236213
  • 0 Votes
    2 Posts
    204 Views
    jsulmJ
    @VIKASKUMAR "They should be shown in Qt textEdit" - then show them in QTextEdit. What is your actual question?
  • The touch screen events are block after deleteLater function

    Unsolved
    29
    0 Votes
    29 Posts
    5k Views
    JKSHJ
    @jsulm said in The touch screen events are block after deleteLater function: @GianmarcoUtech https://lists.qt-project.org/listinfo/development This list is for discussing the development of Qt itself. To discuss using Qt, use this list: https://lists.qt-project.org/listinfo/interest
  • app crashes when a qquickwidget is set into QGraphicsScene

    Solved
    6
    0 Votes
    6 Posts
    483 Views
    JoeCFDJ
    @SGaist I set the wrapper widget to the viewport and it works. Thanks a lot.
  • there seems to be an incompatibility between PySide6 and pyttsx3

    Solved
    4
    0 Votes
    4 Posts
    943 Views
    A
    @atmega328 Would you please share your solution? I faced the same problem using Pyside6 with dronecan!
  • How to bind multiple c++ values to qml properties?

    Solved
    2
    0 Votes
    2 Posts
    226 Views
    C
    I've come across QQmlPropertyMap and it seems to be a decent, dynamic solution to my problem.
  • PostgreSQL support array[] type

    Unsolved
    6
    0 Votes
    6 Posts
    660 Views
    Christian EhrlicherC
    @Reishu said in PostgreSQL support array[] type: But, Maybe I was wrong and anyone solve this problem? any driver extension? etc Not when you think you need those parameters to execute your query. I don't even know what it should do and why it's needed.
  • Updating UI bitween objects

    Unsolved from
    2
    0 Votes
    2 Posts
    196 Views
    No one has replied