【问题标题】:Add QWidget on top of QOpenGLWindow在 QOpenGLWindow 之上添加 QWidget
【发布时间】:2015-09-15 18:49:20
【问题描述】:

我想在我的 QOpenGLWindow 之上添加 QWidget。例如:

在qmainwindow.cpp中:

QWidget *mywidget = new QWidget(this);
mywidget->hide();

QOpenGLWindow *glwindow = new QOpenGLWindow();
QWidget *container = QWidget::createWindowContainer(glwindow, this);

// ...

ui->tabWidget->addTab(container, "Container");

// then I want mywidget to be at the top of my tabWidget and container.
mywidget->show();

但是 mywidgetcontainer 后面。

我该如何解决这个问题?

【问题讨论】:

    标签: c++ qt opengl qwidget qwindow


    【解决方案1】:

    如果您不按 Z 顺序创建小部件,Qt 无法预测您想要的 Z 顺序。您需要raise 小部件。无论如何,整个隐藏的繁琐都是完全没有必要的。只需在需要的地方创建小部件。

    【讨论】:

      猜你喜欢
      • 2021-02-04
      • 2018-01-24
      • 1970-01-01
      • 2014-11-29
      • 2014-12-05
      • 1970-01-01
      • 2019-01-03
      • 2020-07-09
      • 1970-01-01
      相关资源
      最近更新 更多