一个基于QT简单登录对话框
1. 登录对话框式样

2. QLoginDialog.h
#ifndef DIALOG_H
#define DIALOG_H #include <QtGui/QDialog>
#include <QPushButton>
#include <QLabel>
#include <QLineEdit> class QLoginDialog : public QDialog
{
Q_OBJECT
private:
QLabel UserLable;
QLabel PwdLable;
QPushButton CancelBtn;
QPushButton LoginBtn;
QLineEdit UserLineEdit;
QLineEdit PwdLineEdit;
QString m_user;
QString m_pwd;
private slots:
void CancelBtn_Clicked();
void LoginBtn_Clicked();
public:
QLoginDialog(QWidget *parent = );
QString GetUser();
QString GetPwd();
~QLoginDialog();
}; #endif // DIALOG_H
3. QLoginDialog.cpp
#include <QDebug>
#include "QLoginDialog.h" QLoginDialog::QLoginDialog(QWidget *parent) : QDialog(parent, Qt::WindowCloseButtonHint),
UserLable(this), PwdLable(this), CancelBtn(this), LoginBtn(this),UserLineEdit(this), PwdLineEdit(this)
{
UserLable.setText("User Name");
UserLable.move(, );
UserLable.resize(, ); UserLineEdit.move(, );
UserLineEdit.resize(, ); PwdLable.setText("Password");
PwdLable.move(, );
PwdLable.resize(, ); PwdLineEdit.move(, );
PwdLineEdit.resize(, );
PwdLineEdit.setEchoMode(QLineEdit::Password); CancelBtn.setText("Cancel");
CancelBtn.move(, );
CancelBtn.resize(, ); LoginBtn.setText("Login");
LoginBtn.move(, );
LoginBtn.resize(, ); setWindowTitle("Login");
setFixedSize(, ); connect(&CancelBtn, SIGNAL(clicked()), this, SLOT(CancelBtn_Clicked()));
connect(&LoginBtn, SIGNAL(clicked()), this, SLOT(LoginBtn_Clicked())); }
void QLoginDialog::CancelBtn_Clicked()
{
qDebug("CancelBtn_Clicked start"); done(Rejected); qDebug("CancelBtn_Clicked end");
}
void QLoginDialog::LoginBtn_Clicked()
{
qDebug("LoginBtn_Clicked start"); m_user = UserLineEdit.text().trimmed();//trimmed():Delete space
m_pwd = PwdLineEdit.text(); done(Accepted); qDebug("LoginBtn_Clicked end");
} QString QLoginDialog::GetUser()
{
return m_user;
}
QString QLoginDialog::GetPwd()
{
return m_pwd;
} QLoginDialog::~QLoginDialog()
{ }
一个基于QT简单登录对话框的更多相关文章
- 一个基于QT简单登录对话框(带验证码功能)
1. 对话框样式 2. 源代码 ①. main.cpp #include <QtGui/QApplication> #include "QLoginDialog.h" ...
- artDialog是一个基于javascript编写的对话框组件,它拥有精致的界面与友好的接口
artDialog是一个基于javascript编写的对话框组件,它拥有精致的界面与友好的接口 自适应内容 artDialog的特殊UI框架能够适应内容变化,甚至连外部程序动态插入的内容它仍然能自适应 ...
- CountBoard 是一个基于Tkinter简单的,开源的桌面日程倒计时应用
CountBoard 是一个基于Tkinter简单的,开源的桌面日程倒计时应用. 项目地址 https://github.com/Gaoyongxian666/CountBoard 基本功能 置顶功能 ...
- 一个基于Qt的截屏程序
最近有一个arm板上的程序需要重写用户手册,在网上找了许久,没找到合适的截屏工具.于是只好自己动手做一个了. 因为arm板上有已经有了Qt环境,于是想到用 Qt的QPixmap::grabWindow ...
- qt 简单登录界面(一)
widget.h #ifndef WIDGET_H #define WIDGET_H #include <QWidget> #include<QLineEdit> class ...
- 基于QT的一个简易的安防
工程描述 opencv2.4.8 QT5 背景建模后,当有异物入侵时,把入侵的帧写到视频文件 使用BackgroundSubtractorMOG2背景建模 程序基于QT对话框 .pro #------ ...
- 【Qt编程】基于Qt的词典开发系列<八>--用户登录及API调用的实现
在上一篇文章<调用网络API>中,我仅仅讲述了怎样直观的使用API接口以及调用API后返回的结果,本文则从程序实现的角度来实现API的调用.当然本程序的实现也是借助于扇贝网的API接口文档 ...
- Mario是一个基于.NETCore的简单快速开发框架
Mario .NET Core简单快速开发框架 Mario是一个基于.NET Core的简单快速开发框架 GitHub:https://github.com/deeround/Mario 技术特点 基 ...
- 基于Server-Sent Event的简单聊天室 Web 2.0时代,即时通信已经成为必不可少的网站功能,那实现Web即时通信的机制有哪些呢?在这门项目课中我们将一一介绍。最后我们将会实现一个基于Server-Sent Event和Flask简单的在线聊天室。
基于Server-Sent Event的简单聊天室 Web 2.0时代,即时通信已经成为必不可少的网站功能,那实现Web即时通信的机制有哪些呢?在这门项目课中我们将一一介绍.最后我们将会实现一个基于S ...
随机推荐
- 第4章_Java仿微信全栈高性能后台+移动客户端
基于web端使用netty和websocket来做一个简单的聊天的小练习.实时通信有三种方式:Ajax轮询.Long pull.websocket,现在很多的业务场景,比方说聊天室.或者手机端onli ...
- ES6中的Set与Map数据结构
本文实例讲述了ES6学习笔记之Set和Map数据结构.分享给大家供大家参考,具体如下: 一.Set ES6提供了新的数据结构Set.类似于数组,只不过其成员值都是唯一的,没有重复的值. Set本身是一 ...
- Condition实现多线程顺序打印
Condition实现多线程顺序打印: import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.R ...
- 205. Isomorphic Strings两个数组变形记,是否符合规则
[抄题]: Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the ...
- vs调试时不抛出异常的解决方案
选项->调试->常规->启用“仅我的代码” 打勾
- 去掉utf-8的Bom头:使用java以及jdbc不使用第三方库执行sql文件脚本
package com.xxx.xxx.dao; import java.io.BufferedReader; import java.io.File; import java.io.FileInpu ...
- 问题:org.hibernate.LazyInitializationException: failed to lazily initialize
今天搞了一上午,都在解决这个问题:org.hibernate.LazyInitializationException: failed to lazily initialize 原因很简单,是在非法的s ...
- LeetCode第617题:合并二叉树
问题描述 解题思路 略略略略略 C++代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * Tree ...
- excel导出工具
介绍 excel导出工具 整个项目的代码结构如下 com \---utils +---demo # 案例相关 | | ExcelExportApplication.java # springboot启 ...
- springcloud 通过后端去下载和预览文件,要重设跨域允许
@RequestMapping("/download") public void downloadNet(String uri, boolean isOnLine, HttpSer ...