QT5-控件-QLineEdit-文本输入控件,用来输入密码什么的还不错,可以和Linux登录一样不移动光标哦
#ifndef MAINWINDOW_H
#define MAINWINDOW_H #include <QMainWindow>
#include <QLineEdit>
#include <QLabel> class MainWindow : public QMainWindow
{
Q_OBJECT public:
MainWindow(QWidget *parent = );
~MainWindow(); QLineEdit* edit[];
QLabel* label ;
public slots:
void textChanged(const QString& text);
}; #endif // MAINWINDOW_H
#include "mainwindow.h" MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
this->resize(,);
this->centralWidget(); int ypos = ;
for(int i=;i<;i++)
{
edit[i] = new QLineEdit("世界,不好",this);
edit[i]->setGeometry(,ypos,,);
ypos += ;
}
// 设置显示模式
edit[]->setEchoMode(QLineEdit::Normal); // 与默认类型一致
edit[]->setEchoMode(QLineEdit::NoEcho); // 隐藏输入文本,不改变光标位置
edit[]->setEchoMode(QLineEdit::Password); // 用*表示文本
edit[]->setEchoMode(QLineEdit::PasswordEchoOnEdit); // 若编辑文本与默认相同,失去焦点显示* label = new QLabel("文本框内容为:",this);
label->setGeometry(,,,);
connect(edit[],SIGNAL(textChanged(QString)),this,SLOT(textChanged(QString))); } MainWindow::~MainWindow()
{ } void MainWindow::textChanged(const QString& text)
{
label->setText("文本框内容为:"+text);
}
#include "mainwindow.h"
#include <QApplication> int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show(); return a.exec();
}

QT5-控件-QLineEdit-文本输入控件,用来输入密码什么的还不错,可以和Linux登录一样不移动光标哦的更多相关文章
- 重新想象 Windows 8.1 Store Apps (77) - 控件增强: 文本类控件的增强, 部分控件增加了 Header 属性和 HeaderTemplate 属性, 部分控件增加了 PlaceholderText 属性
[源码下载] 重新想象 Windows 8.1 Store Apps (77) - 控件增强: 文本类控件的增强, 部分控件增加了 Header 属性和 HeaderTemplate 属性, 部分控件 ...
- C#控件系列--文本类控件
C#控件系列--文本类控件 文本类控件主要包含Label.LinkLabel.Button.TextBox以及RichTextBox. Label 功能 Label用来 ...
- 【PyQt5-Qt Designer】QLineEdit 文本输入
QLineEdit 文本输入 一.QlineEdit 基本方法 setAlignment() 按固定值方式对齐文本 Qt.AlignLeft:水平方向靠左对齐 Qt.AlignRight:水平方向靠右 ...
- wxpython 基本的控件 (文本)
wxPython 工具包提供了多种不同的窗口部件,包括了本章所提到的基本控件.我们涉及静态文本.可编辑的文本.按钮.微调.滑块.复选框.单选按钮.选择器.列表框.组合框和标尺.对于每种窗口部件,我们将 ...
- 深入浅出ExtJS 第四章 表单与输入控件
4.1 制作表单 var form = new Ext.form.FormPanel({ title:'form', defaultType:'textfield', buttonAlign:'cen ...
- ExtJS4.2学习(17)表单基本输入控件Ext.form.Field(转)
鸣谢:http://www.shuyangyang.com.cn/jishuliangongfang/qianduanjishu/2013-12-11/189.html --------------- ...
- ASP.NET中 TextBox 文本输入框控件的使用方法
TextBox控件又称文本框控件,为用户提供输入文本的功能. 1.属性 TextBox控件的常用属性及说明如表1所示. 表1 TextBox控件常用属性及说明 属性 说明 AutoPostBack 获 ...
- atitit.组件化事件化的编程模型--服务端控件(1)---------服务端控件与标签的关系
atitit.组件化事件化的编程模型--服务端控件(1)---------服务端控件与标签的关系 1. 服务器控件是可被服务器理解的标签.有三种类型的服务器控件: 1 1.1. HTML 服务器控件 ...
- UI输入控件
--UI输入控件 -- 输入控件 cc.uii.UIInput.new(table) --[[ 参数 table{ image 输入框图像,可以为图片名或者display.newScale9Sprit ...
随机推荐
- poj 1275 Cashier Employment
http://poj.org/problem?id=1275 #include <cstdio> #include <cstring> #include <algorit ...
- BZOJ1629: [Usaco2007 Demo]Cow Acrobats
1629: [Usaco2007 Demo]Cow Acrobats Time Limit: 5 Sec Memory Limit: 64 MBSubmit: 601 Solved: 305[Su ...
- Best Time to Buy and Sell Stock II ——LeetCode
Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...
- mongodbOperator
mongodb创建数据库表语句 db.createCollection("CollectionName or tableName"); db.createCollection(&q ...
- 红米note不好用
手感不错 拍摄效果暗,没有调好 有死机现象
- spring3.1的BeanFactory与Quartz1.8整合
spring的applicationContext.xml配置文件: 加入 <bean id="myJob" class="org.springframework. ...
- Markdown入门指南-指间阁
宗旨 Markdown 的目标是实现「易读易写」. 可读性,无论如何,都是最重要的.一份使用 Markdown 格式撰写的文件应该可以直接以纯文本发布,并且看起来不会像是由许多标签或是格式指令所构成. ...
- duilib DirectUI库里面的一个简单的例子RichListDemo
1.首先来看这里的CRichListWnd 已经不再是从CWindowWnd继承了 classCRichListWnd:publicWindowImplBase 从WindowImplBase中,可以 ...
- Appcelerator Titanium 3.x Win7 64位平台安装步骤
刚接触Android移动开发,第一次下载Titanium,第一次下载ADT,第一次看Javascript代码,N多第一次...... 慢慢摸索了一个礼拜把移动开发的工具链的配置学习了一下,抛砖引玉,但 ...
- Android各种颜色dawable.xml中定义
< drawable name="white">#FFFFFF< /drawable>< !--白 --> < drawable name ...