php建立网站,权大师的网站是哪个公司做的,网站开发最好的语言,资阳房产网站建设从上向下依次是菜单栏#xff0c;工具栏#xff0c;铆接部件#xff08;浮动窗口#xff09;#xff0c;状态栏#xff0c;中心部件
菜单栏
创建菜单栏
QMenuBar* mybar1 menuBar(); 将菜单栏放到窗口中
setMenuBar(mybar1); 创建菜单
QMenu *myfilemenu mybar1-…
从上向下依次是菜单栏工具栏铆接部件浮动窗口状态栏中心部件
菜单栏
创建菜单栏
QMenuBar* mybar1 menuBar(); 将菜单栏放到窗口中
setMenuBar(mybar1); 创建菜单
QMenu *myfilemenu mybar1-addMenu(文件); 创建菜单项
myfilemenu-addAction(新建);
myfilemenu-addAction(打开);
添加分割符 myfilemenu-addSeparator();
note菜单栏最多只有一个
工具栏
note工具栏可以有多个
//创建工具栏
QToolBar* mytool1 new QToolBar(this);
addToolBar(Qt::LeftToolBarArea,mytool1);
//只允许左右停靠
mytool1-setAllowedAreas(Qt::LeftToolBarArea | Qt::RightToolBarArea);
//禁止浮动
mytool1-setFloatable(false);
//工具栏中设置的内容
mytool1-addAction(openAction);
mytool1-addAction(newAction);
状态栏 //创建状态栏:最多只有一个QStatusBar* myState statusBar();setStatusBar(myState);QLabel* mylabel1 new QLabel(提示信息, this);myState-addWidget(mylabel1);QLabel* myLabel2 new QLabel(右侧提示信息, this);myState-addPermanentWidget(myLabel2);
铆接部件和中心部件 //铆接部件多个QDockWidget* myDock new QDockWidget(浮动,this);addDockWidget(Qt::BottomDockWidgetArea, myDock);//设置中心部件一个QTextEdit* myEdit new QTextEdit(this);setCentralWidget(myEdit);
资源文件添加
ui-actionnew-setIcon(QIcon(路径));
添加资源文件步骤 添加资源文件 open in Editor 随后添加前缀和添加文件即可
模态和非模态对话框创建
头文件
#include QDialog
connect(ui-actionnew,QAction::triggered,this,[](){//对话框//模态对话框不可以对其他窗口进行操作QDialog mylog(this);mylog.resize(200,100);mylog.exec();});
connect(ui-actionnew,QAction::triggered,this,[](){//对话框//非模态对话框可以对其他窗口进行操作QDialog *mylog new QDialog(this);mylog-resize(200,100);mylog-show();//当关闭时候释放内存mylog-setAttribute(Qt::WA_DeleteOnClose);});
消息对话框 头文件
#includeQMessageBox connect(ui-actionnew,QAction::triggered,this,[](){//消息对话框QMessageBox::critical(parent,critial,错误);});
connect(ui-actionnew,QAction::triggered,this,[](){//消息对话框QMessageBox::information(parent,info,提问);});
参数1父亲 参数2标题 参数三提示内容 参数4按钮类型
其他标准对话框
例子使用颜色对话框
//颜色connect(ui-actionnew,QAction::triggered,this,[](){//消息对话框QColor color QColorDialog::getColor(QColor(255,0,0));});
文件对话框
//文件connect(ui-actionnew,QAction::triggered,this,[](){//消息对话框:返回值为路径QFileDialog::getOpenFileName(this,打开文件,.\\,(*.docx));});
登录窗口布局
在ui设计窗口进行设计
label标签
text edit 输入框
push button 点击按钮
拖动widget进行布局
spacers是两个弹簧
间隙 最大大小 密码模式 UI控件
按钮控件 QListWidget控件 其他控件