当前位置: 首页 > news >正文

【Qt之QWizard】使用1

QWizard使用

      • 描述
      • 方法
        • 枚举:enum QWizard::WizardButton
        • 枚举:enum QWizard::WizardOption
        • 枚举:enum QWizard::WizardStyle
        • 枚举:enum QWizard::WizardPixmap
        • 常用成员方法
        • 槽函数
        • 信号
      • 示例
        • 设置标题
        • 添加page页
        • 设置按钮文本
        • 设置自定义按钮文本
        • 设置page页
        • 设置帮助 按钮
        • 设置像素图
        • registerField(const QString &name, QWidget *widget, const char *property = Q_NULLPTR, const char *changedSignal = Q_NULLPTR)方法
        • QWizardPage::setCommitPage(bool commitPage)方法
        • 创建QWizardPage
        • 调用
      • 完整示例
      • 解释

描述

QWizard类为向导提供了一个框架。

向导(在macOS上也称为助手)是一种特殊类型的输入对话框,由一系列页面组成。向导的目的是一步一步地指导用户完成流程。对于用户可能难以学习的复杂或不常见的任务,向导非常有用。

QWizard继承QDialog并表示向导。每个页面都是一个QWizardPage (QWidget的子类)。要创建您自己的向导,您可以直接使用这些类,或者您可以创建它们的子类以获得更多的控制。

方法

枚举:enum QWizard::WizardButton

此enum指定向导中的按钮。
关联函数:
可使用setButton(),setButtonText(),setButtonLayout()等函数进行设置。

常量描述解释
QWizard::BackButton0The Back button (Go Back on macOS)后退按钮(在macOS上返回)
QWizard::NextButton1The Next button (Continue on macOS)Next按钮(macOS上的Continue)
QWizard::CommitButton2The Commit button提交按钮
QWizard::FinishButton3The Finish button (Done on macOS)完成按钮(在macOS上完成)
QWizard::CancelButton4The Cancel button (see also NoCancelButton)取消按钮(参见NoCancelButton)
QWizard::HelpButton5The Help button (see also HaveHelpButton)帮助按钮(参见HaveHelpButton)
QWizard::CustomButton16The first user-defined button (see also HaveCustomButton1)第一个用户定义的按钮(参见HaveCustomButton1)
QWizard::CustomButton27The second user-defined button (see also HaveCustomButton2)第二个用户定义的按钮(参见HaveCustomButton2)
QWizard::CustomButton38The third user-defined button (see also HaveCustomButton3)第三个用户定义按钮(参见HaveCustomButton3)

以下值只有在使用setButtonLayout()方法的时候有效:

常量描述解释
QWizard::Stretch9A horizontal stretch in the button layout水平伸缩在按钮布局中
枚举:enum QWizard::WizardOption

此enum指定影响向导外观的各种选项。
关联函数:
setOptions(), setOption(), 和 testOption().

常量描述解释
QWizard::IndependentPages0x00000001The pages are independent of each other (i.e., they don’t derive values from each other).各页面相互独立(即,它们不从彼此中派生值)。
QWizard::IgnoreSubTitles0x00000002Don’t show any subtitles, even if they are set.即使已设置,也不显示任何副标题。
QWizard::ExtendedWatermarkPixmap0x00000004Extend any WatermarkPixmap all the way down to the window’s edge.将任何水印位图一直扩展到窗口边缘。
QWizard::NoDefaultButton0x00000008Don’t make the Next or Finish button the dialog’s default button.不要将“下一步”或“完成”按钮设置为对话框的默认按钮。
QWizard::NoBackButtonOnStartPage0x00000010Don’t show the Back button on the start page.在起始页面上不显示“返回”按钮。
QWizard::NoBackButtonOnLastPage0x00000020Don’t show the Back button on the last page.在最后一页上不显示“返回”按钮。
QWizard::DisabledBackButtonOnLastPage0x00000040Disable the Back button on the last page.禁用最后一页上的“返回”按钮。
QWizard::HaveNextButtonOnLastPage0x00000080Show the (disabled) Next button on the last page.在最后一页上显示(禁用)的“下一步”按钮。
QWizard::HaveFinishButtonOnEarlyPages0x00000100Show the (disabled) Finish button on non-final pages.在非最终页面上显示(禁用)的“完成”按钮。
QWizard::NoCancelButton0x00000200Don’t show the Cancel button.不显示“取消”按钮。
QWizard::CancelButtonOnLeft0x00000400Put the Cancel button on the left of Back (rather than on the right of Finish or Next).将“取消”按钮放在“返回”按钮的左侧(而不是“完成”或“下一步”按钮的右侧)。
QWizard::HaveHelpButton0x00000800Show the Help button.显示“帮助”按钮。
QWizard::HelpButtonOnRight0x00001000Put the Help button on the far right of the button layout (rather than on the far left).将“帮助”按钮放在按钮布局的最右边(而不是最左边)。
QWizard::HaveCustomButton10x00002000Show the first user-defined button (CustomButton1).显示第一个用户定义的按钮(CustomButton1)。
QWizard::HaveCustomButton20x00004000Show the second user-defined button (CustomButton2).显示第二个用户定义的按钮(CustomButton2)。
QWizard::HaveCustomButton30x00008000Show the third user-defined button (CustomButton3).显示第三个用户定义的按钮(CustomButton3)。
QWizard::NoCancelButtonOnLastPage0x00010000Don’t show the Cancel button on the last page.在最后一页上不显示“取消”按钮。

