QT Development - Introduction to QWT

1. Introduction to QWT

QWT, Qt Widgets for Technical Applications, is an open source project based on the LGPL copyright agreement. It can generate various statistical graphs. It provides GUI components and a set of practical classes for programs with technical backgrounds. Its goal is to use 2D-based Form components to display data, the data source is provided in the form of numerical values, arrays or a set of floating point numbers, and the output methods can be Curves (curves), Slider (scroll bars), Dials (discs), Compasses (dashboards), etc. wait. The QWT tool library is developed based on Qt and inherits the cross-platform features of Qt.

The benefits of this article, free to receive Qt development learning materials package, technical video, including (C++ language foundation, C++ design pattern, introduction to Qt programming, QT signal and slot mechanism, QT interface development-image drawing, QT network, QT database programming, QT project actual combat, QSS, OpenCV, Quick module, interview questions, etc.) ↓↓↓↓↓↓See below↓↓Click on the bottom of the article to receive the fee↓↓ 

 

2. Installation of QWT in Linux environment

1. Related environment

Linux distribution: RHEL7.3
Qt version: Qt 4.8.6
QWT version: QWT6.1.3

2. QWT source directory

designer directory: source code of QWT plug-in
doc directory: help document
example directory: source code of QWT simple example
src directory: QWT source code
textengines directory: text-driven engine code of mathematical indicator language playground directory: module qwt
for exploring and testing new features in QWT development
.pro: project file
qwtconfig.pri: configuration file

3. Installation directory

The directory after QWT installation is as follows:
doc: including two directories of html and articles, storing qwt’s documentation, where the html directory is the local version of qwt’s official web page
features: qwt’s installation configuration file
include: all header files of qwt controls are in Here
lib: the core part, since the default configuration file is to compile the qwt library into a dynamic library, so there are 4 so files in this directory (actually there is only one library file, and the other three are soft links) plugins: Qt Designer plug-ins
, Used to display qwt in the control list on the left in the Designer or Creator designer

4. Configuration

Configured in the Qwtconfig.pri configuration file:

#版本配置
QWT_VER_MAJ      = 6
QWT_VER_MIN      = 1
QWT_VER_PAT      = 3
QWT_VERSION      = $${QWT_VER_MAJ}.$${QWT_VER_MIN}.$${QWT_VER_PAT}

# Install paths  安装路径配置
QWT_INSTALL_PREFIX = $$[QT_INSTALL_PREFIX]
#Linux系统安装路径
unix {
    QWT_INSTALL_PREFIX    = /usr/local/Trolltech/qwt-$$QWT_VERSION
    # QWT_INSTALL_PREFIX = /usr/local/Trolltech/qwt-$$QWT_VERSION-qt-$$QT_VERSION
}
#Windows系统安装路径
win32 {
    QWT_INSTALL_PREFIX    = C:/Qwt-$$QWT_VERSION
    # QWT_INSTALL_PREFIX = C:/Qwt-$$QWT_VERSION-qt-$$QT_VERSION
}
#doc、include、lib目录安装路径
QWT_INSTALL_DOCS      = $${QWT_INSTALL_PREFIX}/doc
QWT_INSTALL_HEADERS   = $${QWT_INSTALL_PREFIX}/include
QWT_INSTALL_LIBS      = $${QWT_INSTALL_PREFIX}/lib

#designer插件安装路径
QWT_INSTALL_PLUGINS   = $${QWT_INSTALL_PREFIX}/plugins/designer

#features安装路径
QWT_INSTALL_FEATURES  = $${QWT_INSTALL_PREFIX}/features
# QWT_INSTALL_FEATURES  = $$[QT_INSTALL_PREFIX]/features

#编译链接成动态链接库或是静态链接库,如果QwtDll有效,为动态链接库
QWT_CONFIG           += QwtDll

QWT_CONFIG       += QwtPlot
QWT_CONFIG     += QwtWidgets
QWT_CONFIG     += QwtSvg
#依赖于QtOpenGL
QWT_CONFIG     += QwtOpenGL
#是否支持QwtMathMl, 是Qwt统计数据的数学库支持
#QWT_CONFIG     += QwtMathML
QWT_CONFIG     += QwtDesigner

win32 {
    QWT_CONFIG     += QwtDesignerSelfContained
}

#是否编译示例程序,默认不编译
#QWT_CONFIG     += QwtExamples
#playground模块,默认不编译
#QWT_CONFIG     += QwtPlayground

macx:!static:CONFIG(qt_framework, qt_framework|qt_no_framework) {

    QWT_CONFIG += QwtFramework
}  

unix {
    #QWT_CONFIG     += QwtPkgConfig
}

5. Generate Makefile

Command line execution:
[user@localhost qwt-6.1.3]$qmake qwt.pro
The error message is as follows:
[user@localhost qwt-6.1.3]$ qmake qwt.pro
QMAKESPEC has not been set, so configuration cannot be deduced.
Error processing project file: qwt.pro
Solution:
export QMAKESPEC=/usr/local/Trolltech/Qt-4.8.6/mkspecs/linux-g++
Execute again:
[user@localhost qwt-6.1.3]$qmake qwt.pro

6. Compile and install

Compile: make
Install: sudo make install

7. Installation of QWT control plug-in

qwt-6.1.3/designer/plugins/designer/libqwt_designer_plugin.so is the dynamic link library of QWT control. You need to import libqwt_designer_plugin.so into QtCreater or Designer's control directory to use QWT controls in QtCreater and Designer.
Copy libqwt_designer_plugin.so to the QtCreator control directory:
sudo cp libqwt_designer_plugin.so /usr/local/Trolltech/qtcreator-2.8.1/bin/plugins/designer/
Copy libqwt_designer_plugin.so to the Designer control directory:
sudo cp libqwt_designer_plugin.so /usr/ local/Trolltech/Qt-4.8.6/plugins/designer/

8. View the results

Use QtCreator to create a new project and open the Designer mode, the results are as follows:

The benefits of this article, free to receive Qt development learning materials package, technical video, including (C++ language foundation, C++ design pattern, introduction to Qt programming, QT signal and slot mechanism, QT interface development-image drawing, QT network, QT database programming, QT project actual combat, QSS, OpenCV, Quick module, interview questions, etc.) ↓↓↓↓↓↓See below↓↓Click on the bottom of the article to receive the fee↓↓ 

Guess you like

Origin blog.csdn.net/m0_73443478/article/details/130410317