当前位置:网站首页>3. Overall UI architecture of the project
3. Overall UI architecture of the project
2022-06-28 13:45:00 【Endless character】
Catalog
One 、MYPlayer.pro Detailed explanation
MYPlayer.pro: The setting of the whole project is recorded , It is not recommended to modify it casually
- Project template : Build an application of makefile
# Project Type
TEMPLATE = app
- QT Refer to the module
# Qt modules that are used by your project
QT += qml quick gui widgets multimedia opengl openglextensions
- Project compilation options and Libraries
# Project configuration and compiler options
CONFIG += qt warn_on c++11 rtti stl thread exceptions
- moc File path configuration :moc The full name is Meta-Object Compiler, That is to say “ Metaobject compiler ”; After compiling, you will see moc file
- Qt It's not used “ The standard ” C++ Language , It's a certain degree of “ Expand ”. Here we are from Qt The newly added keywords can be seen :signals、slots perhaps emit. So some people think Qt The compilation speed of the program is slow , This is mainly because Qt Hand over the source code to the standard C++ compiler , Such as gcc Before , You need to remove these extended syntax in advance . This is done by moc
- moc The full name is Meta-Object Compiler, That is to say “ Metaobject compiler ”.Qt Before the program is compiled by the standard compiler , First use moc analysis C++ Source file . If it finds that a header file contains macros Q_OBJECT, Then another C++ Source file . This source file contains Q_OBJECT Macro implementation code . The new file name will be the original file name preceded by moc_ constitute . This new file will also enter the compilation system , Eventually linked to binary code . So we can know , This new file is not “ Replace ” Drop old files , But participate in the compilation together with the original file . in addition , We can also see one thing ,moc The execution of is before the preprocessor . Because after the preprocessor executes ,Q_OBJECT Macros don't exist
# Directory where all intermediate objects and moc files should be placed
CONFIG(debug, debug|release) {
OBJECTS_DIR = ./tmp/debug
MOC_DIR = ./tmp/debug
} else {
OBJECTS_DIR = ./tmp/release
MOC_DIR = ./tmp/release
}
- Temporary file and resource file path of compiler output
# Directory where all intermediate files from uic should be placed
CONFIG(debug, debug|release) {
UI_DIR = ./tmp/debug
} else {
UI_DIR = ./tmp/release
}
# Directory for Qt Resource Compiler output files
CONFIG(debug, debug|release) {
RCC_DIR = ./tmp/debug
} else {
RCC_DIR = ./tmp/release
}
- Debug and Release The generation path of
# Specifies where to put the target file
CONFIG(debug, debug|release) {
contains(QMAKE_TARGET.arch, x86_64) {
DESTDIR = $$_PRO_FILE_/../../../bin/debug/x64
} else {
DESTDIR = $$_PRO_FILE_/../../../bin/debug/x86
}
} else {
contains(QMAKE_TARGET.arch, x86_64) {
DESTDIR = $$_PRO_FILE_/../../../bin/release/x64
} else {
DESTDIR = $$_PRO_FILE_/../../../bin/release/x86
}
}
- Specify the executable file name of the project target : It doesn't contain any extensions 、 Prefix or version number ( The default is the current directory name )
# Name of the target file
TARGET = MYPlayer
- Specify the project resource file 、code The coding
# Name of the resource collection files (qrc) for the target
RESOURCES += resource/MYPlayer.qrc
#RESOURCES += qml.qrc
# Codec configuration
CODECFORTR = UTF-8
CODECFORSRC = UTF-8
- Project used jml and js file
# Source files which contains strings for i18n
lupdate_only {
SOURCES += resource/ui/qml/*.qml \ resource/ui/qml/*.js } - Translate the document : Can open resource/ui/translation/MYPlayer_zh_CN.ts The file to view , Support Chinese and English translation
# Translation file path
TRANSLATIONS += ./resource/ui/translation/MYPlayer_zh_CN.ts

- Compile option definition :QT_DEPRECATED_WARNINGS Express QT When certain features of are marked as obsolete , The compiler issues a warning
# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Refer to the documentation for the
# deprecated API to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
- Project source file
# Source files in the project
SOURCES += \
MYAudioPlay.cpp \
MYAudioThread.cpp \
MYDecode.cpp \
MYDecodeThread.cpp \
MYDemux.cpp \
MYDemuxThread.cpp \
MYResample.cpp \
MYVideoThread.cpp \
MYVideoOutput.cpp \
MYPlay.cpp \
main.cpp \
MainApp.cpp \
MYSubTitle.cpp \
- Project header file and include file path
# Header files for the project
HEADERS += MainApp.h \
IVideoCall.h \
MYAudioPlay.h \
MYAudioThread.h \
MYDecode.h \
MYDecodeThread.h \
MYDemux.h \
MYDemuxThread.h \
MYResample.h \
MYVideoThread.h \
MYVideoOutput.h \
MYPlay.h \
MYSubTitle.h \
# Include path
INCLUDEPATH += ../../include
- Library files used in the project
# Libaray path and libaray
CONFIG(debug, debug|release) {
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L"$$PWD/../../lib/debug/x64/"
} else {
LIBS += -L"$$PWD/../../lib/debug/x86/"
}
# win32:LIBS += libqrencode.lib\ # libzint.lib
# unix:LIBS += -lqrencode\ # -lzint
} else {
contains(QMAKE_TARGET.arch, x86_64) {
LIBS += -L"$$PWD/../../lib/release/x64/"
} else {
LIBS += -L"$$PWD/../../lib/release/x86/"
}
# win32:LIBS += libqrencode.lib\ # libzint.lib
# unix:LIBS += -lqrencode\ # -lzint
}
win32:LIBS += avformat.lib\
avcodec.lib\
avutil.lib\
swresample.lib\
swscale.lib
- win32 Required by the platform rc file : Other platforms are not maintained , The default can be
################################################################################
# Windows platform
win32 {
RC_FILE = win32/MYPlayer.rc
HEADERS += win32/targetver.h \
win32/resource.h
OTHER_FILES += win32/MYPlayer.rc
}
################################################################################
# Linux platform
linux {
}
################################################################################
# Mac OS X platform
macx {
}
Two 、Visual Stdio Start source code
1 - Generate vs Project documents
- a. New under the project directory GenerateVCProj.bat:
qmake -tp vc MYPlayer.pro
- b. function GenerateVCProj.bat Generate vs Project documents : Use vs open MYPlayer.vcxproj File to start vs project

2 - vs Description of the directory structure of the project

3 - MainApp.h Start class analysis
- class MainApp : public QApplication:MainApp Inherit QApplication class , Mainly to complete the work of program initialization , The purpose of this part of initialization is to establish the interface management mechanism in the project

- MainApp Added Q_OBJECT macro : Then we can use signals in our projects (signal) Slot (slot) Mechanism

- MainApp Member variables of

- MainApp Member method of

- Signals and slots

- QML attribute -Q_PROPERTY:QML The processing of the interface layer is related to the complex logic of the logic layer
Q_PROPERTY(int demoNum READ demoNum WRITE setDemoNum NOTIFY demoNumChanged):demoNum Variable reading 、 Write 、 Changes will trigger events on the interfaceQ_PROPERTY(QString language READ language WRITE setLanguage NOTIFY languageChanged): The reading of the same language 、 Write 、 Changes are also associated with

边栏推荐
- 原生JS 实现页面元素的拖动 拖拽
- Align content attribute in flex layout
- 中国广电5G套餐来了,比三大运营商低,却没预期那么低
- NFT digital collection system development (3D modeling economic model development case)
- New product experience: Alibaba cloud's new generation of local SSD instance I4 open beta
- Jeecg 官方组件的使用笔记(更新中...)
- How to open an account on the flush? Is it safe
- Class structure in C language - dot
- Votre Code parle? (1)
- Hang Seng Electronics: lightdb, a financial distributed database, has passed a number of evaluations by China Academy of communications technology
猜你喜欢

Websocket automatically disconnects in 1 minute

Oracle cloud infrastructure extends distributed cloud services to provide organizations with greater flexibility and controllability

Hubble database x a joint-stock commercial bank: upgrade the number management system of Guanzi, so that every RMB has an "ID card"

Nature子刊 | 绘制植物叶际菌群互作图谱以建立基因型表型关系

抢做意大利岛主?刘强东两月套现66亿 疑一次性5.6亿“紧急转账”急购欧洲海上皇宫

Align content attribute in flex layout

From PDB source code to frame frame object

Forecast and Analysis on market scale and development trend of China's operation and maintenance security products in 2022

如何设计数据可视化平台

中国广电5G套餐来了,比三大运营商低,却没预期那么低
随机推荐
(原创)【MAUI】一步一步实现“悬浮操作按钮”(FAB,Floating Action Button)
3、项目的整体UI架构
PCB understand Wang, are you? I am not
yii2编写swoole的websocket服务
Simple understanding of ThreadLocal
Yii2 connects to websocket service to realize that the server actively pushes messages to the client
1015. picking flowers
Build a learning environment
Electronic components distribution 1billion Club [easy to understand]
Template_ Large integer multiplication
程序员坐牢了,会被安排去写代码吗?
How to set auto format after saving code in vscade
Solution to directory access of thinkphp6 multi-level controller
MySQL multi table joint query
Special test for cold and hot start of app
Pytorch model parameter adjustment and training related contents
Nature子刊 | 绘制植物叶际菌群互作图谱以建立基因型表型关系
决策树预测红酒品质
MySQL从库Error:“You cannot ‘Alter‘ a log table...“
Mobile web training day-1