Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.8k Posts
  • Reusing some widgets or not?

    Solved
    5
    0 Votes
    5 Posts
    324 Views
    A
    @mpergand Thanks, for confirming my supposition. So I'll spare me the headache of trying to reuse those widgets...
  • qabstractitemmodeltester and editabletreemodel test failures

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    J
    @StarterKit Yes, that "parent.column() > 0" check is necessary in the rowCount method. That is how I implemented it in all my TreeModels. I do: if(parent.isValid() && parent.column() > 0) return 0; Hope that helps.
  • The WindowDoesNotAcceptFocus flag is making me thirsty!!!!!!!

    Unsolved
    17
    0 Votes
    17 Posts
    6k Views
    Y
    I've encountered a similar problem. In my case, the widget continually activates and gains focus while being resized. I've set the following properties for the widget: setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); setAttribute(Qt::WA_ShowWithoutActivating); This issue seems to occur only on Windows, and it doesn't happen before we upgrade to 5.15; I haven't experienced it on MacOS. My solution was to add Qt::BypassWindowManagerHint to the widget, and the widget won't get activated and focused anymore.
  • Combining QTabWidget und QStackedWidget at runtime

    Solved
    5
    0 Votes
    5 Posts
    427 Views
    A
    @SGaist Thank you. I really only had to change one line of code and now it works, i.e., instead of the QWidget instance (baseWidget) I had to add the QStackedWidget instance to the QTabWidget.
  • 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
    500 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
    402 Views
    No one has replied
  • Example to keep track of CallStack and how to print

    Unsolved backtrace callstack
    1
    0 Votes
    1 Posts
    284 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
    434 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
    512 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
    716 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
    209 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
    701 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
    493 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
    771 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...