WizardOptions类型是qflag的类型定义。它存储了WizardOption值OR组合。

枚举:enum QWizard::WizardStyle

enum指定QWizard支持的不同外观。
关联函数:
可通过setWizardStyle()进行外观设置,如果不设置,使用setPixmap()方法设置位图无效。

常量描述解释
QWizard::ClassicStyle0Classic Windows look经典的 Windows 外观
QWizard::ModernStyle1Modern Windows look现代的 Windows 外观
QWizard::MacStyle2macOS lookmacOS 外观
QWizard::AeroStyle3Windows Aero lookWindows Aero 外观
QWizard::NStyles4默认

在这里插入图片描述

枚举:enum QWizard::WizardPixmap

此enum指定可以与页面关联的像素图。
关联函数:
通过 setPixmap(), QWizardPage::setPixmap()等方法设置像素图。

常量描述解释
QWizard::WatermarkPixmap0The tall pixmap on the left side of a ClassicStyle or ModernStyle pageClassicStyle或ModernStyle页面左侧的高度较高的像素图
QWizard::LogoPixmap1The small pixmap on the right side of a ClassicStyle or ModernStyle page headerClassicStyle或ModernStyle页面标题栏右侧的小像素
QWizard::BannerPixmap2The pixmap that occupies the background of a ModernStyle page header占用ModernStyle页面标题栏背景的像素图
QWizard::BackgroundPixmap3The pixmap that occupies the background of a MacStyle wizard占用MacStyle向导背景的像素图
QWizard::NPixmaps4默认
常用成员方法
  • int addPage(QWizardPage *page):将给定的页面添加到向导中,返回新页面的ID。
  • QAbstractButton *button(WizardButton which) const:返回指定按钮类型的按钮(如下一步、上一步、完成等)。
  • QString buttonText(WizardButton which) const:返回指定按钮类型的文本。
  • int currentId() const:返回当前页面的ID。
  • QWizardPage *currentPage() const:返回当前页面。
  • QVariant field(const QString &name) const:返回具有给定名称的字段的值。
  • bool hasVisitedPage(int id) const:检查页面ID是否已经被访问过。
  • virtual int nextId() const:返回下一个要显示的页面的ID。
  • WizardOptions options() const:返回当前设置的选项。
  • QWizardPage *page(int id) const:返回指定ID的页面。
  • QList<int> pageIds() const:返回添加到向导中的所有页面的ID的列表。
  • QPixmap pixmap(WizardPixmap which) const:返回指定像素图类型的像素图(如向导标志、向导背景等)。
  • void removePage(int id):从向导中删除指定ID的页面。
  • void setButton(WizardButton which, QAbstractButton *button):设置指定按钮类型的按钮。
  • void setButtonLayout(const QList<WizardButton> &layout):设置按钮布局。
  • void setButtonText(WizardButton which, const QString &text):设置指定按钮类型的文本。
  • void setDefaultProperty(const char *className, const char *property, const char *changedSignal):设置默认属性。
  • void setField(const QString &name, const QVariant &value):设置字段的值。
  • void setOption(WizardOption option, bool on = true):设置指定选项的开启或关闭状态。
  • void setOptions(WizardOptions options):设置选项。
  • void setPage(int id, QWizardPage *page):设置指定ID的页面。
  • void setPixmap(WizardPixmap which, const QPixmap &pixmap):设置指定像素图类型的像素图。
  • void setSideWidget(QWidget *widget):设置侧边栏小部件。
  • void setStartId(int id):设置向导的起始ID。
  • void setSubTitleFormat(Qt::TextFormat format):设置副标题的格式。
  • void setTitleFormat(Qt::TextFormat format):设置标题的格式。
  • void setWizardStyle(WizardStyle style):设置向导的风格。
  • QWidget *sideWidget() const:返回侧边栏小部件。
  • int startId() const:返回向导的起始ID。
  • Qt::TextFormat subTitleFormat() const:返回副标题的格式。
  • bool testOption(WizardOption option) const:检查指定选项是否已启用。
  • Qt::TextFormat titleFormat() const:返回标题的格式。
  • virtual bool validateCurrentPage():验证当前页面是否符合要求。
  • QList<int> visitedPages() const:返回已访问的页面的ID列表。
  • WizardStyle wizardStyle() const:返回向导的风格。
