开发者

cant exchange widget in QSplitter (Qt)

开发者 https://www.devze.com 2022-12-17 18:04 出处:网络
I have a QSplitter with two widgets. One of them is static, the other one is supposed to change on the press of a button. But the problem is the widget does not change?

I have a QSplitter with two widgets. One of them is static, the other one is supposed to change on the press of a button. But the problem is the widget does not change?

I have a pointer for the widget that is changing - this->content

The widget to switch to is in the pointer named widget.

Here's a code snippet where I switch the widget:

qDebug() << "before: " << this->content;
this->content = widget;
qDebug() << "after: " << this->content;
this->content->update();
this->content->repaint();

My debug output there ve开发者_JAVA技巧rifies that the pointer points to the other widget:

before:  QLineEdit(0x363850)
after:   SCTableView(0x3644c0)

Trying to make it show by calling update() and repaint(), without any success.

Any ideas?


Problem solved. Got help from some people in #qt on freenode. Thanks. I forgot to call setVisible(true) on this->content after switching to the new widget.

0

精彩评论

暂无评论...
验证码 换一张
取 消