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.
  • python script integration with QT Desktop software

    Unsolved a day ago
    0 Votes
    4 Posts
    49 Views
    @shusong-Peng I do not have personal experience of calling C++ from Python. However it is obviously a very common thing, as many libraries are written in C++ and callable from Python. I suggested starting from Googling for, say, call C++ api from python.
  • 0 Votes
    4 Posts
    75 Views
    Use signal for parent of QScrollArea: windowStateChanged(Qt::WindowState windowState) and save/restore parameters for QScrollArea
  • 0 Votes
    3 Posts
    291 Views
    Having just come across this specific problem, it should be mentioned in the documentation here: https://doc.qt.io/qt-6/windows-building.html And if there's a cmake command line equivalent, then definitely here where the "-debug-and-release" is called out. https://doc.qt.io/qt-6/configure-options.html
  • How do I check for Shift + Tab?

    Unsolved 4 days ago
    0 Votes
    9 Posts
    152 Views
    It's not a mapping from multiple keys to one. These are just special values for that specific enum that will end up creating the sequence corresponding to the right platform specific version of the short-cut.
  • Qt6 CMake qt_add_resources with LANG why does order matter ?

    Unsolved 2 days ago
    0 Votes
    4 Posts
    70 Views
    Would it be possible to provide a minimal compilable project to study that behavior ?
  • 0 Votes
    4 Posts
    1k Views
    @stevej, see post/529035: On Windows and macOS, the native print dialog is used, which means that some QWidget and QDialog properties set on the dialog won't be respected. I can confirm on Linux that it utilises its own modal. I don't believe that a portal exists for this yet.
  • 0 Votes
    5 Posts
    188 Views
    @johnzhou721 said in How Should One Register Standard QActions in the Menu Bar to Perform the Appropriate Action?: are those edit actions usually not present if there’s multiple line edits then? The shortcut is pretty much the same as pressing Ctrl + X. What else do you want to "cut"? If there is nothing to which you can apply "cut", nothing happens. Same as if you just press Ctrl + X without selecting some file/text.
  • Include large resources using Visual Studio?

    Unsolved a day ago
    0 Votes
    3 Posts
    78 Views
    @Christian-Ehrlicher QT VS Tools is automatically including .qrc files, so I'm not using qt_add_resources. Also, I'm not using CMAKE.
  • 0 Votes
    5 Posts
    356 Views
    I've encountered the same. But this time on iOS, whereby the stateChanged signal stays stuck in ConnectedState, even if the central device disconnects.
  • Don't play mp3

    Solved 6 days ago
    0 Votes
    12 Posts
    247 Views
    it's work with vlc #pragma once #include <QObject> #include <vlc/vlc.h> #include <QString> #include <QUrl> #include <QTimer> class VlcAudioPlayer : public QObject { Q_OBJECT public: explicit VlcAudioPlayer(QObject* parent = nullptr); ~VlcAudioPlayer(); // Запустить воспроизведение аудиофайла по локальному пути bool play(const QString& filePath); // Остановить воспроизведение void stop(); // Проверить, играет ли сейчас аудио bool isPlaying() const; signals: void started(); void stopped(); void finished(); private slots: void checkPlayback(); private: libvlc_instance_t* m_instance = nullptr; libvlc_media_player_t* m_mediaPlayer = nullptr; QTimer m_timer; }; #include "VlcAudioPlayer.h" #include <QDebug> VlcAudioPlayer::VlcAudioPlayer(QObject* parent) : QObject(parent) { const char* args[] = { "--no-xlib" }; m_instance = libvlc_new(1, args); if (!m_instance) { qWarning() << "Failed to create libVLC instance"; } m_mediaPlayer = nullptr; // Таймер для проверки состояния воспроизведения connect(&m_timer, &QTimer::timeout, this, &VlcAudioPlayer::checkPlayback); m_timer.setInterval(200); // проверять каждые 200 мс } VlcAudioPlayer::~VlcAudioPlayer() { if (m_mediaPlayer) { libvlc_media_player_stop(m_mediaPlayer); libvlc_media_player_release(m_mediaPlayer); } if (m_instance) { libvlc_release(m_instance); } } bool VlcAudioPlayer::play(const QString& filePath) { if (!m_instance) { qWarning() << "libVLC instance is null"; return false; } // Если уже играет, остановим if (isPlaying()) { stop(); } // Преобразуем путь в URI QUrl url = QUrl::fromLocalFile(filePath); QString uri = url.toString(); libvlc_media_t* media = libvlc_media_new_location(m_instance, uri.toUtf8().constData()); if (!media) { qWarning() << "Failed to create media from URI:" << uri; return false; } if (m_mediaPlayer) { libvlc_media_player_stop(m_mediaPlayer); libvlc_media_player_release(m_mediaPlayer); m_mediaPlayer = nullptr; } m_mediaPlayer = libvlc_media_player_new_from_media(media); libvlc_media_release(media); if (!m_mediaPlayer) { qWarning() << "Failed to create media player"; return false; } if (libvlc_media_player_play(m_mediaPlayer) != 0) { qWarning() << "Failed to start playback"; libvlc_media_player_release(m_mediaPlayer); m_mediaPlayer = nullptr; return false; } emit started(); m_timer.start(); return true; } void VlcAudioPlayer::stop() { if (m_mediaPlayer && isPlaying()) { libvlc_media_player_stop(m_mediaPlayer); emit stopped(); } m_timer.stop(); } bool VlcAudioPlayer::isPlaying() const { if (!m_mediaPlayer) return false; return libvlc_media_player_is_playing(m_mediaPlayer) != 0; } void VlcAudioPlayer::checkPlayback() { if (!m_mediaPlayer) { m_timer.stop(); return; } if (!isPlaying()) { m_timer.stop(); emit finished(); } }
  • Using ASM (x86) with Qt on MacOS with CMake. How?

    Unsolved 4 days ago
    0 Votes
    2 Posts
    66 Views
    @bogong said in Using ASM (x86) with Qt on MacOS with CMake. How?: What is missing by me? That the error messages imply that you try to use x86 assembly but your compilation is targeting arm64 (hence the assembler's complaints about the eax register not existing; and you getting offered ARM mnemonics like movz, probably in response to you trying to use the movl mnemonic which is x86 only). Make sure you target only x86_64 in your build (in CMake, you have CMAKE_OSX_ARCHITECTURES). Or if you want to target ARM, you need to use ARM assembly code which is completely different to x86 assembly. If you are building universal binaries, then you need to write a different version of the inline assembly block for each architecture, and direct to the correct one with preprocessor macros. May I ask why you think you need inline assembly? There is quite possibly an easier approach.
  • Segmentation fault when exiting when linked against Qt 6.9.1

    Solved 15 Jun 2025, 20:58
    0 Votes
    36 Posts
    3k Views
    Thanks @JonB for notifying! The dock widget implementation has some obvious limitations, like e.g. permissions: You can limit allowed main window dock areas, but not the permission to dock on a floating dock. You can’t merge floating docks. That said, we’ll have to take a deeper look and come up with a solid concept for a quick control equivalent. My guess is a year or so. I’ll update this thread in case we have a Jira ticket for input and discussion. In the meanwhile feel free to post ideas here!
  • QVulkanWindow freezes until swapchain recreation on macOS

    Unsolved 21 Jan 2025, 18:14
    0 Votes
    2 Posts
    135 Views
    Bump... Still an issue for me as well.
  • How to set colors for LineSeries in QtGraphs using C++

    Unsolved 3 days ago
    0 Votes
    1 Posts
    32 Views
    No one has replied
  • 0 Votes
    5 Posts
    179 Views
    thanks, @GrecKo You sent issue is matched with my.
  • QVulkanWindow freezes until window resize on macOS only

    Unsolved 12 Jan 2025, 18:14
    1 Votes
    5 Posts
    441 Views
    I am experiencing the same issue.. Did you ever find a way to make it work?
  • QFileDialog::getOpenFileName Fails to Display Dialog with Native macOS

    Unsolved 5 days ago
    1 Votes
    2 Posts
    67 Views
    Hi, Please provide a complete minimal example that shows that issue. This will allow people to test in the same conditions as you.
  • QScatterSeries + QChartView scaling issue

    Solved 7 days ago
    0 Votes
    3 Posts
    72 Views
    I use the same method to place candles. I considered sharing it for you, but I decided against it because it might be a more practical solution or might be too complicated. I'm sharing it for variety and to provide the code, as I use it. auto axis = dynamic_cast<QDateTimeAxis *>(a); QDateTime min, max; const unsigned long long imsec = classes->settingsManager->intervalMsec(klines->interval()) / 2; using namespace std::chrono; time_t timeLast = (static_cast<long>(klines->lastDate() + imsec)) / 1000; time_t timeFirst = (static_cast<long>(klines->firstDate() + imsec)) / 1000; min = QDateTime::fromString(ctime(&timeFirst)); max = QDateTime::fromString(ctime(&timeLast)); if (min != axis->min() || max != axis->max()) { axis->setMin(min); axis->setMax(max); axis->setRange(min, max); }
  • 0 Votes
    6 Posts
    145 Views
    @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.