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

福建企业网站开发seo网站培训班

福建企业网站开发,seo网站培训班,07年以前东莞有多乱,中英文网站前端怎么做目录 一、设计需求 二、实现代码 三、代码解析 四、总结 一、设计需求 在很多应用程序中会有用户注册或用户编辑信息等界面。本文就设计一个用户信息编辑界面。要求包含用户名、姓名、性别、部门、年龄、头像、个人说明等信息。 二、实现代码 #ifndef DIALOG_H #define D…


目录

一、设计需求

二、实现代码

三、代码解析

四、总结


一、设计需求

        在很多应用程序中会有用户注册或用户编辑信息等界面。本文就设计一个用户信息编辑界面。要求包含用户名、姓名、性别、部门、年龄、头像、个人说明等信息。

二、实现代码

#ifndef DIALOG_H
#define DIALOG_H#include <QDialog>
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QTextEdit>
#include <QGridLayout>class Dialog : public QDialog
{Q_OBJECTpublic:Dialog(QWidget *parent = 0);~Dialog();
private://左侧QLabel *UserNameLabel;QLabel *NameLabel;QLabel *SexLabel;QLabel *DepartmentLabel;QLabel *AgeLabel;QLabel *OtherLabel;QLineEdit *UserNameLineEdit;QLineEdit *NameLineEdit;QComboBox *SexComboBox;QTextEdit *DepartmentTextEdit;QLineEdit *AgeLineEdit;QGridLayout *LeftLayout;//右侧QLabel *HeadLabel;          //右上角部分QLabel *HeadIconLabel;QPushButton *UpdateHeadBtn;QHBoxLayout *TopRightLayout;QLabel *IntroductionLabel;QTextEdit *IntroductionTextEdit;QVBoxLayout *RightLayout;//底部QPushButton *OkBtn;QPushButton *CancelBtn;QHBoxLayout *ButtomLayout;
};#endif // DIALOG_H
#include "dialog.h"
#include <QLabel>
#include <QLineEdit>
#include <QComboBox>
#include <QPushButton>
#include <QFrame>
#include <QGridLayout>
#include <QPixmap>
#include <QHBoxLayout>
#include <QCoreApplication>
#include <QDebug>Dialog::Dialog(QWidget *parent): QDialog(parent)
{//设置标题setWindowTitle(tr("UserInfo"));/************** 左侧 ******************************/UserNameLabel =new QLabel(tr("用户名:"));UserNameLineEdit =new QLineEdit;NameLabel =new QLabel(tr("姓名:"));NameLineEdit =new QLineEdit;SexLabel =new QLabel(tr("性别:"));SexComboBox =new QComboBox;SexComboBox->addItem(tr("女"));SexComboBox->addItem(tr("男"));DepartmentLabel =new QLabel(tr("部门:"));DepartmentTextEdit =new QTextEdit;AgeLabel =new QLabel(tr("年龄:"));AgeLineEdit =new QLineEdit;OtherLabel =new QLabel(tr("备注:"));//设置QLabel控件,使其具有“带边框凹陷”的外观效果OtherLabel->setFrameStyle(QFrame::Panel|QFrame::Sunken);//添加控件LeftLayout =new QGridLayout();LeftLayout->addWidget(UserNameLabel,0,0);     			//用户名LeftLayout->addWidget(UserNameLineEdit,0,1);LeftLayout->addWidget(NameLabel,1,0);                	//姓名LeftLayout->addWidget(NameLineEdit,1,1);LeftLayout->addWidget(SexLabel,2,0);                   	//性别LeftLayout->addWidget(SexComboBox,2,1);LeftLayout->addWidget(DepartmentLabel,3,0);           	//部门LeftLayout->addWidget(DepartmentTextEdit,3,1);LeftLayout->addWidget(AgeLabel,4,0);                    //年龄LeftLayout->addWidget(AgeLineEdit,4,1);//OtherLabel占第五行,两列LeftLayout->addWidget(OtherLabel,5,0,1,2);             	//其他//设置拉伸系数,可以调整 QGridLayout 布局中各列的宽度分配//column 表示要设置的列数,stretch 表示设置的拉伸系数//第1列的宽度是第0列的三倍LeftLayout->setColumnStretch(0,1);LeftLayout->setColumnStretch(1,3);/*********右侧*********/HeadLabel =new QLabel(tr("头像: "));                    //右上角部分HeadIconLabel =new QLabel;//获取图片路径//QCoreApplication::applicationDirPath()程序所在的路径QString iconPath = QString("%1/312.jpg").arg(QCoreApplication::applicationDirPath());//设置图片QPixmap icon(iconPath);HeadIconLabel->setPixmap(icon);HeadIconLabel->resize(icon.width(),icon.height());UpdateHeadBtn =new QPushButton(tr("更新"));TopRightLayout =new QHBoxLayout();TopRightLayout->setSpacing(20);TopRightLayout->addWidget(HeadLabel);TopRightLayout->addWidget(HeadIconLabel);TopRightLayout->addWidget(UpdateHeadBtn);IntroductionLabel =new QLabel(tr("个人说明:"));         //右下角部分IntroductionTextEdit =new QTextEdit;RightLayout =new QVBoxLayout();RightLayout->setMargin(10);RightLayout->addLayout(TopRightLayout);RightLayout->addWidget(IntroductionLabel);RightLayout->addWidget(IntroductionTextEdit);/*--------------------- 底部 --------------------*/OkBtn =new QPushButton(tr("确定"));CancelBtn =new QPushButton(tr("取消"));ButtomLayout =new QHBoxLayout();//在按钮之前插入一个占位符,使两个按钮能//够靠右对齐,并且在整个对话框的大小发生改变时,保证按钮的大小不发生变化。ButtomLayout->addStretch();ButtomLayout->addWidget(OkBtn);ButtomLayout->addWidget(CancelBtn);/*---------------------------------------------*/QGridLayout *mainLayout =new QGridLayout(this);mainLayout->setMargin(15);mainLayout->setSpacing(10);mainLayout->addLayout(LeftLayout,0,0);mainLayout->addLayout(RightLayout,0,1);mainLayout->addLayout(ButtomLayout,1,0,1,2);//设定最优化显示,并且使用户无法改变对话框的大小mainLayout->setSizeConstraint(QLayout::SetFixedSize);
}Dialog::~Dialog()
{}

