【问题标题】:Get a QWidget to take up the entire QMainWindow获取一个QWidget来占据整个QMainWindow
【发布时间】:2010-04-08 02:17:51
【问题描述】:

我有一个继承 QMainWindow 的类,我只希望它有一个 webview 小部件,没有别的,

这就是我尝试为构造函数做的事情:

MyWindow::MyWindow(QWidget *parent) : QMainWindow(parent)
{
    this->_webView = new QWebView(this);
    this->setCentralWidget(this->_webView);
}

这不起作用,我必须使用某种布局来进行填充吗?

【问题讨论】:

    标签: c++ qt webkit webview


    【解决方案1】:

    只需摆脱 QMainWindow 并使用 QWebView 作为顶级小部件。如果您不打算使用 QMainWindow 的任何功能,那么没有理由使用它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-07-13
      • 2014-05-18
      • 1970-01-01
      • 2014-10-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多