Mastering QtCreator Guide 2020-0
2020-08-12 本文已影响0人
liyangyao
快捷键
- F4 切换头文件和源文件
- Ctrl + function/class 转到定义
- Ctrl + Shift + V 历史剪切板
- Ctrl + Shift + (UP/DOWN KEYS) 向上向下移动行
- Ctrl + ALT + SHIFT + (UP/DOWN KEYS) 多行编辑
提升代码质量
- 通过clang tidy (c++ issues) 和clazy (Qt issues)检查修复代码
重构
- 重构变量
Right click on variable -> Refactor -> Rename. Works with class members and function variables. - 自动生成Q_PROPERTY(...) 成员
Right click on Q_PROPERTY(...) -> Refactor -> generate missing Q_PROPERTY members - Switch through all enum values
Right click on switch -> Refactor-> complete switch statement. (SADLY WONT WORK WITH ENUM CLASSES) - 选中的代码提取函数
Select code, right click -> Refactor -> extract function. Then you can select the function name and the visiblity - 实现基类中的虚函数
Right click on the base class -> Refactor-> Implement virtual functions of base class. Now you can choose which functions to implement and where to put them. - 移动所有函数定义
Right click on your class -> Refactor -> Move all function definitions to (myClass.cpp or outside class) - 移动单个函数定义
Right click on your function -> Refactor -> Move function definitions to (myClass.cpp or outside class)