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