随笔分类 -  QT

QDir::count 可能消耗过多内存,咋一看像内存泄漏
摘要:用 QDir::count 获取文件夹的文件数很方便。 但在文件夹里有数百万个文件的时候,执行一次 QDir::count 就可能花费上 GB 的内存。 uint QDir::count() const { const QDirPrivate* d = d_ptr.constData(); d->i 阅读全文

posted @ 2021-02-25 09:25 liujx2019 阅读(310) 评论(0) 推荐(0)

Deleaker Review
摘要:http://winfig.com/deleaker-review/ Posted on June 27, 2020 by Andreas Schmidt In this article I want to provide a review of the Deleaker plugin for Vi 阅读全文

posted @ 2021-02-22 10:57 liujx2019 阅读(73) 评论(0) 推荐(0)

How to detect memory leaks in QtCreator on Windows?
摘要:https://stackoverflow.com/questions/6825376/how-to-detect-memory-leaks-in-qtcreator-on-windows 阅读全文

posted @ 2021-02-04 11:05 liujx2019 阅读(79) 评论(0) 推荐(0)

Qt 内存泄漏查找工具 Deleaker 要付费的
摘要:https://www.deleaker.com/ 阅读全文

posted @ 2021-02-04 10:33 liujx2019 阅读(506) 评论(0) 推荐(0)

QStringList 可能占用大量内存
摘要:Qt / QTBUG-47645 https://bugreports.qt.io/browse/QTBUG-47645QStringList has memory leak? void xccxds::on_pushButton_1_clicked() { QStringList list; fo 阅读全文

posted @ 2021-02-04 10:20 liujx2019 阅读(835) 评论(0) 推荐(0)

Qt GUI程序带命令行
摘要:VS + QT: 项目--属性--链接器--系统--子系统--控制台 (/SUBSYSTEM:CONSOLE) QT Creator 用如下方法: Windows does not really support dual mode applications. To see console outpu 阅读全文

posted @ 2021-01-28 10:16 liujx2019 阅读(544) 评论(0) 推荐(0)

Qt 获取当前程序的路径 QDir::currentPath()
摘要:https://forum.qt.io/topic/29374/how-to-get-current-working-directory-in-a-qt-application/3 阅读全文

posted @ 2020-12-24 18:00 liujx2019 阅读(1200) 评论(0) 推荐(0)

Qt embedded resources 图片资源等嵌入到exe里面
摘要:Note the :/ part in url(:/resources/pixmaps/close.png). That's needed for embedded resources. https://stackoverflow.com/questions/22109342/background- 阅读全文

posted @ 2020-12-18 18:15 liujx2019 阅读(154) 评论(0) 推荐(0)

Qt QToolBox Tab 高度的设置,不同 Tab 高度不同
摘要:After speaking with Qt support, the only way I found was to assign an empty icon to all tabs, and set the icon-size to the desired height. By laurapon 阅读全文

posted @ 2020-12-18 18:14 liujx2019 阅读(964) 评论(0) 推荐(0)

QGroupBox 的派生类,在构造函数中 setStyleSheet 不起作用
摘要:打开 ui_xxx.h 可以看到,在 Qt Creator 中创建的对象,会在构造函数之后 setStyleSheet. 所以会覆盖构造函数中设定的 QSS. 所以,必须由上层显式的设置 QSS. QtExtGroupBox_1 = new QtExtGroupBox(tabWidget_1); Q 阅读全文

posted @ 2020-12-18 15:27 liujx2019 阅读(335) 评论(0) 推荐(0)

GUI 数字要右对齐,有小数点的要对齐小数点
摘要:https://ux.stackexchange.com/questions/13795/is-there-a-standard-to-left-justify-text-and-right-justify-numeric-values 简而言之,这样可以对齐数位,易于肉眼比较大小 English 阅读全文

posted @ 2020-12-17 16:01 liujx2019 阅读(152) 评论(0) 推荐(0)

QT 编译时 Warning: The name 'layoutWidget' (QWidget) is already in use, defaulting to 'layoutWidget1'.
摘要:总之,是Qt Creator 的 bug. 只能用文本编辑器修改 .ui 文件来消除这个 warning. It means that inside the .ui XML file, the element named "layoutWidget" has already been used so 阅读全文

posted @ 2020-12-16 13:41 liujx2019 阅读(1696) 评论(0) 推荐(0)

QVBoxLayout 不能移动
摘要:QVBoxLayout 本身是不能移动的。 但如果把它放到另一个控件上面,例如一个 QWidget, 那么这个 QWidget 就可以像托盘一样托住 QVBoxLayout。 于是移动 QWidget 的同时,QVBoxLayout 就跟着一起移动了。 阅读全文

posted @ 2020-12-16 13:36 liujx2019 阅读(317) 评论(0) 推荐(0)

QTabWidget size depending on current Tab
摘要:https://stackoverflow.com/questions/29128936/qtabwidget-size-depending-on-current-tab 没看懂但是感觉好厉害 阅读全文

posted @ 2020-12-16 13:32 liujx2019 阅读(68) 评论(0) 推荐(0)

Qt QTabWidget stylesheet 的一个例子
摘要:https://stackoverflow.com/questions/38369015/customuzing-qtabwidget-with-style-sheets QTabWidget::pane { border: 1px solid lightgray; top:-1px; backgr 阅读全文

posted @ 2020-12-16 13:28 liujx2019 阅读(539) 评论(0) 推荐(0)

Qt QStyle 只改变容器控件本身,不改变容器里的控件
摘要:例如最外层是 QMainWindow, 如果只写上 border: 1px solid gray; QMainWindow 里的控件,例如 QTabWidget 也会有同样的轮廓线。 如果写成 QMainWindow { border: 1px solid gray; } 就只有 QMainWind 阅读全文

posted @ 2020-12-16 13:24 liujx2019 阅读(201) 评论(0) 推荐(0)

Qt 不用记录鼠标是否按下的状态,就可实现左键按下拖动
摘要:其中 mCurrentPos 是一个 QPoint 类型的成员变量,记录鼠标左键按下时,窗体的位置。 event->buttons() 是一个用 bit 表示move 是由哪个按键发起的。 所以按位与 Qt::LeftButton 如果不为零,就表示当前的 move 事件是由左键触发的。 所以无需记 阅读全文

posted @ 2020-12-16 13:19 liujx2019 阅读(868) 评论(0) 推荐(0)

QT Layout 的 Spaceing 调为0之后, 如果还有多余的留白,可以通过增大控件的 min size 来去掉留白
摘要:如题 阅读全文

posted @ 2020-12-16 13:12 liujx2019 阅读(268) 评论(0) 推荐(0)

QT 用 border image 代替 background image, 图片大小会随控件大小自动缩放
摘要:如题 阅读全文

posted @ 2020-12-16 13:10 liujx2019 阅读(616) 评论(0) 推荐(0)

QT 无边框的窗口,QCombBox 会变成扁平的
摘要:QCombBox 本身并没有办法让自己变成扁平的。 this->setWindowFlags(Qt::FramelessWindowHint); 阅读全文

posted @ 2020-12-16 13:09 liujx2019 阅读(179) 评论(0) 推荐(0)

导航