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

【Qt之QWizardPage】使用

介绍

QWizardPage类是向导页面的基类。
QWizard表示一个向导。每个页面都是一个QWizardPage。当创建自己的向导时,可以直接使用QWizardPage,也可以子类化它以获得更多控制。
页面具有以下属性,由QWizard呈现:a titlea subTitlea set of pixmaps。有关详细信息,请参见向导页面元素。一旦将页面添加到向导中(使用QWizard :: addPage()QWizard :: setPage()),wizard()将返回指向相关的QWizard对象的指针。
页面提供了五个虚函数,可以重新实现以提供自定义行为:

  • initializePage()在用户单击向导的“下一步”按钮时调用以初始化页面的内容。如果您想从先前页面输入的内容中派生页面的默认值,则应该重新实现此函数。
  • cleanupPage()在用户单击向导的“返回”按钮时调用以重置页面的内容。
  • validatePage()在用户单击Next或Finish时验证页面。如果用户输入了不完整或无效的信息,通常会使用此函数显示错误消息。
  • nextId()返回下一页的ID。它在创建非线性向导时很有用,这些向导允许基于用户提供的信息进行不同的遍历路径。
  • isComplete()用于确定是否应启用或禁用“下一步”和/或“完成”按钮。如果重新实现isComplete(),还必须确保每当完成状态更改时发出completeChanged()。

通常,向导的“下一步”按钮和“完成”按钮是互斥的。如果isFinalPage()返回true,则可用Finish;否则,可用下一步。默认情况下,isFinalPage()仅在nextId()返回-1时为true。如果要在页面上同时显示“下一步”“完成”(允许用户执行“早期完成”),请在该页面上调用setFinalPage(true)。对于支持早期完成的向导,您可能还想在向导上设置HaveNextButtonOnLastPageHaveFinishButtonOnEarlyPages选项。

在许多向导中,页面的内容可能会影响后续页面的字段的默认值。为了方便页面之间的通信,QWizard支持“字段”机制,允许您在页面上注册字段(例如QLineEdit)并从任何页面访问其值。字段对整个向导程序是全局的,并使任何单个页面都可以访问存储在另一个页面中的信息,而无需将所有逻辑放入QWizard或页面明确知道彼此。使用registerField()注册字段,可以使用field()setField()随时访问它们。

常用方法

  1. virtual void initializePage(int id)
    这个虚函数由QWizard::initializePage()调用,以便在页面显示之前对其进行准备,或者由于QWizard::restart()被调用,或者由于用户单击Next而显示页面。(但是,如果设置了QWizard::IndependentPages选项,则仅在第一次显示页面时调用此函数。)
    通过重新实现这个函数,您可以确保页面的字段是基于先前页面中的字段正确初始化的。例如:
void OutputFilesPage: initializePage ()
{QString className = field("className").toString();headerLineEdit->setText(className.toLower() + ".h");implementationLineEdit->setText(className.toLower() + ".cpp");outputDirLineEdit - > setText (QDir:: toNativeSeparators (QDir: tempPath ()));
}

默认实现什么都不做。
2. void setButtonText(QWizard::WizardButton which, const QString &text)
将按钮上的文本设置为本页上的文本。
默认情况下,按钮上的文本依赖于QWizard::wizardStyle,但可以使用QWizard::setButtonText()为整个向导重新定义。

setButtonText(QWizard::NextButton, "hei");

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

setCommitPage(true);

在这里插入图片描述

  1. void setFinalPage(bool finalPage)
    如果finalPage为true,则显式地将此页面设置为final。
    调用setFinalPage(true)后,isFinalPage()返回true, Finish按钮可见(如果isComplete()返回true则启用)。
    调用setFinalPage(false)后,如果nextId()返回-1,isFinalPage()返回true;否则,返回false。

示例

.h

