한국어 English
Table of Content
- Qt 백서
- 서문
- 그래픽 유저 인터페이스 (GUI)
- 어플리케이션 기능
- Qt 디자이너
- 그래픽스와 멀티미디어
- 아이템 뷰
- 텍스트 처리
- 웹킷을 이용한 웹과의 통합
- 데이터베이스
- 국제화
- Qt Script
- Styles and Themes
- Input/Output and Networking
- Collection Classes
- Plugins and the Meta-Object System
- Building Qt Applications
- Qt's Architecture
- Platform Specific Extensions and Qt Solutions
- The Qt Development Community
Qt 백서

뿐만아니라 Qt 어플리케이션은 embedded Linux, Symbian, Windows CE 플랫폼 상에서도 작동합니다.
Qt는 멀티미디어, 3D 그래픽, 국제화, SQL, XML, 단위 테스트 등에서 고성능의 크로스 플랫폼 환경을 지원하고 있습니다. 물론 특정 플랫폼을 위한 특화된 확장기능 역시 제공하고 있습니다.
유저 인터페이스 개발 환경인 Qt Designer 를 이용하면 Qt 어플리케이션을 시각적으로 확인하면서 개발가능합니다. Qt Designer는 기존의 유명한 IDE에 통합되어 문제없이 이용 가능합니다.
Qt Quick이란 Qt 4.7에서 도입한 유저 인터페이스 기술들의 총칭으로, 신속한 프로토타입 개발(rapid prototyping)과 최신의 직관적인 유저 인터페이스 개발을 가능하게 합니다. 이와 관련 된 간략한 설명은 백서의 Qt Quick 섹션에서 볼 수 있으며 보다 구체적인 내용은 Introduction to Qt Quick for C++ Developers 에서 볼 수 있습니다..
서문
Qt는 고성능의 크로스 플랫폼 소프트웨어 개발을 가능하게 해 주는, 표준 C++ 기반의 최신 프레임워크입니다. Qt는 확장성이 용이한 C++ 클래스 라이브러리는 물론, 어플리케이션을 신속하고 간편하게 작성할 수 있도록 해 주는 툴들을 포함하고 있습니다. Qt의 크로스 플랫폼 기능과 국제화 지원기능을 이용하면, Qt 어플리케이션이 적용가능한 마켓이 가장 광범위하다고 자신합니다.
Qt C++프레임워크는 1995년 이래로 상용 어플리케이션의 핵심 기능의 개발에 사용되어 왔습니다. Adobe®, Boeing®, Google®, IBM, Motorola®, NASA, Skype®를 비롯하여 수많은 기업과 기관에서 Qt가 쓰여졌습니다. Qt 4는 이전보다 강력한 기능을 제공함은 물론, 보다 사용하기 편리하도록 재설계 되었습니다. 각종 Qt 클래스들은 사용자에게 필요한 기능을 거의 완벽히 갖추고 있으며 일관성있는 인터페이스를 제공합니다. 개발자가 사용법을 익히기 쉽도록 하고, 개발에 필요한 추가 부담을 줄여주며, 프로그래머의 생산성을 향상시켜줍니다. Qt는 완벽한 개체지향(Object-oriented) 프레임워크입니다.
이 백서는 Qt가 제공하는 기능과 툴에 대해 전반적으로 설명합니다. 각 섹션의 도입부는 non-technical한 설명으로 되어 있으며 도입부 이후 구체적인 기능에 대해 설명합니다. 설명에 쓰인 자료는 각 영역별로 온라인 링크가 제공되어 있습니다.
Qt를 30일간 사용해 보고 싶으시다면 http://qt.nokia.com/ [qt.nokia.com] 를 방문하세요.
주요 기능 요약
Qt에는 다양한 기능의 위젯 – wiget – (Windows에서는 보통 컨트롤 – control – 이라는 말을 씁니다.)이 포함되어있으며 표준 GUI 기능을 제공합니다. Qt는 “signals and slots”(시그널 – 슬롯)이라고 하는 매우 혁신적인 오브젝트 상호간의 통신 기술을 도입하였습니다. 시그널 – 슬롯은 기존의 프레임워크에서 흔히 사용되었던 구식의 불안전한(unsafe) 콜백 기능을 대체하기 위한 기술입니다. 단, 마우스, 키, 기타 입력장치의 이벤트 핸들링에 대해서는 기존 방식으로도 Qt에서 핸들링 할 수 있습니다. 또한, 메뉴, 컨텍스트 메뉴, 드래그 앤드 드롭, 도킹 툴바 등 최근에 등장한 UI 기능들도 제공하고 있습니다. Qt에서 제공하는 데스크탑(바탕화면)연계 기능을 이용하면 각 플래폼 별로 제공하는 데스크탑 기능을 어플리케이션에서 활용할 수 있습니다.
Qt는 또한 _Qt Designer_라는 이름의 GUI 디자인 툴을 제공합니다. _Qt Designer_는 고정된 위치 설정 등을 비롯한 강력한 레이아웃 기능을 제공합니다. _Qt Designer_는 순전히 GUI 디자인만을 위해 사용할 수도 있으나, 현존하는 유명한 개발툴(IDE)과 통합시켜서 사용하면, 어플리케이션의 UI를 바로 개발툴 안에서 적용하는 것도 가능합니다.
Qt는 멀티미디어와 3D그래픽 (page)을 지원합니다. Qt는 플랫폼 독립적인 OpenGL® 프로그래밍을 지원하는 _가장 최신_의 표준 GUI 프레임워크입니다. Qt가 지원하는 플랫폼에서는 전부 고성능의 렌더링 기능을 제공합니다. 캔버스 프레임워크를 사용하면, Qt의 고성능 페인팅 기능을 활용한 인터랙티브한 그래픽 어플리케이션을 개발할 수 있습니다.
Qt는 표준 데이터베이스를 이용하면서 플랫폼 독립성을 갖춘 어플리케이션을 개발하는 것이 가능합니다.
Qt는 이미 Oracle®, Microsoft® SQL Server, Sybase® Adaptive Server, IBM DB2, PostgreSQL™, MySQL®, Borland® Interbase, SQLite, ODBC호환 데이터베이스 등의 다양한 데이터베이스 드라이버가 기본 탑재되어 있습니다. Qt는 데이터베이스에 특화된 위젯을 제공합니다. 물론 Qt 기본 위젯이나 상속된 위젯 역시 간단히 데이터베이스 연계가 가능합니다.
Qt가 지원하는 플랫폼에서 Qt 스타일, 테마를 이용하면, Qt기반의 프로그램은 독자적인 룩앤필(native look and feel)을 가질 수 있습니다. 단일한 소스트리에서 컴파일 설정을 바꾸는 것만으로 Windows® XP®and Windows Vista™, Mac OS X®, Linux®, Solaris™, HP-UX™, X11를 지원하는 여타 Unix® 등 각 플랫폼 기반의 어플리케이션을 생성하는 것이 가능합니다. Qt는 설정된 플랫폼에 맞게 자동으로 makefile이나 .dsp를 생성해 주며, 이를 위해 qmake라는 빌드 툴을 제공합니다.
Windows, Mac OS X, Unix 등에서 Qt는 단일 플랫폼 기반의 개발방식으로써도 여전히 매력적입니다. 이들 플랫폼 상에서 Qt는 플랫폼의 거의 모든 기능을 커버하며, Qt식의 개발방법론을 많은 개발자가 선호하기 때문입니다. Qt는 Windows의ActiveX®나 Unix의Motif™같이 특정 플랫폼에서만 작동하지만 중요하다고 여겨지는 기능 역시 지원하고 있습니다. 자세한 내용은 sec:Qt’s-Architecture 를 참고하세요.
Qt는 완벽히 Unicode™를 지원하며, 이것은 특히 국제화 지원에 매우 용이합니다. Qt는 언어 번역 기능을 위해 Qt Linguist 등의 툴을 제공합니다. 어플리케이션은 유니코드를 지원하기 때문에 다양한 언어를 동시에 한 텍스트에 표현하는 것이 가능합니다.
Qt는 이밖에도 다양한 목적을 위한 클래스들을 다수 제공합니다. Qt는 SAX나 DOM같이 XML형식의 데이터를 처리하기 위한 클래스들을 제공합니다. STL과 호환가능한 컬렉션 클래스들 역시 제공하고 있습니다. 이들을 이용하면 개체들을 메모리에 저장할 수 있으며, 자바나 C++ 표준 템플릿 라이브러리(STL)에서 사용되었던 반복자(iterator)스타일을 사용하는 것도 가능합니다. 또한 입출력 클래스와 네트워킹 클래스를 제공하고 있으며, 이를 이용하면 표준 방식으로 로컬 파일 혹인 리모트 파일을 처리할 수 있습니다.
Qt어플리케이션에서는 플러그인이나 다이나믹 라이브러리를 통해 기능을 확장하는 것이 가능합니다. 플러그인으로는 코덱, 데이터베이스 드라이버, 이미지 포맷, 스타일, 위젯을 추가할 수 있습니다. 플러그인과 라이브러리는 개발자(사)의 저작권을 부여하여 제품으로 판매하는 것이 가능합니다.
QtScript 모듈을 이용하면 스크립트를 통해 어플리케이션을 작동시키게 할 수 있습니다. QtScript는 JavaScript와 밀접한 관련이 있는 ECMAScript를 기반으로 하고 있습니다. 스크립트의 용도 범위를 개발자가 설정 가능하기 때문에, 어플리케이션 사용자가 특정 기능을 이용하지 못하게 할 수도 있습니다.
Qt는 전세계적으로 널리 사용되는 매우 뛰어난 C++ 프레임워크 입니다. Qt는 상용 제품 개발에 널리 사용됨은 물론, 리눅스 데스크탑 환경을 개발하는 KDE 재단에서는 오픈소스로도 사용되고 있습니다. Qt의 크로스 플랫폼 빌드 환경, 비주얼화된 폼 디자인, 그리고 빼어난 API를 이용함으로써 보다 쾌적하게 어플리케이션을 개발하는 것이 가능합니다.
온라인 리퍼런스
http://qt.nokia.com/qt-in-use [qt.nokia.com]
그래픽 유저 인터페이스 (GUI)
Qt는 어플리케이션의 그래픽 유저 인터페이스를 만들기 위해 다양한 종류의 표준 위젯들을 지원합니다. 레이아웃 메니저를 이용하면, 위젯의 크기와 배치가, 유저가 지정한 스크린 크기, 언어, 폰트에 맞춰서 바뀝니다.
위젯이란 유저 인터페이스를 만들기위해 시각적 요소가 조합된 것을 의미합니다. 버튼, 메뉴, 스크롤바, 메시지 박스, 어플리케이션 윈도우 등이 전부 위젯이라 할 수 있습니다.
레이아웃 매니저는 하위(child) 위젯들이 상위(parent) 위젯 영역 안에서 어떻게 구성될 것인지를 설정해 주는 역할을 합니다. 차일드 위젯의 사이즈나 위치를 자동으로 조절하며, 최상위(top-level) 위젯의 최소 사이즈나, 디폴트 사이즈 등을 설정 가능합니다. 위젯의 내부 설정이 바뀔 경우에는 자동으로 위치를 재조정해 줍니다.
시그널과 슬롯은 어플리케이션 컴포넌트들을 간결하면서도 타입 안정적(type-safe)인 방법으로 소통하도록 연결해 줍니다. 이러한 오브젝트간 통신 방법은 표준 위젯에서는 물론, 개발자들이 만든 커스텀 위젯에서도 사용가능합니다.

