Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • Bug with `findChildren()` and `deleteLater()` causes crash

    Unsolved
    3
    0 Votes
    3 Posts
    544 Views
    Christian EhrlicherC
    ... or don't use deleteLater() for those objects.
  • Copying CSV file from linux to pendrive causes format change how to fix it ?

    Unsolved
    4
    0 Votes
    4 Posts
    258 Views
    JonBJ
    @mranger90 Surely the OP would have allowed for that before posting?! :)
  • How to assign values to multidimensional QList

    Solved
    6
    0 Votes
    6 Posts
    579 Views
    JonBJ
    @emazed said in How to assign values to multidimensional QList: so the element must exists before i can copy a value in it. ok Yes you must create the elements for each dimension before you can address them. A C array v[10][5][8] is pre-sized to hold all the elements. QList does not offer a "set/re-size" method at Qt5 (so you have to append), though it does at Qt6. QVector has always had a resize(). You could use resize() to create elements/make it more like the C array. Although it's not an issue at Qt6, I would use a QVector rather than a QList if i wanted to approximate the C.
  • qtwebengine slow resize

    Unsolved
    1
    0 Votes
    1 Posts
    216 Views
    No one has replied
  • QIntValidator again

    Unsolved
    1
    0 Votes
    1 Posts
    176 Views
    No one has replied
  • How to use QVector<QRgb> in QwtColorMap?

    Unsolved
    1
    0 Votes
    1 Posts
    160 Views
    No one has replied
  • Drag and Drop when source is deleted

    Unsolved
    6
    0 Votes
    6 Posts
    532 Views
    Z
    @SGaist @wrosecrans, this program is a submodule , which gets external data to update. So I remove old plots and move another. There is main problem in existing connections with drag and drop But if there is no way to "reconnect drag and drop" from deleted widget, okay, thank you for help
  • How to draw a border around a pixmap derived from png

    Solved
    15
    0 Votes
    15 Posts
    4k Views
    kshegunovK
    Yes indeed. I completely missed that rightmost image pixel. Do you mind opening a pull request so I can merge this in the repo?
  • How to update QIcon on palette change?

    Unsolved
    4
    0 Votes
    4 Posts
    347 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
    565 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
    386 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
    498 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
    329 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.