文章分类 -  Qt

摘要:https://www.cnblogs.com/zhaobinyouth/p/9478010.html 此外如果需要直接退出某个应用程序,可以直接调用Qt中的一个全局指针:qApp ,全局指针qApp指向全局的QApplication对象。 在需要停止程序运行的位置直接加入如下代码 #include 阅读全文
posted @ 2020-03-04 08:35 friedCoder 阅读(2309) 评论(0) 推荐(1)
摘要:解决方法 使用如下代码: 原因 update()是更新这个控件 viewport() update()是更新这个控件里面的内容 进一步分析 QTableWidget Class 官网的资料如下 http://doc.qt.io/qt 5/qtablewidget.html 顺着继承关系,一步步往上找 阅读全文
posted @ 2020-03-03 22:26 friedCoder 阅读(1170) 评论(0) 推荐(0)
摘要:下面是一个能显示内容的例子 注意 setItem之前必须设置行列数 setItem的第三个参数不能是临时变量!如果使用了new创建的变量,delete之后,表格内容也会消失。 阅读全文
posted @ 2020-03-03 22:22 friedCoder 阅读(2359) 评论(0) 推荐(0)
摘要:简单的说,每个QObject的对象,都和某个创建对象所在的线程关联,如果把对象通过 moveToThread 移动到其他线程,这个对象不能有父对象,否则会出现 QObject::moveToThread: Cannot move objects with a parent 阅读全文
posted @ 2020-03-03 13:19 friedCoder 阅读(315) 评论(0) 推荐(0)
摘要:方法一: (1)官方帮助文档里写着,QIODevice::readLine(char data, qint64 maxSize)这个函数读入的一行内容中包含换行符。 (2)官方帮助文档里还写着,trimmed()函数能去除一行文字开头和结尾的空白符例如\t ,\r\n ,\n等,但不会去点这一行中间 阅读全文
posted @ 2020-03-03 09:21 friedCoder 阅读(204) 评论(0) 推荐(0)
摘要:This is an overloaded function. Sets the string to the printed value of n, formatted according to the given format and precision, and returns a refere 阅读全文
posted @ 2020-03-03 09:18 friedCoder 阅读(2667) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2020-03-02 22:14 friedCoder 阅读(153) 评论(0) 推荐(0)
摘要:初始化时指定文件,打开时不指定 QFile的readall函数返回的是QByteArray类型。 readall一次会读取文件全部内容,所以如果文件比较大时,采用readLine 阅读全文
posted @ 2020-03-02 22:12 friedCoder 阅读(218) 评论(0) 推荐(0)
摘要:区别 QtableWidget 继承自 QtableView.QtableView 有一个setModel的函数设定model, QtableWidget是用的默认的。 “The QTableWidget class provides an item based table view with a 阅读全文
posted @ 2020-03-02 15:24 friedCoder 阅读(536) 评论(0) 推荐(0)
摘要:表头无效一般是由于 未设置列数量; 调用 setColumnCount 后, 再调用 setHorizontalHeaderLabels 即可生效;; 当然最好的情况是 setHorizontalHeaderLabels 时根据参数的大小自动设置列数; 但QT未支持;; 阅读全文
posted @ 2020-03-02 15:06 friedCoder 阅读(3693) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/xiapang009/article/details/73603885 QStringLiteral 是Qt5中新引入的一个用来从 字符串常量”创建QString对象的宏 (字符串常量指在源码中由""包含的字符串)。 提要 让我们从它的使用环境开始说起: 阅读全文
posted @ 2020-03-02 11:10 friedCoder 阅读(1208) 评论(0) 推荐(0)
摘要:原文链接https://blog.csdn.net/zhu522959034/article/details/80279873 QString QStringList 类似字符串数组 阅读全文
posted @ 2020-03-02 11:08 friedCoder 阅读(349) 评论(0) 推荐(0)
摘要:将.qch和文件夹放在Docs目录下 阅读全文
posted @ 2020-03-02 09:47 friedCoder 阅读(172) 评论(0) 推荐(0)
摘要:csdn : https://blog.csdn.net/llq108/article/details/45603047 https://blog.csdn.net/guo_lei_lamant/article/details/79826685 https://blog.csdn.net/yxy24 阅读全文
posted @ 2020-03-02 09:45 friedCoder 阅读(285) 评论(0) 推荐(0)
摘要:一般在 设计模式 中使用,可以将某个Widget提升为第三方的控件,之后方便操作。 全局包含 选项决定 你 include 的时候 是 用 还是 "" 还有是 在所有include 之前插入,还是之后添加 阅读全文
posted @ 2020-03-02 09:38 friedCoder 阅读(470) 评论(0) 推荐(0)
摘要:解决方案: 方法1. 一般情况我们都会在.pro文件里面添加 LIBS += L 路径 库 来配置 方法2. 直接在项目上面点击右键 Add Library 然后选择添加第三方库 阅读全文
posted @ 2020-03-02 09:36 friedCoder 阅读(392) 评论(0) 推荐(0)
摘要:https://blog.csdn.net/u012627502/article/details/38613041 Qt程序中的主窗口通常具有一个中心窗口部件。从理论上来讲,任何继承自QWidget的类的派生类的实例,都可以作为中心窗口部件使用。 QMainWindow的中心区域可以被任意种类的窗口 阅读全文
posted @ 2020-03-02 08:08 friedCoder 阅读(1294) 评论(0) 推荐(0)
摘要:同页面多个窗口 添加多个tab, 在TabWidget中点击鼠标右键, 点击插入页 阅读全文
posted @ 2020-03-02 08:05 friedCoder 阅读(115) 评论(0) 推荐(0)
摘要:创建.qrc文件 右键单击我们的项目文件 添加 新建项 Qt Qt Resource File 双击我们新生成的.qrc文件,点击Add,可以将我们创建菜单栏和工具栏等需要用到的图标加进去,添加以后一定要记得保存,如果资源有了更新,比如某个图片只变名称不变内容,需要重新添加该资源并保存,才能有效。 阅读全文
posted @ 2020-03-02 08:04 friedCoder 阅读(283) 评论(0) 推荐(0)
摘要:注意:要在pro文件中加上 CONFIG += C++11 阅读全文
posted @ 2020-02-25 20:40 friedCoder 阅读(676) 评论(0) 推荐(0)