Table of Contents
Qt Creator 5.x 설치
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . .
Qt Creator 설치하기
sudo apt update; sudo apt install build-essential
sudo apt install qtbase5-dev qttools5-dev qtdeclarative5-dev libqt5sql5-mysql
sudo apt install libqwt-qt5-dev libqt5svg5-dev
sudo apt install qtcreator
# sudo apt install qt5-default
sudo apt install autoconf
sudo apt install libtool
sudo apt install texinfo
Qt Hello World
mkdir ProjectQt
cd ProjectQt
vi main.cpp
#include <QApplication>
#include <QLabel>
#include <QWidget>
int main(int argc, char *argv[ ]) {
QApplication app(argc, argv);
QLabel hello("<center>Hello, World!</center>");
hello.setWindowTitle("Hello, World!");
hello.resize(600, 400);
hello.show();
return app.exec();
}
Qt 프로젝트 파일 생성
qmake -project
cat ProjectQt.pro
프로젝트 파일에 아래 내용을 추가한다.
QT += gui widgets
vi ProjectoQt.pro
-----------------------------
......
TEMPLATE = app
TARGET = ProjectQt
INCLUDEPATH += .
QT += gui widgets
......
-----------------------------
Makefile 생성
qmake ProjectQt.pro
cat Makefile
컴파일하기
make
실행하기
./ProjectQt
오류 대응
Project ERROR: Unknown module(s) in QT: multimedia
sudo apt-get install qtmultimedia5-dev libqt5multimediawidgets5 libqt5multimedia5-plugins libqt5multimedia5
Project ERROR: Unknown module(s) in QT: charts
sudo apt-get install libqt5charts5-dev
QT 5.6 설치하기
QT 5.6 이후로 LGPL 2.1 라이센스 지원이 중단되었습니다.
LGPL 2.1 을 이용하려면 5.7 이전 버전인 QT 5.6.3 을 이용해서 합니다.
sudo apt-get remove qtcreator && sudo apt-get remove qt5*
sudo apt-get purge qtcreator && sudo apt-get purge qt5*
sudo apt-get autoremove
sudo apt-get autoclean
# wget https://download.qt.io/new_archive/qt/5.6/5.6.3/qt-opensource-linux-x64-5.6.3.run
wget http://qtmirror.ics.com/pub/qtproject/official_releases/qt/5.6/5.6.3/qt-opensource-linux-x64-5.6.3.run
chmod +x qt-opensource-linux-x64-5.6.3.run
./qt-opensource-linux-x64-5.6.3.run
qtcharts 설치
wget http://qtmirror.ics.com/pub/qtproject/official_releases/qt/5.6/5.6.3/submodules/qtcharts-opensource-src-2.1.3.zip
unzip qtcharts-opensource-src-2.1.3.zip
cd qtcharts-opensource-src-2.1.3/
qmake qtcharts.pro
make
make install
qtmultimedia 설치
wget http://qtmirror.ics.com/pub/qtproject/official_releases/qt/5.6/5.6.3/submodules/qtmultimedia-opensource-src-5.6.3.zip
unzip qtmultimedia-opensource-src-5.6.3.zip
cd qtmultimedia-opensource-src-5.6.3/
qmake qtmultimedia.pro
make
make install
QAction(QObject *parent)
QAction(const QString &text, QObject *parent)
QAction(const QIcon &icon, const QString &text, QObject *parent)