电子商务网站建设,如何给自己的公司建网站,农业局网站建设实施方案,北京网站排名优化公司文章目录一、准备工作二、UI设计1.QPushButton#xff1a;三、遇到的bug一、准备工作
1.MSVC和MinGW上编译的项目#xff0c;不能用另一个编译器进行编译 2.若要使用MSVC编译器#xff0c;需要下载对应版本的VS 见此篇#xff1a;https://blog.csdn.net/Copperxcx/article…
文章目录一、准备工作二、UI设计1.QPushButton三、遇到的bug一、准备工作
1.MSVC和MinGW上编译的项目不能用另一个编译器进行编译 2.若要使用MSVC编译器需要下载对应版本的VS 见此篇https://blog.csdn.net/Copperxcx/article/details/122540629 二、UI设计
1.QPushButton
btn-resize(30,30);//按钮大小
openBtn-setStyleSheet(font:bold;background-color:rgb(255,255,255);text-align:left);//按钮样式
btn-setStyleSheet(color:blue);//按钮字体颜色
openBtn-setFont(QFont(宋体,12));//按钮字体和大小openBtn-setFixedSize(QSize(200,60));//按钮大小1.隐藏标题栏将菜单栏改造为自定义的标题栏
在主窗口的构造函数中使用以下语句隐藏标题栏:
this-setWindowFlags(Qt::FramelessWindowHint);2.菜单栏染色
this-setStyleSheet(QString::fromUtf8(background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(59,59,59, 255), stop:1 rgba(84,84,84, 255));));//设置背景色3.加入登录用户、最小化、最大化、关闭按钮并用槽函数实现点击后的效果。 让这几个按钮随着窗口大小变化而移动而不是定死的坐标 4.加入工具栏ToolBar和状态栏StatusBar
工具栏:
QToolBar *toolBar new QToolBar(this); //创建工具栏
addToolBar(toolBar); //添加工具栏到窗口
addToolBar(Qt::LeftToolBarArea,toolBar);//靠左
toolBar-setMovable(false); //不可移动状态栏
QStatusBar * stBar statusBar();
setStatusBar(stBar);5.QLabel控件背景透明(阴影去除)
ui-lbl_icon-setStyleSheet(background:transparent);//QLabel控件背景透明ui-lbl_YSP-setAttribute(Qt::WA_TranslucentBackground);//QLabel控件背景透明三、遇到的bug
1.无法解析的外部符号 ①声明了没有实现 ②试试重新构建