槽函数
  • void back():显示前一个页面。
  • void next():显示下一个页面。
  • void restart():从头开始显示向导的第一个页面。
信号
  • void currentIdChanged(int id):当前页面的ID已更改。
  • void customButtonClicked(int which):单击自定义按钮时发射。
  • void helpRequested():当用户请求帮助时发射。
  • void pageAdded(int id):向导中添加了新页面。
  • void pageRemoved(int id):从向导中删除了页面。

示例

c
在这里插入图片描述

设置标题
setWindowTitle(QStringLiteral("wizard show"));
添加page页
    QWizard wizard;wizard.addPage(createIntroPage());wizard.addPage(createRegistrationPage());wizard.addPage(createConclusionPage());
设置按钮文本
    setButtonText(QWizard::NextButton, "下一步");setButtonText(QWizard::CancelButton, "取消");setButtonText(QWizard::BackButton, "返回");

这个是只有设置了setWizardStyle(QWizard::ModernStyle);样式后,才会显示回退按钮,只有添加了page页之后,才会显示下一步按钮,如果啥都没添加,界面只有 cancel,如果是最后一页,显示是finish,而不是"下一步"。
在这里插入图片描述

设置自定义按钮文本
    setButtonText(QWizard::CustomButton1, "自定义1");setOptions(options() | QWizard::HaveCustomButton1);

设置自定义按钮文本后,不会显示,只有设置setOptions()后,才显示,这个自定义按钮是每页都显示,可以根据是否需要,自行控制显隐。
在这里插入图片描述

设置page页
    setPage(Page_Intro, new IntroPage);setPage(Page_Evaluate, new EvaluatePage);setPage(Page_Register, new RegisterPage);setPage(Page_Details, new DetailsPage);setPage(Page_Conclusion, new ConclusionPage);

第一个参数为自定义id,可以重写QWizardnextId()方法,自定义上一步下一步,具体跳到某页。

设置帮助 按钮
setOption(HaveHelpButton, true);
设置像素图
    setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo.png"));

在这里插入图片描述

registerField(const QString &name, QWidget *widget, const char *property = Q_NULLPTR, const char *changedSignal = Q_NULLPTR)方法
    registerField("details.company*", companyLineEdit);registerField("details.email*", emailLineEdit);registerField("details.postal*", postalLineEdit);

创建一个名为name的字段,该字段与给定小部件的给定属性关联。从那时起,可以使用field()和setField()访问该属性。
字段对于整个向导来说是全局的,并且使任何单个页面都可以轻松访问由另一个页面存储的信息,而不必将所有逻辑放在QWizard中,也不必让页面显式地了解彼此。
“name”以“*”结尾时为必填字段。当页面有强制字段时,Next和/或Finish按钮只有在所有强制字段都填满时才启用。这需要指定一个changedSignal,以告诉QWizard重新检查由必填字段存储的值。
调用,不加后面的*

