Qt 어플리케이션의 기본 폰트를 설정하는 방법
#include <QApplication> #include <QFontDatabase> int main(int argc, char *argv[]) { QApplication a(argc, argv); int id = QFontDatabase::addApplicationFont(qApp->applicationDirPath()+"/Daum_Regular.ttf"); QString family = QFontDatabase::applicationFontFamilies(id).at(0); QFont SerifFont(family); a.setFont(SerifFont); return a.exec(); }
QApplication 객체 생성 후
qApp전역 변수에 접근하여 실행되는 위치에서 폰트파일의 경로를 설정하였다.
그러면 기본적으로 어플리케이션의 폰트는 Daum Regula로 적용된다.
번호 | 제목 | 글쓴이 | 날짜 | 조회 수 |
---|---|---|---|---|
공지 | Qt프로그래밍(QtQuick) Beginner를 위한 글 읽는 순서 | 운영자 | 2019.01.05 | 87270 |
10 | 초보자를 위한 첫번째 프로젝트 - QML로 만드는 Hello World | makersweb | 2018.03.16 | 14718 |
9 | 다국어 지원 어플리케이션 개발 | makersweb | 2018.01.27 | 3095 |
» | Qt 어플리에이션 전역에 폰트 설정 | makersweb | 2018.01.24 | 5794 |
7 | 임의의 메모리 영역(QImage)에 QPainter를 이용하여 그리기 | makersweb | 2017.12.19 | 3585 |
6 | 타임스탬프( timestamp) 유닉스 시간 | makersweb | 2017.10.19 | 1714 |
5 | Qt Logging Rule, Qt 프레임워크 로그 출력 | makersweb | 2017.01.13 | 3845 |
4 | 멀티 스레드환경, 스레드에 안전한 이벤트처리 | makersweb | 2016.10.27 | 5234 |
3 | Qt 프로그래밍의 시작 | makersweb | 2015.10.25 | 14548 |
2 | Qt의 스레드간 시그널 슬롯의 커넥션타입 [1] | makersweb | 2015.10.24 | 10389 |
1 | Qt의 시그널 슬롯 시스템 | makersweb | 2015.10.20 | 23957 |