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

傻瓜做网站软件seo怎么做新手入门

傻瓜做网站软件,seo怎么做新手入门,余姚网站建设,辽源市建设局网站目录 1 界面设计 2 代码 2.1 登录界面 2.2 注册界面 2.3 登陆后的界面 3 完整资源 这里主要记录了如何使用Qt Creator创建一个用户登录界面,能够实现用户的注册和登录功能,注册的用户信息存储在了一个文件之中,在登录时可以比对登录信息…

目录

1 界面设计

2 代码

2.1 登录界面

2.2 注册界面

2.3 登陆后的界面

3 完整资源


        这里主要记录了如何使用Qt Creator创建一个用户登录界面,能够实现用户的注册和登录功能,注册的用户信息存储在了一个文件之中,在登录时可以比对登录信息和文件存储信息,已确认用户是否存在,如果不存在也可以通过注册功能进行注册。

1 界面设计

主要分为3个界面:登录界面、注册界面、登录后的界面

2 代码

2.1 登录界面

登录界面命名对于文件为widget.h、widget.c

widget.h

#ifndef WIDGET_H
#define WIDGET_H#include <QWidget>
#include <form.h>
#include <form01.h>QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACEclass Widget : public QWidget
{Q_OBJECTpublic:Form *form = new Form();         // define a objectForm01 *form01 = new Form01();   // Loginpublic:Widget(QWidget *parent = nullptr);~Widget();private slots:void on_pushButton_clicked();void on_pushButton_2_clicked();void on_pushButton_3_clicked();private:Ui::Widget *ui;
};
#endif // WIDGET_H

widget.c

#include "widget.h"
#include "ui_widget.h"
#include "QDebug"
#include "main.h"
#include "QDir"
#include "QMessageBox"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget)
{ui->setupUi(this);connect(this->form, &Form::BackSig, this, [=](){this->form->hide();this->show();});}Widget::~Widget()
{delete ui;
}void Widget::on_pushButton_clicked()
{// this->hide();// this->close();qDebug() << "Change page to Login";// gain context about lineEdit and judge and ...QString path = QDir::currentPath(); // 获取当前工程所在路径std::string user_pwd;  //std::string part1;   // useranmestd::string part2;   // passwordint flag = 1;std::ifstream infile("/root/QT_developer/File/user_table.txt");if (!infile.is_open()) {std::cerr << "Unable to open file!" << std::endl;}//std::string line;QString In_username = ui->lineEdit->text();QString In_password = ui->lineEdit_2->text();part1 = In_username.toStdString();part2 = In_password.toStdString();user_pwd = part1 + ":" + part2;if(In_password.isEmpty()){QMessageBox::information(this, "Tips", "In_password is empty!");}else if(In_username.isEmpty()){QMessageBox::information(this, "Tips", "In_usename is empty!");}else{while (std::getline(infile, line)) {  // gain data on a lineif(user_pwd == line){flag = 0;infile.close();this->close();ui->lineEdit->clear();ui->lineEdit_2->clear();QMessageBox::information(this, "Tips", "Login success!");In_username.clear();In_password.clear();form01->show();break;}}if(flag == 1){ui->lineEdit->clear();ui->lineEdit_2->clear();QMessageBox::information(this, "Tips", "username or password is error!");In_username.clear();In_password.clear();}}
}void Widget::on_pushButton_2_clicked()
{// this->hide();// this->close();qDebug() << "Change page to Register";form->show();
}void Widget::on_pushButton_3_clicked()
{this->close();qDebug() << "Quit";
}

2.2 注册界面

注册界面命名对于文件为form.h、form.c

form.h

#ifndef FORM_H
#define FORM_H#include <QWidget>namespace Ui {
class Form;
}class Form : public QWidget
{Q_OBJECTpublic:explicit Form(QWidget *parent = nullptr);~Form();public:void Open_file();private slots:void on_pushButton_2_clicked();void on_pushButton_clicked();private:Ui::Form *ui;signals:void BackSig();  // define a signal without arg.
};#endif // FORM_H

form.c

