Qt Creator๋ Qt ํ๋ ์์ํฌ ๊ธฐ๋ฐ ์ ํ๋ฆฌ์ผ์ด์
์ ๊ฐ๋ฐํ๊ธฐ ์ํ ๊ณต์ IDE(ํตํฉ ๊ฐ๋ฐ ํ๊ฒฝ)์
๋๋ค.
C++๊ณผ QML์ ๊ธฐ๋ณธ์ผ๋ก ์ง์ํ๋ฉฐ, ํฌ๋ก์คํ๋ซํผ ๊ฐ๋ฐ์ ์ํ ๊ฐ๋ ฅํ ๋๊ตฌ๋ฅผ ์ ๊ณตํฉ๋๋ค.
๐ ์ฆ, Windows / macOS / Linux / Android / iOS ๋ฑ ๋ค์ํ ํ๋ซํผ์์ ํ๋์ ์ฝ๋๋ก ์ฌ๋ฌ ํ๊ฒฝ์์ ์คํ ๊ฐ๋ฅํ ์ฑ์ ๋ง๋ค ์ ์์ต๋๋ค.
.ui ํ์ผ ์๋ ์์ฑ โ ์ฝ๋์ UI๋ฅผ ๋ถ๋ฆฌํ์ฌ ๊ด๋ฆฌ ๊ฐ๋ฅ๐ฆ MyQtProject/
โโโ main.cpp // C++ ์ง์
์
โโโ mainwindow.ui // Qt Designer๋ก ๋ง๋ UI ํ์ผ
โโโ mainwindow.cpp // UI ์ด๋ฒคํธ ์ฒ๋ฆฌ ์ฝ๋
โโโ CMakeLists.txt // ๋น๋ ์์คํ
ํ์ผ
โโโ resources.qrc // ์ด๋ฏธ์ง, ์์ด์ฝ, ๋ฆฌ์์ค ๋ชจ์
Tools โ Options โ Kits์์ ๋น๋ ํด ํ์ธsudo apt install qtcreator qtbase5-dev
Homebrew๋ก ๊ฐ๋จํ ์ค์น ๊ฐ๋ฅ:
brew install qt-creator
File โ New ProjectQt Widgets Application ์ ํ.ui ํ์ผ์์ ๋ฒํผ ์ถ๊ฐQMessageBox ๋์ฐ๊ธฐ ์ฝ๋ ์์ฑ// mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QMessageBox>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->pushButton, &QPushButton::clicked, this, [](){
QMessageBox::information(nullptr, "Hello", "Qt Creator์์ ๋ง๋ ์ฑ!");
});
}
MainWindow::~MainWindow()
{
delete ui;
}
Qt ์ฑ์ ๋จ์ํ .exe๋ง ๋ณต์ฌํ๋ฉด ์คํ๋์ง ์์ต๋๋ค.
๐ windeployqt (Windows), **macdeployqt (macOS)**๋ฅผ ์ฌ์ฉํด ํ์ํ DLL/Framework์ ์๋ ๋ณต์ฌํด์ผ ํฉ๋๋ค.
windeployqt my_app.exe
์ด๋ ๊ฒ ํ๋ฉด ๋ฐฐํฌ ๊ฐ๋ฅํ ํด๋๊ฐ ๋ง๋ค์ด์ง๊ณ , ์์ถํด์ ๋ฐฐํฌํ๋ฉด ๋ฉ๋๋ค.
Qt Creator๋ ๋จ์ํ IDE๋ฅผ ๋์ด, ํฌ๋ก์คํ๋ซํผ ์ฑ ๊ฐ๋ฐ์ ์ํ ์ฌ์ธ์ ํ๊ฒฝ์
๋๋ค.
ํนํ, C++๋ก ๋ฐ์คํฌํฑ ์ฑ ๊ฐ๋ฐ โ ๋ชจ๋ฐ์ผ๊น์ง ํ์ฅํ๋ ค๋ ๋ถ๋ค์๊ฒ ๊ฐ๋ ฅํ ๋ฌด๊ธฐ๊ฐ ๋ฉ๋๋ค.