上一页 1 2 3 4 5 6 ··· 8 下一页
摘要: 多次调用CMFCToolTipCtrl的AddTool会导致程序内存不断增加,尤其在循环中,因此需要AddTool之前,先进行判断,如果新文本与旧的不相同,才添加,并且添加之前先删除。需要注意的是,提示文本支持最大长度是MAX_TIP_TEXT_LENGTH.该宏在tooltip.cpp line: 阅读全文
posted @ 2024-12-25 18:05 快雪 阅读(23) 评论(0) 推荐(0)
摘要: CBitmap、CBrush、CFont、CPalette、CPen、CRgn均继承自CGdiObject,GDI对象属于CGdiObject,该类的析构函数会释放GDI对象。因此,如果CPen等GDI对象在栈上创建,则不必要显式调用DeleteObject,如果在堆上创建,则在特定时刻需要删除它, 阅读全文
posted @ 2024-12-25 14:20 快雪 阅读(54) 评论(0) 推荐(0)
摘要: 1、子类化QListWidget class ToolStoreListWidget : public QListWidget { Q_OBJECT public: explicit ToolStoreListWidget(QWidget *parent = nullptr); protected: 阅读全文
posted @ 2024-12-06 11:10 快雪 阅读(149) 评论(0) 推荐(0)
摘要: 1、获取当前ProcessID。 GetCurrentProcess 2、执行cmd或PowerShell cmd:wmic process where "processid=15844" get /format:list PowerShell:Get-Process -id 15844 | For 阅读全文
posted @ 2024-12-02 19:08 快雪 阅读(196) 评论(0) 推荐(0)
摘要: #include <vector> #include <iostream> //定义命令接口 class Command { public: virtual void execute() = 0; virtual void undo() = 0; }; //实现“增加”命令类 class Incre 阅读全文
posted @ 2024-11-15 14:26 快雪 阅读(44) 评论(0) 推荐(0)
摘要: double getAverage(const std::vector<double>& data) { double avg = 0; for (size_t i = 0; i < data.size(); ++i) { avg = avg + (data[i] - avg) /(i + 1.0) 阅读全文
posted @ 2024-07-12 14:03 快雪 阅读(66) 评论(0) 推荐(0)
摘要: std::string bytes2string(const char* bytes, const int length) { std::stringstream ss; ss << "\n"; for (int i = 0; i < length; ++i) { ss << std::hex << 阅读全文
posted @ 2024-06-18 16:23 快雪 阅读(46) 评论(0) 推荐(0)
摘要: Pimpl(Pointer to implementation)是一种C++编程技术,用于将类的实现细节与其接口分离。通常情况下,类的实现细节会暴露在类的头文件中,这会增加代码的复杂性并使得类的修改和维护变得困难。使用Pimpl技术,可以在类的头文件中只暴露必要的接口,而将具体实现细节放在单独的实现 阅读全文
posted @ 2024-04-26 08:57 快雪 阅读(93) 评论(0) 推荐(0)
摘要: template<typename T> class Singleton { public: static T& GetInstance() { static T instance; return instance; } virtual ~Singleton() { } Singleton(cons 阅读全文
posted @ 2024-04-16 08:51 快雪 阅读(13) 评论(0) 推荐(0)
摘要: 最近的一个项目,需要支持多国语言,即中、英、俄,以下是两种实现方式: 为了脚本简约,提前定义两个变量,分别用来存放qm和ts文件 set(TRANSLATIONS_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}/translations)set(LANGUAGES_DIREC 阅读全文
posted @ 2024-04-09 16:24 快雪 阅读(306) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 ··· 8 下一页