195 , usesDoubleBufferedGLContext(0) |
195 , usesDoubleBufferedGLContext(0) |
196 #if defined(Q_WS_X11) |
196 #if defined(Q_WS_X11) |
197 , picture(0) |
197 , picture(0) |
198 #elif defined(Q_WS_WIN) |
198 #elif defined(Q_WS_WIN) |
199 , noPaintOnScreen(0) |
199 , noPaintOnScreen(0) |
|
200 , nativeGesturePanEnabled(0) |
200 #elif defined(Q_WS_MAC) |
201 #elif defined(Q_WS_MAC) |
201 , needWindowChange(0) |
202 , needWindowChange(0) |
202 , isGLWidget(0) |
203 , isGLWidget(0) |
203 , window_event(0) |
204 , window_event(0) |
204 , qd_hd(0) |
205 , qd_hd(0) |
361 If \a enable is true, make this widget have edit focus, in which |
364 If \a enable is true, make this widget have edit focus, in which |
362 case Qt::Key_Up and Qt::Key_Down will be delivered to the widget |
365 case Qt::Key_Up and Qt::Key_Down will be delivered to the widget |
363 normally; otherwise, Qt::Key_Up and Qt::Key_Down are used to |
366 normally; otherwise, Qt::Key_Up and Qt::Key_Down are used to |
364 change focus. |
367 change focus. |
365 |
368 |
366 This feature is only available in Qt for Embedded Linux. |
369 This feature is only available in Qt for Embedded Linux and Qt |
|
370 for Symbian. |
367 |
371 |
368 \sa hasEditFocus(), QApplication::keypadNavigationEnabled() |
372 \sa hasEditFocus(), QApplication::keypadNavigationEnabled() |
369 */ |
373 */ |
370 void QWidget::setEditFocus(bool on) |
374 void QWidget::setEditFocus(bool on) |
371 { |
375 { |
895 |
899 |
896 In Qt, contextual softkeys are added to a widget by calling addAction() and |
900 In Qt, contextual softkeys are added to a widget by calling addAction() and |
897 passing a \c QAction with a softkey role set on it. When the widget |
901 passing a \c QAction with a softkey role set on it. When the widget |
898 containing the softkey actions has focus, its softkeys should appear in |
902 containing the softkey actions has focus, its softkeys should appear in |
899 the user interface. Softkeys are discovered by traversing the widget |
903 the user interface. Softkeys are discovered by traversing the widget |
900 heirarchy so it is possible to define a single set of softkeys that are |
904 hierarchy so it is possible to define a single set of softkeys that are |
901 present at all times by calling addAction() for a given top level widget. |
905 present at all times by calling addAction() for a given top level widget. |
902 |
906 |
903 On some platforms, this concept overlaps with \c QMenuBar such that if no |
907 On some platforms, this concept overlaps with \c QMenuBar such that if no |
904 other softkeys are found and the top level widget is a QMainWindow containing |
908 other softkeys are found and the top level widget is a QMainWindow containing |
905 a QMenuBar, the menubar actions may appear on one of the softkeys. |
909 a QMenuBar, the menubar actions may appear on one of the softkeys. |
1547 { |
1551 { |
1548 if (!extra) { // if not exists |
1552 if (!extra) { // if not exists |
1549 extra = new QWExtra; |
1553 extra = new QWExtra; |
1550 extra->glContext = 0; |
1554 extra->glContext = 0; |
1551 extra->topextra = 0; |
1555 extra->topextra = 0; |
|
1556 #ifndef QT_NO_GRAPHICSVIEW |
1552 extra->proxyWidget = 0; |
1557 extra->proxyWidget = 0; |
|
1558 #endif |
1553 #ifndef QT_NO_CURSOR |
1559 #ifndef QT_NO_CURSOR |
1554 extra->curs = 0; |
1560 extra->curs = 0; |
1555 #endif |
1561 #endif |
1556 extra->minw = 0; |
1562 extra->minw = 0; |
1557 extra->minh = 0; |
1563 extra->minh = 0; |
1697 */ |
1703 */ |
1698 void QWidgetPrivate::propagatePaletteChange() |
1704 void QWidgetPrivate::propagatePaletteChange() |
1699 { |
1705 { |
1700 Q_Q(QWidget); |
1706 Q_Q(QWidget); |
1701 // Propagate a new inherited mask to all children. |
1707 // Propagate a new inherited mask to all children. |
|
1708 #ifndef QT_NO_GRAPHICSVIEW |
1702 if (!q->parentWidget() && extra && extra->proxyWidget) { |
1709 if (!q->parentWidget() && extra && extra->proxyWidget) { |
1703 #ifndef QT_NO_GRAPHICSVIEW |
|
1704 QGraphicsProxyWidget *p = extra->proxyWidget; |
1710 QGraphicsProxyWidget *p = extra->proxyWidget; |
1705 inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve(); |
1711 inheritedPaletteResolveMask = p->d_func()->inheritedPaletteResolveMask | p->palette().resolve(); |
|
1712 } else |
1706 #endif //QT_NO_GRAPHICSVIEW |
1713 #endif //QT_NO_GRAPHICSVIEW |
1707 } else if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { |
1714 if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { |
1708 inheritedPaletteResolveMask = 0; |
1715 inheritedPaletteResolveMask = 0; |
1709 } |
1716 } |
1710 int mask = data.pal.resolve() | inheritedPaletteResolveMask; |
1717 int mask = data.pal.resolve() | inheritedPaletteResolveMask; |
1711 |
1718 |
1712 QEvent pc(QEvent::PaletteChange); |
1719 QEvent pc(QEvent::PaletteChange); |
1801 w->graphicsEffect()->source()->d_func()->invalidateCache(); |
1809 w->graphicsEffect()->source()->d_func()->invalidateCache(); |
1802 } |
1810 } |
1803 w = w->parentWidget(); |
1811 w = w->parentWidget(); |
1804 } while (w); |
1812 } while (w); |
1805 } |
1813 } |
|
1814 #endif //QT_NO_GRAPHICSEFFECT |
1806 |
1815 |
1807 void QWidgetPrivate::setDirtyOpaqueRegion() |
1816 void QWidgetPrivate::setDirtyOpaqueRegion() |
1808 { |
1817 { |
1809 Q_Q(QWidget); |
1818 Q_Q(QWidget); |
1810 |
1819 |
1811 dirtyOpaqueChildren = true; |
1820 dirtyOpaqueChildren = true; |
1812 |
1821 |
|
1822 #ifndef QT_NO_GRAPHICSEFFECT |
1813 invalidateGraphicsEffectsRecursively(); |
1823 invalidateGraphicsEffectsRecursively(); |
|
1824 #endif //QT_NO_GRAPHICSEFFECT |
1814 |
1825 |
1815 if (q->isWindow()) |
1826 if (q->isWindow()) |
1816 return; |
1827 return; |
1817 |
1828 |
1818 QWidget *parent = q->parentWidget(); |
1829 QWidget *parent = q->parentWidget(); |
1823 QWidgetPrivate *pd = parent->d_func(); |
1834 QWidgetPrivate *pd = parent->d_func(); |
1824 if (!pd->dirtyOpaqueChildren) |
1835 if (!pd->dirtyOpaqueChildren) |
1825 pd->setDirtyOpaqueRegion(); |
1836 pd->setDirtyOpaqueRegion(); |
1826 } |
1837 } |
1827 |
1838 |
1828 QRegion QWidgetPrivate::getOpaqueRegion() const |
|
1829 { |
|
1830 Q_Q(const QWidget); |
|
1831 |
|
1832 QRegion r = isOpaque ? q->rect() : getOpaqueChildren(); |
|
1833 if (extra && extra->hasMask) |
|
1834 r &= extra->mask; |
|
1835 if (r.isEmpty()) |
|
1836 return r; |
|
1837 return r & clipRect(); |
|
1838 } |
|
1839 |
|
1840 const QRegion &QWidgetPrivate::getOpaqueChildren() const |
1839 const QRegion &QWidgetPrivate::getOpaqueChildren() const |
1841 { |
1840 { |
1842 if (!dirtyOpaqueChildren) |
1841 if (!dirtyOpaqueChildren) |
1843 return opaqueChildren; |
1842 return opaqueChildren; |
1844 |
1843 |
1849 QWidget *child = qobject_cast<QWidget *>(children.at(i)); |
1848 QWidget *child = qobject_cast<QWidget *>(children.at(i)); |
1850 if (!child || !child->isVisible() || child->isWindow()) |
1849 if (!child || !child->isVisible() || child->isWindow()) |
1851 continue; |
1850 continue; |
1852 |
1851 |
1853 const QPoint offset = child->geometry().topLeft(); |
1852 const QPoint offset = child->geometry().topLeft(); |
1854 that->opaqueChildren += child->d_func()->getOpaqueRegion().translated(offset); |
1853 QWidgetPrivate *childd = child->d_func(); |
1855 } |
1854 QRegion r = childd->isOpaque ? child->rect() : childd->getOpaqueChildren(); |
1856 |
1855 if (childd->extra && childd->extra->hasMask) |
|
1856 r &= childd->extra->mask; |
|
1857 if (r.isEmpty()) |
|
1858 continue; |
|
1859 r.translate(offset); |
|
1860 that->opaqueChildren += r; |
|
1861 } |
|
1862 |
|
1863 that->opaqueChildren &= q_func()->rect(); |
1857 that->dirtyOpaqueChildren = false; |
1864 that->dirtyOpaqueChildren = false; |
1858 |
1865 |
1859 return that->opaqueChildren; |
1866 return that->opaqueChildren; |
1860 } |
1867 } |
1861 |
1868 |
1961 Q_Q(const QWidget); |
1968 Q_Q(const QWidget); |
1962 |
1969 |
1963 const QWidget *w = q; |
1970 const QWidget *w = q; |
1964 QPoint offset; |
1971 QPoint offset; |
1965 |
1972 |
|
1973 #ifndef QT_NO_GRAPHICSEFFECT |
1966 if (graphicsEffect) { |
1974 if (graphicsEffect) { |
1967 w = q->parentWidget(); |
1975 w = q->parentWidget(); |
1968 offset -= data.crect.topLeft(); |
1976 offset -= data.crect.topLeft(); |
1969 } |
1977 } |
|
1978 #endif //QT_NO_GRAPHICSEFFECT |
1970 |
1979 |
1971 while (w) { |
1980 while (w) { |
1972 const QWidgetPrivate *wd = w->d_func(); |
1981 const QWidgetPrivate *wd = w->d_func(); |
1973 if (wd->extra && wd->extra->hasMask) |
1982 if (wd->extra && wd->extra->hasMask) |
1974 region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask; |
1983 region &= (w != q) ? wd->extra->mask.translated(offset) : wd->extra->mask; |
1999 void QWidgetPrivate::updateIsOpaque() |
2008 void QWidgetPrivate::updateIsOpaque() |
2000 { |
2009 { |
2001 // hw: todo: only needed if opacity actually changed |
2010 // hw: todo: only needed if opacity actually changed |
2002 setDirtyOpaqueRegion(); |
2011 setDirtyOpaqueRegion(); |
2003 |
2012 |
|
2013 #ifndef QT_NO_GRAPHICSEFFECT |
2004 if (graphicsEffect) { |
2014 if (graphicsEffect) { |
2005 // ### We should probably add QGraphicsEffect::isOpaque at some point. |
2015 // ### We should probably add QGraphicsEffect::isOpaque at some point. |
2006 setOpaque(false); |
2016 setOpaque(false); |
2007 return; |
2017 return; |
2008 } |
2018 } |
|
2019 #endif //QT_NO_GRAPHICSEFFECT |
2009 |
2020 |
2010 Q_Q(QWidget); |
2021 Q_Q(QWidget); |
2011 #ifdef Q_WS_X11 |
2022 #ifdef Q_WS_X11 |
2012 if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) { |
2023 if (q->testAttribute(Qt::WA_X11OpenGLOverlay)) { |
2013 setOpaque(false); |
2024 setOpaque(false); |
3070 } |
3081 } |
3071 #endif |
3082 #endif |
3072 #if defined(Q_WS_MAC) |
3083 #if defined(Q_WS_MAC) |
3073 setEnabled_helper_sys(enable); |
3084 setEnabled_helper_sys(enable); |
3074 #endif |
3085 #endif |
|
3086 #ifndef QT_NO_IM |
3075 if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) { |
3087 if (q->testAttribute(Qt::WA_InputMethodEnabled) && q->hasFocus()) { |
3076 QInputContext *qic = inputContext(); |
3088 QWidget *focusWidget = effectiveFocusWidget(); |
|
3089 QInputContext *qic = focusWidget->d_func()->inputContext(); |
3077 if (enable) { |
3090 if (enable) { |
3078 qic->setFocusWidget(q); |
3091 qic->setFocusWidget(focusWidget); |
3079 } else { |
3092 } else { |
3080 qic->reset(); |
3093 qic->reset(); |
3081 qic->setFocusWidget(0); |
3094 qic->setFocusWidget(0); |
3082 } |
3095 } |
3083 } |
3096 } |
|
3097 #endif //QT_NO_IM |
3084 QEvent e(QEvent::EnabledChange); |
3098 QEvent e(QEvent::EnabledChange); |
3085 QApplication::sendEvent(q, &e); |
3099 QApplication::sendEvent(q, &e); |
3086 #ifdef QT3_SUPPORT |
3100 #ifdef QT3_SUPPORT |
3087 q->enabledChange(!enable); // compatibility |
3101 q->enabledChange(!enable); // compatibility |
3088 #endif |
3102 #endif |
4377 QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const |
4391 QPalette QWidgetPrivate::naturalWidgetPalette(uint inheritedMask) const |
4378 { |
4392 { |
4379 Q_Q(const QWidget); |
4393 Q_Q(const QWidget); |
4380 QPalette naturalPalette = QApplication::palette(q); |
4394 QPalette naturalPalette = QApplication::palette(q); |
4381 if (!q->testAttribute(Qt::WA_StyleSheet) |
4395 if (!q->testAttribute(Qt::WA_StyleSheet) |
4382 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) || (extra && extra->proxyWidget))) { |
4396 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) |
|
4397 #ifndef QT_NO_GRAPHICSVIEW |
|
4398 || (extra && extra->proxyWidget) |
|
4399 #endif //QT_NO_GRAPHICSVIEW |
|
4400 )) { |
4383 if (QWidget *p = q->parentWidget()) { |
4401 if (QWidget *p = q->parentWidget()) { |
4384 if (!p->testAttribute(Qt::WA_StyleSheet)) { |
4402 if (!p->testAttribute(Qt::WA_StyleSheet)) { |
4385 if (!naturalPalette.isCopyOf(QApplication::palette())) { |
4403 if (!naturalPalette.isCopyOf(QApplication::palette())) { |
4386 QPalette inheritedPalette = p->palette(); |
4404 QPalette inheritedPalette = p->palette(); |
4387 inheritedPalette.resolve(inheritedMask); |
4405 inheritedPalette.resolve(inheritedMask); |
4388 naturalPalette = inheritedPalette.resolve(naturalPalette); |
4406 naturalPalette = inheritedPalette.resolve(naturalPalette); |
4389 } else { |
4407 } else { |
4390 naturalPalette = p->palette(); |
4408 naturalPalette = p->palette(); |
4391 } |
4409 } |
4392 } |
4410 } |
4393 } else if (extra && extra->proxyWidget) { |
4411 } |
4394 #ifndef QT_NO_GRAPHICSVIEW |
4412 #ifndef QT_NO_GRAPHICSVIEW |
|
4413 else if (extra && extra->proxyWidget) { |
4395 QPalette inheritedPalette = extra->proxyWidget->palette(); |
4414 QPalette inheritedPalette = extra->proxyWidget->palette(); |
4396 inheritedPalette.resolve(inheritedMask); |
4415 inheritedPalette.resolve(inheritedMask); |
4397 naturalPalette = inheritedPalette.resolve(naturalPalette); |
4416 naturalPalette = inheritedPalette.resolve(naturalPalette); |
|
4417 } |
4398 #endif //QT_NO_GRAPHICSVIEW |
4418 #endif //QT_NO_GRAPHICSVIEW |
4399 } |
|
4400 } |
4419 } |
4401 naturalPalette.resolve(0); |
4420 naturalPalette.resolve(0); |
4402 return naturalPalette; |
4421 return naturalPalette; |
4403 } |
4422 } |
4404 /*! |
4423 /*! |
4512 QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const |
4531 QFont QWidgetPrivate::naturalWidgetFont(uint inheritedMask) const |
4513 { |
4532 { |
4514 Q_Q(const QWidget); |
4533 Q_Q(const QWidget); |
4515 QFont naturalFont = QApplication::font(q); |
4534 QFont naturalFont = QApplication::font(q); |
4516 if (!q->testAttribute(Qt::WA_StyleSheet) |
4535 if (!q->testAttribute(Qt::WA_StyleSheet) |
4517 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) || (extra && extra->proxyWidget))) { |
4536 && (!q->isWindow() || q->testAttribute(Qt::WA_WindowPropagation) |
|
4537 #ifndef QT_NO_GRAPHICSVIEW |
|
4538 || (extra && extra->proxyWidget) |
|
4539 #endif //QT_NO_GRAPHICSVIEW |
|
4540 )) { |
4518 if (QWidget *p = q->parentWidget()) { |
4541 if (QWidget *p = q->parentWidget()) { |
4519 if (!p->testAttribute(Qt::WA_StyleSheet)) { |
4542 if (!p->testAttribute(Qt::WA_StyleSheet)) { |
4520 if (!naturalFont.isCopyOf(QApplication::font())) { |
4543 if (!naturalFont.isCopyOf(QApplication::font())) { |
4521 QFont inheritedFont = p->font(); |
4544 QFont inheritedFont = p->font(); |
4522 inheritedFont.resolve(inheritedMask); |
4545 inheritedFont.resolve(inheritedMask); |
4523 naturalFont = inheritedFont.resolve(naturalFont); |
4546 naturalFont = inheritedFont.resolve(naturalFont); |
4524 } else { |
4547 } else { |
4525 naturalFont = p->font(); |
4548 naturalFont = p->font(); |
4526 } |
4549 } |
4527 } |
4550 } |
4528 } else if (extra && extra->proxyWidget) { |
4551 } |
4529 #ifndef QT_NO_GRAPHICSVIEW |
4552 #ifndef QT_NO_GRAPHICSVIEW |
|
4553 else if (extra && extra->proxyWidget) { |
4530 QFont inheritedFont = extra->proxyWidget->font(); |
4554 QFont inheritedFont = extra->proxyWidget->font(); |
4531 inheritedFont.resolve(inheritedMask); |
4555 inheritedFont.resolve(inheritedMask); |
4532 naturalFont = inheritedFont.resolve(naturalFont); |
4556 naturalFont = inheritedFont.resolve(naturalFont); |
|
4557 } |
4533 #endif //QT_NO_GRAPHICSVIEW |
4558 #endif //QT_NO_GRAPHICSVIEW |
4534 } |
|
4535 } |
4559 } |
4536 naturalFont.resolve(0); |
4560 naturalFont.resolve(0); |
4537 return naturalFont; |
4561 return naturalFont; |
4538 } |
4562 } |
4539 |
4563 |
4576 #if defined(Q_WS_X11) |
4600 #if defined(Q_WS_X11) |
4577 // make sure the font set on this widget is associated with the correct screen |
4601 // make sure the font set on this widget is associated with the correct screen |
4578 data.fnt.x11SetScreen(xinfo.screen()); |
4602 data.fnt.x11SetScreen(xinfo.screen()); |
4579 #endif |
4603 #endif |
4580 // Combine new mask with natural mask and propagate to children. |
4604 // Combine new mask with natural mask and propagate to children. |
|
4605 #ifndef QT_NO_GRAPHICSVIEW |
4581 if (!q->parentWidget() && extra && extra->proxyWidget) { |
4606 if (!q->parentWidget() && extra && extra->proxyWidget) { |
4582 #ifndef QT_NO_GRAPHICSVIEW |
|
4583 QGraphicsProxyWidget *p = extra->proxyWidget; |
4607 QGraphicsProxyWidget *p = extra->proxyWidget; |
4584 inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve(); |
4608 inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve(); |
|
4609 } else |
4585 #endif //QT_NO_GRAPHICSVIEW |
4610 #endif //QT_NO_GRAPHICSVIEW |
4586 } else if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { |
4611 if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) { |
4587 inheritedFontResolveMask = 0; |
4612 inheritedFontResolveMask = 0; |
4588 } |
4613 } |
4589 uint newMask = data.fnt.resolve() | inheritedFontResolveMask; |
4614 uint newMask = data.fnt.resolve() | inheritedFontResolveMask; |
4590 |
4615 |
4591 for (int i = 0; i < children.size(); ++i) { |
4616 for (int i = 0; i < children.size(); ++i) { |
4651 \brief the layout direction for this widget |
4676 \brief the layout direction for this widget |
4652 |
4677 |
4653 By default, this property is set to Qt::LeftToRight. |
4678 By default, this property is set to Qt::LeftToRight. |
4654 |
4679 |
4655 When the layout direction is set on a widget, it will propagate to |
4680 When the layout direction is set on a widget, it will propagate to |
4656 the widget's children. Children added after the call to \c |
4681 the widget's children, but not to a child that is a window and not |
4657 setLayoutDirection() will not inherit the parent's layout |
4682 to a child for which setLayoutDirection() has been explicitly |
|
4683 called. Also, child widgets added \e after setLayoutDirection() |
|
4684 has been called for the parent do not inherit the parent's layout |
4658 direction. |
4685 direction. |
4659 |
4686 |
4660 \sa QApplication::layoutDirection |
4687 \sa QApplication::layoutDirection |
4661 */ |
4688 */ |
4662 void QWidget::setLayoutDirection(Qt::LayoutDirection direction) |
4689 void QWidget::setLayoutDirection(Qt::LayoutDirection direction) |
5015 the new \a effect. |
5044 the new \a effect. |
5016 |
5045 |
5017 If \a effect is the installed on a different widget, setGraphicsEffect() will remove |
5046 If \a effect is the installed on a different widget, setGraphicsEffect() will remove |
5018 the effect from the widget and install it on this widget. |
5047 the effect from the widget and install it on this widget. |
5019 |
5048 |
|
5049 QWidget takes ownership of \a effect. |
|
5050 |
5020 \note This function will apply the effect on itself and all its children. |
5051 \note This function will apply the effect on itself and all its children. |
5021 |
5052 |
5022 \since 4.6 |
5053 \since 4.6 |
5023 |
5054 |
5024 \sa graphicsEffect() |
5055 \sa graphicsEffect() |
5025 */ |
5056 */ |
|
5057 #ifndef QT_NO_GRAPHICSEFFECT |
5026 void QWidget::setGraphicsEffect(QGraphicsEffect *effect) |
5058 void QWidget::setGraphicsEffect(QGraphicsEffect *effect) |
5027 { |
5059 { |
5028 Q_D(QWidget); |
5060 Q_D(QWidget); |
5029 if (d->graphicsEffect == effect) |
5061 if (d->graphicsEffect == effect) |
5030 return; |
5062 return; |
5031 |
5063 |
5032 if (d->graphicsEffect && effect) { |
5064 if (d->graphicsEffect) { |
|
5065 d->invalidateBuffer(rect()); |
5033 delete d->graphicsEffect; |
5066 delete d->graphicsEffect; |
5034 d->graphicsEffect = 0; |
5067 d->graphicsEffect = 0; |
5035 } |
5068 } |
5036 |
5069 |
5037 if (!effect) { |
5070 if (effect) { |
5038 // Unset current effect. |
|
5039 QGraphicsEffectPrivate *oldEffectPrivate = d->graphicsEffect->d_func(); |
|
5040 d->graphicsEffect = 0; |
|
5041 if (oldEffectPrivate) { |
|
5042 oldEffectPrivate->setGraphicsEffectSource(0); // deletes the current source. |
|
5043 } |
|
5044 } else { |
|
5045 // Set new effect. |
5071 // Set new effect. |
5046 QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this); |
5072 QGraphicsEffectSourcePrivate *sourced = new QWidgetEffectSourcePrivate(this); |
5047 QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced); |
5073 QGraphicsEffectSource *source = new QGraphicsEffectSource(*sourced); |
5048 d->graphicsEffect = effect; |
5074 d->graphicsEffect = effect; |
5049 effect->d_func()->setGraphicsEffectSource(source); |
5075 effect->d_func()->setGraphicsEffectSource(source); |
|
5076 update(); |
5050 } |
5077 } |
5051 |
5078 |
5052 d->updateIsOpaque(); |
5079 d->updateIsOpaque(); |
5053 update(); |
5080 } |
5054 } |
5081 #endif //QT_NO_GRAPHICSEFFECT |
5055 |
5082 |
5056 bool QWidgetPrivate::isAboutToShow() const |
5083 bool QWidgetPrivate::isAboutToShow() const |
5057 { |
5084 { |
5058 if (data.in_show) |
5085 if (data.in_show) |
5059 return true; |
5086 return true; |
5142 const QSize size = rect.size(); |
5169 const QSize size = rect.size(); |
5143 if (size.isNull()) |
5170 if (size.isNull()) |
5144 return; |
5171 return; |
5145 |
5172 |
5146 QPixmap pixmap(size); |
5173 QPixmap pixmap(size); |
5147 if (!(renderFlags & QWidget::DrawWindowBackground) |
5174 if (!(renderFlags & QWidget::DrawWindowBackground) || !isOpaque) |
5148 || !q->palette().brush(q->backgroundRole()).isOpaque()) |
|
5149 pixmap.fill(Qt::transparent); |
5175 pixmap.fill(Qt::transparent); |
5150 q->render(&pixmap, QPoint(), toBePainted, renderFlags); |
5176 q->render(&pixmap, QPoint(), toBePainted, renderFlags); |
5151 |
5177 |
5152 const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform); |
5178 const bool restore = !(painter->renderHints() & QPainter::SmoothPixmapTransform); |
5153 painter->setRenderHints(QPainter::SmoothPixmapTransform, true); |
5179 painter->setRenderHints(QPainter::SmoothPixmapTransform, true); |
5196 { |
5222 { |
5197 if (rgn.isEmpty()) |
5223 if (rgn.isEmpty()) |
5198 return; |
5224 return; |
5199 |
5225 |
5200 Q_Q(QWidget); |
5226 Q_Q(QWidget); |
|
5227 #ifndef QT_NO_GRAPHICSEFFECT |
5201 if (graphicsEffect && graphicsEffect->isEnabled()) { |
5228 if (graphicsEffect && graphicsEffect->isEnabled()) { |
5202 QGraphicsEffectSource *source = graphicsEffect->d_func()->source; |
5229 QGraphicsEffectSource *source = graphicsEffect->d_func()->source; |
5203 QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *> |
5230 QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *> |
5204 (source->d_func()); |
5231 (source->d_func()); |
5205 if (!sourced->context) { |
5232 if (!sourced->context) { |
5209 QPaintEngine *paintEngine = pdev->paintEngine(); |
5236 QPaintEngine *paintEngine = pdev->paintEngine(); |
5210 paintEngine->d_func()->systemClip = rgn.translated(offset); |
5237 paintEngine->d_func()->systemClip = rgn.translated(offset); |
5211 QPainter p(pdev); |
5238 QPainter p(pdev); |
5212 p.translate(offset); |
5239 p.translate(offset); |
5213 context.painter = &p; |
5240 context.painter = &p; |
5214 graphicsEffect->draw(&p, source); |
5241 graphicsEffect->draw(&p); |
5215 paintEngine->d_func()->systemClip = QRegion(); |
5242 paintEngine->d_func()->systemClip = QRegion(); |
5216 } else { |
5243 } else { |
5217 context.painter = sharedPainter; |
5244 context.painter = sharedPainter; |
5218 if (sharedPainter->worldTransform() != sourced->lastEffectTransform) { |
5245 if (sharedPainter->worldTransform() != sourced->lastEffectTransform) { |
5219 sourced->invalidateCache(); |
5246 sourced->invalidateCache(); |
5220 sourced->lastEffectTransform = sharedPainter->worldTransform(); |
5247 sourced->lastEffectTransform = sharedPainter->worldTransform(); |
5221 } |
5248 } |
5222 sharedPainter->save(); |
5249 sharedPainter->save(); |
5223 sharedPainter->translate(offset); |
5250 sharedPainter->translate(offset); |
5224 graphicsEffect->draw(sharedPainter, source); |
5251 graphicsEffect->draw(sharedPainter); |
5225 sharedPainter->restore(); |
5252 sharedPainter->restore(); |
5226 } |
5253 } |
5227 sourced->context = 0; |
5254 sourced->context = 0; |
5228 return; |
5255 return; |
5229 } |
5256 } |
5230 } |
5257 } |
|
5258 #endif //QT_NO_GRAFFICSEFFECT |
5231 |
5259 |
5232 const bool asRoot = flags & DrawAsRoot; |
5260 const bool asRoot = flags & DrawAsRoot; |
5233 const bool alsoOnScreen = flags & DrawPaintOnScreen; |
5261 const bool alsoOnScreen = flags & DrawPaintOnScreen; |
5234 const bool recursive = flags & DrawRecursive; |
5262 const bool recursive = flags & DrawRecursive; |
5235 const bool alsoInvisible = flags & DrawInvisible; |
5263 const bool alsoInvisible = flags & DrawInvisible; |
5380 return; |
5408 return; |
5381 |
5409 |
5382 QWidgetPrivate *wd = w->d_func(); |
5410 QWidgetPrivate *wd = w->d_func(); |
5383 const QPoint widgetPos(w->data->crect.topLeft()); |
5411 const QPoint widgetPos(w->data->crect.topLeft()); |
5384 const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect; |
5412 const bool hasMask = wd->extra && wd->extra->hasMask && !wd->graphicsEffect; |
5385 |
|
5386 if (index > 0) { |
5413 if (index > 0) { |
5387 QRegion wr(rgn); |
5414 QRegion wr(rgn); |
5388 if (wd->isOpaque) |
5415 if (wd->isOpaque) |
5389 wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect; |
5416 wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect; |
5390 paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags |
5417 paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags |
5392 , currentSurface |
5419 , currentSurface |
5393 #endif |
5420 #endif |
5394 , sharedPainter, backingStore); |
5421 , sharedPainter, backingStore); |
5395 } |
5422 } |
5396 |
5423 |
5397 if (w->updatesEnabled() && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget)) { |
5424 if (w->updatesEnabled() |
|
5425 #ifndef QT_NO_GRAPHICSVIEW |
|
5426 && (!w->d_func()->extra || !w->d_func()->extra->proxyWidget) |
|
5427 #endif //QT_NO_GRAPHICSVIEW |
|
5428 ) { |
5398 QRegion wRegion(rgn); |
5429 QRegion wRegion(rgn); |
5399 wRegion &= wd->effectiveRectFor(w->data->crect); |
5430 wRegion &= wd->effectiveRectFor(w->data->crect); |
5400 wRegion.translate(-widgetPos); |
5431 wRegion.translate(-widgetPos); |
5401 if (hasMask) |
5432 if (hasMask) |
5402 wRegion &= wd->extra->mask; |
5433 wRegion &= wd->extra->mask; |
5403 wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, backingStore); |
5434 wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, backingStore); |
5404 } |
5435 } |
5405 } |
5436 } |
5406 |
5437 |
|
5438 #ifndef QT_NO_GRAPHICSEFFECT |
5407 QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const |
5439 QRectF QWidgetEffectSourcePrivate::boundingRect(Qt::CoordinateSystem system) const |
5408 { |
5440 { |
5409 if (system != Qt::DeviceCoordinates) |
5441 if (system != Qt::DeviceCoordinates) |
5410 return m_widget->rect(); |
5442 return m_widget->rect(); |
5411 |
5443 |
5435 |
5467 |
5436 wd->drawWidget(context->pdev, toBePainted, context->offset, context->flags, |
5468 wd->drawWidget(context->pdev, toBePainted, context->offset, context->flags, |
5437 context->sharedPainter, context->backingStore); |
5469 context->sharedPainter, context->backingStore); |
5438 } |
5470 } |
5439 |
5471 |
5440 QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset) const |
5472 QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, |
|
5473 QGraphicsEffect::PixmapPadMode mode) const |
5441 { |
5474 { |
5442 const bool deviceCoordinates = (system == Qt::DeviceCoordinates); |
5475 const bool deviceCoordinates = (system == Qt::DeviceCoordinates); |
5443 if (!context && deviceCoordinates) { |
5476 if (!context && deviceCoordinates) { |
5444 // Device coordinates without context not yet supported. |
5477 // Device coordinates without context not yet supported. |
5445 qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); |
5478 qWarning("QGraphicsEffectSource::pixmap: Not yet implemented, lacking device context"); |
5453 const QTransform &painterTransform = context->painter->worldTransform(); |
5486 const QTransform &painterTransform = context->painter->worldTransform(); |
5454 sourceRect = painterTransform.mapRect(sourceRect); |
5487 sourceRect = painterTransform.mapRect(sourceRect); |
5455 pixmapOffset = painterTransform.map(pixmapOffset); |
5488 pixmapOffset = painterTransform.map(pixmapOffset); |
5456 } |
5489 } |
5457 |
5490 |
5458 QRect effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect(); |
5491 |
|
5492 QRect effectRect; |
|
5493 |
|
5494 if (mode == QGraphicsEffect::PadToEffectiveBoundingRect) { |
|
5495 effectRect = m_widget->graphicsEffect()->boundingRectFor(sourceRect).toAlignedRect(); |
|
5496 |
|
5497 } else if (mode == QGraphicsEffect::PadToTransparentBorder) { |
|
5498 effectRect = sourceRect.adjusted(-1, -1, 1, 1).toAlignedRect(); |
|
5499 |
|
5500 } else { |
|
5501 effectRect = sourceRect.toAlignedRect(); |
|
5502 |
|
5503 } |
|
5504 |
5459 if (offset) |
5505 if (offset) |
5460 *offset = effectRect.topLeft(); |
5506 *offset = effectRect.topLeft(); |
5461 |
5507 |
5462 if (deviceCoordinates) { |
5508 if (deviceCoordinates) { |
5463 // Clip to device rect. |
5509 // Clip to device rect. |
5993 tell it that it is about to lose the focus. Then a focus in event |
6040 tell it that it is about to lose the focus. Then a focus in event |
5994 is sent to this widget to tell it that it just received the focus. |
6041 is sent to this widget to tell it that it just received the focus. |
5995 (Nothing happens if the focus in and focus out widgets are the |
6042 (Nothing happens if the focus in and focus out widgets are the |
5996 same.) |
6043 same.) |
5997 |
6044 |
|
6045 \note On embedded platforms, setFocus() will not cause an input panel |
|
6046 to be opened by the input method. If you want this to happen, you |
|
6047 have to send a QEvent::RequestSoftwareInputPanel event to the |
|
6048 widget yourself. |
|
6049 |
5998 setFocus() gives focus to a widget regardless of its focus policy, |
6050 setFocus() gives focus to a widget regardless of its focus policy, |
5999 but does not clear any keyboard grab (see grabKeyboard()). |
6051 but does not clear any keyboard grab (see grabKeyboard()). |
6000 |
6052 |
6001 Be aware that if the widget is hidden, it will not accept focus |
6053 Be aware that if the widget is hidden, it will not accept focus |
6002 until it is shown. |
6054 until it is shown. |
6005 called from focusOutEvent() or focusInEvent(), you may get an |
6057 called from focusOutEvent() or focusInEvent(), you may get an |
6006 infinite recursion. |
6058 infinite recursion. |
6007 |
6059 |
6008 \sa hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(), |
6060 \sa hasFocus(), clearFocus(), focusInEvent(), focusOutEvent(), |
6009 setFocusPolicy(), focusWidget(), QApplication::focusWidget(), grabKeyboard(), |
6061 setFocusPolicy(), focusWidget(), QApplication::focusWidget(), grabKeyboard(), |
6010 grabMouse(), {Keyboard Focus} |
6062 grabMouse(), {Keyboard Focus}, QEvent::RequestSoftwareInputPanel |
6011 */ |
6063 */ |
6012 |
6064 |
6013 void QWidget::setFocus(Qt::FocusReason reason) |
6065 void QWidget::setFocus(Qt::FocusReason reason) |
6014 { |
6066 { |
6015 if (!isEnabled()) |
6067 if (!isEnabled()) |
7318 parent->d_func()->layout->activate(); |
7370 parent->d_func()->layout->activate(); |
7319 if (parent->isWindow()) |
7371 if (parent->isWindow()) |
7320 break; |
7372 break; |
7321 parent = parent->parentWidget(); |
7373 parent = parent->parentWidget(); |
7322 } |
7374 } |
7323 if (parent && !d->getOpaqueRegion().isEmpty()) |
7375 if (parent) |
7324 parent->d_func()->setDirtyOpaqueRegion(); |
7376 parent->d_func()->setDirtyOpaqueRegion(); |
7325 } |
7377 } |
7326 |
7378 |
7327 // adjust size if necessary |
7379 // adjust size if necessary |
7328 if (!wasResized |
7380 if (!wasResized |
8225 case QEvent::WindowUnblocked: |
8278 case QEvent::WindowUnblocked: |
8226 { |
8279 { |
8227 QList<QObject*> childList = d->children; |
8280 QList<QObject*> childList = d->children; |
8228 for (int i = 0; i < childList.size(); ++i) { |
8281 for (int i = 0; i < childList.size(); ++i) { |
8229 QObject *o = childList.at(i); |
8282 QObject *o = childList.at(i); |
8230 if (o != QApplication::activeModalWidget()) { |
8283 if (o && o != QApplication::activeModalWidget()) { |
8231 if (qobject_cast<QWidget *>(o) && static_cast<QWidget *>(o)->isWindow()) { |
8284 if (qobject_cast<QWidget *>(o) && static_cast<QWidget *>(o)->isWindow()) { |
8232 // do not forward the event to child windows, |
8285 // do not forward the event to child windows, |
8233 // QApplication does this for us |
8286 // QApplication does this for us |
8234 continue; |
8287 continue; |
8235 } |
8288 } |
8321 #endif |
8374 #endif |
8322 case QEvent::TouchBegin: |
8375 case QEvent::TouchBegin: |
8323 case QEvent::TouchUpdate: |
8376 case QEvent::TouchUpdate: |
8324 case QEvent::TouchEnd: |
8377 case QEvent::TouchEnd: |
8325 { |
8378 { |
|
8379 #ifndef Q_WS_MAC |
8326 QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event); |
8380 QTouchEvent *touchEvent = static_cast<QTouchEvent *>(event); |
8327 const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().first(); |
8381 const QTouchEvent::TouchPoint &touchPoint = touchEvent->touchPoints().first(); |
8328 if (touchPoint.isPrimary()) |
8382 if (touchPoint.isPrimary() || touchEvent->deviceType() == QTouchEvent::TouchPad) |
8329 break; |
8383 break; |
8330 |
8384 |
8331 // fake a mouse event! |
8385 // fake a mouse event! |
8332 QEvent::Type eventType = QEvent::None; |
8386 QEvent::Type eventType = QEvent::None; |
8333 switch (touchEvent->type()) { |
8387 switch (touchEvent->type()) { |
8948 \sa inputMethodQuery(), QInputContext |
9003 \sa inputMethodQuery(), QInputContext |
8949 */ |
9004 */ |
8950 Qt::InputMethodHints QWidget::inputMethodHints() const |
9005 Qt::InputMethodHints QWidget::inputMethodHints() const |
8951 { |
9006 { |
8952 Q_D(const QWidget); |
9007 Q_D(const QWidget); |
|
9008 #ifndef QT_NO_IM |
8953 return d->imHints; |
9009 return d->imHints; |
|
9010 #else //QT_NO_IM |
|
9011 return 0; |
|
9012 #endif //QT_NO_IM |
8954 } |
9013 } |
8955 |
9014 |
8956 void QWidget::setInputMethodHints(Qt::InputMethodHints hints) |
9015 void QWidget::setInputMethodHints(Qt::InputMethodHints hints) |
8957 { |
9016 { |
|
9017 #ifndef QT_NO_IM |
8958 Q_D(QWidget); |
9018 Q_D(QWidget); |
8959 d->imHints = hints; |
9019 d->imHints = hints; |
8960 // Optimisation to update input context only it has already been created. |
9020 // Optimisation to update input context only it has already been created. |
8961 if (d->ic || qApp->d_func()->inputContext) { |
9021 if (d->ic || qApp->d_func()->inputContext) { |
8962 QInputContext *ic = inputContext(); |
9022 QInputContext *ic = inputContext(); |
8963 if (ic) |
9023 if (ic) |
8964 ic->update(); |
9024 ic->update(); |
8965 } |
9025 } |
|
9026 #endif //QT_NO_IM |
8966 } |
9027 } |
8967 |
9028 |
8968 |
9029 |
8969 #ifndef QT_NO_DRAGANDDROP |
9030 #ifndef QT_NO_DRAGANDDROP |
8970 |
9031 |
9838 if (dx == 0 && dy == 0) |
9899 if (dx == 0 && dy == 0) |
9839 return; |
9900 return; |
9840 Q_D(QWidget); |
9901 Q_D(QWidget); |
9841 #ifndef QT_NO_GRAPHICSVIEW |
9902 #ifndef QT_NO_GRAPHICSVIEW |
9842 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { |
9903 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { |
9843 // Graphics View maintains its own dirty region as a list of rects; |
9904 // Graphics View maintains its own dirty region as a list of rects; |
9844 // until we can connect item updates directly to the view, we must |
9905 // until we can connect item updates directly to the view, we must |
9845 // separately add a translated dirty region. |
9906 // separately add a translated dirty region. |
9846 if (!d->dirty.isEmpty()) { |
9907 if (!d->dirty.isEmpty()) { |
9847 foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) |
9908 foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects()) |
9848 proxy->update(rect); |
9909 proxy->update(rect); |
9849 } |
9910 } |
9850 proxy->scroll(dx, dy, proxy->subWidgetRect(this)); |
9911 proxy->scroll(dx, dy, proxy->subWidgetRect(this)); |
9851 return; |
9912 return; |
9852 } |
9913 } |
9853 #endif |
9914 #endif |
9854 d->setDirtyOpaqueRegion(); |
9915 d->setDirtyOpaqueRegion(); |
9873 if (dx == 0 && dy == 0) |
9934 if (dx == 0 && dy == 0) |
9874 return; |
9935 return; |
9875 Q_D(QWidget); |
9936 Q_D(QWidget); |
9876 #ifndef QT_NO_GRAPHICSVIEW |
9937 #ifndef QT_NO_GRAPHICSVIEW |
9877 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { |
9938 if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) { |
9878 // Graphics View maintains its own dirty region as a list of rects; |
9939 // Graphics View maintains its own dirty region as a list of rects; |
9879 // until we can connect item updates directly to the view, we must |
9940 // until we can connect item updates directly to the view, we must |
9880 // separately add a translated dirty region. |
9941 // separately add a translated dirty region. |
9881 if (!d->dirty.isEmpty()) { |
9942 if (!d->dirty.isEmpty()) { |
9882 foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) |
9943 foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects()) |
9883 proxy->update(rect); |
9944 proxy->update(rect); |
9884 } |
9945 } |
9885 proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); |
9946 proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint())); |
9886 return; |
9947 return; |
9887 } |
9948 } |
9888 #endif |
9949 #endif |
9889 d->scroll_sys(dx, dy, r); |
9950 d->scroll_sys(dx, dy, r); |
10292 case Qt::WA_MouseTracking: { |
10353 case Qt::WA_MouseTracking: { |
10293 QEvent e(QEvent::MouseTrackingChange); |
10354 QEvent e(QEvent::MouseTrackingChange); |
10294 QApplication::sendEvent(this, &e); |
10355 QApplication::sendEvent(this, &e); |
10295 break; } |
10356 break; } |
10296 case Qt::WA_NativeWindow: { |
10357 case Qt::WA_NativeWindow: { |
|
10358 #ifndef QT_NO_IM |
|
10359 QWidget *focusWidget = d->effectiveFocusWidget(); |
10297 QInputContext *ic = 0; |
10360 QInputContext *ic = 0; |
10298 if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) { |
10361 if (on && !internalWinId() && testAttribute(Qt::WA_InputMethodEnabled) && hasFocus()) { |
10299 ic = d->inputContext(); |
10362 ic = focusWidget->d_func()->inputContext(); |
10300 ic->reset(); |
10363 ic->reset(); |
10301 ic->setFocusWidget(0); |
10364 ic->setFocusWidget(0); |
10302 } |
10365 } |
10303 if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()) |
10366 if (!qApp->testAttribute(Qt::AA_DontCreateNativeWidgetSiblings) && parentWidget()) |
10304 parentWidget()->d_func()->enforceNativeChildren(); |
10367 parentWidget()->d_func()->enforceNativeChildren(); |
10305 if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created)) |
10368 if (on && !internalWinId() && testAttribute(Qt::WA_WState_Created)) |
10306 d->createWinId(); |
10369 d->createWinId(); |
10307 if (ic && isEnabled()) |
10370 if (ic && isEnabled()) |
10308 ic->setFocusWidget(this); |
10371 ic->setFocusWidget(focusWidget); |
|
10372 #endif //QT_NO_IM |
10309 break; |
10373 break; |
10310 } |
10374 } |
10311 case Qt::WA_PaintOnScreen: |
10375 case Qt::WA_PaintOnScreen: |
10312 d->updateIsOpaque(); |
10376 d->updateIsOpaque(); |
10313 #if defined(Q_WS_WIN) || defined(Q_WS_X11) |
10377 #if defined(Q_WS_WIN) || defined(Q_WS_X11) |
10333 #ifdef Q_WS_MAC |
10397 #ifdef Q_WS_MAC |
10334 d->macUpdateIgnoreMouseEvents(); |
10398 d->macUpdateIgnoreMouseEvents(); |
10335 #endif |
10399 #endif |
10336 break; |
10400 break; |
10337 case Qt::WA_InputMethodEnabled: { |
10401 case Qt::WA_InputMethodEnabled: { |
10338 QInputContext *ic = d->ic; |
10402 #ifndef QT_NO_IM |
|
10403 QWidget *focusWidget = d->effectiveFocusWidget(); |
|
10404 QInputContext *ic = focusWidget->d_func()->ic; |
10339 if (!ic && (!on || hasFocus())) |
10405 if (!ic && (!on || hasFocus())) |
10340 ic = d->inputContext(); |
10406 ic = focusWidget->d_func()->inputContext(); |
10341 if (ic) { |
10407 if (ic) { |
10342 if (on && hasFocus() && ic->focusWidget() != this && isEnabled()) { |
10408 if (on && hasFocus() && ic->focusWidget() != focusWidget && isEnabled()) { |
10343 ic->setFocusWidget(this); |
10409 ic->setFocusWidget(focusWidget); |
10344 } else if (!on && ic->focusWidget() == this) { |
10410 } else if (!on && ic->focusWidget() == focusWidget) { |
10345 ic->reset(); |
10411 ic->reset(); |
10346 ic->setFocusWidget(0); |
10412 ic->setFocusWidget(0); |
10347 } |
10413 } |
10348 } |
10414 } |
|
10415 #endif //QT_NO_IM |
10349 break; |
10416 break; |
10350 } |
10417 } |
10351 case Qt::WA_WindowPropagation: |
10418 case Qt::WA_WindowPropagation: |
10352 d->resolvePalette(); |
10419 d->resolvePalette(); |
10353 d->resolveFont(); |
10420 d->resolveFont(); |
11401 |
11468 |
11402 The largest allowed size for a widget is QSize(QWIDGETSIZE_MAX, |
11469 The largest allowed size for a widget is QSize(QWIDGETSIZE_MAX, |
11403 QWIDGETSIZE_MAX), i.e. QSize (16777215,16777215). |
11470 QWIDGETSIZE_MAX), i.e. QSize (16777215,16777215). |
11404 |
11471 |
11405 \sa QWidget::setMaximumSize() |
11472 \sa QWidget::setMaximumSize() |
|
11473 */ |
|
11474 |
|
11475 /*! |
|
11476 \fn QWidget::setupUi(QWidget *widget) |
|
11477 |
|
11478 Sets up the user interface for the specified \a widget. |
|
11479 |
|
11480 \note This function is available with widgets that derive from user |
|
11481 interface descriptions created using \l{uic}. |
|
11482 |
|
11483 \sa {Using a Designer UI File in Your Application} |
11406 */ |
11484 */ |
11407 |
11485 |
11408 QRect QWidgetPrivate::frameStrut() const |
11486 QRect QWidgetPrivate::frameStrut() const |
11409 { |
11487 { |
11410 Q_Q(const QWidget); |
11488 Q_Q(const QWidget); |
11694 |
11772 |
11695 Synonym for QList<QWidget *>. |
11773 Synonym for QList<QWidget *>. |
11696 */ |
11774 */ |
11697 |
11775 |
11698 /*! |
11776 /*! |
11699 Subscribes the widget to a given \a gesture with a \a context. |
11777 Subscribes the widget to a given \a gesture with specific \a flags. |
11700 |
11778 |
11701 \sa QGestureEvent |
11779 \sa ungrabGesture(), QGestureEvent |
11702 \since 4.6 |
11780 \since 4.6 |
11703 */ |
11781 */ |
11704 void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureContext context) |
11782 void QWidget::grabGesture(Qt::GestureType gesture, Qt::GestureFlags flags) |
11705 { |
11783 { |
11706 Q_D(QWidget); |
11784 Q_D(QWidget); |
11707 d->gestureContext.insert(gesture, context); |
11785 d->gestureContext.insert(gesture, flags); |
11708 (void)QGestureManager::instance(); // create a gesture manager |
11786 (void)QGestureManager::instance(); // create a gesture manager |
11709 } |
11787 } |
11710 |
11788 |
11711 QT_END_NAMESPACE |
11789 /*! |
11712 |
11790 Unsubscribes the widget from a given \a gesture type |
11713 #include "moc_qwidget.cpp" |
11791 |
|
11792 \sa grabGesture(), QGestureEvent |
|
11793 \since 4.6 |
|
11794 */ |
|
11795 void QWidget::ungrabGesture(Qt::GestureType gesture) |
|
11796 { |
|
11797 Q_D(QWidget); |
|
11798 if (d->gestureContext.remove(gesture)) { |
|
11799 QGestureManager *manager = QGestureManager::instance(); |
|
11800 manager->cleanupCachedGestures(this, gesture); |
|
11801 } |
|
11802 } |
|
11803 |
11714 |
11804 |
11715 /*! |
11805 /*! |
11716 \typedef WId |
11806 \typedef WId |
11717 \relates QWidget |
11807 \relates QWidget |
11718 |
11808 |