Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/147.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ qspliter(Qt)中的无法交换小部件_C++_Qt_Widget_Qsplitter - Fatal编程技术网

C++ qspliter(Qt)中的无法交换小部件

C++ qspliter(Qt)中的无法交换小部件,c++,qt,widget,qsplitter,C++,Qt,Widget,Qsplitter,我有一个带有两个小部件的QSplitter。其中一个是静态的,另一个应该在按下按钮后改变。但问题是小部件没有改变 我有一个指向正在更改的小部件的指针-this->content 要切换到的小部件位于名为widget的指针中 下面是我切换小部件的代码片段: qDebug() << "before: " << this->content; this->content = widget; qDebug() << "after: " << th

我有一个带有两个小部件的QSplitter。其中一个是静态的,另一个应该在按下按钮后改变。但问题是小部件没有改变

我有一个指向正在更改的小部件的指针-
this->content

要切换到的小部件位于名为widget的指针中

下面是我切换小部件的代码片段:

qDebug() << "before: " << this->content;
this->content = widget;
qDebug() << "after: " << this->content;
this->content->update();
this->content->repaint();
qDebug()content=widget;
qDebug()内容->更新();
此->内容->重新绘制();
我在那里的调试输出验证指针是否指向其他小部件:

before: QLineEdit(0x363850) after: SCTableView(0x3644c0) 之前:QLineEdit(0x363850) 之后:SCTableView(0x3644c0) 试图通过调用
update()
repaint()
来显示它,但没有成功


有什么想法吗?

问题解决了。在freenode上的#qt中得到了一些人的帮助。谢谢 切换到新的小部件后,我忘记在这个->内容上调用setVisible(true)