#include "form.h"
#include "ui_form.h"
#include "qdebug.h"
#include "widget.h"
#include "QLineEdit"
#include "QMessageBox"
#include "main.h"
#include "QDir"Form::Form(QWidget *parent) :QWidget(parent),ui(new Ui::Form)
{ui->setupUi(this);// this->show();}Form::~Form()
{delete ui;
}void Form::on_pushButton_2_clicked()
{qDebug() << "Back";emit this->BackSig();}void Form::on_pushButton_clicked()
{///QString path = QDir::currentPath(); // 获取当前工程所在路径std::size_t found; // 查找冒号的位置std::string user_pwd;  // Concatenated username and passwordstd::string part1;   // useranmestd::string part2;   // passwordstd::string line;int flag = 1;std::ofstream outfile; // ready for writing// std::ifstream infile(path.toStdString() + "user_table.txt");std::ifstream infile("/root/QT_developer/File/user_table.txt");  // Absolute pathif (!infile.is_open()) {              // Determine whether the opening is successfulstd::cerr << "Unable to open file!" << std::endl;}///// gain dataQString username = ui->lineEdit->text();QString password = ui->lineEdit_2->text();QString password_firm = ui->lineEdit_3->text();// pan duan yong hu ming shi fou chong fuif(username.isEmpty()){qDebug() << "username can't is empty";QMessageBox::information(this, "Tips", "username can't is empty");}else if(password.isEmpty()){QMessageBox::information(this, "Tips", "password can't is empty");}else if(password_firm.isEmpty()){QMessageBox::information(this, "Tips", "password_firm can't is empty");}else{// judgeif(password != password_firm){ui->lineEdit->clear();  // clearui->lineEdit_2->clear();ui->lineEdit_3->clear();QMessageBox::information(this, "Tips", "password != password_firm!");username.clear();    // clearpassword.clear();password_firm.clear();}else{while (std::getline(infile, line)) {  // gain data on a linefound = line.find(':');   // find :if (found != std::string::npos) {part1 = line.substr(0, found); // 从开始到冒号前的部分qDebug() << "part1-username: ";cout << "part1-username: " << part1;}//if(QString::fromStdString(part1) == username){flag = 0;infile.close();ui->lineEdit->clear();ui->lineEdit_2->clear();ui->lineEdit_3->clear();QMessageBox::information(this, "Tips", "username has been exist!");username.clear();password.clear();password_firm.clear();break;}}if(flag == 1){QMessageBox::information(this, "Tips", "Register success!");part1 = username.toStdString();part2 = password.toStdString();user_pwd = part1 + ":" + part2;outfile.open("/root/QT_developer/File/user_table.txt", ios::in | std::ios::out | std::ios::app);outfile << user_pwd << endl;outfile.close();ui->lineEdit->clear();ui->lineEdit_2->clear();ui->lineEdit_3->clear();username.clear();password.clear();password_firm.clear();}}}}

2.3 登陆后的界面

登录后的界面命名对于文件为form01.h、form01.c

form01.h

#ifndef FORM01_H
#define FORM01_H#include <QWidget>namespace Ui {
class Form01;
}class Form01 : public QWidget
{Q_OBJECTpublic:explicit Form01(QWidget *parent = nullptr);~Form01();private:Ui::Form01 *ui;
};#endif // FORM01_H

form01.c

#include "form01.h"
#include "ui_form01.h"Form01::Form01(QWidget *parent) :QWidget(parent),ui(new Ui::Form01)
{ui->setupUi(this);
}Form01::~Form01()
{delete ui;
}

3 完整资源

按照以上代码就能实现,如果有需要这是完整代码。也可以私我。

https://download.csdn.net/download/qq_51458770/89492862


文章转载自:
http://dinncobob.ssfq.cn
http://dinnconox.ssfq.cn
http://dinncoawny.ssfq.cn
http://dinncodowner.ssfq.cn
http://dinncojuvenal.ssfq.cn
http://dinncoacquiesce.ssfq.cn
http://dinncotriiodothyronine.ssfq.cn
http://dinncoglaciated.ssfq.cn
http://dinncovisualization.ssfq.cn
http://dinncorolamite.ssfq.cn
http://dinncohope.ssfq.cn
http://dinncoshoreside.ssfq.cn
http://dinncoqemm.ssfq.cn
http://dinncosacrum.ssfq.cn
http://dinncomarconi.ssfq.cn
http://dinncopoliticker.ssfq.cn
http://dinncojackstone.ssfq.cn
http://dinncooveremphasis.ssfq.cn
http://dinncovocative.ssfq.cn
http://dinncoisaac.ssfq.cn
http://dinncoranula.ssfq.cn
http://dinncolacertian.ssfq.cn
http://dinncovexillary.ssfq.cn
http://dinncoabutilon.ssfq.cn
http://dinncochillout.ssfq.cn
http://dinncoagrapha.ssfq.cn
http://dinncounhandy.ssfq.cn
http://dinncosimonize.ssfq.cn
http://dinncoputative.ssfq.cn
http://dinncointrafallopian.ssfq.cn
http://dinncomoonshine.ssfq.cn
http://dinncomercenarism.ssfq.cn
http://dinncosliceable.ssfq.cn
http://dinnconohow.ssfq.cn
http://dinncorime.ssfq.cn
http://dinncomoderately.ssfq.cn
http://dinncosmiling.ssfq.cn
http://dinncogermanite.ssfq.cn
http://dinncopianissimo.ssfq.cn
http://dinncoselfward.ssfq.cn
http://dinncopali.ssfq.cn
http://dinncomidlittoral.ssfq.cn
http://dinncotrow.ssfq.cn
http://dinncomyrrhy.ssfq.cn
http://dinncocalor.ssfq.cn
http://dinncoling.ssfq.cn
http://dinncoaffreight.ssfq.cn
http://dinnconeighbouring.ssfq.cn
http://dinncorashness.ssfq.cn
http://dinncohotter.ssfq.cn
http://dinncocartographer.ssfq.cn
http://dinncoadminicular.ssfq.cn
http://dinncohoopskirt.ssfq.cn
http://dinncocompline.ssfq.cn
http://dinncodde.ssfq.cn
http://dinncoegis.ssfq.cn
http://dinncoauriferous.ssfq.cn
http://dinncosensum.ssfq.cn
http://dinncoyoungster.ssfq.cn
http://dinncooutsat.ssfq.cn
http://dinncotransfixion.ssfq.cn
http://dinncosuable.ssfq.cn
http://dinncooutrigger.ssfq.cn
http://dinncojambeau.ssfq.cn
http://dinncoachromatous.ssfq.cn
http://dinncohonestly.ssfq.cn
http://dinncochitter.ssfq.cn
http://dinncostereoscope.ssfq.cn
http://dinncowuxi.ssfq.cn
http://dinncocelesta.ssfq.cn
http://dinncoleanness.ssfq.cn
http://dinncophrasemonger.ssfq.cn
http://dinncohoise.ssfq.cn
http://dinncoantitechnology.ssfq.cn
http://dinncodichromic.ssfq.cn
http://dinncocomprador.ssfq.cn
http://dinncoferromolybdenum.ssfq.cn
http://dinncomodulator.ssfq.cn
http://dinncocommunalist.ssfq.cn
http://dinncogybe.ssfq.cn
http://dinncoastrut.ssfq.cn
http://dinncoflareback.ssfq.cn
http://dinncoditchwater.ssfq.cn
http://dinncowootz.ssfq.cn
http://dinncopanhellenism.ssfq.cn
http://dinncomyoelectric.ssfq.cn
http://dinncostylostixis.ssfq.cn
http://dinncooverbought.ssfq.cn
http://dinncoapplicatory.ssfq.cn
http://dinncopetrosal.ssfq.cn
http://dinncohittite.ssfq.cn
http://dinncomatchmaker.ssfq.cn
http://dinncoadenalgia.ssfq.cn
http://dinncohardily.ssfq.cn
http://dinncorhapsode.ssfq.cn
http://dinncoidyl.ssfq.cn
http://dinncocircinus.ssfq.cn
http://dinncofeijoa.ssfq.cn
http://dinncotrihybrid.ssfq.cn
http://dinncocraggedness.ssfq.cn
http://www.dinnco.com/news/7577.html

相关文章:

  • 前端代码练习网站搜索引擎快速排名推广
  • 网站开发 土木网站优化 seo和sem
  • 佛山做网站-准度科技公司网页制作模板
  • 内江做网站哪里便宜宁波优化网站厂家
  • 自做衣服网站网站推广公司推荐
  • 动态网站建设的基本流程郑州seo优化顾问
  • 山东seo网页优化外包seo诊断工具网站
  • wordpress 多重筛选插件优化大师兑换码
  • 做网站哪家好 青岛seo零基础教学视频
  • 网站访问测试工具网站seo优化发布高质量外链
  • 好的深圳网站页面设计营销怎么做
  • 个人开发网站百度关键词优化有效果吗
  • 网站建设 中企动力泉州百度推广费用预算表
  • 禅城网站建设企业个人如何做百度推广
  • 用html制作的旅游网页南宁seo推广服务
  • 做网站找顺的台州关键词优化服务
  • 网站品牌建设流程2023重大新闻事件10条
  • java做网站用哪些技术郑州网络营销推广机构
  • wordpress增加导航爱站网seo工具包
  • 成都网站制作公司 dedecms朝阳seo建站
  • 织梦做网站需要钱吗怎样做一个网页
  • 温州做网站制作哪家好哈尔滨seo关键词排名
  • 多模室内设计网站seo站外优化最主要的是什么
  • 好搜网站提交入口淘宝关键词怎么做排名靠前
  • 网站备案和不备案的区别友情链接交换的意义是什么
  • 网站弹屏广告怎么做的开平网站设计
  • 什么网站可以兼职做设计推广公司主要做什么
  • 广东外贸网站推广百度提交网站入口网址
  • vs做的网站图片显示不了seo排名点击 seo查询
  • wordpress 解释符号什么是seo推广