Linux中qt编写登录
来源:互联网 发布:网络上赌博 编辑:程序博客网 时间:2024/06/03 16:28
//head.h
ifndef HEAD_H
define HEAD_H
include”QtWidgets”
class QLabel;
class QLineEdit;
class QPushButton;
class LoginDialog:public QDialog
{
Q_OBJECT
public:
LoginDialog(QWidget *parent = 0);
~LoginDialog();
private slots:
// void xianshi();
void Register();
void login();
private:
QLabel *label1;
QLabel *label2;
QLineEdit *lineEdit1;
QLineEdit *lineEdit2;
QPushButton *loginbutton;
QPushButton *registerbutton;
QString name;
QString password;
QStringList lines;
};
endif
//login.cpp
include “QtWidgets”
include “QTextStream”
include “head.h”
LoginDialog::LoginDialog(QWidget *parent):QDialog(parent)
{
label1 = new QLabel(tr(“number”));
label2 = new QLabel(tr(“password”));
lineEdit1 = new QLineEdit();
lineEdit2 = new QLineEdit;
lineEdit1->setEchoMode(QLineEdit::Normal);
lineEdit2->setEchoMode(QLineEdit::Password);
lineEdit1->setValidator(new QIntValidator(lineEdit1));
loginbutton = new QPushButton(tr(“login”));
registerbutton = new QPushButton(tr(“regiter”));
QHBoxLayout *a = new QHBoxLayout;
QHBoxLayout *b = new QHBoxLayout;
QHBoxLayout *c = new QHBoxLayout;
a->addWidget(label1);
a->addWidget(lineEdit1);
b->addWidget(label2);
b->addWidget(lineEdit2);
c->addWidget(loginbutton);
c->addWidget(registerbutton);
QVBoxLayout *totalLayout = new QVBoxLayout;
totalLayout->addLayout(a);
totalLayout->addLayout(b);
totalLayout->addLayout(c);
connect(registerbutton,SIGNAL(clicked()),this,SLOT(Register()));
connect(loginbutton,SIGNAL(clicked()),this,SLOT(login()));
setLayout(totalLayout);
setWindowTitle(tr(“login”));
setFixedHeight(sizeHint().height());
}
LoginDialog::~LoginDialog()
{
}
void LoginDialog::Register()
{
name=lineEdit1->text();
password=lineEdit2->text();
QFile file(“./a.txt”);
if(file.open(QIODevice::WriteOnly|QIODevice::Append))
{
QTextStream out(&file);
out<
include “QApplication”
include “head.h”
int main(int argc, char *argv[])
{
QApplication app(argc,argv);
LoginDialog *dialog = new LoginDialog;
dialog->show();
return app.exec();
}
- Linux中qt编写登录
- qt中pro文件编写
- QT 使用qtcreator编写第一个登录程序
- linux中makefile编写
- 利用Qt creator编写linux驱动
- 利用Qt creator编写linux驱动
- QT编写中碰到:找不到批处理文件
- QT中登陆界面的编写
- Hello Qt(在Linux下编写运行Qt程序)
- Hello Qt(在Linux下编写运行Qt程序)
- Qt中登录对话框的开发
- linux中模块的编写
- LINUX内核中编写procfs
- Linux中脚本的编写
- linux中Makefile的编写
- Fedora Linux中登录QQ
- Linux下QT图形界面开发 用快速开发工具Qt Designer编写Qt程序(2)
- 用expect编写Linux自动化交互登录脚本
- 严重: StandardWrapper.Throwable org.springframework.beans.factory.BeanCreationException
- 水平分库分表的关键问题及解决思路
- css3制作淡出淡入动画
- tensorflow官方文档 mnist进阶(卷积神经网络)
- 重装ubuntu1404系统后的配置
- Linux中qt编写登录
- 菜鸟学习历程【19】进程通信(1)
- LibSVM学习详细说明
- HDU 1253
- Telephone Lines POJ
- Angularjs自定义过滤器
- python 调用C++动态库所遇到的undefined symbol ***
- 对于 Handler MessageQueue Message Looper的理解
- xshell连不上阿里云服务器