#include <qapplication_p.h>
Inheritance diagram for QApplicationPrivate:


Definition at line 148 of file qapplication_p.h.
| QApplicationPrivate::QApplicationPrivate | ( | int & | argc, | |
| char ** | argv, | |||
| QApplication::Type | type | |||
| ) |
Definition at line 83 of file qapplication.cpp.
References QCoreApplicationPrivate::application_type, is_session_restored, qt_appType, qt_dispatchAccelEvent(), qt_tryAccelEvent(), qt_tryComposeUnicode(), and quitOnLastWindowClosed.
Referenced by process_cmdline().
00084 : QCoreApplicationPrivate(argc, argv) 00085 { 00086 application_type = type; 00087 qt_appType = type; 00088 00089 #ifndef QT_NO_SESSIONMANAGER 00090 is_session_restored = false; 00091 #endif 00092 00093 quitOnLastWindowClosed = true; 00094 00095 #ifdef QT3_SUPPORT 00096 qt_compat_used = 0; 00097 qt_compat_resolved = 0; 00098 qt_tryAccelEvent = 0; 00099 qt_tryComposeUnicode = 0; 00100 qt_dispatchAccelEvent = 0; 00101 #endif 00102 #if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER) 00103 directPainters = 0; 00104 #endif 00105 00106 if (!self) 00107 self = this; 00108 }
Here is the call graph for this function:

| QApplicationPrivate::~QApplicationPrivate | ( | ) |
| void QApplicationPrivate::emitLastWindowClosed | ( | ) | [static] |
Definition at line 4055 of file qapplication.cpp.
References emit, qApp, and quitOnLastWindowClosed.
Referenced by _q_tryEmitLastWindowClosed().
04056 { 04057 if (qApp && qApp->d_func()->in_exec) { 04058 if (QApplicationPrivate::quitOnLastWindowClosed) 04059 qApp->quit(); 04060 emit qApp->lastWindowClosed(); 04061 } 04062 }
| void QApplicationPrivate::createEventDispatcher | ( | ) | [virtual] |
Reimplemented from QCoreApplicationPrivate.
Definition at line 368 of file qapplication_x11.cpp.
References QCoreApplicationPrivate::eventDispatcher, isEmpty(), qgetenv(), and QApplication::Tty.
00369 { 00370 Q_Q(QApplication); 00371 #if !defined(QT_NO_GLIB) 00372 if (qgetenv("QT_NO_GLIB").isEmpty()) 00373 eventDispatcher = (q->type() != QApplication::Tty 00374 ? new QGuiEventDispatcherGlib(q) 00375 : new QEventDispatcherGlib(q)); 00376 else 00377 #endif 00378 eventDispatcher = (q->type() != QApplication::Tty 00379 ? new QEventDispatcherX11(q) 00380 : new QEventDispatcherUNIX(q)); 00381 }
Here is the call graph for this function:

| QString QApplicationPrivate::appName | ( | ) | const [virtual] |
Reimplemented from QCoreApplicationPrivate.
Definition at line 2111 of file qapplication_x11.cpp.
References QString::fromLocal8Bit().
02112 { 02113 return QString::fromLocal8Bit(::appName); 02114 }
Here is the call graph for this function:

Definition at line 2139 of file qapplication.cpp.
References QList< T >::append(), QList< T >::at(), QEvent::Enter, QEvent::HoverEnter, hoverGlobalPos, QEvent::HoverLeave, instance(), QWidget::isWindow(), QEvent::Leave, QWidget::parentWidget(), QCursor::pos(), QList< T >::prepend(), qApp, QCoreApplication::sendEvent(), QList< T >::size(), tryModalHelper(), w, Qt::WA_Hover, and QWidget::window().
Referenced by enterModal_sys(), and leaveModal_sys().
02139 { 02140 #if 0 02141 if (leave) { 02142 QEvent e(QEvent::Leave); 02143 QApplication::sendEvent(leave, & e); 02144 } 02145 if (enter) { 02146 QEvent e(QEvent::Enter); 02147 QApplication::sendEvent(enter, & e); 02148 } 02149 return; 02150 #endif 02151 02152 QWidget* w ; 02153 if (!enter && !leave) 02154 return; 02155 QWidgetList leaveList; 02156 QWidgetList enterList; 02157 02158 bool sameWindow = leave && enter && leave->window() == enter->window(); 02159 if (leave && !sameWindow) { 02160 w = leave; 02161 do { 02162 leaveList.append(w); 02163 } while (!w->isWindow() && (w = w->parentWidget())); 02164 } 02165 if (enter && !sameWindow) { 02166 w = enter; 02167 do { 02168 enterList.prepend(w); 02169 } while (!w->isWindow() && (w = w->parentWidget())); 02170 } 02171 if (sameWindow) { 02172 int enterDepth = 0; 02173 int leaveDepth = 0; 02174 w = enter; 02175 while (!w->isWindow() && (w = w->parentWidget())) 02176 enterDepth++; 02177 w = leave; 02178 while (!w->isWindow() && (w = w->parentWidget())) 02179 leaveDepth++; 02180 QWidget* wenter = enter; 02181 QWidget* wleave = leave; 02182 while (enterDepth > leaveDepth) { 02183 wenter = wenter->parentWidget(); 02184 enterDepth--; 02185 } 02186 while (leaveDepth > enterDepth) { 02187 wleave = wleave->parentWidget(); 02188 leaveDepth--; 02189 } 02190 while (!wenter->isWindow() && wenter != wleave) { 02191 wenter = wenter->parentWidget(); 02192 wleave = wleave->parentWidget(); 02193 } 02194 02195 w = leave; 02196 while (w != wleave) { 02197 leaveList.append(w); 02198 w = w->parentWidget(); 02199 } 02200 w = enter; 02201 while (w != wenter) { 02202 enterList.prepend(w); 02203 w = w->parentWidget(); 02204 } 02205 } 02206 02207 QEvent leaveEvent(QEvent::Leave); 02208 for (int i = 0; i < leaveList.size(); ++i) { 02209 w = leaveList.at(i); 02210 if (!qApp->activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { 02211 QApplication::sendEvent(w, &leaveEvent); 02212 if (w->testAttribute(Qt::WA_Hover) && 02213 (!qApp->activePopupWidget() || qApp->activePopupWidget() == w->window())) { 02214 Q_ASSERT(instance()); 02215 QHoverEvent he(QEvent::HoverLeave, QPoint(-1, -1), w->mapFromGlobal(QApplicationPrivate::instance()->hoverGlobalPos)); 02216 qApp->d_func()->notify_helper(w, &he); 02217 } 02218 } 02219 } 02220 QPoint posEnter = QCursor::pos(); 02221 QEvent enterEvent(QEvent::Enter); 02222 for (int i = 0; i < enterList.size(); ++i) { 02223 w = enterList.at(i); 02224 if (!qApp->activeModalWidget() || QApplicationPrivate::tryModalHelper(w, 0)) { 02225 QApplication::sendEvent(w, &enterEvent); 02226 if (w->testAttribute(Qt::WA_Hover) && 02227 (!qApp->activePopupWidget() || qApp->activePopupWidget() == w->window())) { 02228 QHoverEvent he(QEvent::HoverEnter, w->mapFromGlobal(posEnter), QPoint(-1, -1)); 02229 qApp->d_func()->notify_helper(w, &he); 02230 } 02231 } 02232 } 02233 }
Here is the call graph for this function:

| void QApplicationPrivate::enterModal | ( | QWidget * | ) | [static] |
Definition at line 2335 of file qapplication.cpp.
References QList< T >::at(), QSet< T >::contains(), QList< T >::count(), enterModal_sys(), QSet< T >::insert(), isBlockedByModal(), qApp, QCoreApplication::sendEvent(), Qt::Tool, and QEvent::WindowBlocked.
Referenced by QWidgetPrivate::show_helper().
02336 { 02337 QSet<QWidget*> blocked; 02338 QList<QWidget*> windows = qApp->topLevelWidgets(); 02339 for (int i = 0; i < windows.count(); ++i) { 02340 QWidget *window = windows.at(i); 02341 if (window->windowType() != Qt::Tool && isBlockedByModal(window)) 02342 blocked.insert(window); 02343 } 02344 02345 enterModal_sys(widget); 02346 02347 windows = qApp->topLevelWidgets(); 02348 QEvent e(QEvent::WindowBlocked); 02349 for (int i = 0; i < windows.count(); ++i) { 02350 QWidget *window = windows.at(i); 02351 if (!blocked.contains(window) && window->windowType() != Qt::Tool && isBlockedByModal(window)) 02352 QApplication::sendEvent(window, &e); 02353 } 02354 }
Here is the call graph for this function:

| void QApplicationPrivate::leaveModal | ( | QWidget * | ) | [static] |
Definition at line 2358 of file qapplication.cpp.
References QList< T >::at(), QSet< T >::contains(), QList< T >::count(), QSet< T >::insert(), isBlockedByModal(), leaveModal_sys(), qApp, QCoreApplication::sendEvent(), Qt::Tool, and QEvent::WindowUnblocked.
Referenced by QWidget::destroy(), QWidgetPrivate::hide_helper(), and QWidget::setAttribute().
02359 { 02360 QSet<QWidget*> blocked; 02361 QList<QWidget*> windows = qApp->topLevelWidgets(); 02362 for (int i = 0; i < windows.count(); ++i) { 02363 QWidget *window = windows.at(i); 02364 if (window->windowType() != Qt::Tool && isBlockedByModal(window)) 02365 blocked.insert(window); 02366 } 02367 02368 leaveModal_sys(widget); 02369 02370 windows = qApp->topLevelWidgets(); 02371 QEvent e(QEvent::WindowUnblocked); 02372 for (int i = 0; i < windows.count(); ++i) { 02373 QWidget *window = windows.at(i); 02374 if(blocked.contains(window) && window->windowType() != Qt::Tool && !isBlockedByModal(window)) 02375 QApplication::sendEvent(window, &e); 02376 } 02377 }
Here is the call graph for this function:

| void QApplicationPrivate::enterModal_sys | ( | QWidget * | ) | [static] |
Definition at line 3130 of file qapplication_x11.cpp.
References app_do_modal, curWin, dispatchEnterLeave(), QWidget::find(), QList< T >::insert(), and qt_modal_stack.
Referenced by enterModal().
03131 { 03132 if (!qt_modal_stack) 03133 qt_modal_stack = new QWidgetList; 03134 03135 QApplicationPrivate::dispatchEnterLeave(0, QWidget::find((WId)curWin)); 03136 qt_modal_stack->insert(0, widget); 03137 app_do_modal = true; 03138 curWin = 0; 03139 }
Here is the call graph for this function:

| void QApplicationPrivate::leaveModal_sys | ( | QWidget * | ) | [static] |
Definition at line 3141 of file qapplication_x11.cpp.
References app_do_modal, curWin, dispatchEnterLeave(), QWidget::find(), QList< T >::isEmpty(), p, QCursor::pos(), qt_modal_stack, QList< T >::removeAll(), w, and QApplication::widgetAt().
Referenced by leaveModal().
03142 { 03143 if (qt_modal_stack && qt_modal_stack->removeAll(widget)) { 03144 if (qt_modal_stack->isEmpty()) { 03145 delete qt_modal_stack; 03146 qt_modal_stack = 0; 03147 QPoint p(QCursor::pos()); 03148 QWidget* w = QApplication::widgetAt(p.x(), p.y()); 03149 QApplicationPrivate::dispatchEnterLeave(w, QWidget::find(curWin)); // send synthetic enter event 03150 curWin = w? w->internalWinId() : 0; 03151 } 03152 } 03153 app_do_modal = qt_modal_stack != 0; 03154 }
Here is the call graph for this function:

| bool QApplicationPrivate::isBlockedByModal | ( | QWidget * | widget | ) | [static] |
Definition at line 2244 of file qapplication.cpp.
References Qt::ApplicationModal, QList< T >::at(), m, modalState(), Qt::NonModal, QWidget::parentWidget(), qApp, qt_modal_stack, QList< T >::size(), QWidget::testAttribute(), w, Qt::WA_GroupLeader, Qt::WA_WState_Created, QWidget::window(), and Qt::WindowModal.
Referenced by enterModal(), leaveModal(), and tryModalHelper().
02245 { 02246 widget = widget->window(); 02247 if (!modalState()) 02248 return false; 02249 if (qApp->activePopupWidget() == widget) 02250 return false; 02251 02252 for (int i = 0; i < qt_modal_stack->size(); ++i) { 02253 QWidget *modalWidget = qt_modal_stack->at(i); 02254 02255 { 02256 // check if the active modal widget is our widget or a parent of our widget 02257 QWidget *w = widget; 02258 while (w) { 02259 if (w == modalWidget) 02260 return false; 02261 w = w->parentWidget(); 02262 } 02263 #ifdef Q_WS_WIN 02264 if ((widget->testAttribute(Qt::WA_WState_Created) || widget->data->winid) 02265 && (modalWidget->testAttribute(Qt::WA_WState_Created) || modalWidget->data->winid) 02266 && IsChild(modalWidget->data->winid, widget->data->winid)) 02267 return false; 02268 #endif 02269 } 02270 02271 Qt::WindowModality windowModality = modalWidget->windowModality(); 02272 if (windowModality == Qt::NonModal) { 02273 // determine the modality type if it hasn't been set on the 02274 // modalWidget, this normally happens when waiting for a 02275 // native dialog. use WindowModal if we are the child of a 02276 // group leader; otherwise use ApplicationModal. 02277 QWidget *m = modalWidget; 02278 while (m && !m->testAttribute(Qt::WA_GroupLeader)) { 02279 m = m->parentWidget(); 02280 if (m) 02281 m = m->window(); 02282 } 02283 windowModality = (m && m->testAttribute(Qt::WA_GroupLeader)) 02284 ? Qt::WindowModal 02285 : Qt::ApplicationModal; 02286 } 02287 02288 switch (windowModality) { 02289 case Qt::ApplicationModal: 02290 { 02291 QWidget *groupLeaderForWidget = widget; 02292 while (groupLeaderForWidget && !groupLeaderForWidget->testAttribute(Qt::WA_GroupLeader)) 02293 groupLeaderForWidget = groupLeaderForWidget->parentWidget(); 02294 02295 if (groupLeaderForWidget) { 02296 // if \a widget has WA_GroupLeader, it can only be blocked by ApplicationModal children 02297 QWidget *m = modalWidget; 02298 while (m && m != groupLeaderForWidget && !m->testAttribute(Qt::WA_GroupLeader)) 02299 m = m->parentWidget(); 02300 if (m == groupLeaderForWidget) 02301 return true; 02302 } else if (modalWidget != widget) { 02303 return true; 02304 } 02305 break; 02306 } 02307 case Qt::WindowModal: 02308 { 02309 QWidget *w = widget; 02310 do { 02311 QWidget *m = modalWidget; 02312 do { 02313 if (m == w) 02314 return true; 02315 m = m->parentWidget(); 02316 if (m) 02317 m = m->window(); 02318 } while (m); 02319 w = w->parentWidget(); 02320 if (w) 02321 w = w->window(); 02322 } while (w); 02323 break; 02324 } 02325 default: 02326 Q_ASSERT_X(false, "QApplication", "internal error, a modal widget cannot be modeless"); 02327 break; 02328 } 02329 } 02330 return false; 02331 }
Here is the call graph for this function:

| bool QApplicationPrivate::modalState | ( | ) | [static] |
Definition at line 3125 of file qapplication_x11.cpp.
References app_do_modal.
Referenced by isBlockedByModal().
03126 { 03127 return app_do_modal; 03128 }
Definition at line 2386 of file qapplication.cpp.
References QApplication::activeModalWidget(), isBlockedByModal(), qApp, and QWidget::window().
Referenced by QShortcutMap::correctContext(), dispatchEnterLeave(), qt_try_modal(), and qt_tryModalHelper().
02387 { 02388 QWidget *top = QApplication::activeModalWidget(); 02389 if (rettop) 02390 *rettop = top; 02391 02392 // the active popup widget always gets the input event 02393 if (qApp->activePopupWidget()) 02394 return true; 02395 02396 #ifdef Q_WS_MAC 02397 top = QApplicationPrivate::tryModalHelper_sys(top); 02398 if (rettop) 02399 *rettop = top; 02400 #endif 02401 02402 return !isBlockedByModal(widget->window()); 02403 }
Here is the call graph for this function:

Reimplemented from QCoreApplicationPrivate.
Definition at line 3382 of file qapplication.cpp.
References QList< T >::at(), QEvent::DragEnter, QEvent::DragLeave, QEvent::Enter, QObject::event(), QObjectPrivate::eventFilters, QObject::isWidgetType(), layout, QEvent::Leave, QReadWriteLock::lockForRead(), qApp, QObjectPrivate::readWriteLock(), QList< T >::size(), QEvent::spont, QEvent::type(), QReadWriteLock::unlock(), and Qt::WA_UnderMouse.
03383 { 03384 Q_Q(QApplication); 03385 03386 QReadWriteLock *lock = QObjectPrivate::readWriteLock(); 03387 03388 // send to all application event filters 03389 if (lock) 03390 lock->lockForRead(); 03391 for (int i = 0; i < eventFilters.size(); ++i) { 03392 register QObject *obj = eventFilters.at(i); 03393 if (lock) 03394 lock->unlock(); 03395 if (obj && obj->eventFilter(receiver,e)) 03396 return true; 03397 if (lock) 03398 lock->lockForRead(); 03399 } 03400 if (lock) 03401 lock->unlock(); 03402 03403 if (receiver->isWidgetType()) { 03404 QWidget *widget = static_cast<QWidget *>(receiver); 03405 03406 // toggle HasMouse widget state on enter and leave 03407 if ((e->type() == QEvent::Enter || e->type() == QEvent::DragEnter) && 03408 (!qApp->activePopupWidget() || qApp->activePopupWidget() == widget->window())) 03409 widget->setAttribute(Qt::WA_UnderMouse, true); 03410 else if (e->type() == QEvent::Leave || e->type() == QEvent::DragLeave) 03411 widget->setAttribute(Qt::WA_UnderMouse, false); 03412 03413 if (QLayout *layout=widget->d_func()->layout) { 03414 layout->widgetEvent(e); 03415 } 03416 } 03417 03418 // send to all receiver event filters 03419 if (receiver != q) { 03420 if (lock) 03421 lock->lockForRead(); 03422 for (int i = 0; i < receiver->d_func()->eventFilters.size(); ++i) { 03423 register QObject *obj = receiver->d_func()->eventFilters.at(i); 03424 if (lock) 03425 lock->unlock(); 03426 if (obj && obj->eventFilter(receiver,e)) 03427 return true; 03428 if (lock) 03429 lock->lockForRead(); 03430 } 03431 if (lock) 03432 lock->unlock(); 03433 } 03434 bool consumed = receiver->event(e); 03435 e->spont = false; 03436 return consumed; 03437 }
Here is the call graph for this function:

| void QApplicationPrivate::construct | ( | ) |
| void QApplicationPrivate::initialize | ( | ) |
Initializes the QApplication object, called from the constructors.
Definition at line 752 of file qapplication.cpp.
References QCoreApplicationPrivate::is_app_running, QWidgetPrivate::mapper, qRegisterGuiVariant(), qt_appType, session_id, session_key, session_manager, QApplication::style(), QApplication::Tty, and QWidgetPrivate::uncreatedWidgets.
00753 { 00754 QWidgetPrivate::mapper = new QWidgetMapper; 00755 QWidgetPrivate::uncreatedWidgets = new QWidgetSet; 00756 if (qt_appType != QApplication::Tty) 00757 (void) QApplication::style(); // trigger creation of application style 00758 // trigger registering of QVariant's GUI types 00759 extern int qRegisterGuiVariant(); 00760 qRegisterGuiVariant(); 00761 00762 is_app_running = true; // no longer starting up 00763 00764 #ifndef QT_NO_SESSIONMANAGER 00765 // connect to the session manager 00766 Q_Q(QApplication); 00767 session_manager = new QSessionManager(q, session_id, session_key); 00768 #endif 00769 00770 }
Here is the call graph for this function:

| void QApplicationPrivate::process_cmdline | ( | ) |
Definition at line 428 of file qapplication.cpp.
References QCoreApplicationPrivate::argc, QCoreApplicationPrivate::argv, d, force_reverse, QString::fromLatin1(), QString::fromLocal8Bit(), i, QByteArray::indexOf(), QString::indexOf(), is_session_restored, j, QString::left(), QByteArray::length(), QString::mid(), p, QApplication::QApplication(), QApplicationPrivate(), qstrcmp(), qt_is_gui_used, QByteArray::right(), Qt::RightToLeft, s, session_id, session_key, styleOverride, QString::toLower(), and widgetCount.
00429 { 00430 Q_Q(QApplication); 00431 Q_UNUSED(q);// only static members being used. 00432 // process platform-indep command line 00433 if (!qt_is_gui_used || !argc) 00434 return; 00435 00436 int i, j; 00437 00438 j = 1; 00439 for (i=1; i<argc; i++) { // if you add anything here, modify QCoreApplication::arguments() 00440 if (argv[i] && *argv[i] != '-') { 00441 argv[j++] = argv[i]; 00442 continue; 00443 } 00444 QByteArray arg = argv[i]; 00445 arg = arg; 00446 QString s; 00447 if (arg == "-qdevel" || arg == "-qdebug") { 00448 // obsolete argument 00449 } else if (arg.indexOf("-style=", 0) != -1) { 00450 s = QString::fromLocal8Bit(arg.right(arg.length() - 7).toLower()); 00451 } else if (arg == "-style" && i < argc-1) { 00452 s = QString::fromLocal8Bit(argv[++i]).toLower(); 00453 #ifndef QT_NO_SESSIONMANAGER 00454 } else if (arg == "-session" && i < argc-1) { 00455 ++i; 00456 if (argv[i] && *argv[i]) { 00457 session_id = QString::fromLatin1(argv[i]); 00458 int p = session_id.indexOf(QLatin1Char('_')); 00459 if (p >= 0) { 00460 session_key = session_id.mid(p +1); 00461 session_id = session_id.left(p); 00462 } 00463 is_session_restored = true; 00464 } 00465 #endif 00466 } else if (qstrcmp(arg, "-reverse") == 0) { 00467 force_reverse = true; 00468 q->setLayoutDirection(Qt::RightToLeft); 00469 } else if (qstrcmp(arg, "-widgetcount") == 0) { 00470 widgetCount = true; 00471 } else { 00472 argv[j++] = argv[i]; 00473 } 00474 if (!s.isEmpty()) { 00475 if (!styleOverride) 00476 styleOverride = new QString; 00477 *styleOverride = s; 00478 } 00479 } 00480 00481 if(j < argc) { 00482 argv[j] = 0; 00483 argc = j; 00484 } 00485 }
Here is the call graph for this function:

| uint QApplicationPrivate::currentPlatform | ( | ) | [static] |
Definition at line 4184 of file qapplication.cpp.
References DE_CDE, DE_GNOME, DE_KDE, KB_CDE, KB_Gnome, KB_KDE, KB_Mac, KB_Win, KB_X11, and X11.
Referenced by QKeySequence::keyBindings(), and QKeyEvent::matches().
04184 { 04185 uint platform = KB_Win; 04186 #ifdef Q_WS_MAC 04187 platform = KB_Mac; 04188 #elif defined Q_WS_X11 04189 platform = KB_X11; 04190 if (X11->desktopEnvironment == DE_KDE) 04191 platform |= KB_KDE; 04192 if (X11->desktopEnvironment == DE_GNOME) 04193 platform |= KB_Gnome; 04194 if (X11->desktopEnvironment == DE_CDE) 04195 platform |= KB_CDE; 04196 #endif 04197 return platform; 04198 }
| bool QApplicationPrivate::inPopupMode | ( | ) | const |
Definition at line 4023 of file qapplication.cpp.
References popupWidgets.
04024 { 04025 return QApplicationPrivate::popupWidgets != 0; 04026 }
| void QApplicationPrivate::closePopup | ( | QWidget * | popup | ) |
Definition at line 3248 of file qapplication_x11.cpp.
References active_window, QRect::contains(), QEvent::FocusIn, QWidget::focusWidget(), QApplication::focusWidget(), QWidget::geometry(), QWidget::internalWinId(), QList< T >::last(), mouseButtonPressTime, mouseGlobalXPos, mouseGlobalYPos, Qt::PopupFocusReason, popupGrabOk, popupWidgets, qt_button_down, qt_nograb(), qt_popup_down, QList< T >::removeAll(), replayPopupMouseEvent, QWidget::setFocus(), QWidget::testAttribute(), Qt::WA_NoMouseReplay, Qt::WA_WState_Created, X11, and XNone.
03249 { 03250 Q_Q(QApplication); 03251 if (!QApplicationPrivate::popupWidgets) 03252 return; 03253 QApplicationPrivate::popupWidgets->removeAll(popup); 03254 if (popup == qt_popup_down) { 03255 qt_button_down = 0; 03256 qt_popup_down = 0; 03257 } 03258 if (QApplicationPrivate::popupWidgets->count() == 0) { // this was the last popup 03259 delete QApplicationPrivate::popupWidgets; 03260 QApplicationPrivate::popupWidgets = 0; 03261 if (!qt_nograb() && popupGrabOk) { // grabbing not disabled 03262 Display *dpy = X11->display; 03263 if (popup->geometry().contains(QPoint(mouseGlobalXPos, mouseGlobalYPos)) 03264 || popup->testAttribute(Qt::WA_NoMouseReplay)) { 03265 // mouse release event or inside 03266 replayPopupMouseEvent = false; 03267 } else { // mouse press event 03268 mouseButtonPressTime -= 10000; // avoid double click 03269 replayPopupMouseEvent = true; 03270 } 03271 XUngrabPointer(dpy, X11->time); 03272 XUngrabKeyboard(dpy, X11->time); 03273 XFlush(dpy); 03274 } 03275 if (QApplicationPrivate::active_window) { 03276 if (QWidget *fw = QApplicationPrivate::active_window->focusWidget()) { 03277 if (fw != QApplication::focusWidget()) { 03278 fw->setFocus(Qt::PopupFocusReason); 03279 } else { 03280 QFocusEvent e(QEvent::FocusIn, Qt::PopupFocusReason); 03281 q->sendEvent(fw, &e); 03282 } 03283 } 03284 } 03285 } else { 03286 // popups are not focus-handled by the window system (the 03287 // first popup grabbed the keyboard), so we have to do that 03288 // manually: A popup was closed, so the previous popup gets 03289 // the focus. 03290 QWidget* aw = QApplicationPrivate::popupWidgets->last(); 03291 if (QWidget *fw = aw->focusWidget()) 03292 fw->setFocus(Qt::PopupFocusReason); 03293 03294 // regrab the keyboard and mouse in case 'popup' lost the grab 03295 if (QApplicationPrivate::popupWidgets->count() == 1 && !qt_nograb()){ // grab mouse/keyboard 03296 Display *dpy = X11->display; 03297 Q_ASSERT(aw->testAttribute(Qt::WA_WState_Created)); 03298 int r = XGrabKeyboard(dpy, aw->internalWinId(), false, 03299 GrabModeAsync, GrabModeAsync, X11->time); 03300 if ((popupGrabOk = (r == GrabSuccess))) { 03301 r = XGrabPointer(dpy, aw->internalWinId(), true, 03302 (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask 03303 | EnterWindowMask | LeaveWindowMask | PointerMotionMask), 03304 GrabModeAsync, GrabModeAsync, XNone, XNone, X11->time); 03305 if (!(popupGrabOk = (r == GrabSuccess))) 03306 XUngrabKeyboard(dpy, X11->time); 03307 } 03308 } 03309 } 03310 }
Here is the call graph for this function:

| void QApplicationPrivate::openPopup | ( | QWidget * | popup | ) |
Definition at line 3212 of file qapplication_x11.cpp.
References QList< T >::append(), QEvent::FocusOut, QWidget::focusWidget(), QApplication::focusWidget(), QWidget::internalWinId(), Qt::PopupFocusReason, popupGrabOk, popupWidgets, qt_nograb(), QWidget::setFocus(), QWidget::testAttribute(), Qt::WA_WState_Created, X11, and XNone.
03213 { 03214 Q_Q(QApplication); 03215 openPopupCount++; 03216 if (!QApplicationPrivate::popupWidgets) { // create list 03217 QApplicationPrivate::popupWidgets = new QWidgetList; 03218 } 03219 QApplicationPrivate::popupWidgets->append(popup); // add to end of list 03220 Display *dpy = X11->display; 03221 if (QApplicationPrivate::popupWidgets->count() == 1 && !qt_nograb()){ // grab mouse/keyboard 03222 Q_ASSERT(popup->testAttribute(Qt::WA_WState_Created)); 03223 int r = XGrabKeyboard(dpy, popup->internalWinId(), false, 03224 GrabModeAsync, GrabModeAsync, X11->time); 03225 if ((popupGrabOk = (r == GrabSuccess))) { 03226 r = XGrabPointer(dpy, popup->internalWinId(), true, 03227 (ButtonPressMask | ButtonReleaseMask | ButtonMotionMask 03228 | EnterWindowMask | LeaveWindowMask | PointerMotionMask), 03229 GrabModeAsync, GrabModeAsync, XNone, XNone, X11->time); 03230 if (!(popupGrabOk = (r == GrabSuccess))) 03231 XUngrabKeyboard(dpy, X11->time); 03232 } 03233 } 03234 03235 // popups are not focus-handled by the window system (the first 03236 // popup grabbed the keyboard), so we have to do that manually: A 03237 // new popup gets the focus 03238 if (popup->focusWidget()) { 03239 popup->focusWidget()->setFocus(Qt::PopupFocusReason); 03240 } else if (QApplicationPrivate::popupWidgets->count() == 1) { // this was the first popup 03241 if (QWidget *fw = QApplication::focusWidget()) { 03242 QFocusEvent e(QEvent::FocusOut, Qt::PopupFocusReason); 03243 q->sendEvent(fw, &e); 03244 } 03245 } 03246 }
Here is the call graph for this function:

| void QApplicationPrivate::setFocusWidget | ( | QWidget * | focus, | |
| Qt::FocusReason | reason | |||
| ) | [static] |
Definition at line 1764 of file qapplication.cpp.
References Qt::BacktabFocusReason, emit, focus_widget, QEvent::FocusIn, QEvent::FocusOut, QWidget::inputContext(), Qt::MenuBarFocusReason, Qt::NoFocusReason, Qt::PopupFocusReason, qApp, qt_in_tab_key_event, QInputContext::reset(), QCoreApplication::sendEvent(), QWidget::setAttribute(), QInputContext::setFocusWidget(), Qt::ShortcutFocusReason, QWidget::style(), Qt::TabFocusReason, QWidget::testAttribute(), Qt::WA_KeyboardFocusChange, Qt::WA_WState_Created, and QWidget::window().
Referenced by QWidget::clearFocus(), QApplication::setActiveWindow(), and QWidget::setFocus().
01765 { 01766 if (focus != focus_widget) { 01767 if (focus && (reason == Qt::BacktabFocusReason || reason == Qt::TabFocusReason) 01768 && qt_in_tab_key_event) 01769 focus->window()->setAttribute(Qt::WA_KeyboardFocusChange); 01770 else if (focus && reason == Qt::ShortcutFocusReason) { 01771 focus->window()->setAttribute(Qt::WA_KeyboardFocusChange); 01772 } 01773 QWidget *prev = focus_widget; 01774 01775 if (prev && reason != Qt::PopupFocusReason && reason != Qt::MenuBarFocusReason) { 01776 QInputContext *qic = prev->inputContext(); 01777 if(qic) { 01778 qic->reset(); 01779 qic->setFocusWidget(0); 01780 } 01781 } 01782 01783 focus_widget = focus; 01784 01785 if (reason != Qt::NoFocusReason) { 01786 01787 //send events 01788 if (prev) { 01789 #ifdef QT_KEYPAD_NAVIGATION 01790 if (QApplication::keypadNavigationEnabled()) { 01791 if (prev->hasEditFocus()) 01792 prev->setEditFocus(false); 01793 } 01794 #endif 01795 QFocusEvent out(QEvent::FocusOut, reason); 01796 QStyle *style = prev->style(); 01797 QApplication::sendEvent(prev, &out); 01798 QApplication::sendEvent(style, &out); 01799 } 01800 if(focus && QApplicationPrivate::focus_widget == focus) { 01801 QInputContext *qic = focus->inputContext(); 01802 if (qic && focus_widget->testAttribute(Qt::WA_WState_Created)) 01803 qic->setFocusWidget( focus_widget ); 01804 QFocusEvent in(QEvent::FocusIn, reason); 01805 QApplication::sendEvent(focus, &in); 01806 QApplication::sendEvent(focus->style(), &in); 01807 } 01808 } 01809 emit qApp->focusChanged(prev, focus_widget); 01810 } 01811 }
Here is the call graph for this function:

internal Helper function that returns the new focus widget, but does not set the focus reason. Returns 0 if a new focus widget could not be found.
Definition at line 2103 of file qapplication.cpp.
References QWidget::focusPolicy(), QWidget::focusWidget(), QWidget::isAncestorOf(), QWidget::isEnabled(), QWidget::isVisibleTo(), qt_in_tab_key_event, qt_tab_all_widgets, Qt::StrongFocus, Qt::SubWindow, Qt::TabFocus, w, Qt::WA_KeyboardFocusChange, and QWidget::windowType().
Referenced by QWidget::focusNextPrevChild(), and QApplication::setActiveWindow().
02104 { 02105 uint focus_flag = qt_tab_all_widgets ? Qt::TabFocus : Qt::StrongFocus; 02106 02107 QWidget *f = toplevel->focusWidget(); 02108 if (!f) 02109 f = toplevel; 02110 02111 QWidget *w = f; 02112 QWidget *test = f->d_func()->focus_next; 02113 while (test && test != f) { 02114 if ((test->focusPolicy() & focus_flag) == focus_flag 02115 && !(test->d_func()->extra && test->d_func()->extra->focus_proxy) 02116 && test->isVisibleTo(toplevel) && test->isEnabled() 02117 && (toplevel->windowType() != Qt::SubWindow || toplevel->isAncestorOf(test))) { 02118 w = test; 02119 if (next) 02120 break; 02121 } 02122 test = test->d_func()->focus_next; 02123 } 02124 if (w == f) { 02125 if (qt_in_tab_key_event) { 02126 w->window()->setAttribute(Qt::WA_KeyboardFocusChange); 02127 w->update(); 02128 } 02129 return 0; 02130 } 02131 return w; 02132 }
Here is the call graph for this function:

| void QApplicationPrivate::setSystemPalette | ( | const QPalette & | pal | ) | [static] |
Definition at line 1531 of file qapplication.cpp.
References QPalette::color(), QColormap::colorAt(), g, QColormap::instance(), QPalette::NColorGroups, QPalette::NColorRoles, QColormap::pixel(), set_pal, QPalette::setColor(), QApplication::setPalette(), and sys_pal.
Referenced by qt_set_x11_resources(), QApplication::setStyle(), and QApplication::style().
01532 { 01533 QPalette adjusted; 01534 01535 #if 0 01536 // adjust the system palette to avoid dithering 01537 QColormap cmap = QColormap::instance(); 01538 if (cmap.depths() > 4 && cmap.depths() < 24) { 01539 for (int g = 0; g < QPalette::NColorGroups; g++) 01540 for (int i = 0; i < QPalette::NColorRoles; i++) { 01541 QColor color = pal.color((QPalette::ColorGroup)g, (QPalette::ColorRole)i); 01542 color = cmap.colorAt(cmap.pixel(color)); 01543 adjusted.setColor((QPalette::ColorGroup)g, (QPalette::ColorRole) i, color); 01544 } 01545 } 01546 #else 01547 adjusted = pal; 01548 #endif 01549 01550 if (!sys_pal) 01551 sys_pal = new QPalette(adjusted); 01552 else 01553 *sys_pal = adjusted; 01554 01555 01556 if (!QApplicationPrivate::set_pal) 01557 QApplication::setPalette(*sys_pal); 01558 }
Here is the call graph for this function:

| void QApplicationPrivate::setPalette_helper | ( | const QPalette & | palette, | |
| const char * | className, | |||
| bool | clearWidgetPaletteHash | |||
| ) | [static] |
Definition at line 1468 of file qapplication.cpp.
References QApplication::allWidgets(), app_pal, app_style, QEvent::ApplicationPaletteChange, QHash< Key, T >::clear(), QList< T >::constBegin(), QList< T >::constEnd(), QHash< Key, T >::insert(), QCoreApplicationPrivate::is_app_closing, QCoreApplicationPrivate::is_app_running, QPalette::isCopyOf(), palette, QStyle::polish(), QCoreApplication::sendEvent(), set_pal, QHash< Key, T >::size(), sys_pal, and w.
Referenced by QApplication::setPalette(), and QApplication::setStyle().
01469 { 01470 QPalette pal = palette; 01471 01472 if (QApplicationPrivate::app_style) 01473 QApplicationPrivate::app_style->polish(pal); // NB: non-const reference 01474 01475 bool all = false; 01476 PaletteHash *hash = app_palettes(); 01477 if (!className) { 01478 if (QApplicationPrivate::app_pal && pal.isCopyOf(*QApplicationPrivate::app_pal)) 01479 return; 01480 if (!QApplicationPrivate::app_pal) 01481 QApplicationPrivate::app_pal = new QPalette(pal); 01482 else 01483 *QApplicationPrivate::app_pal = pal; 01484 if (hash && hash->size()) { 01485 all = true; 01486 if (clearWidgetPaletteHash) 01487 hash->clear(); 01488 } 01489 } else if (hash) { 01490 hash->insert(className, pal); 01491 } 01492 01493 if (QApplicationPrivate::is_app_running && !QApplicationPrivate::is_app_closing) { 01494 QEvent e(QEvent::ApplicationPaletteChange); 01495 QWidgetList wids = QApplication::allWidgets(); 01496 for (QWidgetList::ConstIterator it = wids.constBegin(); it != wids.constEnd(); ++it) { 01497 register QWidget *w = *it; 01498 if (all || (!className && w->isWindow()) || w->inherits(className)) // matching class 01499 QApplication::sendEvent(w, &e); 01500 } 01501 } 01502 if (!className && (!QApplicationPrivate::sys_pal || !palette.isCopyOf(*QApplicationPrivate::sys_pal))) { 01503 if (!QApplicationPrivate::set_pal) 01504 QApplicationPrivate::set_pal = new QPalette(palette); 01505 else 01506 *QApplicationPrivate::set_pal = palette; 01507 } 01508 }
Here is the call graph for this function:

| void QApplicationPrivate::initializeWidgetPaletteHash | ( | ) | [static] |
| static QApplicationPrivate* QApplicationPrivate::instance | ( | ) | [inline, static] |
Definition at line 305 of file qapplication_p.h.
Referenced by dispatchEnterLeave(), QWidgetPrivate::setMinimumSize_helper(), and QKeyMapperPrivate::translateKeyEvent().
| void QApplicationPrivate::_q_tryEmitLastWindowClosed | ( | ) |
Definition at line 4064 of file qapplication.cpp.
References QList< T >::at(), emitLastWindowClosed(), QList< T >::size(), QApplication::topLevelWidgets(), w, and Qt::WA_QuitOnClose.
04065 { 04066 /* if there is no non-withdrawn primary window left (except 04067 the ones without QuitOnClose), we emit the lastWindowClosed 04068 signal */ 04069 QWidgetList list = QApplication::topLevelWidgets(); 04070 bool lastWindowClosed = true; 04071 for (int i = 0; i < list.size(); ++i) { 04072 QWidget *w = list.at(i); 04073 if (!w->isVisible() 04074 || (w->parentWidget() && w->parentWidget()->isVisible()) 04075 || !w->testAttribute(Qt::WA_QuitOnClose)) { 04076 continue; 04077 } 04078 lastWindowClosed = false; 04079 break; 04080 } 04081 if (lastWindowClosed) 04082 emitLastWindowClosed(); 04083 }
Here is the call graph for this function:

bool QApplicationPrivate::quitOnLastWindowClosed [static] |
Definition at line 164 of file qapplication_p.h.
Referenced by emitLastWindowClosed(), QApplicationPrivate(), QApplication::quitOnLastWindowClosed(), and QApplication::setQuitOnLastWindowClosed().
Definition at line 219 of file qapplication_p.h.
Referenced by process_cmdline(), and QApplicationPrivate().
Definition at line 223 of file qapplication_p.h.
Definition at line 226 of file qapplication_p.h.
Definition at line 226 of file qapplication_p.h.
Definition at line 227 of file qapplication_p.h.
Definition at line 227 of file qapplication_p.h.
Definition at line 228 of file qapplication_p.h.
Definition at line 230 of file qapplication_p.h.
QInputContext * QApplicationPrivate::inputContext [static] |
Qt::MouseButtons QApplicationPrivate::mouse_buttons [static] |
Definition at line 248 of file qapplication_p.h.
Referenced by QApplication::mouseButtons(), and QApplication::notify().
Qt::KeyboardModifiers QApplicationPrivate::modifier_buttons [static] |
Definition at line 249 of file qapplication_p.h.
Referenced by QApplication::keyboardModifiers(), and QApplication::notify().
QSize QApplicationPrivate::app_strut [static] |
Definition at line 251 of file qapplication_p.h.
Referenced by QApplication::globalStrut(), QApplication::setGlobalStrut(), and QApplication::~QApplication().
QWidgetList * QApplicationPrivate::popupWidgets [static] |
Definition at line 252 of file qapplication_p.h.
Referenced by QApplication::activePopupWidget(), closePopup(), inPopupMode(), openPopup(), and QApplication::setActiveWindow().
QStyle * QApplicationPrivate::app_style [static] |
Definition at line 253 of file qapplication_p.h.
Referenced by setPalette_helper(), QApplication::setStyle(), QApplication::setStyleSheet(), QApplication::style(), and QApplication::~QApplication().
int QApplicationPrivate::app_cspec [static] |
Definition at line 254 of file qapplication_p.h.
Referenced by QApplication::colorSpec(), and QApplication::setColorSpec().
QPalette * QApplicationPrivate::app_pal [static] |
Definition at line 255 of file qapplication_p.h.
Referenced by QApplication::palette(), setPalette_helper(), and QApplication::~QApplication().
QPalette * QApplicationPrivate::sys_pal [static] |
Definition at line 256 of file qapplication_p.h.
Referenced by qt_set_x11_resources(), setPalette_helper(), QApplication::setStyle(), setSystemPalette(), QApplication::style(), and QApplication::~QApplication().
QPalette * QApplicationPrivate::set_pal [static] |
Definition at line 257 of file qapplication_p.h.
Referenced by setPalette_helper(), QApplication::setStyle(), setSystemPalette(), QApplication::style(), and QApplication::~QApplication().
QFont * QApplicationPrivate::app_font [static] |
Definition at line 258 of file qapplication_p.h.
Referenced by QApplication::font(), QApplication::setFont(), and QApplication::~QApplication().
QWidget * QApplicationPrivate::main_widget [static] |
Definition at line 259 of file qapplication_p.h.
Referenced by QWidgetPrivate::close_helper(), and QWidget::~QWidget().
QWidget * QApplicationPrivate::focus_widget [static] |
Definition at line 260 of file qapplication_p.h.
Referenced by QApplication::focusWidget(), QApplication::setActiveWindow(), setFocusWidget(), and QApplication::setStyle().
QWidget * QApplicationPrivate::active_window [static] |
Definition at line 261 of file qapplication_p.h.
Referenced by QApplication::activeWindow(), closePopup(), and QApplication::setActiveWindow().
QIcon * QApplicationPrivate::app_icon [static] |
Definition at line 262 of file qapplication_p.h.
Referenced by QApplication::setWindowIcon(), QApplication::windowIcon(), and QApplication::~QApplication().
bool QApplicationPrivate::obey_desktop_settings [static] |
Definition at line 263 of file qapplication_p.h.
Referenced by QApplication::desktopSettingsAware(), QApplication::setDesktopSettingsAware(), and QApplication::~QApplication().
int QApplicationPrivate::cursor_flash_time [static] |
Definition at line 264 of file qapplication_p.h.
Referenced by QApplication::cursorFlashTime(), QApplication::setCursorFlashTime(), and QApplication::~QApplication().
int QApplicationPrivate::mouse_double_click_time [static] |
Definition at line 265 of file qapplication_p.h.
Referenced by QApplication::doubleClickInterval(), QApplication::setDoubleClickInterval(), and QApplication::~QApplication().
int QApplicationPrivate::keyboard_input_time [static] |
Definition at line 266 of file qapplication_p.h.
Referenced by QApplication::keyboardInputInterval(), QApplication::setKeyboardInputInterval(), and QApplication::~QApplication().
int QApplicationPrivate::wheel_scroll_lines [static] |
Definition at line 267 of file qapplication_p.h.
Referenced by QApplication::setWheelScrollLines(), QApplication::wheelScrollLines(), and QApplication::~QApplication().
bool QApplicationPrivate::animate_ui [static] |
Definition at line 269 of file qapplication_p.h.
Referenced by QApplication::isEffectEnabled(), QApplication::setEffectEnabled(), and QApplication::~QApplication().
bool QApplicationPrivate::animate_menu [static] |
Definition at line 270 of file qapplication_p.h.
Referenced by QApplication::isEffectEnabled(), QApplication::setEffectEnabled(), and QApplication::~QApplication().
bool QApplicationPrivate::animate_tooltip [static] |
Definition at line 271 of file qapplication_p.h.
Referenced by QApplication::isEffectEnabled(), QApplication::setEffectEnabled(), and QApplication::~QApplication().
bool QApplicationPrivate::animate_combo [static] |
Definition at line 272 of file qapplication_p.h.
Referenced by QApplication::isEffectEnabled(), QApplication::setEffectEnabled(), and QApplication::~QApplication().
bool QApplicationPrivate::fade_menu [static] |
Definition at line 273 of file qapplication_p.h.
Referenced by QApplication::isEffectEnabled(), QApplication::setEffectEnabled(), and QApplication::~QApplication().
bool QApplicationPrivate::fade_tooltip [static] |
Definition at line 274 of file qapplication_p.h.
Referenced by QApplication::isEffectEnabled(), QApplication::setEffectEnabled(), and QApplication::~QApplication().
bool QApplicationPrivate::animate_toolbox [static] |
Definition at line 275 of file qapplication_p.h.
Referenced by QApplication::isEffectEnabled(), and QApplication::setEffectEnabled().
bool QApplicationPrivate::widgetCount [static] |
Definition at line 276 of file qapplication_p.h.
Referenced by process_cmdline(), and QApplication::~QApplication().
QString * QApplicationPrivate::styleOverride [static] |
Definition at line 307 of file qapplication_p.h.
Referenced by process_cmdline(), and QApplication::style().
int QApplicationPrivate::app_compile_version [static] |
Definition at line 309 of file qapplication_p.h.
Referenced by QWidgetPrivate::init(), QApplication::QApplication(), and QWidget::setParent().
QString QApplicationPrivate::styleSheet [static] |
Definition at line 317 of file qapplication_p.h.
Referenced by QApplication::setStyle(), QApplication::setStyleSheet(), and QApplication::styleSheet().
QApplicationPrivate * QApplicationPrivate::self [static, private] |
Definition at line 324 of file qapplication_p.h.
1.5.1