Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. A strange problem with QOpenGLWidget and QAXWidget
Forum Updated to NodeBB v4.3 + New Features

A strange problem with QOpenGLWidget and QAXWidget

Scheduled Pinned Locked Moved General and Desktop
qopenglwidgetqaxwidget
2 Posts 1 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hankern
    wrote on last edited by hankern
    #1

    when i use qopenglwidget and qaxwidget in qt,i meet a strange problem that qopenglwidget does not show correctly.i dont know why.the code is like that:

    QTabWidget *tt=new QTabWidget;
    MyOpenGLWidget *openGL = new MyOpenGLWidget ();
    QAxWidget *native = new QAxWidget();
    native->setControl(QStringLiteral("{f587310d-5306-494d-87e2-88334b46e781}"));
    native->setAttribute(Qt::WA_NativeWindow);
    native->setAttribute(Qt::WA_DontCreateNativeAncestors);
    tt->addTab(native,"n");
    tt->addTab(openGL,"o");

    MyOpenGLWidget inherit from QOpenGLWidget and has an override method paintEvent,like:
    void MyOpenGLWidget ::paintEvent(QPaintEvent *event)
    {
    QPainter painter;
    painter.begin(this);
    painter.setRenderHint(QPainter::Antialiasing);
    painter.fillRect(event->rect(), QColor(255,255,0));
    painter.end();
    }
    and i also set app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings); in main function
    the problem is
    1.the background of MyOpenGLWidget is black,not yellow that i expect
    2.when i change
    tt->addTab(native,"n");
    tt->addTab(openGL,"o");
    to
    tt->addTab(openGL,"o");
    tt->addTab(native,"n");
    MyOpenGLWidget show right

    i create a test project in https://github.com/hankern/Test-QOpenGLWidget

    1 Reply Last reply
    0
    • H Offline
      H Offline
      hankern
      wrote on last edited by
      #2

      i think the context of qaxwidget affects the context of qopenglwidget,but how can i assign a new context for qopenglwidget

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved