qPrintable
- 将QString 转为const char*,类似于:str.toLocal8Bit().constData().
示例:
相关的函数还有:qUtf8Printable()、qUtf16Printable()等参见https://doc.qt.io/qt-6/qtglobal.html#qUtf8PrintableQString str ="hello";qPrintable(str);
QReadLocker、QWriteLocker、QMutexLocker
- QMutexLocker(QMutex) 主要是一个方便类,在使用互斥锁时,能够避免在繁琐的加锁解锁操作:构造(加锁)、析构(解锁)
- QReadLocker、QWriteLocker (QReadWriteLock)同上,是方便的使用读写锁的类
示例:
//读写锁(互斥锁类似):QReadWriteLock lock;void writeData(const QByteArray &data){QWriteLocker locker(&lock);}//相当于:void writeData(const QByteArray &data){lock.lockForWrite();lock.unlock();}
C++ static initialization order fiasco
这个静态初始化失败记得之前面试的时候好像被遇到过
判断double类型是否相等:
if(std::abs(up - low) < std::numeric_limits<double>::epsilon()){}
qt creator f1键不能使用
主要原因是禁用了window的F1~F12功能,开启和关闭使用 Fn + Esc
解决vscode 无法调试问题
解决vscode python 代码格式化问题:
https://www.code456.com/article/35047.html
配置vs code 中python的版本:
- 点击 ctrl + shift + p
- 输入: Python: Select Interpreter
设置Qt dialog默认隐藏?
QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton, true);
作者:admin 创建时间:2022-07-29 17:33
更新时间:2025-02-10 11:18
更新时间:2025-02-10 11:18