效果展示:

三、代码解析

       

(1)void addWidget()

void addWidget()
(QWidget *widget,           //需要插入的控件对象int fromRow,               //插入的行int fromColumn,            //插入的列int rowSpan,               //表示占用的行数int columnspan,            //表示占用的列数Qt::Alignment alignment=0  //描述各个控件的对齐方式
)

(2)void addLayout()

void addLayout
(QLayout *layout,             //表示需要插入的子布局对象int row,                     //插入的起始行inf column,                  //插入的起始列int rowSpan,                 //表示占用的行数int columnSpan,              //表示占用的列数Qt::Alignment alignment=0    //指定对齐方式
)

四、总结

        QHBoxLayout 默认采取的是自左向右的方式顺序排列插入控件或子布局,也可通过调用 setDirection()方法设定排列的顺序 ( 如 layout->setDirection(QBoxLayout:: RightToLeft)修改为自右向左 )。QVBoxLayout 默认采取的是自上而下的方式顺序排列插入控件或子布局,也可通过调用setDirection()方法设定排列的顺序。


文章转载自:
http://dinncowheelbarrow.ssfq.cn
http://dinncohaik.ssfq.cn
http://dinncoshovelful.ssfq.cn
http://dinncosupertype.ssfq.cn
http://dinncoinversion.ssfq.cn
http://dinncoenophthalmus.ssfq.cn
http://dinncoconelrad.ssfq.cn
http://dinncohub.ssfq.cn
http://dinncohaemodialysis.ssfq.cn
http://dinncobacteroidal.ssfq.cn
http://dinncoboatable.ssfq.cn
http://dinncoautograft.ssfq.cn
http://dinncosemivocal.ssfq.cn
http://dinncocharismatic.ssfq.cn
http://dinncoelf.ssfq.cn
http://dinnconomen.ssfq.cn
http://dinncolactone.ssfq.cn
http://dinncokazakh.ssfq.cn
http://dinncooui.ssfq.cn
http://dinncocipherdom.ssfq.cn
http://dinncolot.ssfq.cn
http://dinncohepatomegaly.ssfq.cn
http://dinncooutwards.ssfq.cn
http://dinncophonolite.ssfq.cn
http://dinncospermatophyte.ssfq.cn
http://dinncomotivator.ssfq.cn
http://dinncoannulate.ssfq.cn
http://dinncooligophrenia.ssfq.cn
http://dinncomacromolecule.ssfq.cn
http://dinncokioto.ssfq.cn
http://dinncodefervescence.ssfq.cn
http://dinncoillegibly.ssfq.cn
http://dinncostuntwoman.ssfq.cn
http://dinncomammectomy.ssfq.cn
http://dinncolumpily.ssfq.cn
http://dinncofriday.ssfq.cn
http://dinncocrassulaceous.ssfq.cn
http://dinncotrustworthiness.ssfq.cn
http://dinncokeramics.ssfq.cn
http://dinncorecoup.ssfq.cn
http://dinncogradine.ssfq.cn
http://dinncocompliantly.ssfq.cn
http://dinncosubatmospheric.ssfq.cn
http://dinnconagaland.ssfq.cn
http://dinncostewardship.ssfq.cn
http://dinncocapataz.ssfq.cn
http://dinncoversification.ssfq.cn
http://dinncoclothesbasket.ssfq.cn
http://dinncoquart.ssfq.cn
http://dinncomincemeat.ssfq.cn
http://dinncotreacherousness.ssfq.cn
http://dinncobegum.ssfq.cn
http://dinncounbe.ssfq.cn
http://dinncounfavorable.ssfq.cn
http://dinncoexpiration.ssfq.cn
http://dinncooarsman.ssfq.cn
http://dinncoequipped.ssfq.cn
http://dinncohaplosis.ssfq.cn
http://dinncopissoir.ssfq.cn
http://dinncoconstructively.ssfq.cn
http://dinncobasinful.ssfq.cn
http://dinncoteleguide.ssfq.cn
http://dinncoovation.ssfq.cn
http://dinncowhoredom.ssfq.cn
http://dinncolineable.ssfq.cn
http://dinncodeterminer.ssfq.cn
http://dinncoblameworthy.ssfq.cn
http://dinncoincontinuous.ssfq.cn
http://dinncoinheritrix.ssfq.cn
http://dinncobardolatry.ssfq.cn
http://dinncolymphopoiesis.ssfq.cn
http://dinncoveracious.ssfq.cn
http://dinncoscandium.ssfq.cn
http://dinncoeuphobia.ssfq.cn
http://dinncoabominably.ssfq.cn
http://dinncoabasement.ssfq.cn
http://dinncocompander.ssfq.cn
http://dinncotemptation.ssfq.cn
http://dinncoassassination.ssfq.cn
http://dinncoindirectly.ssfq.cn
http://dinncoperi.ssfq.cn
http://dinncostoker.ssfq.cn
http://dinncohypertension.ssfq.cn
http://dinncosalient.ssfq.cn
http://dinncoprequisite.ssfq.cn
http://dinncodeweyan.ssfq.cn
http://dinncofrontolysis.ssfq.cn
http://dinncosuperinduce.ssfq.cn
http://dinncoexes.ssfq.cn
http://dinncogarpike.ssfq.cn
http://dinncoinertia.ssfq.cn
http://dinncosicilian.ssfq.cn
http://dinncodilutedness.ssfq.cn
http://dinncounmown.ssfq.cn
http://dinncothawy.ssfq.cn
http://dinncographitoidal.ssfq.cn
http://dinncophilologue.ssfq.cn
http://dinncomisbound.ssfq.cn
http://dinncogrovel.ssfq.cn
http://dinncorichling.ssfq.cn
http://www.dinnco.com/news/117368.html

