Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • QFileDialog- Using getOpenFile

    Solved
    34
    0 Votes
    34 Posts
    5k Views
    L
    @jsulm Thanks
  • Cannot load Custom type using QSettings

    Solved
    2
    0 Votes
    2 Posts
    213 Views
    S
    The issue we were having was qRegisterMetaType was being called too far in for QSettings to use it. In hindsight, the documentation does mention to include it in the main/constructor but we were abit mislead by the working part of the program. I hope this helps anybody reading this, below is the best way we found to ensure the metatypes are always registered: Header File static const bool _registered; static bool register_types() { bool result; result = qRegisterMetaType<CustomType>("CustomType"); qRegisterMetaTypeStreamOperators<CustomType>("CustomType"); return result; } Source File const bool CustomType::_registered = CustomType::register_types();
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • An error occurred: bad allocation

    Unsolved
    15
    0 Votes
    15 Posts
    2k Views
    JonBJ
    @SPlatten For buffered devices, this function [waitForBytesWritten()] waits until a payload of buffered written data has been written to the device I think there is some distinction between write() accepting the bytes initially into a buffer versus those buffered bytes being sent to the device. Easy enough to use the signal to check, or look at whatever the source code does for waitForBytesWritten(). In any case: if you quickly try waitForBytesWritten() (and it works under Windows, I don't know, else use the signal) and your error message goes away you know where you are. If it does not, you do not.
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    2 Views
    No one has replied
  • QSharedPointer crash in Linux

    Unsolved
    6
    0 Votes
    6 Posts
    738 Views
    jeremy_kJ
    Chance plus the choices made by the compiler and runtime sometimes appear to produce working programs for undefined behavior.
  • Improving performance

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    jeremy_kJ
    @SPlatten said in Improving performance: @SimonSchroeder, I've now moved to a separate thread which is so much faster than the timer could ever be on Windows. Not using an event loop will be faster than using an event loop. Not calling a function will be faster than calling a function. Not context switching and data synchronizing will be faster than context switching and data synchronizing. At a glance, the Windows zero timer implementation doesn't use an OS timer facility.
  • QObject Pointer deleteLater() Question

    Unsolved
    4
    0 Votes
    4 Posts
    338 Views
    jeremy_kJ
    @Rich-Bair said in QObject Pointer deleteLater() Question: Also, is it safer to break all connects first using disconnect(&ptr, nullptr, nullptr, nullptr) before deleteLater()? The QObject destructor handles disconnecting connections to and from the object.
  • 0 Votes
    2 Posts
    339 Views
    SGaistS
    Hi, Because you can't copy QObject based classes. You should allocate your model on the heap and your property should return a pointer to a QStringListModel.
  • Drag and Drop within a QWindow window container on Linux

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    SGaistS
    RHEL is not the only one that is not working. KDE Neon is also concerned. I do wonder if it's not related to the commented out code that you can see in the patch you linked.
  • Best way to format text in this specific case (overlapping highlighting)?

    Unsolved
    3
    0 Votes
    3 Posts
    241 Views
    Z
    Thank you so much for replying! I actually tried to do it this way when I had just started using QT and was unable to so I wanted to confirm I wasn't doing it wrong before attempting again. It worked now. Thank you so much!
  • QDesktopServices::openUrl(QUrl::fromLocalFile()) strange behavior

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    H
    Update: I really think @JonB is right, it's was a Windows behavior rather than Qt's. After switching back to VLC as the default app for .mkv, calling the function opens file every time.
  • Starting executable failed

    Unsolved c++
    2
    0 Votes
    2 Posts
    241 Views
    M
    Does SLC.exe exist in that folder? You probably had a build failure; try to build your project again and see if there are any errors from that.
  • QPushButtons not becoming Buttons

    Solved
    3
    0 Votes
    3 Posts
    251 Views
    P
    Ah I see. I was just trying to remove the border lines of the QGroupBox. I didn't realize that affected the buttons as well. Thank you, that solved it.
  • How can I put an tag on the item in a Iconmode Qlistwidget??

    Unsolved
    5
    0 Votes
    5 Posts
    468 Views
    SGaistS
    You can compose a new image. Fill it with black and draw your thumbnail on top of it.
  • QHostInfo::lookup & QHostInfo::HostNotFound

    Unsolved
    3
    0 Votes
    3 Posts
    282 Views
    SGaistS
    Hi, The most usual way to do that is to run the ping command using QProcess.
  • QPushbutton using method?

    Solved
    4
    0 Votes
    4 Posts
    369 Views
    E
    @JonB said in QPushbutton using method?: @Endorfin35 No alternative, you absolutely should put a slot on the button click and set the label text there as you describe, this is the correct paradigm with Qt. This is my answer. Thanks guys.
  • Event queue processed upon calling QWidget::setEnabled()

    Unsolved
    8
    0 Votes
    8 Posts
    827 Views
    F
    @hskoglund 'blockSignals(true)' works, this function does not trigger procession of the event queue. Thank you for this suggestion!
  • Im searching for text editor example with text completion and coloring

    Unsolved
    3
    0 Votes
    3 Posts
    220 Views
    VRoninV
    Another alternative is KTextEditor/KTextWidgets from the KDE API If you want to implement it yourself a good starting point is the Syntax Highlighter Example
  • Missing modules in Qt 6.2.0 : serialport & bluetooth

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    S
    My bad. The Bluetooth and SerialPort modules are now separately downloadable under "Additional Libraries" under Qt 6.2.0 in the Maintenance Tool. Downloaded them and now works. Thanks!