QGroupBox添加QCheckBox和QLineEdit限制只能整数输入,QComboBox添加选项Item,QLineEdit密码形式.QWidget添加背景,
来源:互联网 发布:软件破解网站 编辑:程序博客网 时间:2024/05/17 02:22
1.一个QGroupBox 中添加QCheckBox,控制这个QGroupBox是否可用,当check为true时QGroupBox可用,反之不可用.group里有个限制1000以内的整形数的QLineEdit和一个QLabel
m_LineEditCustom = new QLineEdit;m_LineEditCustom->setValidator(new QIntValidator(1, 999, m_LineEditIterate));m_GroupCustom = new QGroupBox(QString("输入初始值"));m_GroupCustom->setCheckable(true);m_GroupCustom->setChecked(false);QHBoxLayout* hLayout = new QHBoxLayout;hLayout->addWidget(new QLabel("输入值:"));hLayout->addWidget(m_LineEditCustom);m_GroupCustom->setLayout(hLayout);2.QComboBox添加选项Item
QStringList DrawTypeList;DrawTypeList.clear();DrawTypeList.push_back(QString("第一个"));DrawTypeList.push_back(QString("第二个"));DrawTypeList.push_back(QString("第三个"));DrawTypeList.push_back(QString("第四个"));DrawTypeList.push_back(QString("第五个"));m_ComboBox->clear();m_ComboBox->addItems(DrawTypeList);
3.QDialog桌面居中显示,this是QDialog类界面创建函数
QDesktopWidget *desktop = QApplication::desktop();QRect deskRect = desktop->availableGeometry();int x = (deskRect.width() - this->width())/2;int y = (deskRect.height() - this->height())/2;this->move(x, y);this->setFixedSize(450, 200);this->setAutoFillBackground(true);this->setWindowModality(Qt::ApplicationModal);4.QLineEdit显示密码形式
m_LineEditPWD->setEchoMode(QLineEdit::Password);m_LineEditPWD->setStyleSheet("lineedit-password-character: 42");5.QWidget添加背景图片
QPalette palette; palette.setBrush(this->backgroundRole(),QBrush(QImage(":/images/fmm.png")));this->setPalette(palette);this->setAutoFillBackground(true);//添加登录框的logo.this->setWindowIcon(QIcon(":/images/logo.png"));6.QLabel设置QSS样式表
QLabel *nameLabel = new QLabel("账 户: ", layoutWidget);nameLabel->setStyleSheet(QString::fromUtf8("QLabel{color:#ffffff}"));
7.让一个对话框总是在所有的窗口的最前面显示
this->setWindowFlags(Qt::WindowStaysOnTopHint);
8.修改QMessageBox按钮的显示的文本,使用addButton函数;
QPushButton * QMessageBox::addButton ( const QString & text, ButtonRole role )
QPushButton * a = mesBox.addButton("A", QMessageBox::YesRole);
0 0
- QGroupBox添加QCheckBox和QLineEdit限制只能整数输入,QComboBox添加选项Item,QLineEdit密码形式.QWidget添加背景,
- 2.QLabel,QPushButton,QLineEdit,QComboBox,QCheckBox,QRadioButton,QTextEdit,QTextBrowser,QGroupBox,QSl
- QLineEdit限制输入(整数、浮点数)
- QWidget添加背景
- Qt QLineEdit QLabel 添加clicked事件
- Qt QLineEdit QLabel添加clicked事件
- PyQt5实现QLineEdit添加clicked信号
- QIntValidator 限制QLineEdit输入范围
- Qt QLineEdit 限制输入类型以及大小Int 和double
- Qt QLineEdit 限制输入类型以及大小Int 和double
- Qt QLineEdit 限制输入类型以及大小Int 和double
- Qt QLineEdit 限制输入类型以及大小Int 和double
- Qt QLineEdit 限制输入类型以及大小Int 和double
- QLineEdit 设置其只能输入数字
- 怎么让QLineEdit只能输入数字
- 怎么让QLineEdit只能输入数字
- QLineEdit 设置其只能输入数字
- Qt开发:QLineEdit 只能输入数字
- 我的android & ios之旅
- Android中定义接口的用法
- ios ViewController 页面跳转
- 属性过滤选择器,子元素过滤选择器
- 递归函数
- QGroupBox添加QCheckBox和QLineEdit限制只能整数输入,QComboBox添加选项Item,QLineEdit密码形式.QWidget添加背景,
- android 启动退出
- N的阶乘拓展
- 表单对象属性过滤选择器
- Maven:简单的命令与配置
- USG2000配置IPSEC vpn,其中分公司是adsl上网
- 密码强度判断
- 纯C语言写的:迷宫游戏
- 整理和总结hive sql