Skip to content

Commit

Permalink
yzm
Browse files Browse the repository at this point in the history
  • Loading branch information
yzmninglang committed Apr 5, 2022
1 parent 0479ef8 commit 046b79b
Show file tree
Hide file tree
Showing 294 changed files with 7,216 additions and 53 deletions.
104 changes: 52 additions & 52 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,52 +1,52 @@
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*

# QtCreator 4.8< compilation database
compile_commands.json

# QtCreator local machine specific files for imported projects
*creator.user*
# C++ objects and libs
*.slo
*.lo
*.o
*.a
*.la
*.lai
*.so
*.so.*
*.dll
*.dylib

# Qt-es
object_script.*.Release
object_script.*.Debug
*_plugin_import.cpp
/.qmake.cache
/.qmake.stash
*.pro.user
*.pro.user.*
*.qbs.user
*.qbs.user.*
*.moc
moc_*.cpp
moc_*.h
qrc_*.cpp
ui_*.h
*.qmlc
*.jsc
Makefile*
*build-*
*.qm
*.prl

# Qt unit tests
target_wrapper.*

# QtCreator
*.autosave

# QtCreator Qml
*.qmlproject.user
*.qmlproject.user.*

# QtCreator CMake
CMakeLists.txt.user*

# QtCreator 4.8< compilation database
compile_commands.json

# QtCreator local machine specific files for imported projects
*creator.user*
37 changes: 37 additions & 0 deletions 01QMianWindows/01QMianWindows.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#-------------------------------------------------
#
# Project created by QtCreator 2022-03-29T21:01:38
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = 01QMianWindows
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

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
11 changes: 11 additions & 0 deletions 01QMianWindows/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
w.show();

return a.exec();
}
90 changes: 90 additions & 0 deletions 01QMianWindows/mainwindow.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#include "mainwindow.h"
#include<QToolBar>
#include<QPushButton>
#include<QMenuBar>
#include<QStatusBar>
#include<QLabel>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{

//重置窗口
resize(600,400);


//创建菜单栏
QMenuBar *menu1= menuBar();

//将菜单栏放入Mainwindows其中
setMenuBar(menu1);


//创建一个菜单
QMenu * file= menu1->addMenu("你好");
QMenu * bianjie=menu1->addMenu("边界");

//创建菜单项目
QAction* edit =file->addAction("编辑");
QAction* open= file->addAction("打开");


//添加分隔符
file->addSeparator();
file->addAction("打开1");


//工具栏,可以有多个
QToolBar *tool=new QToolBar(this);

//放入窗口中
addToolBar(Qt::LeftToolBarArea,tool);

//只允许左右停靠
tool->setAllowedAreas(Qt::RightToolBarArea | Qt::RightToolBarArea);

//允许浮动
tool->setFloatable(true);


//设置移动,总开关,无论上面设置什么
tool->setMovable(false);


//设置工具栏内容
tool->addAction("你好");
tool->addAction(open);
//添加分割线
tool->addSeparator();
tool->addAction(edit);
//添加控件:按钮
QPushButton * btn = new QPushButton("aa",this);
tool->addWidget(btn);



//状态栏,只能有一个
QStatusBar * status= new QStatusBar(this);
setStatusBar(status);
//放标签的控件
QLabel * label =new QLabel("提示信息",this);
status->addWidget(label);

QLabel * label1 =new QLabel("右侧提示信息",this);
status->addPermanentWidget(label1);


//铆接固件,围绕着核心固件
QDockWidget * dock = new QDockWidget("浮动",this);
addDockWidget(Qt::LeftDockWidgetArea,dock);


//设置中心部件
QTextEdit * edit1 = new QTextEdit(this);
setCentralWidget(edit1);
dock->setAllowedAreas(Qt::LeftDockWidgetArea|Qt::RightDockWidgetArea);
}

MainWindow::~MainWindow()
{

}
16 changes: 16 additions & 0 deletions 01QMianWindows/mainwindow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include<QDockWidget>
#include <QMainWindow>
#include<QTextEdit>

class MainWindow : public QMainWindow
{
Q_OBJECT

public:
MainWindow(QWidget *parent = 0);
~MainWindow();
};

#endif // MAINWINDOW_H
39 changes: 39 additions & 0 deletions 01day/01day.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#-------------------------------------------------
#
# Project created by QtCreator 2022-03-27T21:27:53
#
#-------------------------------------------------

QT += core gui

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

TARGET = 01day
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 \
widget.cpp \
mypushbutton.cpp

HEADERS += \
widget.h \
mypushbutton.h

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
15 changes: 15 additions & 0 deletions 01day/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include "widget.h"
#include <QApplication>
//argc命令行变量的数量 argv命令行变量的数组
int main(int argc, char *argv[])
{
//应用程序对象
QApplication a(argc, argv);
//窗口对象 Widget ->Qwidget
Widget w;
//窗口对象默认不显示,必须调用show方法
w.show();

//让程序对象进入消息循环机制
return a.exec();
}
12 changes: 12 additions & 0 deletions 01day/mypushbutton.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "mypushbutton.h"
#include<QDebug>

MyPushButton::MyPushButton(QWidget *parent) : QPushButton(parent)
{
qDebug()<<"我的自定义按钮";

}
MyPushButton::~MyPushButton()
{
qDebug()<<"我的按钮的析构";
}
19 changes: 19 additions & 0 deletions 01day/mypushbutton.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef MYPUSHBUTTON_H
#define MYPUSHBUTTON_H

#include <QPushButton>

class MyPushButton : public QPushButton
{
Q_OBJECT
public:
explicit MyPushButton(QWidget *parent = nullptr);

~MyPushButton();

signals:

public slots:
};

#endif // MYPUSHBUTTON_H
Loading

0 comments on commit 046b79b

Please sign in to comment.