#ifndef CLASSWIZARD_H
#define CLASSWIZARD_H#include <QWizard>QT_BEGIN_NAMESPACE
class QCheckBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QRadioButton;
QT_END_NAMESPACEclass ClassWizard : public QWizard
{Q_OBJECTpublic:ClassWizard(QWidget *parent = 0);void accept() override;
};class IntroPage : public QWizardPage
{Q_OBJECTpublic:IntroPage(QWidget *parent = 0);private:QLabel *label;
};class ClassInfoPage : public QWizardPage
{Q_OBJECTpublic:ClassInfoPage(QWidget *parent = 0);private:QLabel *classNameLabel;QLabel *baseClassLabel;QLineEdit *classNameLineEdit;QLineEdit *baseClassLineEdit;QCheckBox *qobjectMacroCheckBox;QGroupBox *groupBox;QRadioButton *qobjectCtorRadioButton;QRadioButton *qwidgetCtorRadioButton;QRadioButton *defaultCtorRadioButton;QCheckBox *copyCtorCheckBox;
};class CodeStylePage : public QWizardPage
{Q_OBJECTpublic:CodeStylePage(QWidget *parent = 0);protected:void initializePage() override;private:QCheckBox *commentCheckBox;QCheckBox *protectCheckBox;QCheckBox *includeBaseCheckBox;QLabel *macroNameLabel;QLabel *baseIncludeLabel;QLineEdit *macroNameLineEdit;QLineEdit *baseIncludeLineEdit;
};class OutputFilesPage : public QWizardPage
{Q_OBJECTpublic:OutputFilesPage(QWidget *parent = 0);protected:void initializePage() override;private:QLabel *outputDirLabel;QLabel *headerLabel;QLabel *implementationLabel;QLineEdit *outputDirLineEdit;QLineEdit *headerLineEdit;QLineEdit *implementationLineEdit;
};class ConclusionPage : public QWizardPage
{Q_OBJECTpublic:ConclusionPage(QWidget *parent = 0);protected:void initializePage() override;private:QLabel *label;
};#endif

.cpp

