我们首先只需要继承QSqlTableModel然后重新实现下面几个函数即可 data() 读取数据库数据返回对应的值 setData() 设置数据库的值 flags()设置用户可选角色,绘制出QCheckBox 另外我还…
标签:编程
C++命名规范
一、简述 Google 的C++规范号称世界上最优秀的编码规范,于是拿来研究下,已改善自己以后的工作,今天只先学习下它的命名规范。 二、命名规则 1.文件命名规则 文件名全部小写,可以含下划线或连字符,按项目约定命名,且…
QT编码转换问题
将GBK编码(ANSI的简体中文编码)转换为Unicode编码格式: QByteArray encodedString = "..."; QTextCodec *codec = QTextCodec::codecForN…
C++ Primer Plus [第六版]第18章编程练习题答案
1 #include <iostream> #include <initializer_list> template <typename T> T average_list(std::…
C++ Primer Plus [第六版]第18章复习题答案
7 书上的答案应该是有误的,我用VS2017无法直接引用lambda表达式,得添加function包装器才行 #include <iostream> #include <array> #inclu…
C++ Primer Plus [第六版]第17章编程练习题答案
1 #include <iostream> int main() { using namespace std; char ch; cout << "输入字符计数[$停止]: \n"; int co…
C++ Primer Plus [第六版]第16章编程练习题答案
1 #include <iostream> #include <string> bool Palindrome(const std::string &st); int main() { u…
C++ Primer Plus [第六版]第15章编程练习题答案
1 随便用了示例的程序测试,懒得写互动程序 #ifndef TV_H_ #define TV_H_ class Remote; class Tv { private: int state; //TV状态 int volu…
C++ Primer Plus [第六版]第14章编程练习题答案
这章真的好难,有点头大,关系多的绕的头疼 1 #ifndef WINEC_H_ #define WINEC_H_ #include <iostream> #include <string> #in…
C++ Primer Plus [第六版]第13章编程练习题答案
1 #ifndef CD_H_ #define CD_H_ class Cd { private: char performers[50]; //歌手 char label[20]; //公司 int selection…