ui->editTotal->repaint();
this->repaint();
this->parentWidget()->repaint();
this->parentWidget()->parentWidget()->repaint();
6.calling '**' with incomplete return type
解决方法是,在项目头文件中,添加相应的头文件包含,在本题中是
#include <QTextBlock>
7.ToolButton关联Action只能在代码里操作。
You can't link action to a button in QtDesigner, you do that in code. QtDesigner is used for easy GUI design.
ui->tBtnListIni->setDefaultAction(ui->actListIni);
8.mac 上 qt creator debug 失败
输入下面命令,然后重启
baidu@localhost ~ % defaults write com.apple.dt.lldb DefaultPythonVersion 2
参考书籍:《Qt 5.9 c++开发指南》
4.6.5 demo4_7创建右键跨界菜单:有一处作者没说就,需要设置ListWidget的contextMenuPolicy,
或者代码设置:setContextMenuPolicy(Qt::CustomContextMenu);
函数前后加const有什么区别:
https://blog.csdn.net/u010029439/article/details/80687360
前面加表示返回值不可更改,后面加表示不能修改class 属性