views:

85

answers:

1

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 verifies 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?

+1  A: 

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.

Niklas Berglund