#include <QtWidgets>#include "classwizard.h"ClassWizard::ClassWizard(QWidget *parent): QWizard(parent)
{addPage(new IntroPage);addPage(new ClassInfoPage);addPage(new CodeStylePage);addPage(new OutputFilesPage);addPage(new ConclusionPage);setPixmap(QWizard::BannerPixmap, QPixmap(":/images/banner.png"));setPixmap(QWizard::BackgroundPixmap, QPixmap(":/images/background.png"));setWindowTitle(tr("Class Wizard"));
}void ClassWizard::accept()
{QByteArray className = field("className").toByteArray();QByteArray baseClass = field("baseClass").toByteArray();QByteArray macroName = field("macroName").toByteArray();QByteArray baseInclude = field("baseInclude").toByteArray();QString outputDir = field("outputDir").toString();QString header = field("header").toString();QString implementation = field("implementation").toString();QByteArray block;if (field("comment").toBool()) {block += "/*\n";block += "    " + header.toLatin1() + '\n';block += "*/\n";block += '\n';}if (field("protect").toBool()) {block += "#ifndef " + macroName + '\n';block += "#define " + macroName + '\n';block += '\n';}if (field("includeBase").toBool()) {block += "#include " + baseInclude + '\n';block += '\n';}block += "class " + className;if (!baseClass.isEmpty())block += " : public " + baseClass;block += '\n';block += "{\n";/* qmake ignore Q_OBJECT */if (field("qobjectMacro").toBool()) {block += "    Q_OBJECT\n";block += '\n';}block += "public:\n";if (field("qobjectCtor").toBool()) {block += "    " + className + "(QObject *parent = 0);\n";} else if (field("qwidgetCtor").toBool()) {block += "    " + className + "(QWidget *parent = 0);\n";} else if (field("defaultCtor").toBool()) {block += "    " + className + "();\n";if (field("copyCtor").toBool()) {block += "    " + className + "(const " + className + " &other);\n";block += '\n';block += "    " + className + " &operator=" + "(const " + className+ " &other);\n";}}block += "};\n";if (field("protect").toBool()) {block += '\n';block += "#endif\n";}QFile headerFile(outputDir + '/' + header);if (!headerFile.open(QFile::WriteOnly | QFile::Text)) {QMessageBox::warning(0, QObject::tr("Simple Wizard"),QObject::tr("Cannot write file %1:\n%2").arg(headerFile.fileName()).arg(headerFile.errorString()));return;}headerFile.write(block);block.clear();if (field("comment").toBool()) {block += "/*\n";block += "    " + implementation.toLatin1() + '\n';block += "*/\n";block += '\n';}block += "#include \"" + header.toLatin1() + "\"\n";block += '\n';if (field("qobjectCtor").toBool()) {block += className + "::" + className + "(QObject *parent)\n";block += "    : " + baseClass + "(parent)\n";block += "{\n";block += "}\n";} else if (field("qwidgetCtor").toBool()) {block += className + "::" + className + "(QWidget *parent)\n";block += "    : " + baseClass + "(parent)\n";block += "{\n";block += "}\n";} else if (field("defaultCtor").toBool()) {block += className + "::" + className + "()\n";block += "{\n";block += "    // missing code\n";block += "}\n";if (field("copyCtor").toBool()) {block += "\n";block += className + "::" + className + "(const " + className+ " &other)\n";block += "{\n";block += "    *this = other;\n";block += "}\n";block += '\n';block += className + " &" + className + "::operator=(const "+ className + " &other)\n";block += "{\n";if (!baseClass.isEmpty())block += "    " + baseClass + "::operator=(other);\n";block += "    // missing code\n";block += "    return *this;\n";block += "}\n";}}QFile implementationFile(outputDir + '/' + implementation);if (!implementationFile.open(QFile::WriteOnly | QFile::Text)) {QMessageBox::warning(0, QObject::tr("Simple Wizard"),QObject::tr("Cannot write file %1:\n%2").arg(implementationFile.fileName()).arg(implementationFile.errorString()));return;}implementationFile.write(block);QDialog::accept();
}IntroPage::IntroPage(QWidget *parent): QWizardPage(parent)
{setTitle(tr("Introduction"));setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark1.png"));label = new QLabel(tr("This wizard will generate a skeleton C++ class ""definition, including a few functions. You simply ""need to specify the class name and set a few ""options to produce a header file and an ""implementation file for your new C++ class."));label->setWordWrap(true);QVBoxLayout *layout = new QVBoxLayout;layout->addWidget(label);setLayout(layout);
}ClassInfoPage::ClassInfoPage(QWidget *parent): QWizardPage(parent)
{setTitle(tr("Class Information"));setSubTitle(tr("Specify basic information about the class for which you ""want to generate skeleton source code files."));setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo1.png"));classNameLabel = new QLabel(tr("&Class name:"));classNameLineEdit = new QLineEdit;classNameLabel->setBuddy(classNameLineEdit);baseClassLabel = new QLabel(tr("B&ase class:"));baseClassLineEdit = new QLineEdit;baseClassLabel->setBuddy(baseClassLineEdit);qobjectMacroCheckBox = new QCheckBox(tr("Generate Q_OBJECT &macro"));groupBox = new QGroupBox(tr("C&onstructor"));qobjectCtorRadioButton = new QRadioButton(tr("&QObject-style constructor"));qwidgetCtorRadioButton = new QRadioButton(tr("Q&Widget-style constructor"));defaultCtorRadioButton = new QRadioButton(tr("&Default constructor"));copyCtorCheckBox = new QCheckBox(tr("&Generate copy constructor and ""operator="));defaultCtorRadioButton->setChecked(true);connect(defaultCtorRadioButton, &QAbstractButton::toggled,copyCtorCheckBox, &QWidget::setEnabled);registerField("className*", classNameLineEdit);registerField("baseClass", baseClassLineEdit);registerField("qobjectMacro", qobjectMacroCheckBox);registerField("qobjectCtor", qobjectCtorRadioButton);registerField("qwidgetCtor", qwidgetCtorRadioButton);registerField("defaultCtor", defaultCtorRadioButton);registerField("copyCtor", copyCtorCheckBox);QVBoxLayout *groupBoxLayout = new QVBoxLayout;groupBoxLayout->addWidget(qobjectCtorRadioButton);groupBoxLayout->addWidget(qwidgetCtorRadioButton);groupBoxLayout->addWidget(defaultCtorRadioButton);groupBoxLayout->addWidget(copyCtorCheckBox);groupBox->setLayout(groupBoxLayout);QGridLayout *layout = new QGridLayout;layout->addWidget(classNameLabel, 0, 0);layout->addWidget(classNameLineEdit, 0, 1);layout->addWidget(baseClassLabel, 1, 0);layout->addWidget(baseClassLineEdit, 1, 1);layout->addWidget(qobjectMacroCheckBox, 2, 0, 1, 2);layout->addWidget(groupBox, 3, 0, 1, 2);setLayout(layout);
}CodeStylePage::CodeStylePage(QWidget *parent): QWizardPage(parent)
{setTitle(tr("Code Style Options"));setSubTitle(tr("Choose the formatting of the generated code."));setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo2.png"));commentCheckBox = new QCheckBox(tr("&Start generated files with a ""comment"));commentCheckBox->setChecked(true);protectCheckBox = new QCheckBox(tr("&Protect header file against multiple ""inclusions"));protectCheckBox->setChecked(true);macroNameLabel = new QLabel(tr("&Macro name:"));macroNameLineEdit = new QLineEdit;macroNameLabel->setBuddy(macroNameLineEdit);includeBaseCheckBox = new QCheckBox(tr("&Include base class definition"));baseIncludeLabel = new QLabel(tr("Base class include:"));baseIncludeLineEdit = new QLineEdit;baseIncludeLabel->setBuddy(baseIncludeLineEdit);connect(protectCheckBox, &QAbstractButton::toggled,macroNameLabel, &QWidget::setEnabled);connect(protectCheckBox, &QAbstractButton::toggled,macroNameLineEdit, &QWidget::setEnabled);connect(includeBaseCheckBox, &QAbstractButton::toggled,baseIncludeLabel, &QWidget::setEnabled);connect(includeBaseCheckBox, &QAbstractButton::toggled,baseIncludeLineEdit, &QWidget::setEnabled);registerField("comment", commentCheckBox);registerField("protect", protectCheckBox);registerField("macroName", macroNameLineEdit);registerField("includeBase", includeBaseCheckBox);registerField("baseInclude", baseIncludeLineEdit);QGridLayout *layout = new QGridLayout;layout->setColumnMinimumWidth(0, 20);layout->addWidget(commentCheckBox, 0, 0, 1, 3);layout->addWidget(protectCheckBox, 1, 0, 1, 3);layout->addWidget(macroNameLabel, 2, 1);layout->addWidget(macroNameLineEdit, 2, 2);layout->addWidget(includeBaseCheckBox, 3, 0, 1, 3);layout->addWidget(baseIncludeLabel, 4, 1);layout->addWidget(baseIncludeLineEdit, 4, 2);setLayout(layout);
}void CodeStylePage::initializePage()
{QString className = field("className").toString();macroNameLineEdit->setText(className.toUpper() + "_H");QString baseClass = field("baseClass").toString();includeBaseCheckBox->setChecked(!baseClass.isEmpty());includeBaseCheckBox->setEnabled(!baseClass.isEmpty());baseIncludeLabel->setEnabled(!baseClass.isEmpty());baseIncludeLineEdit->setEnabled(!baseClass.isEmpty());QRegularExpression rx("Q[A-Z].*");if (baseClass.isEmpty()) {baseIncludeLineEdit->clear();} else if (rx.match(baseClass).hasMatch()) {baseIncludeLineEdit->setText('<' + baseClass + '>');} else {baseIncludeLineEdit->setText('"' + baseClass.toLower() + ".h\"");}
}OutputFilesPage::OutputFilesPage(QWidget *parent): QWizardPage(parent)
{setTitle(tr("Output Files"));setSubTitle(tr("Specify where you want the wizard to put the generated ""skeleton code."));setPixmap(QWizard::LogoPixmap, QPixmap(":/images/logo3.png"));outputDirLabel = new QLabel(tr("&Output directory:"));outputDirLineEdit = new QLineEdit;outputDirLabel->setBuddy(outputDirLineEdit);headerLabel = new QLabel(tr("&Header file name:"));headerLineEdit = new QLineEdit;headerLabel->setBuddy(headerLineEdit);implementationLabel = new QLabel(tr("&Implementation file name:"));implementationLineEdit = new QLineEdit;implementationLabel->setBuddy(implementationLineEdit);registerField("outputDir*", outputDirLineEdit);registerField("header*", headerLineEdit);registerField("implementation*", implementationLineEdit);QGridLayout *layout = new QGridLayout;layout->addWidget(outputDirLabel, 0, 0);layout->addWidget(outputDirLineEdit, 0, 1);layout->addWidget(headerLabel, 1, 0);layout->addWidget(headerLineEdit, 1, 1);layout->addWidget(implementationLabel, 2, 0);layout->addWidget(implementationLineEdit, 2, 1);setLayout(layout);
}void OutputFilesPage::initializePage()
{QString className = field("className").toString();headerLineEdit->setText(className.toLower() + ".h");implementationLineEdit->setText(className.toLower() + ".cpp");outputDirLineEdit->setText(QDir::toNativeSeparators(QDir::tempPath()));
}ConclusionPage::ConclusionPage(QWidget *parent): QWizardPage(parent)
{setTitle(tr("Conclusion"));setPixmap(QWizard::WatermarkPixmap, QPixmap(":/images/watermark2.png"));label = new QLabel;label->setWordWrap(true);QVBoxLayout *layout = new QVBoxLayout;layout->addWidget(label);setLayout(layout);
}void ConclusionPage::initializePage()
{QString finishText = wizard()->buttonText(QWizard::FinishButton);finishText.remove('&');label->setText(tr("Click %1 to generate the class skeleton.")

.main

#include <QApplication>
#include <QTranslator>
#include <QLocale>
#include <QLibraryInfo>#include "classwizard.h"int main(int argc, char *argv[])
{Q_INIT_RESOURCE(classwizard);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);
#endifClassWizard wizard;wizard.show();return app.exec();
}

相关文章:

【Qt之QWizardPage】使用

介绍 QWizardPage类是向导页面的基类。 QWizard表示一个向导。每个页面都是一个QWizardPage。当创建自己的向导时&#xff0c;可以直接使用QWizardPage&#xff0c;也可以子类化它以获得更多控制。 页面具有以下属性&#xff0c;由QWizard呈现&#xff1a;a title&#xff0c;…...

自动化测试,5个技巧轻松搞定

想要在质量保证团队中赢得核心&#xff1f;当你组建你的网络应用时要记住这些技巧&#xff0c;可以变得更容易分析并快速创建更多准确可重复的自动化测试。 1.歧义是敌人 尽可能使你的代码具体化。当然&#xff0c;你已经遵循了W3C标准&#xff0c;对吗&#xff1f;以下有三件…...

EasyWeChat调用企业微信接口获取客户群数据

use EasyWeChat\Factory; use fast\Http;$config [corp_id > Config::get(site.corp_id),agent_id > Config::get(site.agend_id), // 如果有 agend_id 则填写secret > Config::get(site.agent_secret),// 指定 API 调用返回结果的类型&#xff1a;array(default)…...

sql 左联 右联

...

k8s中的端口hostPort、port、nodePort、targetPort

hostPort:apiVersion: v1 kind: Pod metadata:name: tomcat spec:containers:- name: tomcatimage: tomcat:8.5ports:- hostPort: 8081containerPort: 8080protocol: TCPhostPort 类似docker -p 参数做的端口映射&#xff0c;将容器内端口映射到宿主机上(hostPort), 在k8s中&am…...

自动发微博脚本工具,可批量定时发送,按键精灵完全开源版

就跟标题上面讲的&#xff0c;软件是我之前开发好的&#xff0c;所有功能都能用&#xff0c;是按键精灵的脚本&#xff0c;只是单设备操作&#xff0c;也可以在模拟器下面操作&#xff0c;UI代码方面都设计的很完整&#xff0c;我这边就干脆分享出来给大家用&#xff0c;不用繁…...

2023版Idea创建JavaWeb时,右键new没有Servlet快捷键选项

问题&#xff1a;右键时&#xff0c;没有创建servlet的快捷键&#xff0c;如下图&#xff1a; 解决方法&#xff1a; 1.打开idea&#xff0c;点击File>settings(设置)&#xff0c;进入settings页面&#xff0c;如下 从上图中的Files选项中没看到有servlet选项&#xff0c;…...

数据结构(c语言版本) 二叉树的遍历

要求 实现二叉树的创建&#xff0c;并输入二叉树数据 然后先序遍历输出二叉树、中序遍历输出二叉树、后序输出二叉树 输出二叉树的深度、二叉树的叶子结点 例如二叉树为&#xff1a; 该二叉树的先序遍历结果为&#xff1a; A B D C E F 该二叉树的中序遍历结果为&#xff1a…...

Django 配置 Email Admin 详细指南

概要 Django 是一个高级的 Python Web 框架&#xff0c;它鼓励快速开发和清洁、实用的设计。当你正在开发一个 Django 项目时&#xff0c;监控网站的运行情况是非常必要的。Django 提供了一个功能强大的 admin 界面&#xff0c;但同时也可以通过配置 email admin 来获取网站的…...

Apache阿帕奇安装配置

目录 一、下载程序 1. 点击Download 2. 点击Files for Microsoft Windows 3. 点击Apache Lounge 4. 点击httpd-2.4.54-win64-VSI6.zip ​5. 下载压缩包 6.解压到文件夹里 二、配置环境变量 1. 右键我的电脑 - 属性 2. 高级系统设置 3. 点击环境变量 4. 点击系统变…...

时间序列预测实战(十六)PyTorch实现GRU-FCN模型长期预测并可视化结果

往期回顾&#xff1a;时间序列预测专栏——包含上百种时间序列模型带你从入门到精通时间序列预测 一、本文介绍 本文讲解的实战内容是GRU-FCN(门控循环单元-全卷积网络)&#xff0c;这是一种结合了GRU&#xff08;用于处理时间序列数据&#xff09;和FCN&#xff08;全卷积网络…...

如何提升软件测试效率?本文为你揭示秘密

在软件开发中&#xff0c;测试是至关重要的一个环节。它能帮助我们发现并修复问题&#xff0c;从而确保我们提供的软件具有高质量。然而&#xff0c;测试过程往往费时费力。那么&#xff0c;有没有方法可以提升我们的软件测试效率呢&#xff1f;答案是肯定的。下面&#xff0c;…...

参数估计和非参数估计

一、参数估计 参数估计是统计学中的一个重要概念&#xff0c;它涉及到使用样本数据来估计总体参数的过程。在统计学中&#xff0c;总体是指研究对象的整体集合&#xff0c;而样本是从总体中抽取的部分元素。 参数估计有两种主要方法&#xff1a;点估计和区间估计。 点估计&am…...

Apache Airflow (八) :DAG任务依赖设置

&#x1f3e1; 个人主页&#xff1a;IT贫道_大数据OLAP体系技术栈,Apache Doris,Clickhouse 技术-CSDN博客 &#x1f6a9; 私聊博主&#xff1a;加入大数据技术讨论群聊&#xff0c;获取更多大数据资料。 &#x1f514; 博主个人B栈地址&#xff1a;豹哥教你大数据的个人空间-豹…...

使用 com.jacob.activeX 库实现 Word 到 PDF

使用 com.jacob.activeX 库实现 Word 到 PDF 的转换涉及到使用 Java 和 Microsoft Office 的 COM 自动化。JACOB&#xff08;Java COM Bridge&#xff09;库提供了一个桥接器&#xff0c;允许 Java 代码通过 COM&#xff08;组件对象模型&#xff09;与 Windows 应用程序&#…...

2023亚太杯数学建模思路 - 案例:FPTree-频繁模式树算法

文章目录 算法介绍FP树表示法构建FP树实现代码 建模资料 ## 赛题思路 &#xff08;赛题出来以后第一时间在CSDN分享&#xff09; https://blog.csdn.net/dc_sinor?typeblog 算法介绍 FP-Tree算法全称是FrequentPattern Tree算法&#xff0c;就是频繁模式树算法&#xff0c…...

Dart利用私有构造函数_()创建单例模式

文章目录 类的构造函数_()函数dart中构造函数定义 类的构造函数 类的构造函数有两种&#xff1a; 1&#xff09;默认构造函数&#xff1a; 当实例化对象的时候&#xff0c;会自动调用的函数&#xff0c;构造函数的名称和类的名称相同&#xff0c;在一个类中默认构造函数只能由…...

简述如何使用Androidstudio对文件进行保存和获取文件中的数据

在 Android Studio 中&#xff0c;可以使用以下方法对文件进行保存和获取文件中的数据&#xff1a; 保存文件&#xff1a; 创建一个 File 对象&#xff0c;指定要保存的文件路径和文件名。使用 FileOutputStream 类创建一个文件输出流对象。将需要保存的数据写入文件输出流中…...

面向配电网韧性提升的移动储能预布局与动态调度策略(matlab代码)

欢迎关注威♥“电击小子程高兴的MATLAB小屋”获取更多资料 该程序复现《面向配电网韧性提升的移动储能预布局与动态调度策略》&#xff0c;具体摘要内容见下图&#xff0c;程序主要分为两大模块&#xff0c;第一部分是灾前预防代码&#xff0c;该部分采用两阶段优化算法&#…...

内网信息收集

目录 本机信息收集 查看系统配置信息 查看系统服务信息 查看系统登录信息 自动信息收集 域内信息收集 判断是否存在域 探测域内存主机&端口 powershell arp扫描 小工具 telnet 查看用户&机器&会话相关信息 查看机器相关信息 查看用户相关信息 免费领…...

基于ASP.NET+ SQL Server实现(Web)医院信息管理系统

医院信息管理系统 1. 课程设计内容 在 visual studio 2017 平台上&#xff0c;开发一个“医院信息管理系统”Web 程序。 2. 课程设计目的 综合运用 c#.net 知识&#xff0c;在 vs 2017 平台上&#xff0c;进行 ASP.NET 应用程序和简易网站的开发&#xff1b;初步熟悉开发一…...

【JVM】- 内存结构

引言 JVM&#xff1a;Java Virtual Machine 定义&#xff1a;Java虚拟机&#xff0c;Java二进制字节码的运行环境好处&#xff1a; 一次编写&#xff0c;到处运行自动内存管理&#xff0c;垃圾回收的功能数组下标越界检查&#xff08;会抛异常&#xff0c;不会覆盖到其他代码…...

鸿蒙中用HarmonyOS SDK应用服务 HarmonyOS5开发一个医院挂号小程序

一、开发准备 ​​环境搭建​​&#xff1a; 安装DevEco Studio 3.0或更高版本配置HarmonyOS SDK申请开发者账号 ​​项目创建​​&#xff1a; File > New > Create Project > Application (选择"Empty Ability") 二、核心功能实现 1. 医院科室展示 /…...

最新SpringBoot+SpringCloud+Nacos微服务框架分享

文章目录 前言一、服务规划二、架构核心1.cloud的pom2.gateway的异常handler3.gateway的filter4、admin的pom5、admin的登录核心 三、code-helper分享总结 前言 最近有个活蛮赶的&#xff0c;根据Excel列的需求预估的工时直接打骨折&#xff0c;不要问我为什么&#xff0c;主要…...

2021-03-15 iview一些问题

1.iview 在使用tree组件时&#xff0c;发现没有set类的方法&#xff0c;只有get&#xff0c;那么要改变tree值&#xff0c;只能遍历treeData&#xff0c;递归修改treeData的checked&#xff0c;发现无法更改&#xff0c;原因在于check模式下&#xff0c;子元素的勾选状态跟父节…...

vue3 定时器-定义全局方法 vue+ts

1.创建ts文件 路径&#xff1a;src/utils/timer.ts 完整代码&#xff1a; import { onUnmounted } from vuetype TimerCallback (...args: any[]) > voidexport function useGlobalTimer() {const timers: Map<number, NodeJS.Timeout> new Map()// 创建定时器con…...

ardupilot 开发环境eclipse 中import 缺少C++

目录 文章目录 目录摘要1.修复过程摘要 本节主要解决ardupilot 开发环境eclipse 中import 缺少C++,无法导入ardupilot代码,会引起查看不方便的问题。如下图所示 1.修复过程 0.安装ubuntu 软件中自带的eclipse 1.打开eclipse—Help—install new software 2.在 Work with中…...

网络编程(UDP编程)

思维导图 UDP基础编程&#xff08;单播&#xff09; 1.流程图 服务器&#xff1a;短信的接收方 创建套接字 (socket)-----------------------------------------》有手机指定网络信息-----------------------------------------------》有号码绑定套接字 (bind)--------------…...

Android 之 kotlin 语言学习笔记三(Kotlin-Java 互操作)

参考官方文档&#xff1a;https://developer.android.google.cn/kotlin/interop?hlzh-cn 一、Java&#xff08;供 Kotlin 使用&#xff09; 1、不得使用硬关键字 不要使用 Kotlin 的任何硬关键字作为方法的名称 或字段。允许使用 Kotlin 的软关键字、修饰符关键字和特殊标识…...

SiFli 52把Imagie图片,Font字体资源放在指定位置,编译成指定img.bin和font.bin的问题

分区配置 (ptab.json) img 属性介绍&#xff1a; img 属性指定分区存放的 image 名称&#xff0c;指定的 image 名称必须是当前工程生成的 binary 。 如果 binary 有多个文件&#xff0c;则以 proj_name:binary_name 格式指定文件名&#xff0c; proj_name 为工程 名&…...