1 | /****************************************************************************
|
---|
2 | ** $Id: qapplication.h 8 2005-11-16 19:36:46Z dmik $
|
---|
3 | **
|
---|
4 | ** Definition of QApplication class
|
---|
5 | **
|
---|
6 | ** Created : 931107
|
---|
7 | **
|
---|
8 | ** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
|
---|
9 | **
|
---|
10 | ** This file is part of the kernel module of the Qt GUI Toolkit.
|
---|
11 | **
|
---|
12 | ** This file may be distributed under the terms of the Q Public License
|
---|
13 | ** as defined by Trolltech AS of Norway and appearing in the file
|
---|
14 | ** LICENSE.QPL included in the packaging of this file.
|
---|
15 | **
|
---|
16 | ** This file may be distributed and/or modified under the terms of the
|
---|
17 | ** GNU General Public License version 2 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
19 | ** packaging of this file.
|
---|
20 | **
|
---|
21 | ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
|
---|
22 | ** licenses may use this file in accordance with the Qt Commercial License
|
---|
23 | ** Agreement provided with the Software.
|
---|
24 | **
|
---|
25 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
|
---|
26 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
---|
27 | **
|
---|
28 | ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
|
---|
29 | ** information about Qt Commercial License Agreements.
|
---|
30 | ** See http://www.trolltech.com/qpl/ for QPL licensing information.
|
---|
31 | ** See http://www.trolltech.com/gpl/ for GPL licensing information.
|
---|
32 | **
|
---|
33 | ** Contact info@trolltech.com if any conditions of this licensing are
|
---|
34 | ** not clear to you.
|
---|
35 | **
|
---|
36 | **********************************************************************/
|
---|
37 |
|
---|
38 | #ifndef QAPPLICATION_H
|
---|
39 | #define QAPPLICATION_H
|
---|
40 |
|
---|
41 | #ifndef QT_H
|
---|
42 | #include "qdesktopwidget.h"
|
---|
43 | #include "qasciidict.h"
|
---|
44 | //@@TODO (dmik): later
|
---|
45 | //#include "qpalette.h"
|
---|
46 | //#include "qtranslator.h"
|
---|
47 | #include "qstrlist.h"
|
---|
48 | #include "qstringlist.h"
|
---|
49 | #endif // QT_H
|
---|
50 |
|
---|
51 | class QSessionManager;
|
---|
52 | class QStyle;
|
---|
53 | class QTranslator;
|
---|
54 | class QEventLoop;
|
---|
55 | #if defined(Q_WS_QWS)
|
---|
56 | class QWSDecoration;
|
---|
57 | #endif
|
---|
58 |
|
---|
59 | #ifdef QT_THREAD_SUPPORT
|
---|
60 | class QMutex;
|
---|
61 | #endif // QT_THREAD_SUPPORT
|
---|
62 |
|
---|
63 |
|
---|
64 | class QApplication;
|
---|
65 | extern Q_EXPORT QApplication *qApp; // global application object
|
---|
66 |
|
---|
67 |
|
---|
68 | class Q_EXPORT QApplication : public QObject
|
---|
69 | {
|
---|
70 | Q_OBJECT
|
---|
71 | public:
|
---|
72 | QApplication( int &argc, char **argv );
|
---|
73 | QApplication( int &argc, char **argv, bool GUIenabled );
|
---|
74 | enum Type { Tty, GuiClient, GuiServer };
|
---|
75 | QApplication( int &argc, char **argv, Type );
|
---|
76 | #if defined(Q_WS_X11)
|
---|
77 | QApplication( Display* dpy, HANDLE visual = 0, HANDLE cmap = 0 );
|
---|
78 | QApplication( Display *dpy, int argc, char **argv,
|
---|
79 | HANDLE visual = 0, HANDLE cmap= 0 );
|
---|
80 | #endif
|
---|
81 | virtual ~QApplication();
|
---|
82 |
|
---|
83 | int argc() const;
|
---|
84 | char **argv() const;
|
---|
85 |
|
---|
86 | Type type() const;
|
---|
87 |
|
---|
88 | #ifndef QT_NO_STYLE
|
---|
89 | static QStyle &style();
|
---|
90 | static void setStyle( QStyle* );
|
---|
91 | static QStyle* setStyle( const QString& );
|
---|
92 | #endif
|
---|
93 | #ifndef Q_QDOC
|
---|
94 | enum ColorMode { NormalColors, CustomColors };
|
---|
95 | static ColorMode colorMode();
|
---|
96 | static void setColorMode( QApplication::ColorMode );
|
---|
97 | #endif
|
---|
98 |
|
---|
99 | enum ColorSpec { NormalColor=0, CustomColor=1, ManyColor=2 };
|
---|
100 | static int colorSpec();
|
---|
101 | static void setColorSpec( int );
|
---|
102 | #ifndef QT_NO_CURSOR
|
---|
103 | static QCursor *overrideCursor();
|
---|
104 | static void setOverrideCursor( const QCursor &, bool replace=FALSE );
|
---|
105 | static void restoreOverrideCursor();
|
---|
106 | #endif
|
---|
107 | static bool hasGlobalMouseTracking();
|
---|
108 | static void setGlobalMouseTracking( bool enable );
|
---|
109 | #ifndef QT_NO_PALETTE
|
---|
110 | static QPalette palette( const QWidget* = 0 );
|
---|
111 | static void setPalette( const QPalette &, bool informWidgets=FALSE,
|
---|
112 | const char* className = 0 );
|
---|
113 | #endif
|
---|
114 | static QFont font( const QWidget* = 0 );
|
---|
115 | static void setFont( const QFont &, bool informWidgets=FALSE,
|
---|
116 | const char* className = 0 );
|
---|
117 | static QFontMetrics fontMetrics();
|
---|
118 |
|
---|
119 | QWidget *mainWidget() const;
|
---|
120 | virtual void setMainWidget( QWidget * );
|
---|
121 | virtual void polish( QWidget * );
|
---|
122 |
|
---|
123 | static QWidgetList *allWidgets();
|
---|
124 | static QWidgetList *topLevelWidgets();
|
---|
125 |
|
---|
126 | static QDesktopWidget *desktop();
|
---|
127 |
|
---|
128 | static QWidget *activePopupWidget();
|
---|
129 | static QWidget *activeModalWidget();
|
---|
130 | #ifndef QT_NO_CLIPBOARD
|
---|
131 | static QClipboard *clipboard();
|
---|
132 | #endif
|
---|
133 | QWidget *focusWidget() const;
|
---|
134 | QWidget *activeWindow() const;
|
---|
135 |
|
---|
136 | static QWidget *widgetAt( int x, int y, bool child=FALSE );
|
---|
137 | static QWidget *widgetAt( const QPoint &, bool child=FALSE );
|
---|
138 |
|
---|
139 | static QEventLoop *eventLoop();
|
---|
140 |
|
---|
141 | int exec();
|
---|
142 | void processEvents();
|
---|
143 | void processEvents( int maxtime );
|
---|
144 | void processOneEvent();
|
---|
145 | bool hasPendingEvents();
|
---|
146 | int enter_loop();
|
---|
147 | void exit_loop();
|
---|
148 | int loopLevel() const;
|
---|
149 | static void exit( int retcode=0 );
|
---|
150 |
|
---|
151 | static bool sendEvent( QObject *receiver, QEvent *event );
|
---|
152 | static void postEvent( QObject *receiver, QEvent *event );
|
---|
153 | static void sendPostedEvents( QObject *receiver, int event_type );
|
---|
154 | static void sendPostedEvents();
|
---|
155 |
|
---|
156 | static void removePostedEvents( QObject *receiver );
|
---|
157 |
|
---|
158 | virtual bool notify( QObject *, QEvent * );
|
---|
159 |
|
---|
160 | static bool startingUp();
|
---|
161 | static bool closingDown();
|
---|
162 |
|
---|
163 | static void flushX();
|
---|
164 | static void flush();
|
---|
165 | static void syncX();
|
---|
166 |
|
---|
167 | static void beep();
|
---|
168 |
|
---|
169 | #ifndef QT_NO_TRANSLATION
|
---|
170 | # ifndef QT_NO_TEXTCODEC
|
---|
171 | void setDefaultCodec( QTextCodec * );
|
---|
172 | QTextCodec* defaultCodec() const;
|
---|
173 | # endif
|
---|
174 | void installTranslator( QTranslator * );
|
---|
175 | void removeTranslator( QTranslator * );
|
---|
176 | #endif
|
---|
177 | enum Encoding { DefaultCodec, UnicodeUTF8 };
|
---|
178 | QString translate( const char * context,
|
---|
179 | const char * key,
|
---|
180 | const char * comment = 0,
|
---|
181 | Encoding encoding = DefaultCodec ) const;
|
---|
182 | #ifndef QT_NO_DIR
|
---|
183 | QString applicationDirPath();
|
---|
184 | QString applicationFilePath();
|
---|
185 | #endif
|
---|
186 | #ifndef QT_NO_PALETTE
|
---|
187 | // obsolete functions
|
---|
188 | static void setWinStyleHighlightColor( const QColor &c ) {
|
---|
189 | QPalette p( palette() );
|
---|
190 | p.setColor( QColorGroup::Highlight, c );
|
---|
191 | setPalette( p, TRUE);
|
---|
192 | }
|
---|
193 | static const QColor &winStyleHighlightColor() {
|
---|
194 | return palette().active().highlight();
|
---|
195 | }
|
---|
196 | #endif
|
---|
197 | static void setDesktopSettingsAware( bool );
|
---|
198 | static bool desktopSettingsAware();
|
---|
199 |
|
---|
200 | static void setCursorFlashTime( int );
|
---|
201 | static int cursorFlashTime();
|
---|
202 |
|
---|
203 | static void setDoubleClickInterval( int );
|
---|
204 | static int doubleClickInterval();
|
---|
205 | #ifndef QT_NO_WHEELEVENT
|
---|
206 | static void setWheelScrollLines( int );
|
---|
207 | static int wheelScrollLines();
|
---|
208 | #endif
|
---|
209 | static void setGlobalStrut( const QSize & );
|
---|
210 | static QSize globalStrut();
|
---|
211 |
|
---|
212 | #ifndef QT_NO_COMPONENT
|
---|
213 | static void setLibraryPaths( const QStringList & );
|
---|
214 | static QStringList libraryPaths();
|
---|
215 | static void addLibraryPath( const QString & );
|
---|
216 | static void removeLibraryPath( const QString & );
|
---|
217 | #endif // QT_NO_COMPONENT
|
---|
218 | static void setStartDragTime( int ms );
|
---|
219 | static int startDragTime();
|
---|
220 | static void setStartDragDistance( int l );
|
---|
221 | static int startDragDistance();
|
---|
222 |
|
---|
223 | static void setReverseLayout( bool b );
|
---|
224 | static bool reverseLayout();
|
---|
225 |
|
---|
226 | static int horizontalAlignment( int align );
|
---|
227 |
|
---|
228 | static bool isEffectEnabled( Qt::UIEffect );
|
---|
229 | static void setEffectEnabled( Qt::UIEffect, bool enable = TRUE );
|
---|
230 |
|
---|
231 | #if defined(Q_WS_MAC)
|
---|
232 | virtual bool macEventFilter( EventHandlerCallRef, EventRef );
|
---|
233 | #endif
|
---|
234 | #if defined(Q_WS_WIN)
|
---|
235 | virtual bool winEventFilter( MSG * );
|
---|
236 | #endif
|
---|
237 | #if defined(Q_WS_PM)
|
---|
238 | virtual bool pmEventFilter( QMSG * );
|
---|
239 | #endif
|
---|
240 | #if defined(Q_WS_X11)
|
---|
241 | virtual bool x11EventFilter( XEvent * );
|
---|
242 | virtual int x11ClientMessage( QWidget*, XEvent*, bool passive_only);
|
---|
243 | int x11ProcessEvent( XEvent* );
|
---|
244 | #endif
|
---|
245 | #if defined(Q_WS_QWS)
|
---|
246 | virtual bool qwsEventFilter( QWSEvent * );
|
---|
247 | int qwsProcessEvent( QWSEvent* );
|
---|
248 | void qwsSetCustomColors( QRgb *colortable, int start, int numColors );
|
---|
249 | #ifndef QT_NO_QWS_MANAGER
|
---|
250 | static QWSDecoration &qwsDecoration();
|
---|
251 | static void qwsSetDecoration( QWSDecoration *);
|
---|
252 | #endif
|
---|
253 | #endif
|
---|
254 |
|
---|
255 | #if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
|
---|
256 | static WindowsVersion winVersion();
|
---|
257 | #elif defined(Q_OS_MAC)
|
---|
258 | static MacintoshVersion macVersion();
|
---|
259 | #endif
|
---|
260 | //@@TODO (dmik): os2Version??
|
---|
261 | #if defined(Q_WS_WIN)
|
---|
262 | void winFocus( QWidget *, bool );
|
---|
263 | static void winMouseButtonUp();
|
---|
264 | #elif defined(Q_WS_PM)
|
---|
265 | void pmFocus( QWidget *, bool );
|
---|
266 | #endif
|
---|
267 |
|
---|
268 | #ifndef QT_NO_SESSIONMANAGER
|
---|
269 | // session management
|
---|
270 | bool isSessionRestored() const;
|
---|
271 | QString sessionId() const;
|
---|
272 | QString sessionKey() const;
|
---|
273 | virtual void commitData( QSessionManager& sm );
|
---|
274 | virtual void saveState( QSessionManager& sm );
|
---|
275 | #endif
|
---|
276 | #if defined(Q_WS_X11)
|
---|
277 | static void create_xim();
|
---|
278 | static void close_xim();
|
---|
279 | static bool x11_apply_settings();
|
---|
280 | #endif
|
---|
281 | void wakeUpGuiThread();
|
---|
282 | #if defined(QT_THREAD_SUPPORT)
|
---|
283 | void lock();
|
---|
284 | void unlock(bool wakeUpGui = TRUE);
|
---|
285 | bool locked();
|
---|
286 | bool tryLock();
|
---|
287 | #endif
|
---|
288 |
|
---|
289 | signals:
|
---|
290 | void lastWindowClosed();
|
---|
291 | void aboutToQuit();
|
---|
292 | void guiThreadAwake();
|
---|
293 |
|
---|
294 | public slots:
|
---|
295 | void quit();
|
---|
296 | void closeAllWindows();
|
---|
297 | void aboutQt();
|
---|
298 |
|
---|
299 | #if defined(Q_WS_QWS)
|
---|
300 | protected:
|
---|
301 | void setArgs(int, char **);
|
---|
302 | #endif
|
---|
303 |
|
---|
304 | protected:
|
---|
305 | bool event(QEvent *);
|
---|
306 |
|
---|
307 | private:
|
---|
308 | void construct( int &argc, char **argv, Type );
|
---|
309 | void initialize( int, char ** );
|
---|
310 | void init_precmdline();
|
---|
311 | void process_cmdline( int* argcptr, char ** argv );
|
---|
312 | bool internalNotify( QObject *, QEvent * );
|
---|
313 | #if defined(Q_WS_QWS)
|
---|
314 | static QWidget *findChildWidget( const QWidget *p, const QPoint &pos );
|
---|
315 | static QWidget *findWidget( const QObjectList&, const QPoint &, bool rec );
|
---|
316 | #endif
|
---|
317 |
|
---|
318 | #if defined(Q_WS_MAC)
|
---|
319 | bool do_mouse_down(Point *, bool *);
|
---|
320 | static QMAC_PASCAL OSStatus globalEventProcessor(EventHandlerCallRef, EventRef, void *);
|
---|
321 | static QMAC_PASCAL OSStatus globalAppleEventProcessor(const AppleEvent *, AppleEvent *, long);
|
---|
322 | static QMAC_PASCAL void qt_context_timer_callbk(EventLoopTimerRef, void *);
|
---|
323 | static QMAC_PASCAL void qt_select_timer_callbk(EventLoopTimerRef, void *);
|
---|
324 | static bool qt_mac_apply_settings();
|
---|
325 | friend class QMacInputMethod;
|
---|
326 | friend QMAC_PASCAL OSStatus qt_window_event(EventHandlerCallRef, EventRef, void *);
|
---|
327 | friend void qt_mac_update_os_settings();
|
---|
328 | friend bool qt_set_socket_handler( int, int, QObject *, bool);
|
---|
329 | friend void qt_mac_destroy_widget(QWidget *);
|
---|
330 | friend void qt_init(int *, char **, QApplication::Type);
|
---|
331 | #endif
|
---|
332 |
|
---|
333 | #ifdef QT_THREAD_SUPPORT
|
---|
334 | static QMutex *qt_mutex;
|
---|
335 | #endif // QT_THREAD_SUPPORT
|
---|
336 |
|
---|
337 | int app_argc;
|
---|
338 | char **app_argv;
|
---|
339 | bool quit_now;
|
---|
340 | int quit_code;
|
---|
341 | static QStyle *app_style;
|
---|
342 | static int app_cspec;
|
---|
343 | #ifndef QT_NO_PALETTE
|
---|
344 | static QPalette *app_pal;
|
---|
345 | #endif
|
---|
346 | static QFont *app_font;
|
---|
347 | #ifndef QT_NO_CURSOR
|
---|
348 | static QCursor *app_cursor;
|
---|
349 | #endif
|
---|
350 | static QEventLoop* eventloop;
|
---|
351 | static int app_tracking;
|
---|
352 | static bool is_app_running;
|
---|
353 | static bool is_app_closing;
|
---|
354 | static bool app_exit_loop;
|
---|
355 | static int loop_level;
|
---|
356 | static QWidget *main_widget;
|
---|
357 | static QWidget *focus_widget;
|
---|
358 | static QWidget *active_window;
|
---|
359 | static bool obey_desktop_settings;
|
---|
360 | static int cursor_flash_time;
|
---|
361 | static int mouse_double_click_time;
|
---|
362 | static int wheel_scroll_lines;
|
---|
363 | static int composedUnicode; // Value, meta-composed character
|
---|
364 |
|
---|
365 | static bool animate_ui;
|
---|
366 | static bool animate_menu;
|
---|
367 | static bool animate_tooltip;
|
---|
368 | static bool animate_combo;
|
---|
369 | static bool fade_menu;
|
---|
370 | static bool fade_tooltip;
|
---|
371 | static bool animate_toolbox;
|
---|
372 | static bool widgetCount; // Coupled with -widgetcount switch
|
---|
373 | static bool metaComposeUnicode;
|
---|
374 |
|
---|
375 | QValueList<QTranslator*> *translators;
|
---|
376 | #ifndef QT_NO_SESSIONMANAGER
|
---|
377 | QSessionManager *session_manager;
|
---|
378 | QString session_id;
|
---|
379 | static QString* session_key;
|
---|
380 | bool is_session_restored;
|
---|
381 | #endif
|
---|
382 | #if defined(Q_WS_X11) && !defined (QT_NO_STYLE )
|
---|
383 | static void x11_initialize_style();
|
---|
384 | #endif
|
---|
385 |
|
---|
386 | static QSize app_strut;
|
---|
387 | #ifndef QT_NO_COMPONENT
|
---|
388 | static QStringList *app_libpaths;
|
---|
389 | #endif
|
---|
390 | static QAsciiDict<QPalette> *app_palettes;
|
---|
391 | static QAsciiDict<QFont> *app_fonts;
|
---|
392 |
|
---|
393 | static QWidgetList *popupWidgets;
|
---|
394 | bool inPopupMode() const;
|
---|
395 | void closePopup( QWidget *popup );
|
---|
396 | void openPopup( QWidget *popup );
|
---|
397 | void setActiveWindow( QWidget* act );
|
---|
398 |
|
---|
399 | static bool sendSpontaneousEvent( QObject *receiver, QEvent *event );
|
---|
400 | static void removePostedEvent( QEvent * );
|
---|
401 |
|
---|
402 | friend class QWidget;
|
---|
403 | friend class QETWidget;
|
---|
404 | friend class QDialog;
|
---|
405 | friend class QAccelManager;
|
---|
406 | friend class QEvent;
|
---|
407 | friend class QTranslator;
|
---|
408 | friend class QEventLoop;
|
---|
409 | friend Q_EXPORT void qt_ucm_initialize( QApplication * );
|
---|
410 | #if defined(Q_WS_WIN) || defined(Q_WS_PM)
|
---|
411 | friend bool qt_sendSpontaneousEvent( QObject*, QEvent* );
|
---|
412 | #endif
|
---|
413 | #if defined(Q_WS_QWS)
|
---|
414 | friend class QInputContext;
|
---|
415 | #endif
|
---|
416 | private: // Disabled copy constructor and operator=
|
---|
417 | #if defined(Q_DISABLE_COPY)
|
---|
418 | QApplication( const QApplication & );
|
---|
419 | QApplication &operator=( const QApplication & );
|
---|
420 | #endif
|
---|
421 | };
|
---|
422 |
|
---|
423 | inline int QApplication::argc() const
|
---|
424 | {
|
---|
425 | return app_argc;
|
---|
426 | }
|
---|
427 |
|
---|
428 | inline char **QApplication::argv() const
|
---|
429 | {
|
---|
430 | return app_argv;
|
---|
431 | }
|
---|
432 |
|
---|
433 | #if defined(Q_WS_QWS)
|
---|
434 | inline void QApplication::setArgs(int c, char **v)
|
---|
435 | {
|
---|
436 | app_argc = c;
|
---|
437 | app_argv = v;
|
---|
438 | }
|
---|
439 | #endif
|
---|
440 |
|
---|
441 | #ifndef QT_NO_CURSOR
|
---|
442 | inline QCursor *QApplication::overrideCursor()
|
---|
443 | {
|
---|
444 | return app_cursor;
|
---|
445 | }
|
---|
446 | #endif
|
---|
447 | inline bool QApplication::hasGlobalMouseTracking()
|
---|
448 | {
|
---|
449 | return app_tracking > 0;
|
---|
450 | }
|
---|
451 |
|
---|
452 | inline QWidget *QApplication::mainWidget() const
|
---|
453 | {
|
---|
454 | return main_widget;
|
---|
455 | }
|
---|
456 |
|
---|
457 | inline QWidget *QApplication::focusWidget() const
|
---|
458 | {
|
---|
459 | return focus_widget;
|
---|
460 | }
|
---|
461 |
|
---|
462 | inline QWidget *QApplication::activeWindow() const
|
---|
463 | {
|
---|
464 | return active_window;
|
---|
465 | }
|
---|
466 |
|
---|
467 | inline QWidget *QApplication::widgetAt( const QPoint &p, bool child )
|
---|
468 | {
|
---|
469 | return widgetAt( p.x(), p.y(), child );
|
---|
470 | }
|
---|
471 |
|
---|
472 | inline bool QApplication::inPopupMode() const
|
---|
473 | {
|
---|
474 | return popupWidgets != 0;
|
---|
475 | }
|
---|
476 | #ifndef QT_NO_SESSIONMANAGER
|
---|
477 | inline bool QApplication::isSessionRestored() const
|
---|
478 | {
|
---|
479 | return is_session_restored;
|
---|
480 | }
|
---|
481 |
|
---|
482 | inline QString QApplication::sessionId() const
|
---|
483 | {
|
---|
484 | return session_id;
|
---|
485 | }
|
---|
486 |
|
---|
487 | inline QString QApplication::sessionKey() const
|
---|
488 | {
|
---|
489 | return session_key ? *session_key : QString::null;
|
---|
490 | }
|
---|
491 | #endif
|
---|
492 | inline QSize QApplication::globalStrut()
|
---|
493 | {
|
---|
494 | return app_strut;
|
---|
495 | }
|
---|
496 |
|
---|
497 | inline bool QApplication::sendEvent( QObject *receiver, QEvent *event )
|
---|
498 | { if ( event ) event->spont = FALSE; return qApp ? qApp->notify( receiver, event ) : FALSE; }
|
---|
499 |
|
---|
500 | inline bool QApplication::sendSpontaneousEvent( QObject *receiver, QEvent *event )
|
---|
501 | { if ( event ) event->spont = TRUE; return qApp ? qApp->notify( receiver, event ) : FALSE; }
|
---|
502 |
|
---|
503 | #ifdef QT_NO_TRANSLATION
|
---|
504 | // Simple versions
|
---|
505 | inline QString QApplication::translate( const char *, const char *sourceText,
|
---|
506 | const char *, Encoding encoding ) const
|
---|
507 | {
|
---|
508 | #ifndef QT_NO_TEXTCODEC
|
---|
509 | if ( encoding == UnicodeUTF8 )
|
---|
510 | return QString::fromUtf8( sourceText );
|
---|
511 | else
|
---|
512 | #endif
|
---|
513 | return QString::fromLatin1( sourceText );
|
---|
514 | }
|
---|
515 | #endif
|
---|
516 |
|
---|
517 | inline int QApplication::horizontalAlignment( int align )
|
---|
518 | {
|
---|
519 | align &= AlignHorizontal_Mask;
|
---|
520 | if ( align == AlignAuto ) {
|
---|
521 | if ( reverseLayout() )
|
---|
522 | align = AlignRight;
|
---|
523 | else
|
---|
524 | align = AlignLeft;
|
---|
525 | }
|
---|
526 | return align;
|
---|
527 | }
|
---|
528 |
|
---|
529 | #endif // QAPPLICATION_H
|
---|
530 |
|
---|