group box 一个分组布局 用于加入多个控件
Scroll Area 控件用于放入多个控件,地方不够大了会有滚动条
toolbox 和QQ 里的分组很像,家人 朋友等等。
修改内容 currentIndex下的 currentltemText
tab widget标签页的切换 网页中的百度 新浪等等
Stacked widget 栈创空,栈容器
stacked 中的小黑箭头是方便设计的,在运行的时候是没有的。
在设计的情况下才有,方便设计
相当于 整个看到的东西 真个栈都换掉了
放三个按钮,按第一个按钮,切换一个栈,按第二个按钮,切换一个栈
combo box 下拉框
font Combo Box看Word文档字体有什么 这里就有什么
line Edit 行编辑
QLine Edit选项下有 echoMode属性 Normal是什么都看不见
password是密文遮挡
passwordEdit 输入时没哟遮挡,光标放在其他地方才有遮挡
Text Edit是文本编辑框 Plain Text edit是纯文本编辑框
text edit 可以加粗字体颜色等辅助设置 后者是纯文本
QLable 不仅可以显示文字还可以显示图片
QLable 还可以显示动图
ui->lineEdit->setFocus();
//设置光标焦点
光标定位在哪里
#-------------------------------------------------
#
# Project created by QtCreator 2019-08-16T22:28:40
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = 08_Control_Other
TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
RESOURCES += \
res.qrc
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H
#include "mainwindow.h"
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();
return a.exec();
}
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMovie>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
//设置默认选中第零项
ui->stackedWidget->setCurrentIndex(0);
//想要显示全部则添加布局
//stackWidget
connect(ui->btn1,&QPushButton::clicked,this,[=](){
//
ui->stackedWidget->setCurrentIndex(0);
});
connect(ui->btn3,&QPushButton::clicked,this,[=](){
//
ui->stackedWidget->setCurrentIndex(2);
});
connect(ui->btn2,&QPushButton::clicked,this,[=](){
//
ui->stackedWidget->setCurrentIndex(1);
});
//用索引控制翻页
//下拉框的使用
ui->comboBox->addItem("奔驰");
ui-