摘要:
我以前给QWidget或者QDialog设置布局的时候方式很简单。创建好一个布局:mainLayout,然后不停地把各个控件往mainLayout里面放,最后调用setLayout(mainLayout)就行了。错误提示:…Which already has a layout可是今天在QMainWindow中使用这个方法的时候却不管用。当时我也创建了一个mainLayout,再创建了一个QTreeWidget, 我吧QTreeWidget设置为centralWidget,然后把其他的控件有规律地放入mainLayout中,再调用setLayout(mainLayout),结果出错了。编译的时候 阅读全文
摘要:
QCoreApplication::sendPostedEvents: Cannot send posted events for objects in another thread在非GUI线程中操作继承自QObject的对象时会报出此错误,需改为在非GUI线程中发出信号,GUI线程中使用槽函数接收处理才能避免此错误。 阅读全文