field("details.email").toString();
QWizardPage::setCommitPage(bool commitPage)方法

如果commitPage为true,则将该页设置为提交页;否则,将其设置为普通页面。
提交页是表示不能通过单击“返回”或“取消”来撤消的操作的页面。
提交按钮取代提交页面上的Next按钮。单击此按钮只调用QWizard::next(),就像单击next一样。
直接从提交页面进入的页面会禁用后退按钮。

创建QWizardPage
  QWizardPage *createIntroPage(){QWizardPage *page = new QWizardPage;page->setTitle("Introduction");QLabel *label = new QLabel("This wizard will help you register your copy ""of Super Product Two.");label->setWordWrap(true);QVBoxLayout *layout = new QVBoxLayout;layout->addWidget(label);page->setLayout(layout);return page;}

在这里插入图片描述

调用
  int main(int argc, char *argv[]){QApplication app(argc, argv);// 以下是翻译,根据不同style,可以显示不同的最下方按钮为中文#ifndef QT_NO_TRANSLATIONQString translatorFileName = QLatin1String("qt_");translatorFileName += QLocale::system().name();QTranslator *translator = new QTranslator(&app);if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))app.installTranslator(translator);#endifQWizard wizard;wizard.addPage(createIntroPage());wizard.addPage(createRegistrationPage());wizard.addPage(createConclusionPage());wizard.setWindowTitle("Trivial Wizard");wizard.show();return app.exec();}

完整示例

#include <QtWidgets>
#include <QTranslator>
#include <QLocale>
#include <QLibraryInfo>// 创建Intro页
QWizardPage *createIntroPage()
{QWizardPage *page = new QWizardPage;page->setTitle("Introduction");QLabel *label = new QLabel("This wizard will help you register your copy ""of Super Product Two.");label->setWordWrap(true);QVBoxLayout *layout = new QVBoxLayout;layout->addWidget(label);page->setLayout(layout);return page;
}
// 创建Registration页
QWizardPage *createRegistrationPage()
{QWizardPage *page = new QWizardPage;page->setTitle("Registration");page->setSubTitle("Please fill both fields.");QLabel *nameLabel = new QLabel("Name:");QLineEdit *nameLineEdit = new QLineEdit;QLabel *emailLabel = new QLabel("Email address:");QLineEdit *emailLineEdit = new QLineEdit;QGridLayout *layout = new QGridLayout;layout->addWidget(nameLabel, 0, 0);layout->addWidget(nameLineEdit, 0, 1);layout->addWidget(emailLabel, 1, 0);layout->addWidget(emailLineEdit, 1, 1);page->setLayout(layout);return page;
}
// 创建Conclusion页
QWizardPage *createConclusionPage()
{QWizardPage *page = new QWizardPage;page->setTitle("Conclusion");QLabel *label = new QLabel("You are now successfully registered. Have a ""nice day!");label->setWordWrap(true);QVBoxLayout *layout = new QVBoxLayout;layout->addWidget(label);page->setLayout(layout);return page;
}
// 调用
int main(int argc, char *argv[])
{QApplication app(argc, argv);// 翻译
#ifndef QT_NO_TRANSLATIONQString translatorFileName = QLatin1String("qt_");translatorFileName += QLocale::system().name();QTranslator *translator = new QTranslator(&app);if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))app.installTranslator(translator);
#endifQWizard wizard;wizard.addPage(createIntroPage());wizard.addPage(createRegistrationPage());wizard.addPage(createConclusionPage());wizard.setWindowTitle("Trivial Wizard");wizard.show();return app.exec();
}

解释

代码定义了一个简单的 Qt 向导,包括三个页面:Intro(介绍)、Registration(注册)和Conclusion(结论),并提供了一些翻译支持。

createIntroPage() 函数中,创建了一个 QWizardPage 对象,设置了页面的标题和一个 QLabel,用于显示介绍文字。

createRegistrationPage() 函数中,同样创建了一个 QWizardPage 对象,并设置了页面的标题和子标题。然后添加了两个 QLineEdit 和两个 QLabel,用于输入和显示用户的姓名和电子邮件地址。

createConclusionPage() 函数中,也创建了一个 QWizardPage 对象,并设置了页面的标题和一个 QLabel,用于显示注册成功的消息。

main() 函数中,首先创建了一个 QApplication 对象,用于运行整个 Qt 应用程序。然后检查是否启用了翻译功能,如果是,则加载相应的翻译文件,并将其安装到应用程序中。

接下来创建了一个 QWizard 对象,并添加了三个页面。设置了向导的标题,并显示出来。最后,调用 app.exec() 运行应用程序,进入 Qt 的事件循环,直到应用程序关闭或者通过主动退出来结束。

相关文章:

【Qt之QWizard】使用1

QWizard使用 描述方法枚举&#xff1a;enum QWizard::WizardButton枚举&#xff1a;enum QWizard::WizardOption枚举&#xff1a;enum QWizard::WizardStyle枚举&#xff1a;enum QWizard::WizardPixmap常用成员方法槽函数信号 示例设置标题添加page页设置按钮文本设置自定义按…...

移植LVGL到单片机的一个demo简单介绍

简介 背景&#xff1a; 本文使用的是主控IC为stm32f103zet6, 显示IC为ST7735s&#xff0c;它是128*160的像素&#xff0c;色深为RGB565颜色。 官方虽然说LVGL移植平台只需 64kB 闪存和 8kB RAM 就足以满足简单的用户界面。但我移植到stm32f103c8t6&#xff0c;不管怎么修改配…...

rust_for_linux驱动完整版记录

文章目录 [清华开源操作系统训练营]《Rust fox Linux》课程的练习1-2完整版记录。1. 环境搭建2. 编译rust内核2.1 下载源代码2.2 安装rust支持2.3 检查linux内核是否支持rust2.4 编译linux内核 3. aarch64的qemu环境3.1.下载源代码3.2. 解压编译安装3.3. 配置环境变量3.4.验证 …...

Android拖放startDragAndDrop拖拽Glide灵活加载堆叠圆角图,Kotlin(6)

Android拖放startDragAndDrop拖拽Glide灵活加载堆叠圆角图&#xff0c;Kotlin&#xff08;6&#xff09; Android拖放startDragAndDrop拖拽Glide加载堆叠圆角图&#xff0c;Kotlin&#xff08;5&#xff09;-CSDN博客文章浏览阅读1.3k次。&#xfeff;&#xfeff;Android Dyna…...

计算机网络课后作业2023秋

计算机网络第三版吴功宜版 课后作业 第一章作业三、计算与问答3.73.8 第二章作业三、计算与问答3.23.53.6 第三章作业三、计算与问答3.13.53.73.8 第四章作业三、计算与问答3.13.2 第五章作业三、计算与问答3.13.33.4VLAN交换机模式模式切换重置交换机VLA&#xff2e;配置命令其…...

阿里云国际站:全球加速GA

文章目录 一、前言 二、阿里云全球加速的概念 三、阿里云全球加速的功能优势 四、阿里云全球加速的原理 五、阿里云全球加速的应用场景 六、写在最后 一、前言 随着互联网的快速发展&#xff0c;网站速度已经成为了用户访问体验的一个重要指标。阿里云加速作为一种新的技…...

M2LC-Net

模型结构 作者未提供代码...

Jenkins 质量扫描

代码质量扫描工具&#xff08;SonarQube&#xff09; 质量评审 SonarQube有四个关键组件 ◼ SonarQube Server运行有三个组件 ◆ Web Server&#xff1a;UI ◆ Search Server&#xff1a;为UI提供搜索功能&#xff0c;基于ElasticSearch ◆ Compute Engine Server&#xff1a…...

【LeetCode刷题笔记】滑动窗口

992. K 个不同整数的子数组 解题思路: 滑动窗口 , 题目问题转化为: 求 「最多存在 K 个不同整数的子数组的个数」 与 「最多存在 K - 1 个不同整数的子数组的个数」 之差, 就是题目所求的 「恰好存在 K 个不同整数的子数组的个数」 , 最终问题就变成求解滑动窗口内,以 R …...

笔试题之指针和数组的精讲

&#x1d649;&#x1d65e;&#x1d658;&#x1d65a;!!&#x1f44f;&#x1f3fb;‧✧̣̥̇‧✦&#x1f44f;&#x1f3fb;‧✧̣̥̇‧✦ &#x1f44f;&#x1f3fb;‧✧̣̥̇:Solitary-walk ⸝⋆ ━━━┓ - 个性标签 - &#xff1a;来于“云”的“羽球人”。…...

.secret勒索病毒数据恢复|金蝶、用友、管家婆、OA、速达、ERP等软件数据库恢复

导言&#xff1a; 勒索病毒成为了网络安全的一项严峻挑战&#xff0c;其中.secret勒索病毒尤为引人注目。这种恶意软件通过加密用户的数据文件&#xff0c;使其无法访问&#xff0c;并勒索受害者支付赎金以获取解密密钥。本文将介绍.secret勒索病毒的基本信息&#xff0c;以及…...

junit写搜索树测试

用法 assertTrue(range.contains("Two")); 2个参数,右边错就打印左边. AbstractSelfBalancingBinarySearchTree abt; AbstractBinarySearchTree.Node node; Before public void setUp() { abt new AbstractSelfBalancingBinarySearchTree() { Override protecte…...

顺丰接口对接-订单创建与取消(java单元测试)

api文档 下单接口 &#xff1a;https://qiao.sf-express.com/Api/ApiDetails?level3393&interName%E4%B8%8B%E8%AE%A2%E5%8D%95%E6%8E%A5%E5%8F%A3-EXP_RECE_CREATE_ORDER 取消订单接口&#xff1a; https://qiao.sf-express.com/Api/ApiDetails?level3339&interNa…...

C++:OJ练习(每日练习!)

编程题&#xff1a; 题一&#xff1a;计算日期到天数的转换 计算日期到天数转换_牛客题霸_牛客网 (nowcoder.com) 示例1 输入&#xff1a; 2012 12 31 输出&#xff1a; 366 思路一&#xff1a; 第一步&#xff1a;创建年&#xff0c;月&#xff0c;日的变量&#xff0c;并按…...

GPTs Hunter 是什么?

原文&#xff1a; https://openaigptguide.com/openai-gpts-hunter/ GPTs Hunter 是一个功能强大的免费导航网站&#xff0c;支持多语言&#xff0c;提供用户友好的界面。 GPTs Hunter&#xff1a;功能强大的免费导航网站 GPTs Hunter是一个功能强大的免费导航网站&#xff…...

【移远QuecPython】EC800M物联网开发板的硬件TIM定时器精准延时

【移远QuecPython】EC800M物联网开发板的硬件TIM定时器精准延时 文章目录 导入库定时器初始化延时函数定时中断回调调用函数打包附录&#xff1a;列表的赋值类型和py打包列表赋值BUG复现代码改进优化总结 py打包 首先 这个定时器是硬件底层级别的 优先级最高 如果调用 会导致GN…...

HDU 1027:Ignatius and the Princess II ← next_permutation()

【题目来源】http://acm.hdu.edu.cn/showproblem.php?pid1027【题目描述】 Now our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty Princess. But now the BEelzebub has to beat our hero first. feng5…...

主题讲座:全球增材制造现状与未来(暨香港科技大学广州|智能制造学域2024博士学位全额奖学金项目)

时间&#xff1a;2023 年11月16日&#xff08;星期四&#xff09;14:30 地点&#xff1a;合肥工业大学 学术会议中心三楼报告厅 主讲嘉宾&#xff1a;陈模军 助理教授 https://facultyprofiles.hkust-gz.edu.cn/faculty-personal-page/CHEN-Mojun/mjchen 报名表直达&#xff1…...

hugeGraph修改PropertyKey属性类型

修改PropertyKey字段属性的类型&#xff0c;发现没办法保留数据的前提下修改&#xff0c;智能是先删除数据&#xff0c;然后再修改&#xff0c;或者备份后修改再恢复。 方法一、 修改groovy脚本中的Text为Int后重新建元数据 schema.propertyKey(“youkey”).asText().valueSing…...

vscode 访问本地或者远程docker环境

1、vscode 访问docker本地环境 直接点击左下角连接图标&#xff0c;弹出选项可以选择容器&#xff0c;只要容器在本地运行者&#xff0c;选择attach可以看到运行中的容器可以选择&#xff0c;选择其中需要选择的就行 ## 运行容器&#xff0c;可以-d后台运行都可以 docker run…...

MFC内存泄露

1、泄露代码示例 void X::SetApplicationBtn() {CMFCRibbonApplicationButton* pBtn GetApplicationButton();// 获取 Ribbon Bar 指针// 创建自定义按钮CCustomRibbonAppButton* pCustomButton new CCustomRibbonAppButton();pCustomButton->SetImage(IDB_BITMAP_Jdp26)…...

使用van-uploader 的UI组件,结合vue2如何实现图片上传组件的封装

以下是基于 vant-ui&#xff08;适配 Vue2 版本 &#xff09;实现截图中照片上传预览、删除功能&#xff0c;并封装成可复用组件的完整代码&#xff0c;包含样式和逻辑实现&#xff0c;可直接在 Vue2 项目中使用&#xff1a; 1. 封装的图片上传组件 ImageUploader.vue <te…...

OpenLayers 分屏对比(地图联动)

注&#xff1a;当前使用的是 ol 5.3.0 版本&#xff0c;天地图使用的key请到天地图官网申请&#xff0c;并替换为自己的key 地图分屏对比在WebGIS开发中是很常见的功能&#xff0c;和卷帘图层不一样的是&#xff0c;分屏对比是在各个地图中添加相同或者不同的图层进行对比查看。…...

Spring数据访问模块设计

前面我们已经完成了IoC和web模块的设计&#xff0c;聪明的码友立马就知道了&#xff0c;该到数据访问模块了&#xff0c;要不就这俩玩个6啊&#xff0c;查库势在必行&#xff0c;至此&#xff0c;它来了。 一、核心设计理念 1、痛点在哪 应用离不开数据&#xff08;数据库、No…...

有限自动机到正规文法转换器v1.0

1 项目简介 这是一个功能强大的有限自动机&#xff08;Finite Automaton, FA&#xff09;到正规文法&#xff08;Regular Grammar&#xff09;转换器&#xff0c;它配备了一个直观且完整的图形用户界面&#xff0c;使用户能够轻松地进行操作和观察。该程序基于编译原理中的经典…...

Chromium 136 编译指南 Windows篇:depot_tools 配置与源码获取(二)

引言 工欲善其事&#xff0c;必先利其器。在完成了 Visual Studio 2022 和 Windows SDK 的安装后&#xff0c;我们即将接触到 Chromium 开发生态中最核心的工具——depot_tools。这个由 Google 精心打造的工具集&#xff0c;就像是连接开发者与 Chromium 庞大代码库的智能桥梁…...

适应性Java用于现代 API:REST、GraphQL 和事件驱动

在快速发展的软件开发领域&#xff0c;REST、GraphQL 和事件驱动架构等新的 API 标准对于构建可扩展、高效的系统至关重要。Java 在现代 API 方面以其在企业应用中的稳定性而闻名&#xff0c;不断适应这些现代范式的需求。随着不断发展的生态系统&#xff0c;Java 在现代 API 方…...

Python爬虫实战:研究Restkit库相关技术

1. 引言 1.1 研究背景与意义 在当今信息爆炸的时代,互联网上存在着海量的有价值数据。如何高效地采集这些数据并将其应用于实际业务中,成为了许多企业和开发者关注的焦点。网络爬虫技术作为一种自动化的数据采集工具,可以帮助我们从网页中提取所需的信息。而 RESTful API …...

深入浅出JavaScript中的ArrayBuffer:二进制数据的“瑞士军刀”

深入浅出JavaScript中的ArrayBuffer&#xff1a;二进制数据的“瑞士军刀” 在JavaScript中&#xff0c;我们经常需要处理文本、数组、对象等数据类型。但当我们需要处理文件上传、图像处理、网络通信等场景时&#xff0c;单纯依赖字符串或数组就显得力不从心了。这时&#xff…...

中科院1区顶刊|IF14+:多组学MR联合单细胞时空分析,锁定心血管代谢疾病的免疫治疗新靶点

中科院1区顶刊|IF14&#xff1a;多组学MR联合单细胞时空分析&#xff0c;锁定心血管代谢疾病的免疫治疗新靶点 当下&#xff0c;免疫与代谢性疾病的关联研究已成为生命科学领域的前沿热点。随着研究的深入&#xff0c;我们愈发清晰地认识到免疫系统与代谢系统之间存在着极为复…...