Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • QMediaPlayer - setPosition() problem

    Solved
    10
    1 Votes
    10 Posts
    3k Views
    KaguroK
    @Zbigniew-Sch said in QMediaPlayer - setPosition() problem: if(status==QMediaPlayer::MediaStatus::BufferedMedia) { mediaPlayer->setPosition(m_iVideoPosition); } Works like a charm, you are my hero today! :D
  • Qt6 QWebSocket - how to send message to a different endpoint?

    Solved
    3
    0 Votes
    3 Posts
    482 Views
    SGaistS
    Hi, To the best of my knowledge, you can't. It seems you would either need two sockets or to open a new connection once the original exchange is done.
  • Record rtsp stream QMediaplayer

    Unsolved
    1
    0 Votes
    1 Posts
    389 Views
    No one has replied
  • Example to keep track of CallStack and how to print

    Unsolved backtrace callstack
    1
    0 Votes
    1 Posts
    273 Views
    No one has replied
  • QAxObject excel Sort Column

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    J
    @hskoglund it's worked,thank you very mach!╰( ̄▽ ̄)╭
  • Failed to set an OpenGL version to 2.1 for Desktop

    Solved
    3
    0 Votes
    3 Posts
    417 Views
    8Observer88
    Thanks a lot for detailed explanation! I rewrote my example to show OpenGL version on the window. I was build from one code base for Desktop, Redmi 4X, and Android Emulator: Window 10: [image: 51214084-7db1-406e-8928-6ff49d24a10b.png] Android on the physical device Redmi 4X. The device is connected by USB. It is faster way to run and debug than to run on Emulator. I use scrcpy to show a screen of device on laptop: [image: 4a55439a-7f7f-4b29-b44c-34cea11795ef.png] Android Emulator: [image: 67566240-5fcc-42a3-a174-434dfac4a000.png] main.cpp // #ifdef _WIN32 // #include <windows.h> // extern "C" __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001; // extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001; // #endif #include <QtGui/QOpenGLFunctions> #include <QtGui/QSurfaceFormat> #include <QtOpenGLWidgets/QOpenGLWidget> #include <QtWidgets/QApplication> #include <QtWidgets/QLabel> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> class OpenGLWidget : public QOpenGLWidget, private QOpenGLFunctions { Q_OBJECT signals: void showInfoSignal(const QString &openGLVersion, const QString &shadingVersion, const QString &vendor); private: void initializeGL() override { initializeOpenGLFunctions(); glClearColor(0.f, 1.f, 0.f, 1.f); QString version(QString("OpenGL version: %1").arg((const char*) glGetString(GL_VERSION))); QString shadingLanguageVersion(QString("GLSL version: %1").arg((const char*) glGetString(GL_SHADING_LANGUAGE_VERSION))); QString vendor(QString("Vendor: %1").arg((const char*) glGetString(GL_VENDOR))); emit showInfoSignal(version, shadingLanguageVersion, vendor); } void paintGL() override { glClear(GL_COLOR_BUFFER_BIT); } }; class MainWindow : public QWidget { Q_OBJECT public: MainWindow() { setWindowTitle("OpenGL Version"); resize(300, 300); m_openGLVersionLabel = new QLabel(); m_shadingLanguageVersionLabel = new QLabel(); m_vendorLabel = new QLabel(); OpenGLWidget *openGLWidget = new OpenGLWidget(); m_openGLVersionLabel->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); m_shadingLanguageVersionLabel->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); m_vendorLabel->setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed); QVBoxLayout *layout = new QVBoxLayout(); layout->addWidget(m_openGLVersionLabel); layout->addWidget(m_shadingLanguageVersionLabel); layout->addWidget(m_vendorLabel); layout->addWidget(openGLWidget); setLayout(layout); connect(openGLWidget, &OpenGLWidget::showInfoSignal, this, &MainWindow::showInfoSlot); } private slots: void showInfoSlot(const QString &openGLVersion, const QString &shadingVersion, const QString &vendor) { m_openGLVersionLabel->setText(openGLVersion); m_shadingLanguageVersionLabel->setText(shadingVersion); m_vendorLabel->setText(vendor); } private: QLabel *m_openGLVersionLabel; QLabel *m_shadingLanguageVersionLabel; QLabel *m_vendorLabel; }; #include "main.moc" int main(int argc, char *argv[]) { // QApplication::setAttribute(Qt::ApplicationAttribute::AA_UseDesktopOpenGL); QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } pro QT += core gui openglwidgets widgets win32: LIBS += -lopengl32 CONFIG += c++17 SOURCES += \ main.cpp TARGET = app
  • Issue with states of QMediaPlayer

    Moved Unsolved
    2
    0 Votes
    2 Posts
    502 Views
    SGaistS
    Hi, Which version of Qt ? On which OS ? Using which backend ?
  • Building Qt 6.5.0 from source with GStreamer enabled

    Unsolved
    7
    0 Votes
    7 Posts
    691 Views
    SGaistS
    Qt 6 use cmake as build system. You can't just put a path somewhere expecting it to be picked up.
  • QTDataVisualization only draw certain rows/cols of the QAbstractTableModel

    Unsolved
    2
    0 Votes
    2 Posts
    203 Views
    SGaistS
    Hi, What comes to mind is to put a proxy model between your original model and the QItemModelSurfaceDataProxy. That proxy would only return the data that you want to be shown.
  • qt5_create_translation does not update .ts

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    S
    @Christian-Ehrlicher said in qt5_create_translation does not update .ts: Don't know why you don't use the new macros I'm try compile my project with qt5 only, so the new macros are not avaliable.
  • Qt 5 & 6 problems in linux (details in the topic)

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    D
    For the record, the NetworkManager warnings in the initial post are harmless. I just fixed them in https://codereview.qt-project.org/c/qt/qtbase/+/527739 though.
  • xxx does not name a type; did you mean 'mode_t'?

    Solved
    2
    0 Votes
    2 Posts
    1k Views
    Christian EhrlicherC
    You should post the code and the real error message.
  • Mutually Exclusive Checkable Menu and Toolbar Actions

    Solved qaction qmainwindow qactiongroup
    2
    0 Votes
    2 Posts
    660 Views
    C
    Within a half hour of posting this, I stumbled upon the answer. I was thinking things were more complicated than they really were, and adding them to the group is as simple as this: OperationGroup->addAction( ui->actionManual ); OperationGroup->addAction( ui->actionAutomatic );
  • Create and read from zip file with custom extension?

    Unsolved qt c++ zip help install
    19
    0 Votes
    19 Posts
    4k Views
    S
    @Christian-Ehrlicher ... i follow the official documentation but guess what... it doesnt work or i get something wrong. Look at my 2 posts above i downloaded the official precompiled dll of zlib i downloaded quazip opened the quazip cmake.txt and wanted to link to zlib but only errors... AND WELL even when i try to build quazip like in the documentation i get errors too: [image: 8ca7e524-8659-4130-b542-8b54d2a2c9e8.png] And YES i tried to USE the official documentation the last days 5 or 6 times, i really try but i just can't get it to work. Don't want to come of rude, but well it sucks to try countless hours every day to get it working. But just cant get it. Used this: $ cd /wherever/quazip/source/is/quazip-x.y.z $ cmake -S . -B wherever/you/want/your/build/to/be -D QUAZIP_QT_MAJOR_VERSION=6, 5 or 4 {HERE I GET THE ERROR POSTED ABOVE} $ cmake --build wherever/you/want/your/build/to/be
  • One dll for multiple kinds of plugins?

    Solved
    3
    0 Votes
    3 Posts
    488 Views
    M
    Multiple qt-designer widgets implement in one dll: Use QDesignerCustomWidgetCollectionInterface class, it allows you to include several custom widgets in one single library. https://doc.qt.io/qt-6/qdesignercustomwidgetcollectioninterface.html
  • QDomDocument elementsByTagName and namespace

    Unsolved
    9
    0 Votes
    9 Posts
    762 Views
    TalklessT
    @kkoehne said in QDomDocument elementsByTagName and namespace: @mrdebug , Qt 6.5 and onwards features new options for parsing, including the option QDomDocument::ParseOption::UseNamespaceProcessing . Have you tried this? Thanks, didn't knew that! We still use Qt 5.15 though...
  • Any simple example Qt Undo Framework?

    Unsolved
    3
    0 Votes
    3 Posts
    365 Views
    SGaistS
    Hi, Did you also take a look at the offical example ? It shows in a pretty nice way how to implement support for multiple commands.
  • Why does QVideoWidget lag when resizing with QSplitter

    Unsolved qvideowidget lag qt6.6
    1
    0 Votes
    1 Posts
    328 Views
    No one has replied
  • Run Qt app headless in Github Actions on macOS

    Solved
    6
    0 Votes
    6 Posts
    458 Views
    SGaistS
    Ok, I am surprised by that error. Thanks for sharing !
  • The problem of crash of function pointer passed in function

    Unsolved
    3
    0 Votes
    3 Posts
    293 Views
    Chris KawaC
    @QtCaiJi It's hard to tell what's wrong because you seemingly removed lines of actual code at random. this1 is never assigned in that snippet. dll_CreatePlayer is not used. Type LONG is a signed 32bit integer, so reinterpreting a function pointer to it sounds horrible and will not do what you think on e.g. 64bit system. As to the problem at hand - if it crashes then run it under a debugger and see the callstack. We can't help if we don't know what the problem is. I cannot successfully load other dlls that this dll depends on [..], why is this? When you run by starting the exe directly the working directory for your app is that exe's location. When running from Qt Creator it's usually one directory up from where the exe is located (unless you change it in the project run settings). Depending on where your dll and its dependents are located they simply might not be in a location Windows looks for them. This exposes a problem in your application that it depends on a working directory path to load its dependents. It shouldn't do that as you can't predict how the end user will start your app (a shortcut, command line etc.) and so you can't predict what the working directory will be. You should structure your app so that dependencies are automatically picked up according to standard lookup rules or, if you load them manually, are using paths relative to your executable, not working directory.