【Qt之QWizard】使用1

news2024/10/6 19:23:09

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_TRANSLATION
      QString translatorFileName = QLatin1String("qt_");
      translatorFileName += QLocale::system().name();
      QTranslator *translator = new QTranslator(&app);
      if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
          app.installTranslator(translator);
  #endif

      QWizard 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_TRANSLATION
    QString translatorFileName = QLatin1String("qt_");
    translatorFileName += QLocale::system().name();
    QTranslator *translator = new QTranslator(&app);
    if (translator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
        app.installTranslator(translator);
#endif

    QWizard 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 的事件循环,直到应用程序关闭或者通过主动退出来结束。

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1208827.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

H5游戏源码分享-超级染色体小游戏

H5游戏源码分享-超级染色体小游戏 游戏玩法 不断地扩大发展同颜色的色块 用最少的步数完成游戏 <!DOCTYPE html> <html><head><meta charset"UTF-8"><meta name"viewport"content"widthdevice-width,user-scalableno,init…

Linux shell编程学习笔记25:tty

1 tty的由来 在 1830 年代和 1840 年代&#xff0c;开发了称为电传打字机&#xff08;teletypewriters&#xff09;的机器&#xff0c;这些机器可以将发件人在键盘上输入的消息“沿着线路”发送在接收端并打印在纸上。 电传打字机的名称由teletypewriters&#xff0c; 缩短为…

学习samba

文章目录 一、samba介绍二、samba的主要进程三、配置文件四、例子 一、samba介绍 1、SMB&#xff08;Server Message Block&#xff09;协议实现文件共享&#xff0c;也称为CIFS&#xff08;Common Internet File System&#xff09;。 2、是Windows和类Unix系统之间共享文件的…

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…

Python---集合中的交集 、并集 | 与差集 - 特性

用 & 来求两个集合的交集&#xff1a;-----键盘上的7上的符号&#xff0c;shift 7 同时按 用 | 来求两个集合的并集&#xff1a; -----键盘上的7上的符号&#xff0c;shift 同时按&#xff08;就是enter键上面那个|\ &#xff09; 用 - 来求两个集合的差集&#xff…

dbeaver导入sql脚本报错:unhandled event loop exception java heap space

在DBeaver里执行一个有8w条数据的sql文件&#xff0c;只保存了2k条 错误原因见&#xff1a; https://blog.csdn.net/liu_feng_zi_/article/details/122578880文章作者所描述的&#xff1a; 使用dbeaver连接MySQL数据库&#xff0c;在通过sql脚本插入数据&#xff0c;或将插入语…

模拟散列表(哈希表拉链法)

维护一个集合&#xff0c;支持如下几种操作&#xff1a; I x&#xff0c;插入一个整数 x&#xff1b;Q x&#xff0c;询问整数 x 是否在集合中出现过&#xff1b; 现在要进行 N 次操作&#xff0c;对于每个询问操作输出对应的结果。 输入格式 第一行包含整数 N&#xff0c;…

【论文阅读】(VAE-GAN)Autoencoding beyond pixels using a learned similarity metric

论文地址;[1512.09300] Autoencoding beyond pixels using a learned similarity metric (arxiv.org) / 一、Introduction 主要讲了深度学习中生成模型存在的问题&#xff0c;即常用的相似度度量方式&#xff08;使用元素误差度量&#xff09;对于学习良好的生成模型存在一定…

【C++】类与对象 I

类与对象 I &#xff1a; 前言&#xff1a;&#xff08;C&#xff09;面向过程 和&#xff08;C&#xff09;面向对象 初步认识前言&#xff1a;类的引入一、类的介绍二、类的定义&#xff08;一&#xff09;class 语法&#xff08;二&#xff09;类的两种定义方式&#xff1a;…

Linux多线程服务端编程:使用muduo C++网络库 学习笔记 第七章 muduo编程示例(下)

7.5 一种自动反射消息类型的Protobuf网络传输方案 本节假定读者了解Google Protocol Buffers是什么&#xff0c;这不是一篇Protobuf入门教程。本节的示例代码位于examples/protobuf/codec。 本节要解决的问题是&#xff1a;通信双方在编译时就共享proto文件&#xff08;用于定…

解密N数之和问题的秘密

目录 两数之和三数之和 两数之和 我们来看力扣第一题 给定一个整数数组 nums 和一个整数目标值 target&#xff0c;请你在该数组中找出 和为目标值 target 的那 两个 整数&#xff0c;并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是&#xff0c;数组中同一…

jetson配置笔记

typora-root-url: /home/msj/ubuntu笔记本台式机环境配置说明/images Ubuntu18.04 配置 说明&#xff1a;我们所有文档配置都是按照ubuntu18.04&#xff0c;保证x86架构(笔记本台式机)和 ARM架构(jetson Nano只能安装18.04)的一致性 1. 更换各类源 我们所有源都更换清华源&a…

一文说清楚Openai的这波更新内容,大地震 一大波套壳公司倒闭

前几天Openai召开了首届的开发者大会&#xff0c;45分钟的会议&#xff0c;让千万用户感到兴奋&#xff0c;但是让万千的套壳的创业公司&#xff0c;却感觉如坐针毡。这次发布会发布了哪些功能&#xff1f;为什么会导致这种情况的发生&#xff1f;让我们接着往下讲 API升级且降…

振南技术干货集:深入浅出的Bootloader(5)

注解目录 1、烧录方式的更新迭代 1.1 古老的烧录方式 (怀旧一下&#xff0c;单片机高压烧录器。) 1.2 ISP 与ICP 烧录方式 (还记得当年我们玩过的 AT89S51?) 1.3 更方便的 ISP 烧录方式 1.3.1串口 ISP &#xff08;是 STC 单片机成就了我们&#xff0c;还是我们成就了…

以阿里云全球故障为例,聊聊如何保障 Auth 服务的 SLA

在刚刚过去的“双十一”购物狂欢季&#xff0c;阿里云经历了一次大规模故障&#xff0c;导致阿里系产品集体中断服务。据报道&#xff0c;11 月 12 日&#xff0c;淘宝、钉钉、闲鱼、阿里云盘等阿里系产品出现无法使用的问题&#xff0c; “阿里全系产品崩了” 的话题迅速引发众…

龙迅LT9211D MIPI(DSI/CSI)转LVDS和集创北方ICN6202 MIPIDSI转LVDS比对

龙迅LT9211D描述&#xff1a; Lontium LT9211D是一款高性能的MIPI DSI/CSI- 2到双端口LVDS转换器。LT9211D反序列化输入的MIPI视频数据&#xff0c;解码数据包&#xff0c;并将格式化的视频数据流转换为AP和移动显示面板或摄像机之间的LVDS发射机输出。LT9211D支持最大14 dB输…

【luckfox】0、开发环境搭建

前言 本章简单介绍如何搭建luckfox的开发环境。 一、抓取luckfox源码 需要提前准备好ubuntu环境。 git clone https://github.com/LuckfoxTECH/luckfox-pico.git二、编译 youkaiubuntu:/home/luckfox/luckfox-pico$ ./build.sh lunchyoukaiubuntu:/home/luckfox/luckfox-p…

二十、泛型(7)

本章概要 动态类型安全泛型异常混型 C 中的混型与接口混合使用装饰器模式与动态代理混合 动态类型安全 因为可以向 Java 5 之前的代码传递泛型集合&#xff0c;所以旧式代码仍旧有可能会破坏你的集合。Java 5 的 java.util.Collections 中有一组便利工具&#xff0c;可以解…

ubuntu中使用 vscode 连接docker开发环境

文章目录 ubuntu中使用 vscode 连接docker开发环境步骤一&#xff1a;安装 Remote Development 插件步骤二&#xff1a;连接远程环境步骤三&#xff1a;开发 问题解决参考连接 ubuntu中使用 vscode 连接docker开发环境 Remote Development 是一个 Visual Studio Code 插件&…

【python 生成器 面试必备】yield关键字,协程必知必会系列文章--自己控制程序调度,体验做上帝的感觉 1

python生成器系列文章目录 第一章 yield — Python (Part I) 文章目录 python生成器系列文章目录前言1. Generator Function 生成器函数2.并发和并行&#xff0c;抢占式和协作式2.Let’s implement Producer/Consumer pattern using subroutine: 生成器的状态 generator’s st…