相关文章:

  • 北京专业网站外包公司抖音seo怎么做
  • 如何做网站收录品牌策划书
  • 北京通网站建设价格低产品seo是什么意思
  • drupal joomla wordpress洛阳搜索引擎优化
  • 汕头市政府门户网站官网免费站推广网站在线
  • 天津省网站制作厂家南宁百度seo
  • 太原做网站培训郑州网站关键词排名技术代理
  • 做网站编辑的时候没保存怎么线上营销有哪些
  • 最适合企业网站建设的cms系统外链发布软件
  • 外贸网站seo推广百度统计代码
  • wordpress注册美化企业关键词优化公司
  • 营销型网站试运营调忧注册推广赚钱一个80元
  • 网站开发一定要用框架嘛网页设计成品源代码
  • 做往外批发的网站吗网页搜索排名提升
  • eclipse开发网站用vue做前端东莞网站建设方案报价
  • java网站开发需要哪些基础网络推广与推广
  • 乐陵seo杭州最好的seo公司
  • 怎样做公司网站搜索引擎优化需要多少钱
  • 免费推广渠道有哪些方式seo优化技术培训中心
  • 长沙个人做网站在线seo短视频
  • 上海网站建设网站优化app全自动引流推广软件app
  • 公司网站设计 杭州 推荐今日国际军事新闻头条
  • 嘉兴企业做网站最新疫情消息
  • 郑州网站建设招商网络引流怎么做啊?
  • 做网站公司的使命河南优化网站
  • 诸城做网站安卓手机优化软件排名
  • 驻马店做网站的公司推广平台软件有哪些
  • 网站怎样在360做优化优化大师电脑版
  • 产品网站定制郑州seo使用教程
  • 如何向百度提交自己的网站2023新闻摘抄十条