Qt에서 제공하는 대표적인 위젯
위젯
위 그림은 대표적인 위젯들을 나타낸 것입니다. 여기에는 텍스트 입력 위젯, 체크박스, 라디오 버튼, 슬라이더, 푸시 버튼 같은 표준 위젯은 물론 날짜나 시간 입력에 특화된 위젯들도 포함되어 있습니다.
라벨, 메시지 박스, 툴팁, 그 밖의 텍스트 표시를 위한 위젯들은 다양한 색상, 폰트, 언어를 지원합니다. Qt의 모든 텍스트 렌더링 위젯들은 HTML의 일부 기능을 이용하여 다국어 리치 텍스트를 표시할 수 있습니다.
탭 위젯, 그룹 박스 같은 컨테이너 위젯들 역시 제공하고 있습니다. 이들을 통해 유저 인터페이스 컴포넌트들을 관계 별로 그룹화 시킬 수 있습니다. 특히_Qt Designer_를 이용하면 컨테이너 위젯들을 보다 쉽게 사용할 수 있도록 해 줍니다. 디자이너들이 보다 편리하게 유저 인터페이스를 만들 수 있습니다 . 스크롤 뷰 위젯 같이 보다 복잡한 위젯의 경우, 처리하는 컨텐츠가 매우 특수하거나, 실행중에 시시각각 변하기 때문에, 이러한 위젯은 디자이너 보다는 개발자들이 직접 다루는 경우가 많습니다.
개발자들은 자기들만의 독자적인 위젯이나 다이얼로그를 만들 수 있습니다. 이것은 QWidget 클래스를 직접 간접적으로 상속함으로써 가능합니다. 독자적인 컨텐츠를 표시하기 위해, 유저로부터의 입력을 처리하기 위해, 독자적인 시그널 슬롯을 제공하기 위해 커스터마이즈한 특수 위젯을 문제 없이 만들 수 있습니다.
지금까지 소개한 위젯 이외에도 Qt는 많은 위젯을 제공합니다. Qt 온라인 위젯 갤러리 [qt.nokia.com] 에서는 다양한 종류의 위젯들을 소개하고 있으며 해당 클래스에 대한 도큐먼트를 링크하고 있습니다 .
레이아웃 (배치)
레이아웃은 유저 인터페이스의 스타일, 방향, 텍스트 폰트 등이 변경될 경우 즉각적이면서 유동성 있게 대응하게 해 줍니다.
레이아웃은 개발자들이 어플리케이션이 국제화를 지원하도록 해 줍니다. 텍스트의 사이즈나 위치를 고정시킨 상태에서 텍스트의 내용을 다른 언어로 바꿀 경우 내용이 전부 표시되지 않을 수도 있습니다. 하지만 레이아웃을 이용하면 차일드 위젯은 자동적으로 사이즈를 조절합니다. 또한, 글자를 오른쪽에서 왼쪽으로 쓰는 체계를 가진 언어의 경우, 보다 자연스럽게 보일 수 있도록 위젯의 위치를 역순으로 바꾸어 줍니다.
레이아웃의 방향은 위젯의 배치를 오른 쪽에서 왼 쪽, 밑에서 위로의 방향으로도 가능합니다. 아랍어나 히브리어 같이 글자를 오른쪽에서 왼쪽으로 쓰는 언어를 지원하는 국제화에 유용합니다. 기본으로 제공되는 레이아웃은 Qt의 스타일 시스템에 완벽히 통합되어 있기 때문에 역순으로 배치될 시에도 룩-앤-필의 일관성을 잃어버리지 않습니다.
Qt Designer 이용하면 위젯을 배치하기 위한 레이아웃을 마음 껏 활용할 수 있습니다.
시그널, 슬롯
이벨트가 발생하면 위젯은 시그널을 내보냅니다. 예를 들어, 버튼이 클릭되면 이 버튼은 “clicked“라는 시그널을 내보냅니다. 개발자들은 시그널을 자유롭게 연결시킬 수가 있습니다. 슬롯 역할을 하는 멤버함수를 만들고 connect() 함수를 호출하면 시그널이 슬롯에 연결됩니다. Qt의 시그널 슬롯 메커니즘은 연결하려는 상대방이 어떤 클래스인지를 알 필요가 없기 때문에, 클래스의 재사용이 매우 쉽습니다. 시그널, 슬롯은 타입 안정적(type-safe)이기 때문에, 타입 에러가 warning을 발생시키기는 하지만, 오류를 발생시키지는 않습니다.
한 예로, 만약, Quit 버튼의 clicked()라는 시그널이 어플리케이션의 quit() 라는 슬롯에 연결되어 있으면, 유저가 Quit버튼을 클릭할 시에 어플리케이션은 종료됩니다. 코드 상에서는 다음과 같이 표현됩니다.
- connect(button, SIGNAL(clicked()), qApp, SLOT(quit()));
이러한 연결은 Qt 어플리케이션이 실행되는 중에 언제든지 추가되거나 삭제될 수 있습니다. 시그널은 바로 발산되어 바로 그에 연결된 실행이 이루어지기도 하고, 혹은 즉시 큐에 저장되어 나중에 실행되기도 합니다. 또한 서로 다른 스레드상에 있는 오브젝트끼리도 연결하는 것이 가능합니다.
시그널, 슬롯 메커니즘은 표준 C++상에서 구현됩니다. 이러한 메커니즘을 구현하기 위해서는 C++전처리기와 moc이라는 메타 오브젝트 컴파일러를 이용합니다. 이것은 Qt에 이미 포함되어 있으며 Qt 빌드 시스템 sub:Qt’s-Build-System 에서 자동적으로 관련된 코드를 생성합니다. 개발자들은 자동 생성된 코드를 수정하거나 의식할 필요가 없습니다.
메타 오브젝트 컴파일러 시스템은 시그널 슬롯의 핸들링 뿐만 아니라, Qt의 번역 메커니즘, 프로퍼티 시스템, 확장된 런타임 타입 정보 (RTTI)를 지원합니다. 또한 Qt가 지원하는 여러 플랫폼 상에서 동일한 방법으로, 런타임 인트로스펙션을 C++ 프로그램 상에서 지원하게 해 줍니다. 이러한 기능들을 제공하는 시스템을 Qt 메타 오브젝트 시스템이라고 합니다(see page.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/examples.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/layout.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/object.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/signalsandslots.html [qt.nokia.com]
어플리케이션 기능
Qt를 이용하여 최신의 GUI 어플리케이션을 개발하는 것은 매우 빠르고 간단합니다. 직접 코드를 타이핑함으로써 개발할 수도 있고, 혹은 Qt의 비주얼 디자인 툴인 QtDesigner를 이용할 수도 있습니다.
메뉴, 툴바, 도킹 윈도우 같이, GUI 어플리케이션 작성에 필요한 최신 기능들을 전부 Qt에서 제공합니다. Qt는 SDI (single document interface) 와 MDI (multiple document interface) 양쪽을 모두 지원합니다. 또한 Qt는 드래그-앤-드롭과 클립보드를 지원합니다.
Qt는 파일 선택, 폴더 선택, 폰트 선택, 컬러 선택 등을 포함하여 일반적으로 사용되는 표준 다이얼로그를 전부 지원합니다. 실제로, Qt의 정형화된 편의 기능을 이용하면 한줄짜리 문장의 출력은 단순히 표준 다이얼로그에게 맡기면 됩니다.

Qt Assistant는 메인 어플리케이션이 제공하는 다양한 기능을 사용하여 Qt 문서들을 보여 줍니다.
Qt는 유저 인터페이스 프로그래밍을 보다 편리하게 할 수 있도록 액션이라는 개념을 사용합니다. 예를 들어, 만약 메뉴 옵션, 툴바 버튼, 키보드 단축키가 동일한 액션을 수행하도록 한다 하더라도 이 액션은 단 한번만 코딩하면 됩니다.
Qt는 어플리케이션의 설정값을 플랫폼 독립적인 방법으로 저장합니다. 이러한 기능들은 내부적으로 시스템 레지스트리나, 텍스트파일을 이용하며, 유저의 환경설정값도 저장하게 함으로써 최근에 사용했던 파일 리스트나 이전에 사용했던 윈도우, 툴바의 위치나 사이즈 등을 기록하게끔 합니다.
멀티 스레드 프로그래밍 지원 역시 제공됩니다. 스레드와 관련하여 거의 일반적이라 할 수 있는 기능들을 구현한 클래스들을 통해 제공됩니다. 이러한 클래스들을 이용하면, 어플리케이션에서 처리시간이 오래 걸리는 기능을 수행하거나, 어플리케이션의 반응속도를 향상시키기 위해 스레드를 사용하는 것이 가능합니다.
어플리케이션은 또한 Qt의 데스크탑 통합 기능을 이용할 수 있습니다. 유저의 데스크탑 환경에서 제공하는 서비스를 Qt어플리케이션에서 이용할 수 있습니다.
메인 윈도우의 기능
QMainWindow 클래스는 일반적인 어플리케이션용 메인 윈도우를 위한 프레임워크를 제공합니다. 메인 윈도우에는 몇몇의 표준 위젯들이 들어가 있습니다. 메인 윈도우의 상단에는 메뉴바가 자리잡고 있으며, 그 밑에 툴바가 위치합니다. 가운데 있는 윈도우 주변에서 툴바 영역이 자리잡아 이 안에 툴바가 들어가게 됩니다. 메인 윈도우의 제일 하단에 있는 툴바보다도 밑에는 스테이터스바가 자리잡고 있습니다. 툴팁과 “What’s this?” 헬프는 유저 인터페이스 요소들을 위한 풍선 도움말을 제공합니다.
QMenu 위젯은 메뉴 아이템을 세로방향으로 나열시켜 표시해 줍니다. 메뉴는 혼자 독립될 수도 있고 (대표적으로 컨텍스트 팝업 메뉴), 메뉴바에 바로 표시되기도 하며, 혹은 다른 팝업 메뉴의 서브메뉴로 존재하기도 합니다. 메뉴는 분리시켜 사용할 수도 있습니다.
각각의 메뉴 아이템들은 아이콘, 체크박스, 단축키를 가질 수 있습니다. 메뉴 아이템은 대개 액션과 연결되어 있어서(예:“Save”) 유저가 해당 메뉴를 선택하면, 이와 연결된 슬롯이 실행됩니다. Qt의 레이아웃 매니저는 다양한 메뉴바를 고려하였습니다. Mac OS X에서, 메뉴바는 화면의 맨 위에 표시됩니다.
Qt의 메뉴는 매우 유연하며, _액션시스템_의 일부로서 통합되어 사용됩니다(sub:액션 을 참조). 액션은 상황에 맞게 실행을 허가할 지 금지할 지를 설정할 수 있으며, 메뉴에 추가하거나 삭제하는 것도 런타임에 가능합니다.

Mac OS X 환경에 통합된 툴바를 지원합니다. 인접 툴바나 윈도우 타이틀바에 적절하게 붙일 수 있도록 함으로써, 어플리케이션의 룩앤필을 향상시킵니다.
툴바는 유저가 액션을 수행하기 편리하도록 버튼이나 다른 위젯들을 모아서 표시합니다. 메인 윈도우의 중심 부분과 인접한 상,하,좌,우 영역에서 자유롭게 이동가능합니다. 툴바는 툴바 영역 밖으로 드래그 시켜서 독립적인 툴 팔레트 형태로 바꿀 수 있습니다.
툴바에 들어가는 버튼은 QToolButton 클래스로 만들어집니다. 이 클래스는 한개의 아이콘과 한개의 프레임 스타일을 가지며 추가적으로 라벨을 넣을 수 있습니다. 토글 툴바 버튼은 기능을 온/오프 시킬 때 사용됩니다. 다른 툴바 버튼은 명령을 실행하기 위해 사용됩니다. 활성화/비활성화, 사용가능/불가능, 온/오프 모드 같이 버튼의 상태에 맞게 다른 아이콘을 설정할 수도 있습니다. 만약 단 하나의 아이콘만 설정한 경우에는 Qt는 자동적으로 적절한 시각효과를 줌으로써 상태를 구별짓습니다. 예를 들어 버튼이 사용 불가능한 상태에서는 아이콘 색상을 옅은 색으로 만듭니다. 툴바 버튼은 팝업 메뉴를 표시하게 하는 것도 가능합니다.
도킹 윈도우는 유저가 툴바 영역 내부에서 자유롭게 이동시킬 수 있는 윈도우를 가리킵니다. 물론 떨어져 있는 다른 툴바 영역으로도 이동시킬 수 있습니다. 유저는 도킹을 해제할 수 있으며, 이 경우 어플리케이션 최상층에 띄워져 표시되거나, 최소화됩니다. 도킹 에리어 경계상에서 윈도우가 이동 될 경우에는 부드럽게 스크롤되는 애니메이션 효과를 냅니다.
도킹 영역안에서는 여러 도킹 윈도우를 행이나 열방향으로 붙이는 것이 가능합니다. 또한 도킹 윈도우는 같은 영역을 공통적으로 포개질 수도 있으며 이 경우에는 탭 형태를 가지게 됩니다.
도킹 윈도우를 커스터마이즈하는 것도 가능합니다. 세로로 긴 타이틀바를 표시할 수도 있고, 개별적으로 다른 스타일의 타이틀바나 윈도우 컨트롤을 가지는 것도 가능합니다.
Qt Designer 나 Qt Linguist 같은 어플리케이션은 도킹윈도우의 기능을 확장시켰습니다. 도킹 윈도우나 툴바의 위치를 저장해 두는 기능을 제공하였기 때문에 유저가 원하는 작업 환경을 이전 그대로 되살릴 수 있습니다.
액션
어플리케이션은 하나의 특정 액션을 실행하는 데에 있어서 다양한 방법을 제공해 줍니다. 예를 들어, 대부분의 어플리케이션은 “저장“이라는 액션을 제공하며 이 액션은 메뉴, 툴바(저장이라는 액션에 어울리는 아이콘을 가진 툴바 버튼), 단축키를 통해 실행시킬 수가 있습니다. QAction 클래스는 이러한 개념을 캡슐화 시킵니다. 이 클래스는 프로그래머가 한 액션을 중복해서 정의하는 것을 허락하지 않습니다.
QAction 은 이처럼 작업이 서로 중복되는 것을 방지할 뿐만 아니라, 서로 연관성 있는 메뉴와 툴바 버튼의 상태를 자동적으로 동기화 시켜 줍니다. 또한 필요한 경우에는 인터랙티브 헬프 기능도 지원합니다. 특정 액션을 사용불가로 설정하면, 연관되어 있는 메뉴와 툴바 버튼도 따라서 사용불가 상태가 됩니다. 뿐만 아니라, 유저가 툴바에 있는 토글 버튼을 클릭하여 토글 상태를 바꾸면, 메뉴에 있는 아이템도 따라서 토글 상태가 바뀝니다.
다이얼로그와 위저드
대부분의 GUI 어플리케이션은 특정 목적을 위해 유저와 긴밀히 소통하기 위한 다이얼로그 박스를 이용합니다. Qt는 대부분의 일반적인 작업을 위한 편리한 기능들을 클래스에 담아 준비해 두었습니다. 아래의 사진은 Qt의 표준 다이얼로그를 나타낸 것입니다. Qt는 색상 선택, 프린팅, 프로그레스를 나타내고 메시지를 표시하는 등의 표준 다이얼로그를 제공합니다.

QFileDialog 와 QFontDialog 는 Plastique 스타일이 적용된 모습입니다. Windows나 Mac OS X 상에서는 네이티브에서 제공하는 다이얼로그가 사용됩니다.
프로그래머는 *QDialog*를 상속하여 독자적인 다이얼로그를 만들 수 있습니다. 또한 Qt Designer 는 개발자가 독자적인 디자인을 쉽게 작성할 수 있도록 다이얼로그 템플릿을 제공합니다.
특별하지 않은 일반적인 작업이나 절차를 유저에게 안내할 경우에는 위저드가 사용됩니다. 한 단계씩 한 단계씩 유저가 사용가능한 옵션을 제시하고 필요에 따라서는 도움말을 제공합니다. Qt는 확장성이 뛰어나면서도 매우 직관적인 API를 제공합니다. 각각의 플랫폼에 맞는 네이티브 룩앤필을 같이 제공합니다.
QWizard 클래스는 플랫폼에 특화된 룩앤필이 아닌, 독자적으로 디스플레이 스타일을 커스터마이즈할 수 있는 기능을 제공합니다. 이 클래스의 인스턴스는 유저에게 보여주는 페이지의 순서들을 컨트롤합니다. QWizardPage 는 유저가 입력한 내용이 적절한지 검사하거나 입력한 내용을 저장하는 기능을 제공하는 표준 위젯입니다.
인터랙티브 헬프
어플리케이션은 유저 인터페이스 요소의 용도를 설명하고 사용을 용이하게 하기 위해서 다양한 형태의 인터랙티브 헬프가 필요할 때가 있습니다. Qt는 단문의 헬프 메세지를 제공하기 위해 두 가지 방법을 제공합니다. 하나는 툴팁이라는, 현재의 정황에 맞는 단문의 헬프를 제공하는 기능이며 다른 하나는 보다 장문의 구체적인 메세지를 표시하는 “What’s this?” 팝업 헬프입니다. 두 기능 모두 Qt의 액션 시스템에 통합되어 있습니다.
Qt의 Help 모듈에 있는 클래스들을 이용하면, 어플리케이션의 헬프 브라우저 형태로서 혹은 도큐먼트 형태로서 Qt Assistant 를 사용할 수 있습니다. 또한 이 모듈은 유저에게 유용한 정보를 제공할 수 있도록, 툴팁이나 “What’s This?” 클래스를 이용하여 어플리케이션의 도큐먼트를 표시하게 해 주는 API를 제공합니다.
세팅
QSettings 클래스를 이용하면 유저 혹은 어플리케이션의 설정값을 디스크에 저장 가능합니다. Windows, Mac OS X, Linux 플랫폼 상에서는 설정값이 표준 시스템 로케이션에 저장됩니다. 다른 플랫폼에서는 텍스트파일에 저장됩니다.
특별한 추가작업없이 어플리케이션이 데이터를 시리얼라이즈하여 저장하고 불러들일 수 있도록 QSettings 에서는 다양한 Qt데이터 타입을 이용할 수 있습니다. Qt의 데이터 타입의 시리얼라이즈에 관해 보다 자세한 정보를 원하시면 sub:File-Handling 를 참조하시기 바랍니다.
멀티 스레딩과 병렬(Concurrent) 프로그래밍
Qt 어플리케이션은 멀티 스레드를 이용할 수 있습니다. 다만, 오직 한 스레드만이 유저 인터페이스의 응답을 받을 수 있으며 그 이외의 스레드는 대량의 파일을 읽거나 복잡한 연산을 수행하는 등의 작업을 위해 사용됩니다. Qt는 스레드, 뮤텍스, 세마포, 스레드 글로벌 영역, 프리미티브 록을 사용할 수 있는 클래스들을 제공합니다.
map-reduce와 filter-reduce같은 유명한 알고리즘을 포함한 병렬(concurrent) 프로그래밍을 지원하기 위한 기능 역시 제공합니다. 이들은 Qt의 오브젝트 모델에 통합되어 있어서, 표준 컨테이너 클래스를 이용하면 Qt 어플리케이션에서 병렬 처리를 보다 편리하게 이용할 수 있습니다.
Qt의 메타오브젝트 시스템을 이용하면, 다른 스레드상에 있는 개체간의 통신을 가능하게 합니다. 이를 위해 시그널 슬롯을 이용하며, 초기에 어플리케이션이 싱글 스레드 기반으로 만들어졌다 하더라도, 특별히 어플리케이션을 재설계할 필요 없이 간단하게 멀티 스레드를 도입하는 것이 가능합니다.
데스크탑 통합
Qt의 데스크탑 통합 클래스를 이용함으로서 유저의 데스크탑 환경에서 제공하는 서비스와 어플리케이션을 연계할 수 있습니다. QSystemTrayIcon 은 장기간에 걸쳐 실행되는 어플리케이션을 위해 시스템 트레이에 영구적으로 아이콘을 표시하게 해 줍니다. QDesktopServices 는 각 플랫폼이 mailto: 나 http:// URL 같은 리소스에 적절한 어플리케이션을 찾아 실행될 수 있도록 하게 해 줍니다.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/qt4-mainwindow.html [qt.nokia.com]
Qt 디자이너
Qt 디자이너는 Qt 어플리케이션의 GUI를 디자인하기 위한 툴입니다. 어플리케이션은 소스코드상에서 전부 개발되기도 하지만 Qt 디자이너를 이용하여 개발속도를 향상시킬 수 있습니다. 컴포넌트 기반 아키텍쳐는 개발자가 Qt 디자이너의 위젯이나 확장기능을 커스터마이즈할 수 있게 해주며 심지어는 통합 개발환경(IDE) (예:이클립스, 비주얼 스튜디오, Qt 크리에이터)에 통합시켜서 사용하게 하는 것도 가능합니다.
Qt 디자이너 를 이용하여 폼(form)을 디자인하는 방법은 매우 간단합니다. 개발자는 툴박스에 있는 위젯을 폼으로 드래그하거나 선택, 자르기, 붙이기, 크기 조절 같은 일반적인 편집기능을 사용가능합니다. 그 다음 프로퍼티 에디터에서 각 위젯들의 프로퍼티를 변경합니다. 위젯의 위치나 크기를 정밀하게 조정하는 것도 매우 쉽습니다. 개발자는 하나 이상의 위젯을 선택한다음 레이아웃을 적용하기만 하면 됩니다. 예를 들어, 몇 개의 버튼 위젯을 선택한 후 “lay out horizontally” 옵션을 선택하면 위젯들은 옆으로 붙어서 배열됩니다. 이러한 방법은 디자인 시간을 크게 단축시키며, 개발자가 폼의 디자인을 마친 후, 엔드유저가 원하는 대로 윈도우의 사이즈를 바꾸더라도 알맞은 사이즈로 폼의 크기가 자동 조절됩니다. Qt의 자동 레이아웃에 관한 자세한 설명을 원하신다면 sub:레이아웃 을 참고하세요.
Qt 디자이너 는 유저 인터페이스 디자인에 있어서, 많은 시간이 허비되는 “compile, link, and run” 라는 반복과정을 생략함으로써 디자인의 잘못된 점을 개선하고, 디자인을 변경하기가 쉬어졌습니다. Qt 디자이너 의 미리보기 옵션은 개발자가 다른 스타일의 폼을 보고자 할 때 그 결과물을 바로 눈으로 확인할 수 있게 해 줍니다. 예를 들어, Mac OS X 상에서 개발이 이루어진다 하더라도 Windows 스타일로 폼을 미리 볼 수 있습니다. 디바이스의 스킨을 이용하여 미리보는 것도 가능하며, 이 경우 디스플레이의 제약이나 해당 디바이스에서 어떤 모습으로 나타나는가를 미리 볼 수 있습니다.
Windows의 상용 라이센스 버전에서는 Qt 디자이너 의 UI 디자인 지원툴을 Microsoft Visual Studio®에서 사용 가능합니다. 또한 Qt 프레임워크를 이용하면 크로스 플랫폼을 지원하는 Eclipse™ IDE의 플러그인을 개발할 수 있습니다. 이러한 플러그인은 Qt 디자이너 는 물론 다른 Qt 기술들을 IDE 프레임워크 내부로 통합 시켜 주는 역할을 합니다.
Qt 디자이너의 활용
개발자는 두 가지 스타일의 어플리케이션을 작성할 수 있습니다. 하나는 다이얼로그 스타일 어플리케이션이고, 다른 하나는 메인 윈도우 스타일의 어플리케이션입니다. 메인 윈도우 스타일은 메뉴, 툴바, 풍선 도움말 등의 표준 기능을 포함하고 있습니다. 몇 가지의 템플릿이 제공되어 있으며 개발자들 고유의 템플릿을 생성할 수 있습니다. 이를 이용하면 하나 이상의 어플리케이션에 일관성을 확보하는 것이 가능합니다. 또한 프로그래머는 고유의 커스텀 위젯을 작성할 수 있으며 이러한 위젯을 간단하게 Qt 디자이너 상에 통합시킬 수 있습니다.
Qt 디자이너 는 폼 기반의 어플리케이션 개발 방법을 지원합니다. 폼(form)이란 하나의 유저 인터페이스 파일(.ui)에서 작성되며, 이렇게 작성된 파일은 C++로 컴파일되어 어플리케이션에 통합됩니다. 뿐만 아니라 유저 인터페이스 파일을 동적으로 작성하여 런타임에 처리하는 것도 가능합니다. 유저 인터페이스를 컴파일 타임에 생성시킬 경우, 보다 편리한 디자인 프로세스가 가능하도록 하기 위해, Qt의 빌드 시스템은 (see page) 이러한 과정을 자동화시킬 수 있습니다.
Qt 디자이너 를 이용하여 어플리케이션을 만들 경우라도, 개발자는 자신이 선호하는 툴을 사용하여 어플리케이션의 소스를 코딩할 수 있습니다. Qt 디자이너 는 Microsoft Visual Studio 혹은 Eclipse 개발환경에 통합되어 사용할 수 있습니다.

Qt 디자이너의 유저 인터페이스의 전반적인 모습
Qt 디자이너 기능의 확장
Qt 디자이너 의 내부 아키텍쳐는 컴포넌트 기반 아키텍쳐로 구축되어 있습니다. 그러므로 개발자는 커스텀 컴포넌트를 이용하여 유저 인터페이스나 편집 툴을 확장할 수 있습니다. 게다가 Qt 디자이너 어플리케이션 자체가 모듈화되어 있다는 특성을 활용하여 Microsoft Visual Studio 나 KDevelop 같은 통합개발환경(IDE)상에서도 _Qt 디자이너_를 사용할 수 있도록 해줍니다.
Qt 디자이너 모듈은 , .ui를 작성하고, 기능을 확장하기 위해 20개 이상의 클래스를 제공합니다. 이러한 수많은 클래스들을 이용하여, 서드파티는 어플리케이션 고유의 유저인터페이스를 커스터마이즈 할 수 있습니다.
커스터마이즈한 위젯을 다시 Qt 디자이너 상에서 사용하는 것도 가능합니다. 커스텀 위젯의 기본 프로퍼티와 생성자를 제공하는 인터페이스를 이용하여 플러그인을 구현하면, Qt 디자이너 에서 커스텀 위젯을 통합시킬 수 있습니다. sub:Plugins 에 나온 설명과 비슷한 매크로를 이용하면, 커스텀 위젯 플러그인의 인터페이스가 Qt 디자이너 로 익스포트 됩니다.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/designer-manual.html [qt.nokia.com]
http://qt.nokia.com/products/developer-tools [qt.nokia.com]
http://qt.nokia.com/doc/latest/qtdesigner.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/examples.html [qt.nokia.com]
그래픽스와 멀티미디어
Qt는 2D 3D 그래픽을 훌륭히 지원합니다. Qt의 2D 그래픽 클래스들은 래스터 그래픽과 벡터 그래픽 양쪽을 모두 지원하며 현존하는 다양한 이미지 포맷을 지원하며 이를 확장하는 것도 가능합니다. 또한 텍스트와 그래픽을 PDF 포맷으로 출력할 수도 있습니다. Qt는 변형된 유니코드 리치 텍스트와 SVG를 표현 가능하며, 인터랙티브 어플리케이션에서 필수적인 캔버스 기능을 완벽하게 제공합니다. 또한 Qt는 오디오, 비디오, 스트림 파일을 재생하는 기능을 제공합니다.
그래픽의 표현은 디바이스 독립적인(device-independent) 페인터 오브젝트를 이용하여 이루어집니다. 다른 타입의 디바이스에서 그래픽을 렌더링을 한다 하더라도 디바이스가 Qt 페인트 디바이스를 구현했다면, 개발자는 기존 코드를 그대로 사용가능합니다(see sub:Painting on page ). 이러한 방법은, Qt가 지원하는 디바이스라면, 다양한 종류의 고성능의 페인팅을 완벽하게 수행할 수 있다는 것을 보장해 줍니다. 또한 개발자가 큰 고민 없이, 자신의 목적에 맞는 디바이스를 도입할 수 있게 해 줍니다.

Boxes 데모에서는 Qt의 다양한 그래픽 기능들을 확인할 수 있습니다.
인터랙티브한 캔버스를 이용한 그래픽 어플리케이션을 작성해야 한다면, Graphics View 프레임워크를 이용하는 것이 편리합니다. Graphics View 프레임워크는 수많은 인터액티브 아이템을 효과적으로 렌더링 화면에서 관리해 주며, 필요하다면 멀티플 뷰도 이용가능합니다.
Qt는 또한 OpenGL과 OpenGL ES를 지원하므로, 개발자가 어플리케이션에 3D 그래픽을 도입할 수 있습니다. 물론 기존의 2D그래픽에도 최신 그래픽 하드웨어를 적용할 수 있으므로 2D 렌더링의 성능 향상 역시 가능합니다.
디바이스 독립적인 컬러(Device-independent color)은, ARGB, AHSV, ACMYK, 그 이외의 일반적인 규격으로 변환하도록 지원합니다. 사용되는 컬러 채널은 16비트 영역을 가지며 추가적으로 투명도를 가질 수 있습니다. 컬러 지정이 요청되면 Qt는 자동적으로 시스템 팔레트에서 할당하며, 제한된 컬러수를 갖는 디스플레이에서는 가장 비슷한 컬러를 할당합니다. (역자 주 : 여기는 번역하기가 쉽지 않네요)
페인팅
Qt는 위젯이나 다른 페인트 디바이스를 페인팅하는 데 있어서 플랫폼 독립적인 API를 제공합니다. 기본적인 드로잉 기능은 물론 변형(Transformation)이나 클리핑 같은 고급 기능도 제공합니다. Qt에서 기본적으로 제공하는 위젯들은 전부 QPainter 를 이용하여 페인팅되었습니다. 만약 개발자가 커스텀 위젯을 만들고 싶을 때에도 마찬가지로 QPainter를 이용해야 합니다.
QPainter 는 점, 선, 원, 곡선, 베지어 곡선 등을 그리기 위한 기능을 기본적으로 제공합니다. 폴리곤이나 벡터 패스 같은 복잡하고도 세밀한 페인팅 기능도 이미 제공하고 있으며 이러한 기능들도 함수 한 번의 호출로 간단히 사용할 수 있습니다. 텍스트 페인터를 이용하여 바로바로 페인팅할 수도 있고, 모아 두었다 나중에 한 꺼번에 페인팅할 수도 있습니다.
또한 Qt의 페인팅 시스템은 렌더링 퀄리티를 전반적으로 향상시키기 위한 다양한 기능들을 제공합니다. 알파 블렌딩, Porter-Duff 합성 모드, 안티알리아싱, 다양한(linear, radial, conical) 그라데이션 등을 제공합니다.
이미지
Qt는 BMP, GIF, JPEG, MNG, PNG, PNM, TIFF, XBM, XPM 등의 이미지 포맷에 대해 입력, 출력, 편집 기능을 제공합니다. 이러한 클래스들은 인터랙티브 그래픽 어플리케이션 상에서 일종의 페인트 디바이스로써도 사용가능하며, 또한 유저 인터페이스 컴포넌트 상에서 이미지 전처리(preprocess)를 위해 사용되기도 합니다.
QImage 는 이미지를 편집하기 위해서 사용되거나 다양한 컬러 뎁스, 픽셀 포맷들간의 변환을 위해서 사용됩니다. 프로그래머는 픽셀값이나 팔레트 데이터를 편집할 수 있으며 회전(rotations)이나 기울이기(shears)같은 변형을 적용할 수 있습니다. 또한 원한다면 컬러 뎁스를 줄이면서 디더링을 적용하는 것도 가능합니다. 알파 채널을 이용하면 어플리케이션 상에서 이미지 합성 등을 위해 반투명 기능이나 알파 블렌딩을 이용할 수 있습니다.
확장 플러그인 구조를 이용하면 Qt에서 이용 가능한 그래픽 파일 포맷을 추가시킬 수 있습니다.

Graphics View 프레임워크를 이용하면 유저 인터랙션을 위한 다양한 기능을 가지면서도 높은 렌더링 퀄리티를 지원하는 어플리케이션을 제작할 수 있습니다.
페인트 디바이스와 프린팅
QPainter 를 통해 종류에 상관 없이 페인트 디바이스를 제어할 수 있습니다. Qt를 지원하는 디바이스라면, 동일한 코드를 통해 페인팅을 수행합니다.
모든 위젯은 페인트 디바이스라고 할 수 있습니다. Qt는 백킹 스토어 기능(주:더블 버퍼링?)을 이용하여 페인팅 처리시 발생하는 깜빡임 현상을 줄여줍니다. 시스템 환경 설정이 제대로 설정되어 있다면, 반투명의 다양한 모양을 가진 윈도우도 생성 가능합니다.
OpenGL 서피스는 QGLWidget 를 통해 구현된 페인트 디바이스입니다. 표준 QPainter 인터페이스는 OpenGL함수 호출로 변환되어, 하드웨어에서 지원하는 2차원 그래픽 가속 기능을 사용할 수 있도록 해 줍니다.
이미지 생성시에는, 디바이스 독립적인 QImage 혹은 디스플레이에 최적화된 QPixmap 오브젝트를 이용합니다. 원하는 컬러 뎁스와 픽셀 포맷에 맞추어서 표준 이미지 포맷을 이미지에 렌더링할 수 있습니다. 다양한 반투명도를 가지고 이미지를 생성 가능하며, 몇가지 이펙트를 적용하여 커스텀 위젯 상에서 페인팅할 수 있습니다.
벡터 그래픽과 메타파일 포맷도 페인트 시스템에서 지원합니다. QSvgGenerator 는 Scalable Vector Graphics (SVG) 이미지를 생성할 수 있습니다. 적절한 페인팅 커맨드를 SVG파일 포맷상의 관련 구조체에 전달하는 과정을 거칩니다. 일련의 페인팅 커맨드들을 처리하려면 QPicture 를 사용합니다. 커맨드들을 다른 페인팅 디바이스에서 그대로 재현시키거나 파일에 저장할 경우에 사용됩니다.
프린터에 출력할 경우에도, 실제 프린터가 QPrinter 에 구현되어 있기 때문에, QPrinter 에 렌더링 명령을 호출함으로써 이루어집니다. Windows의 경우, 프린터 명령은 Windows 프린터 엔진에 보내지게 되며, 이 엔진은 Windows에 설치된 프린터 드라이브를 제어합니다. Unix의 경우, PostScript® 혹은 Portable Document Format (PDF) 데이터가 프린트 데몬으로 보내집니다. 참고로 프린터 데몬은 최신 시스템의 경우 Common Unix Printing System에서 제어합니다. (CUPS)
Qt의 범용 페인팅 API를 이용하면, 어플리케이션은 모든 플랫폼상에서 PDF와 PostScript 파일을 생성함으로서 고품질의 문서를 작성할 수 있습니다. 이들 문서는 적절한 뷰어 어플리케이션을 통해 열어볼 수 있습니다.
그래픽스 뷰 프레임워크
Qt는 대량의 2차원 그래픽 오브젝트를 다루는 인터랙티브 그래픽 어플리케이션을 제작할 수 있도록 새로운 프레임워크를 도입하였습니다. 그래픽스 뷰는 2차원 신 안에서 새로운 아이템을 추가할 수 있도록 하는 오브젝트 기반의 API를 제공함은 물론, 미리 정의되어 있는 아이템을 생성하기 위한 편리한 기능들을 담고 있는 기존의 캔버스 기반의 API 역시 제공합니다.
일단 아이템을 생성하면, 신 안에서 아이템을 자유자재로 이동, 회전, 확대/축소할 수 있습니다. 아이템을 표시하는 기능과 내부에서 아이템을 관리하는 기능은 QGraphicsView 와 QGraphicsScene 클래스로 나누어져 구현되어 있습니다. 이로 인해 동일한 신을 다른 방식으로 렌더링하는 뷰를 여러 개 구현할 수 있습니다.
몇 개의 표준 아이템 타입이 이미 제공되어 있으며 이러한 아이템을 서브클래싱함으로써 독자적인 아이템 타입을 구현할 수 있습니다. 신의 일부분을 보다 효율적으로 관리하기 위해 아이템들은 그룹으로 묶을 수 있습니다. 각각의 신, 뷰, 아이템들은 서로 다른 좌표계를 사용하더라도 다른 좌표계로 편하게 변환할 수 있도록 하는 기능들을 제공하고 있습니다. 유저가 아이템을 선택하거나 이동하게 하는 등의 기본적인 인터액티브 기능을 코드 몇 줄로 간단하게 구현할 수 있습니다.
그래픽스 뷰는 처음부터 애니메이션을 염두해 두고 설계되었기 때문에 아이템을 이용하여 애니메이션 오브젝트를 구현할 수 있습니다. 애니메이션 오브젝트란 어느 시간대에 어떤 모습으로 변형(Transformation)될 것인지를 미리 설정해 놓은 오브젝트를 말합니다.
기본으로 제공하는 아이템 중 리치 텍스트 에디터, 웹 브라우징, SVG 같은 아이템들은 그래픽스 뷰 프레임워크가 아닌 Qt내의 다른 부분으로부터 제공받아서 동작합니다. 신에 있는 아이템은, 신과 연결된 뷰의 특성에 맞추어서 렌더링할 수 있는 구조로 되어 있으며, 이로 인해 신은 이미지 파일이나 PDF 파일, 프린터 등으로 다양하게 렌더링 할 수 있습니다.
그래픽스 뷰 프레임워크는 이벤트 핸들링 역시 완벽하게 지원하며, 특히 이벤트 핸들링을 원하는 아이템에게만 이벤트를 처리하게 하는 것이 가능합니다. 아이템은 기본적으로 프레임워크상에서 다루어지기 때문에, 아이템은 특정 이벤트가 현 상황에서 필요한지 아닌지에 대해서만 응답하면 됩니다.
만약 기존의 QWidget 기반의 UI를 이용해야 한다면 QGraphicsProxyWidget 을 이용하여 기존 위젯에 연결할 수 있으며, 기존 위젯과 유사한 기능을 제공하는 QGraphicsWidget 을 이용할 수도 있습니다. 보다 편리한 유저 인터페이스를 위해, 신 안에서 아이템과 위젯을 효과적으로 배치할 수 있도록, 레이아웃 매니저를 이용할 수 있습니다.

Qt에서 제공하는 페인트 디바이스상에서 SVG 이미지를 렌더링 할 수 있습니다.
Scalable Vector Graphics (SVG)
SVG란 웹상에서 2차원 그래픽 객체를 다루기 위해 작성된 XML 형식의 파일 포맷입니다. Qt에서는 World Wide Web Consortium (W3C) Recommendation 규격인 SVG 1.1 표준을 지원하며, 또한 추가적으로 SVG 1.1과 1.2의 Tiny 프로파일을 지원합니다.
Qt에서는 이미지나 OpenGL위젯을 비롯, 페인터 디바이스로 구현된 곳이라면 어디든지 SVG 형식을 렌더링할 수 있습니다. 이러한 유연성으로 인해 개발자는 필요에 맞게 퀄리티와 성능을 조절하여 사용할 수 있습니다. 기본적인 UI콘트롤인 아이콘을 여러 사이즈에 대응시키기 위해서, 비트맵에서는 미리 특정 사이즈 몇 개를 준비해 놓을 필요성이 있었지만, SVG형식에서는 이러한 수고를 덜 수 있어서 매우 편리합니다.
SVG 페인트 디바이스에 특화된 QPainter 를 이용하면, 어플리케이션상에서 사용되는 그래픽 오브젝트들을 간단하게 SVG로 익스포트 할 수 있습니다.
3D 그래픽스
OpenGL은 Qt 어플리케이션상에서 3D 그래픽을 이용하기 위해 사용되는 표준 API입니다. Windows, X11, and Mac OS X상에서 Qt의OpenGL모듈을 사용할 수 있으며 이 모듈은 각각의 시스템상의 네이티브 OpenGL라이브러리를 사용합니다.
Qt어플리케이션에서 OpenGL을 이용하기 위해서, 개발자들은 단지 QGLWidget 를 서브클래싱하여 OpenGL 표준 함수를 사용하기만 하면 됩니다. 개발자들이 어플리케이션을 보다 편하게 개발할 수 있도록, Qt에서 사용하는 컬러값을 OpenGL의 컬러포맷으로 변환하는 기능을 제공합니다.
이외에도 Qt는 OpenGL의 기본기능과 확장성을 고려한 편리한 기능들을 제공합니다. 이미지로 부터 텍스쳐를 생성하거나, 픽셀버퍼와 프레임버퍼 오브젝트를 지원하는 클래스들을 제공하며, 몇몇 플랫폼에서는 버퍼의 샘플링 기능을 지원하기도 합니다.
2D 그래픽을 사용함에 있어서도 QGLWidget 를 사용하여 하드웨어의 지원을 받아 렌더링 성능을 향상시킬 수 있습니다. 이 경우 QPainter 의 기본 기능들은 내부적으로 OpenGL 함수를 호출하도록 하며, 이로 인해 순수 OpenGL을 이용한 3D 화면에서도 2D 컨트롤들을 합성시킬 수 있습니다. 임베디드 플랫폼은 하드웨어 가속기능에 제한이 있기는 하지만, 다양한 디바이스에서 문제없이 동작할 수 있도록, OpenGL ES 2.0상에서 페인팅 엔진이 구현되어 있습니다.
고성능의 하드웨어에서는 안티 알리아싱 렌더링 기능을 제공하며, OpenGL 페인팅 엔진이 고성능 고퀄리티의 그래픽을 렌더링 할 수 있게 해 줍니다. 그렇지 못한 하드웨어의 경우에는 개발자들은 유저가 퀄리티와 성능 중 하나를 택일할 수 있도록 하는 옵션을 런타임에서 제공할 수 있습니다.
멀티미디어
Qt는 Phonon이라는 멀티미디오 프레임워크를 이용합니다. Phonon이란 오픈소스 프로젝트인 KDE에서 파생하였으며, 멀티미디어의 재생 기능을 일관성있게 크로스 플랫폼으로 제공합니다. Qt는 Linux/Unix, Windows, Mac OS X 각각의 플랫폼에 있는 멀티미디어 프레임워크를 직접적으로 어플리케이션이 사용할 수 있도록 하고 있습니다. 다시 말해, 어플리케이션은 플랫폼에서 독자적으로 지원하는 오디오, 비디오 코덱이나 포맷을 이용할 수 있게 해 줍니다.
Phonon은 Qt에서 제공하는 다른 기술과도 연결되어 사용되고 있습니다. 예를 들어 무비 위젯은 웹킷 브라우저를 사용하여 웹 페이지를 표시하기 위해 사용되며, 그래픽스 뷰 프레임워크에서도 신을 레더링하기 위해 사용됩니다.
이외에도 멀티미디어와 관련된 기능을 추가적으로 지원하기 위한 클래스가 QtMultimedia 모듈에서 포함되어 있습니다. 이 클래스들은 주로 오디오와 비디오 데이터에 대한 저수준의 접근방법을 제공합니다.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/qpainter.html [qt.nokia.com] http://qt.nokia.com/doc/latest/graphicsview.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/opengl.html [qt.nokia.com] http://qt.nokia.com/doc/latest/qtmultimedia.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/qtsvg.html [qt.nokia.com] http://qt.nokia.com/doc/latest/phonon-overview.html [qt.nokia.com]
아이템 뷰
Qt의 아이템 뷰 위젯은 다량의 데이터를 표시하거나 편집하기 위한 기본적인 GUI 컨트롤들을 제공합니다. 아래에 나와 있는 모델/뷰 프레임워크는 데이터를 저장하는 기능과 데이터를 유저에게 보여주기 위한 기능을 분리하여 구현하고 있습니다. 이로 인해, 동일한 데이터를 가지고 전송(sharing), 정렬, 필터링하거나, 멀티 뷰 기능, 데이터 표현 방법을 다양하게 하는 기능들을 쉽게 구현할 수 있습니다.
대량의 데이터를 처리하는 어플리케이션을 만들 경우, 개발자들은 일반적으로 “item view” 위젯을 이용하여 데이터를 빠르고 효율적으로 표시할 수 있습니다. 최근에 나온 GUI 툴킷들은, 기본적으로 리스트뷰, 트리 뷰, 테이블 뷰를 제공합니다. 리스트뷰는 아이템 리스트를 간단히 표시하기 위한 뷰이며, 트리 뷰는 아이템을 계층적으로 표현하기 위한 뷰이며, 테이블 뷰는 스프레드시트 어플리케이션같은 레이아웃을 제공하기위한 뷰입니다.

Qt에서 기본적으로 제공하는 아이템 뷰에는 트리 뷰, 리스트 뷰, 테이블 뷰가 있습니다.
Qt의 아이템 뷰 클래스들을 기존의 아이템 뷰 위젯 형태로, 혹은 모델/뷰 컴포넌트 형태로, 이렇게 두 가지 형태로 사용할 수 있습니다. 기존의 리스트, 테이블, 트리 위젯은 데이터를 관리하는 기능을 자체 내장한 아이템 뷰입니다. 개발자가 만든 아이템 오브젝트를 직접 관리합니다.
QListView, QTableView, QTreeView 는 기존의 아이템 뷰가 제공하는 동등한 기능을 모델/뷰 컴포넌트 형태로 제공한 것입니다. 이러한 모델/컴포넌트는 클리너라고 불리는, 복수의 데이터 그룹을 다루기 위한 컴포넌트 중심의 방법을 제공합니다. 또한, 개발자들이 데이터를 편리하게 처리할 수 있도록, 기본적인 모델들을 제공합니다.
기본 아이템 뷰
Qt에서는 기본적으로 리스트위젯, 아이콘 뷰, 트리 위젯, 테이블을 형태의 아이템 뷰를 지원합니다. 이러한 뷰들은 드래그-앤-드롭 기능을 제공하며, 뷰 내에서 뿐만 아니라 다른 뷰 사이에서도 이용 가능합니다. 다른 Qt 위젯과 마찬가지로, Qt의 리소스 시스템과 완벽히 통합되어 있습니다.
아이템 뷰 클래스들은 대개 Qt의 다이얼로그 상에서 사용됩니다. 하지만, Qt Designer, Qt Assistant, Qt Linguist 등에서 폭넓게 사용할 수 있습니다.
기존의 아이템 뷰들은 데이터 하나 하나를 캡슐화 하여 오브젝트 역시 그 갯수에 맞게 생성하는 아키텍쳐를 채용하였기 때문에, 대개 수백 개의 데이터를 관리하고 표시하는 데에 적합했습니다. 이러한 방법은 기존의 Qt개발자들에게 매우 익숙한 방법이며, 제한된 용량의 데이터를 다루는 인터페이스를 신속하게 만들 필요가 있을 경우 매우 편리합니다.
기존의 아이템뷰들은 호환성과 유지보수성을 잃지 않으면서, Qt의 모델/뷰 프레임웤으로 재구축 되었습니다. 이로 인해 보다 대량의 데이터를 관리할 수 있게 됨은 물론, 데이터 관리를 커스터마이징하기도 수월해 졌습니다.
Qt의 모델/뷰 프레임워크
Qt에서 제공하는 모델/뷰 프레임워크는 유명한 모델-뷰-컨트롤러 패턴으로부터 파생한 것으로, Qt의 아이템 뷰에 맞게 최적화시킨 것입니다. 모델은 다른 컴포넌트에 데이터를 제공하며, 뷰는 유저에게 데이터의 아이템을 출력합니다. 또한 델리게이트는 아이템의 구체적인 표시방법과 데이터를 수정하는 인터랙션 부분을 담당합니다.

모델/뷰 프레임워크는 컴포넌트 지향의 아키텍쳐를 채용하였기 때문에 아이템 뷰를 커스터마이징 하기가 매우 편리합니다.
모델이란 데이터를 처리하는 부분을 래핑한 것입니다. 모델은 QAbstractItemModel 가 제공하는 표준 인터페이스에 맞게 구현되었습니다. 이 인터페이스를 통해서, 원본 데이터의 형식에 관계 없이, QAbstractItemView 로부터 파생된 위젯이라면 어느 것이든 모델이 제공하는 데이터에 접근할 수 있습니다.
데이터와 그 표현 방법을 분리하는 개념으로 인해, 기존의 아이템 뷰의 기능을 다양하게 확장할 수 있습니다.
- 모델은 데이터에 접근하기 위한 표준 인터페이스를 제공하기 때문에, 모델을 설계하고 작성하기 위해 다른 컴포넌트를 의식할 필요가 없으며, 필요에 따라서는 기존 모델을 다른 것으로 대체할 수도 있습니다.
- 모델을 통해 얻은 데이터는 여러 뷰가 공유할 수 있습니다. 이로 인해, 어플리케이션이 동일한 데이터를 여러 뷰에 전달할 수 있습니다. 즉, 데이터를 여러가지 다른 방식으로 표현하는 것이 가능합니다.
- 특정 뷰에서 선택기능을 사용할 경우에도, 선택기능을 통해 얻은 데이터를 다른 뷰가 접근할 수 있을지를 결정할 수 있습니다.
- 표준 리스트, 트리, 테이블 뷰의 경우, 데이터의 표시는 델리게이트가 처리합니다. 커스터마이즈 시에 새로 작성해야 하는 코드의 양을 획기적으로 줄이고, 보다 간단히 커스터마이징을 할 수 있습니다.
- proxy models 을 이용하면, 모델로부터 제공된 데이터가 뷰에 전달되기 전에 데이터를 가공하는 것이 가능합니다. 어플리케이션이 여러 뷰들에게 동시에, 데이터의 정렬이나 필터링을 사용한 결과를 제공할 수 잇습니다.
모델/뷰 시스템은 Qt의 SQL 모델에서도 사용됩니다. 데이터베이스 개발 경험이 없는 개발자들도 간단히 데이터베이스를 어플리케이션에 적용시킬 수 있습니다.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/model-view-programming.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/examples.html [qt.nokia.com]
텍스트 처리
Qt는 뛰어난 텍스트 에디터 위젯을 제공합니다. 텍스트 위젯을 이용하면, 유저가 리치 텍스트 문서를 작성할 수 있으며 또한 인쇄도 가능합니다. 에디터가 사용하는 기본 도큐먼트 구조체를 개발자는 제한없이 이용할 수 있으며, 구조체의 내용을 변경함은 물론, 그 내부 구조도 변경할 수 있습니다.
리치 텍스트 문서는 대개 다양한 폰트와 문서, 글자크기를 한 문단내에 포함시킬 수 있는 텍스트를 말합니다. 텍스트는 리스트나 테이블 구조를 가지며, 프레임을 이용할 경우 문서의 본문과는 시각적으로 분리된 구조를 가질 수도 있습니다. 각 도큐먼트 요소들은, 리치 텍스트 API를 이용해 개발자들이 수많은 변수를 조절하면, 그에 맞춰서 정확하게 화면에 표시됩니다.

Qt의 뛰어난 리치 텍스트 문서 기능을 가진 QTextEdit (왼쪽) 를 이용하면, 복잡한 문서들을 생성, 편집할 수 있습니다. 문서들은 필요에 따라 OpenDocument 포맷으로 변환할 수 있습니다 (오른쪽).
리치 텍스트 편집
인터랙티브한 리치텍스트를 표시하거나 편집하는 기능은 각각 QTextBrowser 와 QTextEdit 위젯에서 담당합니다. 이러한 위젯들은 유니코드를 완벽히 지원하며, QTextDocument 가 제공하는 구조화된 문서형식에 기반 하였습니다. QTextDocument 는 리치 텍스트를 작성하기 위해 마크업 언어를 사용할 필요가 없으며, HTML 4.0 에 거의 준하는 형식으로 임포팅, 익스포팅이 가능합니다. 완벽하게 undo/redo 기능(작업을 그룹화 하는 기능을 포함)을 지원하며, 텍스트 이외의 리소스 역시 지원합니다.
개발자들이 문서의 구조를 보다 고수준에서 파악할 수 있도록, Qt에서는 오브젝트 기반의 도큐먼트 API를 제공하며, 문서의 탐색과 번역을 편리하게 할 수 있도록 커서 기반의 API도 제공합니다. 뿐만 아니라 문서의 구성요소들을 표시하기 위해 쓰이는 수많은 클래스가 존재합니다. 이들 클래스들은 테이블, 리스트, 프레임, 문단의 텍스트 스타일을 원하는 대로 표시할 수 있게 하는 커스터마이징을 가능하게 해 줍니다.
QTextEdit 위젯에서 생성된 문서는 언제든지 편집가능하며 또한, undo/redo 이력을 온전히 보존합니다. 유저는 기본적인 편집 기능을 사용할 수 있을 뿐만 아니라, 개발자가 추가로 커스터마이징한 구조나 내용을 사용할 수 있습니다.
문서의 커스터마이징, 인쇄, 익스포트
Qt의 텍스트 처리 기능은 커스텀 위젯, 커스텀 리치 텍스트 문서에 특화된 텍스트 포맷을 제공하는 데에도 쓰입니다. 한 줄 한줄을 어떻게 배치할 지를 설정할 수 있는 QTextLayout 과 같은 저수준 클래스를 통해 이러한 커스터마이징을 구현 가능하며, 이들 기능은 QTextEdit 에서도 이용할 수 있도록, QTextDocument 에서 제공하는 텍스트 레이아웃 시스템의 확장 기능으로써 통합시킬 수 있습니다.
QSyntaxHighlighter 클래스를 사용하면 리치 텍스트 문서에 신텍스 하이라이팅 규칙을 설정 가능합니다.
이 기능을 이용하면 QTextEdit 를 코드 에디터로 활용할 수 있으며, 문서의 검색 툴에 하이라이팅 기능을 부가할 수도 있습니다.
문서는 QPrintDialog 에서 제공하는 정보에 맞춰진 형식을 제공 가능하며, 이 형식은 인쇄를 실행시키기 위한 QPrinter 에 맞도록, 문서를 페이지 단위로 분할됩니다.
QTextDocumentWriter 클래스는 HTML, 무형식 텍스트, OpenDocument Format (ODF) 파일을 지원합니다. 이 클래스의 기능들을 이용할 수 있도록 광범위한 API가 제공되며, 향후 다른 형식을 지원할 수 있도록 확장성을 갖추었습니다.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/qt4-scribe.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/richtext.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/qtextdocumentwriter.html [qt.nokia.com]
웹킷을 이용한 웹과의 통합
Qt가 웹킷 브라우저 엔진과 통합되었습니다. 웹 컨텐츠를 표시하고 조작하기 위해 Qt식의 API와 패러다임을 제공함으로써, 개발자들은 웹에서 사용하는 기능들을 어플리케이션에 도입할 수 있게 되었습니다.
Qt는 웹킷이라고 하는, 안정성과 성능을 동시에 추구하는, 오픈소스 기반의 웹 렌더링 엔진을 통합시켰습니다. Qt에 통합된 웹킷 버전은 HTML 4.01, XHTML 1.1, CSS 2.1, JavaScript 1.5 을 포함해, 다양한 웹 표준을 지원하며, 보다 최신의 기능 역시 지원 가능합니다. 이와 관련한 보다 자세한 내용은 WebKit in Qt [qt.nokia.com] 백서를 참조하세요.
웹킷의 네트워크 부분은 Qt의 네트워크 관련 클래스를 그대로 사용합니다. 이 클래스들은
Secure Sockets Layer (SSL) 통신과 프록시를 지원해야 하는 HTTP 1.1 사양을 완벽하게 구현하였습니다.

Qt와 통합된 엡킷 상에서 웹 페이지의 위젯은 Qt 위젯을 사용합니다. 정확히 말하자면, 웹 페이지 자체가 Graphics View의 아이템 일부로써 표시됩니다.
네이티브 어플리케이션과의 통합
Qt는 단순히 HTML을 렌더링하기 위해 웹킷을 지원하는 것이 아닙니다. Qt의 패러다임이 적용된 웹킷 기능을 어플리케이션에서도 이용할 수 있습니다. 예를 들어, Qt의 시그널-슬롯 통신 메커니즘을 이용하면 개발자들은 웹 관련 컴포넌트를 어플리케이션 내의 다른 오브젝트와 간단히 연결시킬 수 있습니다.
반대로, Qt와 브라우저가 통합됨으로써 네이티브 Qt 기능들을 웹 페이지안에서 사용할 수도 있습니다. 이로 인해 매우 동적인 네이티브 유저 인터페이스를 웹페이지에서 작성할 수 있게 되었습니다.
웹킷의 네이티브 스토리지 기능을 이용하면, 웹 어플리케이션이 영구적으로 데이터를 저장할 수 있는데, 이러한 기능을 Qt에서도 사용할 수 있습니다. 개발자는 리모트 서비스와 연계되는 어플리케이션을 개발하기 위해 네이티브 스토리지를 이용할 수 있으며, 이 때 유저의 시스템에서 설정된 저장 위치나 한도를 참조 할 수 있습니다.
DOM 참조용 API
웹페이지 구조를 다루기 위한 표준적인 방법은 Document Object Model (DOM) API를 이용하는 것입니다. W3C는 DOM으로 된 구조를 탐색하거나 수정하기가 용이하도록 하기 위한 셀렉터 API 를 정의해 놓고 있습니다. Qt와 통합된 웹킷은 셀렉터 API를 구현해 놓았습니다.
이러한 API로 인해, 개발자들은 CSS 셀렉터 지식을 활용하여 DOM에 직관적으로 접근할 수 있습니다. 또한 유지보수나 풋프린트와 관련된 오버헤드를 줄일 수 있습니다.
넷스케이프 플러그인 지원
서드파티용 브라우저 컴포넌트 API로써 사실상 표준(de-facto standard)으로 인정받는, 넷스케이프 플러그인 API를 준수하는 플러그인을, 통합 Qt웹킷 기반의 웹 페이지에 포함시키거나 표시할 수 있습니다. 이러한 기능들을 설정하는 작업은 Qt의 플러그인 설정 관련 클래스를 통해 이루어집니다. 이러한 설정관련 플러그인에 사용되는 클래스들은, 어플리케이션용 기능을 웹 환경에서도 사용할 수 있도록 하는 위젯 플러그인 등에 사용되었던 것들이 웹킷에 적용된 것입니다.

통합된 Qt 웹킷은, 넷스케이프 플러그인 API를 사용하는 서드 파티 브라우저 플러그인을 지원합니다.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/qtwebkit.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/demos-browser.html [qt.nokia.com]
http://qt.nokia.com/forms/whitepapers/reg-whitepaper-hybrid/ [qt.nokia.com]
데이터베이스
Qt SQL 모듈을 이용하면, GUI와 데이터 베이스가 연계된 크로스 플랫폼 어플리케이션을 쉽게 개발할 수 있습니다. 프로그래머는 간편하게 SQL 쿼리문을 실행할 수 있습니다. 데이터베이스 모델을 이용하여 아이템 뷰에 적절한 정보를 제공함으로써 정보를 표시하거나 데이터 입력을 받을 수도 있습니다. 또한 위젯 맵퍼를 이용하여, 폼 기반의 유저 인터페이스 상에서 특정 위젯에 데이터베이스 테이블을 맵핑할 수 있습니다.
Qt SQL 모듈은 SQL 데이터베이스에 접근하기 위한 크로스 플랫폼 인터페이스를 제공합니다. 또한 이 묘듈은 Oracle, Microsoft SQL Server, Sybase Adaptive Server, IBM DB2, PostgreSQL, MySQL, Borland Interbase, SQLite, ODBC 연계를 위한 네이티브 드라이버가 들어 있습니다. 클라이언트에서 관련 라이브러리가 제대로 동작한다면 Qt가 지원하는 모든 플랫폼상에서, 이들 드라이버를 사용할 수 있습니다. 동시에 한 어플리케이션이 여러 데이터베이스를 이용할 수도 있습니다. Qt 배포판은 기본적으로 SQLite 데이터베이스를 포함하고 있으며, Qt SQL 모듈은 기본 데이터베이스로써 SQLite를 지원합니다.
개발자는 간단히 SQL 쿼리문을 실행할 수 있으며, Qt에서 제공하는 고수준의 C++ 인터페이스를 이용하여 적절한 SQL 쿼리문을 자동으로 생성할 수 있습니다.
Qt는 모델/뷰 컴포넌트 구조에서 사용가능한 SQL 모델을 제공합니다. SQL 모델을 이용하면 뷰 위젯이 데이터 베이스 쿼리 결과가 반환될 때 자동으로 갱신되며, 데이터베이스에 문외한인 개발자나 사용자도 간단히 편집작업을 할 수 있습니다.
SQL 모듈이 제공하는 편리한 기능들을 이용하면, 데이터베이스 사용하는 어플리케이션을 바로 만들 수 있습니다. 외부키를 통한 탐색 기능과 master-detail 관계를 나타내는 기능을 사용가능합니다.
SQL 명령 실행하기
QSqlQuery 클래스를 사용하면, 직접 SQL문을 실행할 수 있으며, SELECT 쿼리 결과를 살펴볼 수도 있습니다. 물론, INSERT, UPDATE, DELETE 쿼리도 간단히 사용할 수 있습니다.
Qt SQL 모듈은 값 바인딩(value binding)과 준비된 쿼리(prepared queries)를 지원합니다. 값 바인딩은 named binding, named placeholders, positional binding with named, positional placeholders을 통해 이루어집니다. Qt의 바인딩 관련 문법은 Qt에서 지원하는 모든 데이터베이스에서 작동합니다. Qt에서 지원하는 데이터베이스 중에는 바인딩 기능이 제공되지 않는 것도 있으나, 에뮬레이션을 통해 Qt에서 지원할 수 있도록 구현하였습니다.
SQL 모델
Qt는 또한 모델/뷰 프레임워크 상에서 다른 컴포넌트와 함게 사용할 수 있는 모델 클래스들을 제공합니다. 이러한 모델 클래스들을 이용하면, 개발자가 SQL 쿼리를 실행하기만 해도 자동적으로 그 결과가 테이블 뷰에 반영됩니다.
개발자는 최소한의 코딩으로 이와 같은 기능을 구현할 수 있습니다. 쿼리 모델을 설정할 때에는, 쿼리문을 지정하고, 어느 헤더가 필요한지를 정합니다. 그 다음, 반환된 쿼리 결과를 표시할 테이블 뷰를 설정합니다.
Qt는 다양한 방식의 SQL 테이블 관련 모델을 제공합니다. SQL쿼리 결과를 읽기 전용으로 다루는 데이터 모델, 단일 테이블 상에서 편집 가능한 데이터 모델, 외부 키를 가지는 관계형 모델이 존재합니다. Qt Books 데모에서는 관계형 데이터베이스 모델이 테이블 상에서 관련 정보를 어떻게 찾는지를 볼 수 있습니다.
모델/뷰 프레임워크에는 데이터베이스와 연계된 요청들을 처리하기 위한 수많은 기능들이 들어 있습니다. 트랜잭션 기능, 데이터베이스의 라운드 트립을 피하기 위해 행 단위로 데이터를 편집할 수 있는 기능들이 포함됩니다.

Qt Books 데모에서는 Qt의 SQL 클래스와 모델/뷰 프레임워크가 연계된 모습을 볼 수 있습니다.
데이터 변경에 반응하는 위젯 Data-Aware Widgets
SQL 모델을 비롯, 모델로부터 얻은 데이터는 윈도우상의 특정 위젯과 연결됨으로써, 데이터의 특정 부분을 유저에게 표시할 수 있습니다. 이것을 이용하면, 폼 기반으로 데이터를 입력할 수 있는 편리한 인터페이스를 보다 쉽게 개발할 수 있습니다.
유저가 선택한 위젯과 모델 사이에서 맵핑을 설정해야 할 때는 QDataWidgetMapper 가 사용됩니다. Books 데모에서는, 데이터 맵퍼가 생성되어 모델에 연결되면, 위젯들과 데이터 베이스 컬럼들이 일 대 일로 매칭되어, 데이터베이스의 필드를 위젯에서 수정할 수 있습니다.
이처럼 데이터 맵퍼를 이용해 컬럼에 있는 항목들을 특정 위젯에 매핑시키고, 이들 데이터를 시각화 함으로써, 모델의 한 행을 직접적으로 제어할 수 있게 됩니다. 또한 ‘쉬운 탐색 컨트롤(위젯?)‘을 맵퍼에 연결시킴으로써 보다 간단히 탐색 기능을 구현할 수 있습니다.
이러한 클래스들은 아이템 뷰 클래스와 비슷한 API를 가지고 있기 때문에, 맵퍼의 설정을 바꿈으로써 간단히 모델의 다른 역역에 있는 데이터를 가져올 수가 있습니다. 모델/뷰 API를 적절히 활용하면, 데이터 모델이 바뀔 시점에 데이터 맵퍼가 반응하도록 할 수 있습니다. Books 데모에서는, 유저가 테이블뷰 내에서 행 선택을 바꿀(이러한 동작은 시그널/슬롯 연결을 통해 간단히 구현됩니다.) 때 마다 그에 맞춰서 매핑이 달라지는 것을 볼 수 있습니다.
온라인 리퍼런스
http://qt.nokia.com/doc/latest/qtsql.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/qt4-sql.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/examples.html [qt.nokia.com]
국제화
Qt fully supports Unicode, the international standard character set. Programmers can freely mix Arabic, English, Hebrew, Japanese, Russian, and other languages supported by Unicode in their applications. Qt also includes tools to support application translation and localization.
Qt supports the Unicode version 5.0 character encoding and uses the QString class to store Unicode strings, both for the API and internally.
An extensible set of text codecs provide support for different encodings and charsets, including Big5 and GBK for Chinese, EUC-JP, JIS, and Shift-JIS for Japanese, KOI8-R for Russian, and the ISO-8859 series of standard encodings^1. Qt uses text codecs for fonts, input-output, and input methods.
Built-in locale support enables number-to-string and string-to-number conversions to be adapted to suit the user’s geographical location and language preferences.
Qt includes a set of tools to facilitate the translation process that support XML Localization Interchange File Format (XLIFF), GNU Gettext PO format and Qt’s Translation Source (TS) files.
Text Entry and Rendering
Far-Eastern writing systems require many more characters than are available on a keyboard. The conversion from a sequence of key presses to actual characters is performed at the window-system level by software called input methods. Qt automatically supports the installed input methods on a user’s system.
Qt provides a powerful text-rendering engine for all on-screen text, supporting advanced features such as special line breaking behavior, bidirectional writing, and diacritical marks. It renders most of the world’s writing systems, including Arabic, Chinese, Cyrillic, English, Greek, Hebrew, Japanese, Korean, Latin, and Vietnamese. Qt will automatically combine the installed fonts to render multi-language text.
Translating Applications
Qt provides tools and functions to help developers provide applications in their users’ native languages. Qt itself contains about several hundred user-visible strings, for which Qt Development Frameworks provides French, German and Simplified Chinese translations.
To make strings translatable, developers simply wrap them in calls to the tr() translation function, and can supply additional information to human translators with special C and C++ comments.
- //: This name refers to a host name.
- hostNameLabel->setText(tr("Name:"));
- /*: This text refers to a C++ code example. */
Along with the context, this comment information helps translators to accurately translate user-visible strings. Optional arguments can also be used to help with the translation of plural forms.
Qt provides tools to extract user-visible source texts from files in Qt projects, convert between common translation file formats, and generate compressed message files for use in applications. The process of extracting source texts and updating partially-complete translations is integrated into the build system for Qt applications, and can be modified to suit different translation workflows.
At run-time, applications use QTranslator objects to load translation files. Each file contains the translations for a particular language. The language can be chosen at run-time, in accordance with the locale or user preferences.
Translators can edit translation files conveniently using Qt Linguist, a GUI application for performing translation work. The contexts are listed in the left-hand side of the application’s window, and the list of source texts for the current context is displayed in the top-right area, along with translations and their current states (unfinished, obsolete, done). The user interface can be navigated via the keyboard; its dockable windows can be reorganized to suit the translators’ preferences.
Applications often use the same phrases many times in different source texts. Qt Linguist automatically displays intelligent guesses based on previously translated strings and predefined translations; these often serve as a good starting point for new translations. Common translations can also be stored in phrasebooks to make the translation of future applications more efficient. Qt Linguist can optionally validate translations to ensure that accelerators and ending punctuation are translated correctly.
Qt Linguist’s comprehensive manual provides relevant information about the translation process for release managers, translators, and programmers.

Working on French and Simplified Chinese translations simultaneously with Qt Linguist.
Online References
http://qt.nokia.com/doc/latest/i18n.html [qt.nokia.com] http://qt.nokia.com/doc/latest/linguist-manual.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/unicode.html [qt.nokia.com] http://qt.nokia.com/doc/latest/qtextcodec.html [qt.nokia.com]
Qt Script
Qt Script is an interpreted ECMAScript-based language which can be used to script Qt applications. The QtScript module provides an API that makes it easy to expose parts of an application to the scripting environment, including support for signals-slot communication and other standard Qt features.
Application scripting allows users to customize and extend the features of applications by accessing simple APIs for user-oriented scripting languages. Traditionally, Qt developers have used a variety of separate solutions to provide scripting support in their applications. The inclusion of Qt Script as a Qt module is intended to reduce the amount of effort required to implement scripting, while also making the process easier for developers who simply require scripting “out of the box”.
Scripting Architecture
The QtScript module provides an API based around the QScriptEngine and QScriptValue classes. These provide execution and data marshalling facilities.
Instances of QScriptEngine are responsible for executing Qt Script code within a scripting environment and provide facilities to expose instances of QObject subclasses to this environment. Additionally, QScriptEngine allows C++ data types to be converted to their Qt Script equivalents and inserted into the scripting environment. Qt Script data types are represented in C++ as QScriptValue instances which provide functions to convert data to C++ types.
Additionally, signals and slots can be used to communicate between Qt Script and applications. Qt Script objects can emit the signals of the objects they wrap, and any Qt Script function can be used as a slot. This provides the additional level of flexibility that script authors require and expect from a dynamic scripting language.
The simplest use of the QtScript module is to provide an interpreter for Qt Script that executes user-defined code.
- QScriptEngine engine;
The QScriptEngine instance is also able to provide information about any syntax and run-time errors that occur.
In the above image, we can see the use of the QtScript module’s features for integrating Qt Script into an application. A QObject-based wrapper for an image, providing a variety of functions and properties, is exposed to the scripting environment in the following way:
- image = new ImageWrapper(this);
- engine.globalObject().setProperty("image", imageObject);
Once defined in the environment, the user can manipulate the image using a simplified API that hides all the low-level details of managing the application’s user interface.

Debugging a function using the Qt Script debugger’s user interface.
Debugging
Support for debugging of scripts is provided by the QtScriptTools module, which includes a set of integrated graphical components that developers can use when creating scriptable applications.
The QScriptEngineDebugger class has been designed to be simple to use. The separation between the implementation of the debugger and the script engine means that the process of attaching a debugger is simple and non-invasive; code that attaches the debugger to a script engine is self-contained and can be removed when no longer required.
The debugger provides a set of common debugging widgets that show source code, breakpoints, the contents of variables, and other useful information about the script that is being executed. These can be used together in a standard window (see Figure ) or as separate widgets.
In addition to these widgets, the debugger also provides a standard menu and toolbar that can be used separately to create a custom debugging interface. The toolbar contains a set of buttons that are linked to actions (see sub:Actions ) which can be triggered programmatically to control the execution of scripts.
If preferred, the debugger can be used without showing any of the user interface components; the developer has the option of keeping these hidden until an error occurs or a breakpoint is encountered.
A comprehensive user manual documents how to use the debugger’s user interface, and contains information on the commands that can be entered at the debugging console.
Online References
http://qt.nokia.com/doc/latest/qtscript.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/qtscripttools.html [qt.nokia.com]
Styles and Themes
Qt automatically uses the native desktop style for an application’s look and feel. Qt applications respect user preferences for colors, fonts, sounds, and other desktop settings. Qt programmers are free to use any of the supplied styles and can override any preferences. Programmers can modify existing styles or implement their own styles using Qt’s powerful style engine.
A style implements the “look and feel” of the user interface on a particular platform. A style is a QStyle subclass that implements basic drawing functions such as drawing frames, buttons, and images. Qt performs all the widget drawing itself for maximum speed and flexibility.
Built-in Styles
Qt provides the following built-in styles: CDE, Cleanlooks, GTK, Motif, Mac OS X, Plastique, Windows, Windows XP, and Windows Vista. By default, Qt uses the appropriate style for the user’s platform and desktop environment. The style can also be chosen programmatically by the application developer, or by the user with the -style command line option.

Combo boxes in the different native styles.
A style is complemented by the user’s desktop settings, which include the user’s preferences for colors, fonts, sounds, etc. Qt automatically adapts to the computer’s active theme. For example, Qt supports scroll and fade transition effects for menus and tooltips.
The Windows and Mac OS X styles are built on top of native style managers, and are available only on their respective platforms. The other styles are emulated by Qt and are available everywhere.
The default styles on many modern X11 platforms are Plastique, a style inspired by the Plastik widget style for KDE, and GTK, which uses the GTK+ theme engine on GNOME desktops. An alternative style for GTK-based environments is Cleanlooks, a style designed to look like the Clearlooks theme for GNOME.
Qt’s built-in widgets are style-aware. Custom widgets and dialogs are almost always combinations of built-in widgets and layouts, and automatically adapt to the style in use. On the rare occasions when it is necessary to write a custom widget from scratch, developers can use Qt’s style API to draw basic user-interface elements rather than drawing raw graphics primitives directly.
Based on the translation file loaded, Qt applications automatically use right-to-left widget layouts rather than the default left-to-right scheme normally used. Additionally, when used in reversed mode, well-behaved styles render widgets with areas of light and shadow that are appropriate for the user’s desktop environment.
Widget Style Sheets
Qt supports the use of widget style sheets with almost all standard widgets. These textual descriptions, written in a language similar to Cascading Style Sheets (CSS), are used to customize the appearance of widgets in much the same way that CSS descriptions are used to customize HTML rendering in WWW browsers. Each widget’s style sheet is accessed via its styleSheet property, available in QWidget and its subclasses, and this enables customizations to be easily applied to style-aware widgets while an application is running. Since this property is also available for editing in Qt Designer, graphic designers can directly influence the look and feel of applications. For many common situations where customizations to standard widgets are required, the use of style sheets can eliminate the need for a custom style to be written.

The Style Sheet example allows interactive experiments with style sheets.
Custom Styles
Custom styles are used to provide a distinct look to an application or family of applications. Custom styles can be defined by subclassing QStyle or any of its subclasses. It is easy to make small modifications to existing styles by reimplementing one or two virtual functions from the appropriate base class.
The style API provides information about each of the constituent components used to draw widgets, making it possible for highly customized styles to be created and fine-tuned.
A style can also be compiled as a plugin. Plugins make it possible to preview a form using a custom style in Qt Designer without recompiling either Qt or Qt Designer itself. The style of an existing Qt application can be changed using a style plugin without recompiling the application. This enables applications like the Qt Styles example and the qtconfig tool to switch styles on-the-fly to provide previews for each of the available styles.
Online References
http://qt.nokia.com/doc/latest/widgets-styles.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/stylesheet.html [qt.nokia.com]
Input/Output and Networking
Qt can load and save data in plain text, XML, and binary formats. Qt handles local files using its own classes, and remote files using the FTP and HTTP protocols. Inter-process communication and socket-based TCP and UDP networking are fully supported, and information about the network interfaces available can be easily obtained.
File Handling
At the heart of Qt’s device handling infrastructure is QIODevice, a general base class for files, sockets and other devices, which can be subclassed to add support for custom devices. All devices are able to communicate using signals and slots, making it straightforward to integrate file and network communications into applications.
The QFile class supports large files, long file names, and internationalized file names. The QDir and QDirIterator classes are used to read and traverse directories, and can be used to manipulate path names, create directories, delete files, and perform other common operations. QFileInfo provides more detailed information about a file, such as its size, permissions and last modification time.
Qt includes classes similar to the standard iostream classes that operate on any device. Classes for text and raw data streams are used to stream text to and from devices, and these support the encodings provided by QTextCodec. Data streams can be used to serialize basic C++ types and many Qt types in a platform-independent binary format.
Transparent access to remote files is provided via a unified network access API, though specialized classes for HTTP and FTP protocols can also be used if required, building on Qt’s networking classes (see page) . URLs can easily be parsed and reconstructed by using the QUrl class.
Some types of file can be read directly without requiring the use of a QFile object. For example, image files are usually read via the QImage class with its extensible plugin mechanism. Printing text and images is handled by QPrinter.
Qt can also be used to monitor files and directories for changes made by other applications and services. The QFileSystemWatcher class acts as a registry of file paths that need to be monitored, and emits a signal whenever a file or directory on any of these paths is changed.
XML
Qt’s XML module provides a SAX parser and a DOM parser, both of which read well-formed XML and are non-validating. The SAX (Simple API for XML) implementation follows the design of the SAX2 Java implementation, with adapted naming conventions. The DOM (Document Object Model) Level 2 implementation follows the W3C recommendation and includes namespace support.
Qt’s stream reading and writing classes present an alternative approach to reading and writing XML files in which tokens are “pulled” from an input stream and “pushed” to an output stream. The design of these classes makes it easy to write lightweight, high-level parsers for XML-based file formats.
Higher level XML manipulation, including support for XQuery 1.0 and XPath 2.0, is provided by an additional module. This separation between basic XML handling and more powerful querying facilities allows developers to decide the level of XML support used in applications. Partial support for XSLT 2.0 adds another processing option for developers familiar with common XML technologies.
Validation of XML documents is performed by classes representing XML schemas and validators for those schemas. These implement the W3C XML Schema specification as specified by version 1.0 of the standard.
Inter-Process Communication
Qt provides a process class that is used to start external programs and to communicate with them in a platform-independent way. Communication is achieved by writing to the external program’s standard input and reading from its standard output and standard error streams. The QProcess class is derived from QIODevice, meaning that data can be streamed to and from it with text and data streams.
QProcess works asynchronously, reporting the availability of data by emitting signals. Qt applications can connect to the signals to retrieve the data for processing, and optionally respond by sending data back to the external program. Qt’s process handling also supports a blocking mode of operation, and can redirect input and output from external programs to files.
Additionally, higher-level communication between applications, components and the operating system can be achieved on Unix platforms that support the D-Bus protocol. The QtDBus module allows applications to expose services by creating XML-based interface files. These are converted to C++ source code by a tool supplied with Qt.
Access to low-level shared resources, such as shared memory and system semaphores, is provided by dedicated classes. These provide the basis for building alternative communication mechanisms.
Networking
Qt provides a cross-platform interface for writing TCP/IP clients and servers, supporting IPv4 and IPv6. All of the networking classes provided are reentrant and can be used from any thread.

The Qt FTP example uses Qt’s networking features to provide simple FTP browsing capabilities.
The QTcpSocket class provides an asynchronous, buffered TCP connection. As with other QIODevice subclasses, text and data streams can be used to handle socket-level communications. Similarly, QUdpSocket handles UDP socket operations. Both classes support blocking and non-blocking modes of operation. All of Qt’s networking classes are reentrant and can be used from any thread.
Custom TCP servers can be implemented by subclassing QTcpServer, which provides an asynchronous framework for handling incoming connections and serving clients. Servers can operate in blocking and non-blocking modes.
Support for proxy servers is available through the QNetworkProxy class, enabling both application-wide and per-socket proxying facilities. HTTP, FTP and SOCKS 5 proxy types are supported, and caching facilities can be employed to improve performance. Customization features enable an application-wide policy to be employed that can set up proxies based on the socket type, the protocol in use, and other criteria.
The QAbstractSocket class is a platform-independent wrapper for native socket APIs. It provides the underlying functionality for TCP, UDP and local domain sockets. Support for proxy servers is available through the QNetworkProxy class, enabling both application-wide and per-socket proxying facilities.
A management infrastructure for network operations is provided in the form of QNetworkAccessManager, which is used to dispatch requests over common protocols, such as HTTP and FTP, and handle replies. Specific classes for requests and replies make common communication easy, while allowing the developer to customize particular requests.
Information about a machine’s network interfaces is provided by the QNetworkInterface class. This exposes details of each interface, their capabilities, the IP addresses assigned to them, and other interface-dependent information. For example, for Ethernet interfaces, the MAC address of the underlying hardware can be obtained, and the broadcast address and netmask can be obtained in addition to the IP address.
Encrypted Communications
Qt includes features for secure network communications through the use of encrypted TCP connections based on Secure Socket Layer (SSL) protocols, including SSLv3 and TLSv1.
QSslSocket provides an SSL encrypted socket that can be used for both clients and servers. Abstractions for other aspects of the encryption and authentication processes are addressed by classes for ciphers, keys, certificates.
Online References
http://qt.nokia.com/doc/latest/qiodevice.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/qtxml.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/qtnetwork.html [qt.nokia.com]
Collection Classes
Collection classes are used to store groups of items in memory. Qt provides a set of classes that are compatible with the Standard Template Library (STL), and that work regardless of whether the compiler supports STL or not. Java-style iterators are also provided for safety and convenience.
Applications often need to manage items in memory, such as groups of images, widgets, or custom objects. Many C++ compilers support the STL, which provides ready-made data structures for storing items. Qt provides lists, stacks, queues, and dictionaries with STL-syntax. Qt’s collection classes even work with compilers that are not capable of supporting the STL.
Qt’s rich set of portable collection classes (“containers”) and associated iterators are heavily used inside Qt, and are provided as part of the Qt API. Qt’s containers are optimized for speed and memory efficiency. Programmers can also use STL containers on the platforms that support them, at the cost of losing Qt’s optimizations.
Unlike many template classes, which increase the size of executables dramatically when used, Qt’s template collection classes are optimized for minimal code expansion.
Containers
Qt provides sequential container classes for lists, linked lists, vectors, stacks and queues, each with an interface very similar to the corresponding STL container, and each fully compatible with the STL algorithms. Qt provides some STL-equivalent algorithms for copying, finding and sorting items. On platforms with STL support, Qt provides automatic conversion operators between STL and Qt containers.
Additionally, Qt provides Java-style iterators for developers who are more familiar with Java containers than the STL.
Qt provides associative container classes for maps, hashes and sets. The “hash” containers use a hash function to improve search performance. One-to-one and one-to-many variants of the map and hash containers are available.
Qt’s sequential and associative collection classes can be used to store both value-based and pointer-based types, making them especially useful for handling QWidget and QObject pointers. When used to hold pointer-based items, convenience functions can be used to delete the contents of collections in one pass before the collection is destroyed.
Implicit Sharing
When used with Qt’s value classes, the items held in these collection classes are implicitly shared (“copy on write”). Copies of these classes share the same data in memory. The data sharing is handled automatically; if the application modifies the contents of one of the copied objects, a deep copy of the data is made so that the other objects are left unchanged. When an object is copied, only a pointer is passed and a reference count incremented, which is much faster than actually copying the data, and also saves memory.
Sharing is used wherever it makes sense: in Qt’s value-based collection classes, and in other commonly-used classes. Programmers can safely and efficiently copy objects of these classes by value, avoiding the risks related to optimizing pointer-based code by hand. In particular, the implicitly shared QString and QRegExp classes makes string processing easy and fast.
Qt also provides low-level bit and byte array classes which are very efficient for handling basic data types.
Online References
http://qt.nokia.com/doc/latest/containers.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/implicit-sharing.html [qt.nokia.com]
Plugins and the Meta-Object System
Qt applications can access functions from dynamic libraries using a platform-independent API. Qt also supports plugins, allowing developers to create and distribute codecs, database drivers, image format converters, styles, and custom widgets as separate components.
Plugins and Libraries
Converting a Qt component into a plugin is achieved by subclassing the appropriate plugin base class, implementing a few simple functions, and adding a macro. Plugins written in this way can expose properties and interact with applications via the signals and slots mechanism.
Components supplied as plugins are detected and used by the application automatically. Many third parties provide Qt components in source form, as precompiled dynamic libraries, and as plugins.
The QLibrary class provides a cross-platform API for loading dynamic libraries, providing a type-safe way to call functions exported as symbols with C linkage.
The Meta-Object System
The meta-object system enhances Qt components with additional data at compile-time in order to provide extended run-time type information and other dynamic features. This approach makes it possible for Qt to provide features such as run-time object introspection, a translation mechanism for internationalization purposes, signals and slots, and a generic way to invoke functions and methods.
The use of a richly-typed object system makes it possible for applications to be scripted using Qt Script or any other programming language solution that is integrated with the meta-object system.
As mentioned above, these features can also be exposed by plugins to applications and vice versa.
Online References
http://qt.nokia.com/doc/latest/plugins-howto.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/metaobjects.html [qt.nokia.com]
Building Qt Applications
Qt developers can take advantage of a suite of tools to simplify the process of building applications on all supported platforms. Applications, libraries, and plugins are described by project files that are processed to produce suitable Makefiles for each platform.
Qt is designed to work with a range of development tools and environments, from simple command line tools to integration with popular integrated development environments (IDEs). Alternatively, Qt Creator (see page) is a lightweight, cross-platform IDE that is specifically tailored to development of Qt applications.
Qt’s Build System
Projects are described by project files that contain terse, but readable descriptions of source and header files, Qt Designer forms, and other resources. These are processed by the qmake tool to produce suitable Makefiles for the project on each platform.
All of the Qt libraries, tools, and examples are described by project files. A simple example can be described in a few lines of declarations.
Support for conditional builds means that platform-specific code can be incorporated into projects, and will only be built for the appropriate platform.
When qmake is used to build a project, all the enhanced features of Qt are automatically handled by the other tools in the build suite: moc processes the header files to enable signals and slots, rcc compiles the specified resources, and uic is used to create code from user interface forms created with Qt Designer.
Precompiled header support, pkg-config integration, the ability to generate Visual Studio project files, and other advanced features allow developers to take advantage of platform-specific tools while retaining the use of a cross-platform build system for common project components.
Qt’s Resource System
Qt provides a resource system that allows data files to be stored inside executables, so that any resources required by applications can be accessed at run-time. Qt’s widgets support a naming scheme that allows developers to directly refer to these packaged resources.
The resources to be packaged with an application are listed in a Qt Resource Collection file, containing a list of files in the build directory along with the resource paths that are used in the application. These files are processed using rcc to create data that is compiled into the application. This approach ensures that certain critical resources are always available to applications, avoiding possible distribution and installation problems.
The resource system can also be extended at run-time with the QResource class, allowing additional paths to be searched for resources, and enabling additional resources to be loaded on demand, augmenting those built into the application.

An overview of Qt Creator.
Testing and Benchmarking Qt Applications
Support for unit testing is provided as a standard Qt module. Unit tests are written in C++ as QObject-based classes that contain test functions, and these are compiled into executables that can be run independently of any testing framework. Qt’s unit testing library also provides extensions to allow graphical user interfaces to be tested.
Unit tests can also be set up to perform benchmarking operations with the use of a simple macro. Test cases can be configured to measure and report performance via the use of different backends, allowing performance data to be visualized using standard tools.
Qt Creator
Qt Creator is Qt Development Frameworks’s lightweight IDE for C++ and Qt software development. Although it is designed to be easy to use, Qt Creator provides all the features developers have come to expect from IDEs, including syntax coloring and code completion, quick location of classes, functions and other C++ structures, and integrated debugging support.
Qt-specific features include signals and slots signature completion, integrated support for Qt Designer, and built-in Qt documentation. The Qt Creator whitepaper [qt.nokia.com] contains a more detailed introduction to this product.
Online References
http://qt.nokia.com/doc/latest/qmake-manual.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/qtestlib-manual.html [qt.nokia.com]
Qt’s Architecture
Qt’s functionality is built on the low-level APIs of the platforms it supports. This makes Qt flexible and efficient, and enables Qt applications to fit in with single-platform applications.
Qt is a cross-platform framework which uses native style APIs to accurately follow the human interface guidelines on each supported platform. All widgets are drawn by Qt, and programmers can extend or customize them by reimplementing virtual functions. Qt’s widgets accurately emulate the look and feel of the supported platforms, as described in sec:Styles-and-Themes (see page). This technique also enables developers to derive their own custom styles to provide a distinct look and feel for their applications.
Qt uses the low-level APIs of the different platforms it supports. This differs from traditional “layered” cross-platform toolkits that are thin wrappers over single-platform toolkits (e.g., MFC on Windows and Motif on X11). Layered toolkits are usually slow, since every function call to the library results in many additional calls down through the different API layers. Layered toolkits are often restricted by the features and behavior of the underlying toolkits, leading to obscure bugs in applications.
Qt is professionally supported, and takes advantage of the available platforms: Microsoft Windows, X11, Mac OS X, and Embedded Linux. Using a single source tree, a Qt application can be compiled to an executable for each target platform. Although Qt is a cross-platform framework, customers have found it to be easier to learn and more productive than many platform-specific toolkits. Many customers use Qt for single-platform development, preferring Qt’s fully object-oriented approach.
X11
Qt for X11 uses Xlib to communicate with the X server directly. Qt does not use Xt (X Toolkit), Motif, Athena, or any other toolkit.
Qt supports the following versions of Unix: AIX, FreeBSD®, HP-UX, Linux, NetBSD, OpenBSD, and Solaris. See the Qt Development Frameworks Web site for an up-to-date list of supported compilers and operating system versions.
Qt applications automatically adapt to the user’s window manager or desktop environment, and have a native look and feel under Motif, CDE, GNOME, and KDE. This contrasts with most other Unix toolkits, which lock users into their own look and feel.
Qt provides full Unicode support (see page). Qt applications automatically support both Unicode and non-Unicode fonts. Qt combines multiple X fonts to render multi-lingual text. Qt’s font handling is intelligent enough to search all the installed fonts for characters unavailable in the current font.
Qt takes advantage of X extensions where they are available. Qt supports the RENDER extension for anti-aliased and alpha-blended fonts and vector graphics. Qt provides on-the-spot editing for X Input Methods. Qt supports multiple screens both with traditional multi-head and with Xinerama.
Microsoft Windows
Qt for Windows uses the Win32® API and GDI for low-level events and drawing. Qt does not use MFC or any other toolkit, but provides its own more powerful, customizable widgets that are rendered using a fast, yet accurate painting engine. (For non-specialized uses, Qt uses the native Windows file and print dialogs.)
Customers using Windows can create Qt applications using Microsoft Visual Studio that will run on Windows 98, NT4, ME, 2000, XP and Vista. Qt performs a run-time check for the Windows version, and uses the most advanced capabilities available. Qt developers are insulated from differences in the Windows APIs.
The Microsoft accessibility interfaces are supported by Qt. Unlike the common controls on Windows, Qt widgets can be extended without losing the accessibility information of the base widget. Custom widgets can also provide accessibility. Qt also supports multiple screens on Microsoft Windows.

An overview of Qt’s architecture on supported desktop platforms.
Mac OS X
Qt supports Mac OS X by using a combination of Cocoa® and Carbon® APIs. On 64-bit hardware, Qt uses the Cocoa libraries to enable integration with Mac OS X native widgets and Cocoa views.
Qt for Mac OS X introduces layouts and straightforward internationalization support, standardized access to OpenGL, and powerful visual design with Qt Designer. Qt handles files and asynchronous socket input/output in the event loop. Qt provides solid database support. Developers can create Mac OS X applications using a modern object-oriented API that includes comprehensive documentation and full source code.
Developers can create applications on their favorite platform and broaden their market hugely by simply recompiling on the other supported platforms. Support for universal binaries on Mac OS X means that Qt applications can be created for Intel and PowerPC-based Macs. If desired, developers can take advantage of Qt’s integration with native components to add platform-specific features to their applications.
Online References
http://qt.nokia.com/doc/latest/supported-platforms.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/installation.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/deployment.html [qt.nokia.com]
Platform Specific Extensions and Qt Solutions
In addition to being complete in itself, Qt provides some platform-specific extensions to assist developers in certain contexts. The ActiveQt extension allows developers to use ActiveX controls within their Qt applications, and also allows them to make their Qt applications into ActiveX servers. Other platform-specific extensions are made available through Qt Solutions.
ActiveX Interoperability
ActiveX is built on Microsoft’s COM technology. It allows applications and libraries to use components provided by component servers, and to be component servers in their own right. Qt for Windows provides the ActiveQt module that allows developers to turn their applications into ActiveX servers, and to make use of the ActiveX controls provided by other applications.
Integration with Microsoft’s .NET technology is also possible with ActiveQt. Applications can use ActiveQt’s COM support to automatically give .NET developers access to Qt widgets and data types.
ActiveQt seamlessly integrates ActiveX into Qt: ActiveX properties, methods, and events become Qt properties, slots, and signals. This makes it straightforward for Qt developers to work with ActiveX using a familiar programming paradigm, and insulates them from all the different kinds of generated code that is normally part of an ActiveX implementation.
ActiveQt automatically handles the conversions between ActiveX and Qt data types. ActiveQt supports the dynamicCall() function to control an ActiveX component through the control’s
IDispatch interface implementation.
Turning a Qt application into an ActiveX server is simple. If we only need to export a single class, little more is required than the inclusion of a single header file. Once the class is compiled, its properties, slots, and signals become ActiveX properties, methods, and events to ActiveX clients. ActiveQt also provides facilities to determine if the application is being run in its own right or being used as an ActiveX control, so that developers can control which functionality is available in which context.
Qt Solutions
In addition to all the classes supplied with Qt, Qt Development Frameworks also produces Qt Solutions, an optional service available to Qt licensees either at the time of purchase or as an add-on product. Qt Solutions offers a regularly updated set of components and widgets, many of which are available under the same dual licensing scheme as Qt. Almost all of the Solutions made available to Qt 3 developers are also available for Qt 4, and many new Solutions for Qt 4 have already been released.
Online References
http://qt.nokia.com/doc/latest/activeqt.html [qt.nokia.com]
http://qt.nokia.com/doc/latest/intro-to-dbus.html [qt.nokia.com]
http://qt.nokia.com/products/appdev/add-on-products/qt-solutions [qt.nokia.com]
The Qt Development Community
Companies and independent developers from around the world are joining the Qt development community every day. They have recognized that Qt’s architecture lends itself to rapid application development. These developers, whether they are targeting one or many platforms, benefit from Qt’s consistent and straightforward API, powerful build system, and supporting tools such as Qt Designer.
Qt has an active and helpful user community who communicate using the qt-interest mailing list, the Qt Centre Web site at www.qtcentre.org [qtcentre.org], and a number of other community Web sites and Weblogs. In addition, many Qt developers are active members of the KDE [kde.org] community. We publish Qt Quarterly [qt.nokia.com], an online developers’ newsletter, for commercial customers and open source developers. A growing number of commercial and open source add-ons from third parties are also available; see the Qt Development Frameworks [qt.nokia.com] site for the most up-to-date information.
Qt’s extensive documentation is available online at qt.nokia.com/doc [qt.nokia.com]. There are also a number of books in English, French, German, Russian, Chinese and Japanese, that present and explain Qt programming. Qt’s official book is C++ GUI Programming with Qt 4 (ISBN 0-13-235416-0).
Qt Development Frameworks and its partners provide a range of training options for Qt and C++, including open enrollment courses for the general public and on-site courses for customers who have more specific training needs. See the online Qt Development Frameworks training pages [qt.nokia.com] for more information.
As well as providing a comprehensive framework for C++ developers, Qt can also be used with a variety of other programming languages. Qt itself includes the QtScript module, a JavaScript-oriented technology that enables developers to give users access to restricted parts of their applications for scripting purposes.
Qt Development Frameworks provides a set of Qt bindings to the Java programming language, formerly known as Qt Jambi, under the LGPL license.
Language bindings for Python, Ruby, JavaScript, BASIC, Ada 2005, C#, Pascal, Lua, Perl and Scheme are also available from Qt Development Frameworks’s partners and various third parties; many of these solutions are produced and maintained by teams of open source developers.
Developers can evaluate Qt, with support, for 30 days on their preferred platform. For further information, visit http://qt.nokia.com/products/qt [qt.nokia.com]
Online References
http://qt.nokia.com/support-services/training [qt.nokia.com]
http://lists.trolltech.com/qt-interest/ [lists.trolltech.com]
http://qt.nokia.com/doc/qq/ [qt.nokia.com]
This document is licensed under the Creative Commons Attribution-Share Alike 2.5 [creativecommons.org] license.

For more information, see http://creativecommons.org/licenses/by-sa/2.5/legalcode [creativecommons.org] for the full terms of the license.
^1 ISO is a registered trademark of the International Organization for Standardization.


