2015. 7. 25. 02:47

QApplication 소개

QApplication Class

QApplication 클래스

출처 : http://doc.qt.io/qt-4.8/qapplication.html

Detailed Description

자세한 설명

The QApplication class manages the GUI application's control flow and main settings.

QApplication 클래스는 GUI 응용프로그램의 제어 흐름과 기본 설정들을 관리합니다.

QApplication contains the main event loop, where all events from the window system and other sources are processed and dispatched. It also handles the application's initialization, finalization, and provides session management. In addition, QApplication handles most of the system-wide and application-wide settings.

QApplication 은 윈도우 시스템과 다른 (이벤트) 발생지에서 오는 모든 이벤트들을 처리하고 전달하는 메인 이벤트 루프를 포함하고 있습니다. 또한 응용프로그램의 초기화, 마무리를 다루고 있으며, 세션 관리를 제공 합니다. 추가적으로 QApplication 은 대부분의 시스템-범위, 응용프로그램-범위 설정들을 다룹니다.

For any GUI application using Qt, there is precisely one QApplication object, no matter whether the application has 0, 1, 2 or more windows at any given time. For non-GUI Qt applications, use QCoreApplication instead, as it does not depend on the QtGui library.

Qt 를 사용하는 어떤 GUI 응용프로그램에서도, 정확히 한 개의 QApplication 객체를 사용하며, 0, 1, 2 개 혹은 그 이상의 윈도우를 가지고 있는 응용프로그램과는 관계가 없습니다. 비-GUI (CUI) 응용프로그램에 대해서는 QtGui 라이브러리에 의존하지 않는 QCoreApplication 을 사용하시기 바랍니다.

The QApplication object is accessible through the instance() function that returns a pointer equivalent to the global qApp pointer.

QApplication 은 전역 qApp 포인터와 동일한 역할을 하는 포인터를 반환하는 instance() 함수를 통해 접근이 가능합니다.

QApplication's main areas of responsibility are:

QApplication 의 주요 역할은 아래와 같습니다.

  • It initializes the application with the user's desktop settings such as palette(), font() and doubleClickInterval(). It keeps track of these properties in case the user changes the desktop globally, for example through some kind of control panel.
  • palette(), font() 와 doubleClickInterval() 와 같은 사용자 데스크톱 설정을 가지고 응용프로그램을 초기화 합니다. 이는 제어판 설정과 같은 데스크톱 전체에 적용되는 사용자 설정 같은 속성들을 따르게 해줍니다.
  • It performs event handling, meaning that it receives events from the underlying window system and dispatches them to the relevant widgets. By using sendEvent() and postEvent() you can send your own events to widgets.
  • 윈도우 시스템 저변에서 받아들여지는 이벤트들을 연관된 위젯 (컨트롤) 들에게 전달해주는 이벤트 핸들링을 수행합니다. 개발자는 sendEvent() 와 postEvent() 를 통해 자신만의 이벤트들을 위젯들에게 전달할 수 있습니다.
  • It parses common command line arguments and sets its internal state accordingly. See the constructor documentation below for more details.
  • 공통 명령줄 인자들을 해석하고 순서에 맞게 내부적인 상태를 지정합니다. 생성자 문서에 더 자세한 내용을 참고 바랍니다.
  • It defines the application's look and feel, which is encapsulated in a QStyle object. This can be changed at runtime with setStyle().
  • QStyle 객체에 캡슐화 (밀폐) 시켜서 응용프로그램의 룩 앤 필(시각적 느낌)을 정의합니다. setStyle() 을 사용하면 실행 중(런타임) 에 변경이 가능합니다.
  • It specifies how the application is to allocate colors. See setColorSpec() for details.
  • 응용프로그램에 할당된 색깔을 어떻게 할지 지정할 수 있습니다. 자세한 설명은 setColorSpec() 을 참고 바랍니다.
  • It provides localization of strings that are visible to the user via translate().
  • translate() 를 사용하여 사용자에게 현지화된 문자열 표시를 지원합니다.
  • It provides some magical objects like the desktop() and the clipboard().
  • desktop 과 clipboard() 같은 신기한 객체들을 제공합니다.
  • It knows about the application's windows. You can ask which widget is at a certain position using widgetAt(), get a list of topLevelWidgets() and closeAllWindows(), etc.
  • 실행 중인 응용프로그램의 윈도우(창) 들을 알고 있습니다. 개발자는 widgetAt() 을 사용하여 특정 위젯 (컨트롤) 을 요청할 수있고, topLevelWidgets() 과 closeAllWindows() 등과 같은 목록을 얻을 수 있습니다.
  • It manages the application's mouse cursor handling, see setOverrideCursor()
  • 응용프로그램에서 다뤄지는 마우스 커서를 관리할 수 있습니다. setOverrideCursor() 를 참고 바랍니다.
  • On the X window system, it provides functions to flush and sync the communication stream, see flushX() and syncX().
  • X 윈도우 시스템 (예. 리눅스) 환경에서, 통신 스트림을 비우거나 동기화 하는 기능을 제공합니다. flushX() 와 syncX() 를 참고 바랍니다.
  • It provides support for sophisticated session management. This makes it possible for applications to terminate gracefully when the user logs out, to cancel a shutdown process if termination isn't possible and even to preserve the entire application's state for a future session. See isSessionRestored(), sessionId() and commitData() and saveState() for details.
  • 정교한 세션 관리를 위한 지원을 제공합니다. 이는 사용자가 로그아웃 할 때 응용프로그램을 우아하게 종료시킬 수 있으며, 종료가 불가능한 경우 실행 종료를 취소 시키게도 하고, 심지어 향후 세션 (실행 상태) 을 위해 전체 응용프로그램의 상태를 보존하게 할 수도 있습니다. isSessionRestored(), sessionId() 와 commitData(), saveState() 에서 자세한 정보를 확인 바랍니다.
Since the QApplication object does so much initialization, it must be created before any other objects related to the user interface are created. QApplication also deals with common command line arguments. Hence, it is usually a good idea to create it before any interpretation or modification of argv is done in the application itself.

QApplication 객체는초기화 작업에 많은 동작을 수행하기 때문에, 사용자 인터페이스가 생성되는 객체를 만들기 전에 반드시 (QApplication) 객체를 만들어야 합니다. QApplication 은 또한 공통 명령줄 인자들을 지원합니다. 그러므로, 응용프로그램 자신이 argv 변수를 해석하거나 변경하기 전에 (QApplication) 을 만드는 것은 좋은 생각입니다.

© 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.