summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-07-28 10:58:46 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-07-28 11:45:59 (GMT)
commit7eba68adc4a7862d9474179592e5c8393a7acdbb (patch)
tree73014cabc8b10f46203844aeb40de574d97032dc /src/gui
parenta20f8dcbeafa34b50ef69d1c5db0f17b09731d2a (diff)
parent3bf3981c7026de9017887d08312391b54fe8afc6 (diff)
downloadQt-7eba68adc4a7862d9474179592e5c8393a7acdbb.zip
Qt-7eba68adc4a7862d9474179592e5c8393a7acdbb.tar.gz
Qt-7eba68adc4a7862d9474179592e5c8393a7acdbb.tar.bz2
Merge commit 'qt/master-stable'
Conflicts: configure.exe src/corelib/io/io.pri src/corelib/io/qfilesystemwatcher.cpp tests/auto/qfileinfo/tst_qfileinfo.cpp tools/configure/configureapp.cpp
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qabstractprintdialog.cpp6
-rw-r--r--src/gui/embedded/qdirectpainter_qws.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp120
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h5
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h9
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp36
-rw-r--r--src/gui/graphicsview/qgraphicssceneevent.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp20
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp8
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp34
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.h4
-rw-r--r--src/gui/image/qimage.cpp5
-rw-r--r--src/gui/image/qpixmap.cpp12
-rw-r--r--src/gui/image/qpixmap_mac.cpp80
-rw-r--r--src/gui/image/qpixmap_mac_p.h5
-rw-r--r--src/gui/image/qpixmapcache.h2
-rw-r--r--src/gui/itemviews/qlistwidget.cpp25
-rw-r--r--src/gui/itemviews/qtablewidget.cpp2
-rw-r--r--src/gui/itemviews/qtreewidget.cpp8
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm10
-rw-r--r--src/gui/kernel/qgridlayout.cpp19
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm29
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h1
-rw-r--r--src/gui/kernel/qwidget_mac.mm18
-rw-r--r--src/gui/math3d/qvector3d.cpp6
-rw-r--r--src/gui/math3d/qvector4d.cpp6
-rw-r--r--src/gui/painting/qmatrix.cpp7
-rw-r--r--src/gui/painting/qpaintengine_mac_p.h105
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp32
-rw-r--r--src/gui/painting/qpaintengineex.cpp12
-rw-r--r--src/gui/painting/qpaintengineex_p.h2
-rw-r--r--src/gui/painting/qpainter.cpp4
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qprinter.cpp4
-rw-r--r--src/gui/painting/qstroker.cpp5
-rw-r--r--src/gui/styles/qcommonstyle.cpp3
-rw-r--r--src/gui/styles/qstyle.cpp26
-rw-r--r--src/gui/styles/qstyleoption.cpp10
-rw-r--r--src/gui/text/qtextcontrol.cpp3
-rw-r--r--src/gui/text/qtextlist.cpp2
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp11
-rw-r--r--src/gui/widgets/qcocoamenu_mac.mm4
-rw-r--r--src/gui/widgets/qlineedit.cpp3
-rw-r--r--src/gui/widgets/qmenu.cpp7
-rw-r--r--src/gui/widgets/qmenu_mac.mm81
-rw-r--r--src/gui/widgets/qmenu_p.h6
-rw-r--r--src/gui/widgets/qmenubar.cpp3
-rw-r--r--src/gui/widgets/qprogressbar.cpp9
-rw-r--r--src/gui/widgets/qworkspace.cpp6
49 files changed, 366 insertions, 461 deletions
diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp
index 2ffc400..beb6918 100644
--- a/src/gui/dialogs/qabstractprintdialog.cpp
+++ b/src/gui/dialogs/qabstractprintdialog.cpp
@@ -395,10 +395,8 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter)
On Windows and Mac OS X, the native print dialog is used, which means that
some QWidget and QDialog properties set on the dialog won't be respected.
- The native print dialog on
- Mac OS X does not support setting printer options, i.e.
- QAbstractPrintDialog::setEnabledOptions() and
- QAbstractPrintDialog::addEnabledOption() have no effect.
+ The native print dialog on Mac OS X does not support setting printer options,
+ i.e. setOptions() and setOption() have no effect.
In Qt 4.4, it was possible to use the static functions to show a sheet on
Mac OS X. This is no longer supported in Qt 4.5. If you want this
diff --git a/src/gui/embedded/qdirectpainter_qws.cpp b/src/gui/embedded/qdirectpainter_qws.cpp
index e97367c..b3dff06 100644
--- a/src/gui/embedded/qdirectpainter_qws.cpp
+++ b/src/gui/embedded/qdirectpainter_qws.cpp
@@ -150,14 +150,14 @@ QT_BEGIN_NAMESPACE
\value ReservedSynchronous The allocated region will never change and
each function that changes the allocated region will be blocking.
- \sa reservedRegion(), allocatedRegion()
+ \sa allocatedRegion()
*/
/*!
\fn QRegion QDirectPainter::region()
\obsolete
- Use QDirectPainter::reservedRegion() instead.
+ Use QDirectPainter::allocatedRegion() instead.
*/
static inline QScreen *getPrimaryScreen()
@@ -346,7 +346,7 @@ void QDirectPainter::setRegion(const QRegion &region)
returned by the allocatedRegion() function. Otherwise they might
differ (see \l {Dynamic Allocation} for details).
- \sa geometry(), setRegion()
+ \sa geometry(), setRegion(), allocatedRegion()
*/
QRegion QDirectPainter::requestedRegion() const
{
@@ -540,7 +540,7 @@ void QDirectPainter::lower()
any. If not released explicitly, the region will be released on
application exit.
- \sa reservedRegion(), {Static Allocation}
+ \sa allocatedRegion(), {Static Allocation}
\obsolete
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 7e155e1..c4ff7c6 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -325,6 +325,10 @@
\value ItemAcceptsInputMethod The item supports input methods typically
used for Asian languages.
This flag was introduced in Qt 4.6.
+
+ \value ItemAutoDetectsFocusProxy The item will assign any child that
+ gains input focus as its focus proxy. See also focusProxy().
+ This flag was introduced in Qt 4.6.
*/
/*!
@@ -908,12 +912,12 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
scene->d_func()->index->itemChange(q, QGraphicsItem::ItemParentChange, newParentVariant);
}
- if (QGraphicsWidget *w = isWidget ? static_cast<QGraphicsWidget *>(q) : q->parentWidget()) {
- // Update the child focus chain; when reparenting a widget that has a
+ QGraphicsItem *lastSubFocusItem = subFocusItem;
+ if (subFocusItem) {
+ // Update the child focus chain; when reparenting an item that has a
// focus child, ensure that that focus child clears its focus child
// chain from our parents before it's reparented.
- if (QGraphicsWidget *focusChild = w->focusWidget())
- focusChild->clearFocus();
+ subFocusItem->clearFocus();
}
// We anticipate geometry changes. If the item is deleted, it will be
@@ -1001,6 +1005,21 @@ void QGraphicsItemPrivate::setParentItemHelper(QGraphicsItem *newParent)
resolveDepth(parent ? parent->d_ptr->depth : -1);
dirtySceneTransform = 1;
+ // Restore the sub focus chain.
+ if (lastSubFocusItem)
+ lastSubFocusItem->d_ptr->setSubFocus();
+
+ // Auto-update focus proxy. The closest parent that detects
+ // focus proxies is updated as the proxy gains or loses focus.
+ QGraphicsItem *p = newParent;
+ while (p) {
+ if (p->d_ptr->flags & QGraphicsItem::ItemAutoDetectsFocusProxy) {
+ p->setFocusProxy(q);
+ break;
+ }
+ p = p->d_ptr->parent;
+ }
+
// Deliver post-change notification
q->itemChange(QGraphicsItem::ItemParentHasChanged, newParentVariant);
@@ -2463,33 +2482,45 @@ bool QGraphicsItem::hasFocus() const
be passed into any focus event generated by this function; it is used to
give an explanation of what caused the item to get focus.
- Only items that set the ItemIsFocusable flag can accept keyboard focus.
+ Only enabled items that set the ItemIsFocusable flag can accept keyboard
+ focus.
- If this item is not visible (i.e., isVisible() returns false), not
- enabled, not associated with a scene, or if it already has input focus,
- this function will do nothing.
+ If this item is not visible, or not associated with a scene, it will not
+ gain immediate input focus. However, it will be registered as the preferred
+ focus item for its subtree of items, should it later become visible.
As a result of calling this function, this item will receive a focus in
event with \a focusReason. If another item already has focus, that item
will first receive a focus out event indicating that it has lost input
focus.
- \sa clearFocus(), hasFocus()
+ \sa clearFocus(), hasFocus(), focusItem()
*/
void QGraphicsItem::setFocus(Qt::FocusReason focusReason)
{
- if (!d_ptr->scene || !isEnabled() || hasFocus() || !(d_ptr->flags & ItemIsFocusable))
+ // Disabled / unfocusable items cannot accept focus.
+ if (!isEnabled() || !(d_ptr->flags & QGraphicsItem::ItemIsFocusable))
+ return;
+
+ // Find focus proxy.
+ QGraphicsItem *f = this;
+ while (f->d_ptr->focusProxy)
+ f = f->d_ptr->focusProxy;
+
+ // Return if it already has focus.
+ if (d_ptr->scene && d_ptr->scene->focusItem() == f)
return;
- QGraphicsItem *item = this;
- QGraphicsItem *f;
- while ((f = item->d_ptr->focusProxy))
- item = f;
- if (item->isVisible()) {
- // Visible items immediately gain focus from scene.
- d_ptr->scene->d_func()->setFocusItemHelper(item, focusReason);
- } else if (item->d_ptr->isWidget) {
- // Just set up subfocus.
- static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
+
+ // Update the child focus chain.
+ d_ptr->setSubFocus();
+
+ // Update the scene's focus item.
+ if (d_ptr->scene) {
+ QGraphicsWidget *w = window();
+ if (!w || w->isActiveWindow()) {
+ // Visible items immediately gain focus from scene.
+ d_ptr->scene->d_func()->setFocusItemHelper(f, focusReason);
+ }
}
}
@@ -2508,10 +2539,8 @@ void QGraphicsItem::clearFocus()
{
if (!d_ptr->scene)
return;
- if (d_ptr->isWidget) {
- // Invisible widget items with focus must explicitly clear subfocus.
- static_cast<QGraphicsWidget *>(this)->d_func()->clearFocusWidget();
- }
+ // Invisible items with focus must explicitly clear subfocus.
+ d_ptr->clearSubFocus();
if (hasFocus()) {
// If this item has the scene's input focus, clear it.
d_ptr->scene->setFocusItem(0);
@@ -2579,6 +2608,18 @@ void QGraphicsItem::setFocusProxy(QGraphicsItem *item)
}
/*!
+ If this item, a child or descendant of this item currently has input
+ focus, this function will return a pointer to that item. If
+ no descendant has input focus, 0 is returned.
+
+ \sa QWidget::focusWidget()
+*/
+QGraphicsItem *QGraphicsItem::focusItem() const
+{
+ return d_ptr->subFocusItem;
+}
+
+/*!
\since 4.4
Grabs the mouse input.
@@ -4668,6 +4709,34 @@ void QGraphicsItemPrivate::ensureSceneTransform()
/*!
\internal
+*/
+void QGraphicsItemPrivate::setSubFocus()
+{
+ // Update focus child chain.
+ QGraphicsItem *item = q_ptr;
+ QGraphicsItem *parent = item;
+ bool hidden = !visible;
+ do {
+ parent->d_func()->subFocusItem = item;
+ } while (!parent->isWindow() && (parent = parent->d_ptr->parent) && (!hidden || !parent->d_func()->visible));
+}
+
+/*!
+ \internal
+*/
+void QGraphicsItemPrivate::clearSubFocus()
+{
+ // Reset focus child chain.
+ QGraphicsItem *parent = q_ptr;
+ do {
+ if (parent->d_ptr->subFocusItem != q_ptr)
+ break;
+ parent->d_ptr->subFocusItem = 0;
+ } while (!parent->isWindow() && (parent = parent->d_ptr->parent));
+}
+
+/*!
+ \internal
Tells us if it is a proxy widget
*/
@@ -10164,6 +10233,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag)
case QGraphicsItem::ItemAcceptsInputMethod:
str = "ItemAcceptsInputMethod";
break;
+ case QGraphicsItem::ItemAutoDetectsFocusProxy:
+ str = "ItemAutoDetectsFocusProxy";
+ break;
}
debug << str;
return debug;
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index fef09f0..f8e74f3 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -100,7 +100,8 @@ public:
ItemUsesExtendedStyleOption = 0x200,
ItemHasNoContents = 0x400,
ItemSendsGeometryChanges = 0x800,
- ItemAcceptsInputMethod = 0x1000
+ ItemAcceptsInputMethod = 0x1000,
+ ItemAutoDetectsFocusProxy = 0x2000
// NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag.
};
Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag)
@@ -230,6 +231,8 @@ public:
QGraphicsItem *focusProxy() const;
void setFocusProxy(QGraphicsItem *item);
+ QGraphicsItem *focusItem() const;
+
void grabMouse();
void ungrabMouse();
void grabKeyboard();
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index c395cd6..8097519 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -123,6 +123,7 @@ public:
siblingIndex(-1),
depth(0),
focusProxy(0),
+ subFocusItem(0),
acceptedMouseButtons(0x1f),
visible(1),
explicitlyHidden(0),
@@ -391,6 +392,9 @@ public:
|| (childrenCombineOpacity() && isFullyTransparent());
}
+ void setSubFocus();
+ void clearSubFocus();
+
inline QTransform transformToParent() const;
inline void ensureSortedChildren();
@@ -411,6 +415,7 @@ public:
int siblingIndex;
int depth;
QGraphicsItem *focusProxy;
+ QGraphicsItem *subFocusItem;
// Packed 32 bytes
quint32 acceptedMouseButtons : 5;
@@ -440,7 +445,7 @@ public:
// New 32 bits
quint32 fullUpdatePending : 1;
- quint32 flags : 13;
+ quint32 flags : 14;
quint32 dirtyChildrenBoundingRect : 1;
quint32 paintedViewBoundingRectsNeedRepaint : 1;
quint32 dirtySceneTransform : 1;
@@ -453,7 +458,7 @@ public:
quint32 acceptedTouchBeginEvent : 1;
quint32 filtersDescendantEvents : 1;
quint32 sceneTransformTranslateOnly : 1;
- quint32 unused : 6; // feel free to use
+ quint32 unused : 5; // feel free to use
// Optional stacking order
int globalStackingOrder;
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index a1a2b60..7e2f7c8 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -484,6 +484,8 @@ void QGraphicsScenePrivate::removeItemHelper(QGraphicsItem *item)
index->removeItem(item);
}
+ item->d_ptr->clearSubFocus();
+
if (!item->d_ptr->inDestructor && item == tabFocusFirst) {
QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item);
widget->d_func()->fixFocusChainBeforeReparenting(0, 0);
@@ -572,17 +574,34 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
Q_Q(QGraphicsScene);
if (item == focusItem)
return;
+
+ // Clear focus if asked to set focus on something that can't
+ // accept input focus.
if (item && (!(item->flags() & QGraphicsItem::ItemIsFocusable)
|| !item->isVisible() || !item->isEnabled())) {
item = 0;
}
+ // Set focus on the scene if an item requests focus.
if (item) {
q->setFocus(focusReason);
if (item == focusItem)
return;
}
+ // Auto-update focus proxy. The closest parent that detects
+ // focus proxies is updated as the proxy gains or loses focus.
+ if (item) {
+ QGraphicsItem *p = item->d_ptr->parent;
+ while (p) {
+ if (p->d_ptr->flags & QGraphicsItem::ItemAutoDetectsFocusProxy) {
+ p->setFocusProxy(item);
+ break;
+ }
+ p = p->d_ptr->parent;
+ }
+ }
+
if (focusItem) {
QFocusEvent event(QEvent::FocusOut, focusReason);
lastFocusItem = focusItem;
@@ -602,11 +621,6 @@ void QGraphicsScenePrivate::setFocusItemHelper(QGraphicsItem *item,
}
if (item) {
- if (item->isWidget()) {
- // Update focus child chain.
- static_cast<QGraphicsWidget *>(item)->d_func()->setFocusWidget();
- }
-
focusItem = item;
QFocusEvent event(QEvent::FocusIn, focusReason);
sendEvent(item, &event);
@@ -2342,6 +2356,11 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
+ // Ensure that newly added items that have subfocus set, gain
+ // focus automatically if there isn't a focus item already.
+ if (!d->focusItem && item->focusItem())
+ item->focusItem()->setFocus();
+
d->updateInputMethodSensitivityInViews();
}
@@ -3457,7 +3476,7 @@ void QGraphicsScene::helpEvent(QGraphicsSceneHelpEvent *helpEvent)
text = toolTipItem->toolTip();
point = helpEvent->screenPos();
}
- QToolTip::showText(point, text);
+ QToolTip::showText(point, text, helpEvent->widget());
helpEvent->setAccepted(!text.isEmpty());
#endif
}
@@ -3556,8 +3575,7 @@ void QGraphicsScenePrivate::leaveScene()
{
Q_Q(QGraphicsScene);
#ifndef QT_NO_TOOLTIP
- // Remove any tooltips
- QToolTip::showText(QPoint(), QString());
+ QToolTip::hideText();
#endif
// Send HoverLeave events to all existing hover items, topmost first.
QGraphicsView *senderWidget = qobject_cast<QGraphicsView *>(q->sender());
@@ -4698,7 +4716,7 @@ void QGraphicsScenePrivate::processDirtyItemsRecursive(QGraphicsItem *item, bool
background has been drawn, and before the foreground has been
drawn. All painting is done in \e scene coordinates. Before
drawing each item, the painter must be transformed using
- QGraphicsItem::sceneMatrix().
+ QGraphicsItem::sceneTransform().
The \a options parameter is the list of style option objects for
each item in \a items. The \a numItems parameter is the number of
diff --git a/src/gui/graphicsview/qgraphicssceneevent.cpp b/src/gui/graphicsview/qgraphicssceneevent.cpp
index 97e8e46..73cc787 100644
--- a/src/gui/graphicsview/qgraphicssceneevent.cpp
+++ b/src/gui/graphicsview/qgraphicssceneevent.cpp
@@ -1475,7 +1475,7 @@ void QGraphicsSceneDragDropEvent::acceptProposedAction()
/*!
Returns the action that was performed in this drag and drop.
This should be set by the receiver of the drop and is
- returned by QDrag::start().
+ returned by QDrag::exec().
\sa setDropAction(), acceptProposedAction()
*/
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index a3005ae..e1f9f62 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -97,8 +97,8 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
setViewport(new QGLWidget). QGraphicsView takes ownership of the viewport
widget.
- QGraphicsView supports affine transformations, using QMatrix. You can
- either pass a matrix to setMatrix(), or you can call one of the
+ QGraphicsView supports affine transformations, using QTransform. You can
+ either pass a matrix to setTransform(), or you can call one of the
convenience functions rotate(), scale(), translate() or shear(). The most
two common transformations are scaling, which is used to implement
zooming, and rotation. QGraphicsView keeps the center of the view fixed
@@ -1598,7 +1598,7 @@ void QGraphicsView::setSceneRect(const QRectF &rect)
Returns the current transformation matrix for the view. If no current
transformation is set, the identity matrix is returned.
- \sa setMatrix(), rotate(), scale(), shear(), translate()
+ \sa setMatrix(), transform(), rotate(), scale(), shear(), translate()
*/
QMatrix QGraphicsView::matrix() const
{
@@ -1630,7 +1630,7 @@ QMatrix QGraphicsView::matrix() const
a view coordinate to a floating point scene coordinate, or mapFromScene()
to map from floating point scene coordinates to view coordinates.
- \sa matrix(), rotate(), scale(), shear(), translate()
+ \sa matrix(), setTransform(), rotate(), scale(), shear(), translate()
*/
void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine)
{
@@ -1639,6 +1639,8 @@ void QGraphicsView::setMatrix(const QMatrix &matrix, bool combine)
/*!
Resets the view transformation matrix to the identity matrix.
+
+ \sa resetTransform()
*/
void QGraphicsView::resetMatrix()
{
@@ -1648,7 +1650,7 @@ void QGraphicsView::resetMatrix()
/*!
Rotates the current view transformation \a angle degrees clockwise.
- \sa setMatrix(), matrix(), scale(), shear(), translate()
+ \sa setTransform(), transform(), scale(), shear(), translate()
*/
void QGraphicsView::rotate(qreal angle)
{
@@ -1661,7 +1663,7 @@ void QGraphicsView::rotate(qreal angle)
/*!
Scales the current view transformation by (\a sx, \a sy).
- \sa setMatrix(), matrix(), rotate(), shear(), translate()
+ \sa setTransform(), transform(), rotate(), shear(), translate()
*/
void QGraphicsView::scale(qreal sx, qreal sy)
{
@@ -1674,7 +1676,7 @@ void QGraphicsView::scale(qreal sx, qreal sy)
/*!
Shears the current view transformation by (\a sh, \a sv).
- \sa setMatrix(), matrix(), rotate(), scale(), translate()
+ \sa setTransform(), transform(), rotate(), scale(), translate()
*/
void QGraphicsView::shear(qreal sh, qreal sv)
{
@@ -1687,7 +1689,7 @@ void QGraphicsView::shear(qreal sh, qreal sv)
/*!
Translates the current view transformation by (\a dx, \a dy).
- \sa setMatrix(), matrix(), rotate(), shear()
+ \sa setTransform(), transform(), rotate(), shear()
*/
void QGraphicsView::translate(qreal dx, qreal dy)
{
@@ -1845,7 +1847,7 @@ void QGraphicsView::ensureVisible(const QGraphicsItem *item, int xmargin, int ym
If \a rect is empty, or if the viewport is too small, this
function will do nothing.
- \sa setMatrix(), ensureVisible(), centerOn()
+ \sa setTransform(), ensureVisible(), centerOn()
*/
void QGraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRatioMode)
{
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 922db04..5e5c826 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -1716,14 +1716,16 @@ void QGraphicsWidget::setFocusPolicy(Qt::FocusPolicy policy)
/*!
If this widget, a child or descendant of this widget currently has input
focus, this function will return a pointer to that widget. If
- no descendant has input focus, 0 is returned.
+ no descendant widget has input focus, 0 is returned.
- \sa QWidget::focusWidget()
+ \sa QGraphicsItem::focusItem(), QWidget::focusWidget()
*/
QGraphicsWidget *QGraphicsWidget::focusWidget() const
{
Q_D(const QGraphicsWidget);
- return d->focusChild;
+ if (d->subFocusItem && d->subFocusItem->d_ptr->isWidget)
+ return static_cast<QGraphicsWidget *>(d->subFocusItem);
+ return 0;
}
/*! \property QGraphicsWidget::horizontalShear
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index c9212f7..8eac063 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -626,34 +626,6 @@ bool QGraphicsWidgetPrivate::hasDecoration() const
return (windowFlags & Qt::Window) && (windowFlags & Qt::WindowTitleHint);
}
-/*!
- \internal
-*/
-void QGraphicsWidgetPrivate::setFocusWidget()
-{
- // Update focus child chain.
- QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(q_ptr);
- QGraphicsWidget *parent = widget;
- bool hidden = !visible;
- do {
- parent->d_func()->focusChild = widget;
- } while (!parent->isWindow() && (parent = parent->parentWidget()) && (!hidden || !parent->d_func()->visible));
-}
-
-/*!
- \internal
-*/
-void QGraphicsWidgetPrivate::clearFocusWidget()
-{
- // Reset focus child chain.
- QGraphicsWidget *parent = static_cast<QGraphicsWidget *>(q_ptr);
- do {
- if (parent->d_func()->focusChild != q_ptr)
- break;
- parent->d_func()->focusChild = 0;
- } while (!parent->isWindow() && (parent = parent->parentWidget()));
-}
-
/**
* is called after a reparent has taken place to fix up the focus chain(s)
*/
@@ -670,12 +642,6 @@ void QGraphicsWidgetPrivate::fixFocusChainBeforeReparenting(QGraphicsWidget *new
QGraphicsWidget *firstOld = 0;
bool wasPreviousNew = true;
-
- if (focusChild) {
- // Ensure that the current focus child doesn't leave pointers around
- // before reparenting.
- focusChild->clearFocus();
- }
while (w != q) {
bool isCurrentNew = q->isAncestorOf(w);
diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h
index 0c34baa..92e520a 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.h
+++ b/src/gui/graphicsview/qgraphicswidget_p.h
@@ -83,7 +83,6 @@ public:
focusPolicy(Qt::NoFocus),
focusNext(0),
focusPrev(0),
- focusChild(0),
windowFlags(0),
windowData(0),
setWindowFrameMargins(false),
@@ -178,9 +177,6 @@ public:
Qt::FocusPolicy focusPolicy;
QGraphicsWidget *focusNext;
QGraphicsWidget *focusPrev;
- QGraphicsWidget *focusChild;
- void setFocusWidget();
- void clearFocusWidget();
// Windows
Qt::WindowFlags windowFlags;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d3a4855..d71aef3 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -596,9 +596,8 @@ bool QImageData::checkForAlphaPixels() const
The mirrored() function returns a mirror of the image in the
desired direction, the scaled() returns a copy of the image scaled
- to a rectangle of the desired measures, the rgbSwapped() function
- constructs a BGR image from a RGB image, and the alphaChannel()
- function constructs an image from this image's alpha channel.
+ to a rectangle of the desired measures, and the rgbSwapped() function
+ constructs a BGR image from a RGB image.
The scaledToWidth() and scaledToHeight() functions return scaled
copies of the image.
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 12287d3..b7d5efd 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -675,12 +675,7 @@ void QPixmap::resize_helper(const QSize &s)
p.drawPixmap(0, 0, *this, 0, 0, qMin(width(), w), qMin(height(), h));
}
-#if defined(Q_WS_MAC)
-#ifndef QT_MAC_NO_QUICKDRAW
- if(macData && macData->qd_alpha)
- macData->macQDUpdateAlpha();
-#endif
-#elif defined(Q_WS_X11)
+#if defined(Q_WS_X11)
if (x11Data && x11Data->x11_mask) {
QX11PixmapData *pmData = static_cast<QX11PixmapData*>(pm.data);
pmData->x11_mask = (Qt::HANDLE)XCreatePixmap(X11->display,
@@ -1952,11 +1947,6 @@ void QPixmap::detach()
if (data->ref != 1) {
*this = copy();
-#if defined(Q_WS_MAC) && !defined(QT_MAC_NO_QUICKDRAW)
- if (id == QPixmapData::MacClass) {
- macData->qd_alpha = 0;
- }
-#endif
}
++data->detach_no;
diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp
index 25ef8ba..45392f1 100644
--- a/src/gui/image/qpixmap_mac.cpp
+++ b/src/gui/image/qpixmap_mac.cpp
@@ -166,9 +166,6 @@ QMacPixmapData::QMacPixmapData(PixelType type)
: QPixmapData(type, MacClass), has_alpha(0), has_mask(0),
uninit(true), pixels(0), pixelsToFree(0), bytesPerRow(0),
cg_data(0), cg_dataBeingReleased(0), cg_mask(0),
-#ifndef QT_MAC_NO_QUICKDRAW
- qd_data(0), qd_alpha(0),
-#endif
pengine(0)
{
}
@@ -494,13 +491,6 @@ int QMacPixmapData::metric(QPaintDevice::PaintDeviceMetric theMetric) const
QMacPixmapData::~QMacPixmapData()
{
validDataPointers.remove(this);
-#ifndef QT_MAC_NO_QUICKDRAW
- macQDDisposeAlpha();
- if (qd_data) {
- DisposeGWorld(qd_data);
- qd_data = 0;
- }
-#endif
if (cg_mask) {
CGImageRelease(cg_mask);
cg_mask = 0;
@@ -589,48 +579,9 @@ void QMacPixmapData::macGetAlphaChannel(QMacPixmapData *pix, bool asMask) const
void QMacPixmapData::macSetHasAlpha(bool b)
{
has_alpha = b;
-#ifndef QT_MAC_NO_QUICKDRAW
- macQDDisposeAlpha(); //let it get created lazily
-#endif
macReleaseCGImageRef();
}
-#ifndef QT_MAC_NO_QUICKDRAW
-void QMacPixmapData::macQDDisposeAlpha()
-{
- if (qd_alpha) {
- DisposeGWorld(qd_alpha);
- qd_alpha = 0;
- }
-}
-
-void QMacPixmapData::macQDUpdateAlpha()
-{
- macQDDisposeAlpha(); // get rid of alpha pixmap
- if (!has_alpha && !has_mask)
- return;
-
- //setup
- Rect rect;
- SetRect(&rect, 0, 0, w, h);
- const int params = alignPix | stretchPix | newDepth;
- NewGWorld(&qd_alpha, 32, &rect, 0, 0, params);
- int *dptr = (int *)GetPixBaseAddr(GetGWorldPixMap(qd_alpha)), *drow;
- unsigned short dbpr = GetPixRowBytes(GetGWorldPixMap(qd_alpha));
- const int *sptr = (int*)pixels, *srow;
- const uint sbpr = bytesPerRow;
- uchar clr;
- for (int y = 0; y < h; ++y) {
- drow = (int*)((char *)dptr + (y * dbpr));
- srow = (int*)((char *)sptr + (y * sbpr));
- for (int x=0; x < w; x++) {
- clr = qAlpha(*(srow + x));
- *(drow + x) = qRgba(~clr, ~clr, ~clr, 0);
- }
- }
-}
-#endif
-
void QMacPixmapData::macCreateCGImageRef()
{
Q_ASSERT(cg_data == 0);
@@ -979,31 +930,12 @@ QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h)
relocated.
\warning This function is only available on Mac OS X.
+ \warning As of Qt 4.6, this function \e{always} returns zero.
*/
Qt::HANDLE QPixmap::macQDHandle() const
{
-#ifndef QT_MAC_NO_QUICKDRAW
- QMacPixmapData *d = static_cast<QMacPixmapData*>(data);
- if (!d->qd_data) { //create the qd data
- Rect rect;
- SetRect(&rect, 0, 0, d->w, d->h);
- unsigned long qdformat = k32ARGBPixelFormat;
- GWorldFlags qdflags = 0;
- //we play such games so we can use the same buffer in CG as QD this
- //makes our merge much simpler, at some point the hacks will go away
- //because QD will be removed, but until that day this keeps them coexisting
- if (QSysInfo::ByteOrder == QSysInfo::LittleEndian)
- qdformat = k32BGRAPixelFormat;
-
- if(NewGWorldFromPtr(&d->qd_data, qdformat, &rect, 0, 0, qdflags,
- (char*)d->pixels, d->bytesPerRow) != noErr)
- qWarning("Qt: internal: QPixmap::init error (%d %d %d %d)", rect.left, rect.top, rect.right, rect.bottom);
- }
- return d->qd_data;
-#else
return 0;
-#endif
}
/*! \internal
@@ -1013,18 +945,11 @@ Qt::HANDLE QPixmap::macQDHandle() const
long as it can be relocated.
\warning This function is only available on Mac OS X.
+ \warning As of Qt 4.6, this function \e{always} returns zero.
*/
Qt::HANDLE QPixmap::macQDAlphaHandle() const
{
-#ifndef QT_MAC_NO_QUICKDRAW
- QMacPixmapData *d = static_cast<QMacPixmapData*>(data);
- if (d->has_alpha || d->has_mask) {
- if (!d->qd_alpha) //lazily created
- d->macQDUpdateAlpha();
- return d->qd_alpha;
- }
-#endif
return 0;
}
@@ -1094,7 +1019,6 @@ IconRef qt_mac_create_iconref(const QPixmap &px)
if (px.isNull())
return 0;
- QMacSavedPortInfo pi; //save the current state
//create icon
IconFamilyHandle iconFamily = reinterpret_cast<IconFamilyHandle>(NewHandle(0));
//create data
diff --git a/src/gui/image/qpixmap_mac_p.h b/src/gui/image/qpixmap_mac_p.h
index a3ff0d3..ea6fe60 100644
--- a/src/gui/image/qpixmap_mac_p.h
+++ b/src/gui/image/qpixmap_mac_p.h
@@ -109,11 +109,6 @@ private:
uint bytesPerRow;
QRectF cg_mask_rect;
CGImageRef cg_data, cg_dataBeingReleased, cg_mask;
-#ifndef QT_MAC_NO_QUICKDRAW
- GWorldPtr qd_data, qd_alpha;
- void macQDDisposeAlpha();
- void macQDUpdateAlpha();
-#endif
static QSet<QMacPixmapData*> validDataPointers;
QPaintEngine *pengine;
diff --git a/src/gui/image/qpixmapcache.h b/src/gui/image/qpixmapcache.h
index c86f3fa..de589fc 100644
--- a/src/gui/image/qpixmapcache.h
+++ b/src/gui/image/qpixmapcache.h
@@ -54,7 +54,7 @@ class Q_GUI_EXPORT QPixmapCache
{
public:
class KeyData;
- class Key
+ class Q_GUI_EXPORT Key
{
public:
Key();
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 7113217..2565657 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -561,6 +561,13 @@ Qt::DropActions QListModel::supportedDropActions() const
given \a parent.
If the parent is not specified, the item will need to be inserted into a
list widget with QListWidget::insertItem().
+
+ \note that this constructor inserts this same object into the model of
+ the parent that is passed to the constructor. If the model is sorted then
+ the behavior of the insert is undetermined since the model will call
+ the '<' operator method on this object which has still not yet been
+ constructed. In this case it would be better not to specify the parent
+ and use the QListWidget::insertItem method to insert the item instead.
\sa type()
*/
@@ -582,6 +589,13 @@ QListWidgetItem::QListWidgetItem(QListWidget *view, int type)
given \a text and \a parent.
If the parent is not specified, the item will need to be inserted into a
list widget with QListWidget::insertItem().
+
+ \note that this constructor inserts this same object into the model of
+ the parent that is passed to the constructor. If the model is sorted then
+ the behavior of the insert is undetermined since the model will call
+ the '<' operator method on this object which has still not yet been
+ constructed. In this case it would be better not to specify the parent
+ and use the QListWidget::insertItem method to insert the item instead.
\sa type()
*/
@@ -605,7 +619,14 @@ QListWidgetItem::QListWidgetItem(const QString &text, QListWidget *view, int typ
given \a icon, \a text and \a parent.
If the parent is not specified, the item will need to be inserted into a
list widget with QListWidget::insertItem().
-
+
+ \note that this constructor inserts this same object into the model of
+ the parent that is passed to the constructor. If the model is sorted then
+ the behavior of the insert is undetermined since the model will call
+ the '<' operator method on this object which has still not yet been
+ constructed. In this case it would be better not to specify the parent
+ and use the QListWidget::insertItem method to insert the item instead.
+
\sa type()
*/
QListWidgetItem::QListWidgetItem(const QIcon &icon,const QString &text,
@@ -1268,7 +1289,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
This signal is emitted whenever the selection changes.
- \sa selectedItems() isItemSelected() currentItemChanged()
+ \sa selectedItems() QListWidgetItem::isSelected() currentItemChanged()
*/
/*!
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index d975d58..5756f35 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1719,7 +1719,7 @@ void QTableWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
This signal is emitted whenever the selection changes.
- \sa selectedItems() isItemSelected()
+ \sa selectedItems() QTableWidgetItem::isSelected()
*/
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 7dded8d..7cded49 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2437,7 +2437,7 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
\note This signal will not be emitted if an item changes its state when
expandAll() is invoked.
- \sa isItemExpanded(), itemCollapsed(), expandItem()
+ \sa QTreeWidgetItem::isExpanded(), itemCollapsed(), expandItem()
*/
/*!
@@ -2449,7 +2449,7 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
\note This signal will not be emitted if an item changes its state when
collapseAll() is invoked.
- \sa isItemExpanded(), itemExpanded(), collapseItem()
+ \sa QTreeWidgetItem::isExpanded(), itemExpanded(), collapseItem()
*/
/*!
@@ -3109,9 +3109,9 @@ bool QTreeWidget::isItemExpanded(const QTreeWidgetItem *item) const
\sa expandItem(), collapseItem(), itemExpanded()
- \obsolete
+ \obsolete
- This function is deprecated. Use \l{QTreeWidgetItem::setExpanded()} instead.
+ This function is deprecated. Use \l{QTreeWidgetItem::setExpanded()} instead.
*/
void QTreeWidget::setItemExpanded(const QTreeWidgetItem *item, bool expand)
{
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index cde0c47..af36d9f 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -506,16 +506,6 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
wakeUp();
emit awake();
-#ifndef QT_MAC_NO_QUICKDRAW
- if(!qt_mac_safe_pdev) { //create an empty widget and this can be used for a port anytime
- QWidget *tlw = new QWidget;
- tlw->setAttribute(Qt::WA_DeleteOnClose);
- tlw->setObjectName(QLatin1String("empty_widget"));
- tlw->hide();
- qt_mac_safe_pdev = tlw;
- }
-#endif
-
bool retVal = false;
forever {
if (d->interrupt)
diff --git a/src/gui/kernel/qgridlayout.cpp b/src/gui/kernel/qgridlayout.cpp
index 8dbc3cb..7ac874e 100644
--- a/src/gui/kernel/qgridlayout.cpp
+++ b/src/gui/kernel/qgridlayout.cpp
@@ -1034,14 +1034,15 @@ QRect QGridLayoutPrivate::cellRect(int row, int col) const
other layouts into the cells of your grid layout using
addWidget(), addItem(), and addLayout().
- QGridLayout also includes two margin widths: the margin() and the
- spacing(). The margin is the width of the reserved space along
- each of the QGridLayout's four sides. The spacing is the width of
- the automatically allocated spacing between neighboring boxes.
-
- The default margin() and spacing() values are provided by the
- style. The default margin Qt styles specify is 9 for child
- widgets and 11 for windows. The spacing defaults to the same as
+ QGridLayout also includes two margin widths:
+ the \l{getContentsMargins()}{contents margin} and the spacing().
+ The contents margin is the width of the reserved space along each
+ of the QGridLayout's four sides. The spacing() is the width of the
+ automatically allocated spacing between neighboring boxes.
+
+ The default contents margin values are provided by the
+ \l{QStyle::pixelMetric()}{style}. The default value Qt styles specify
+ is 9 for child widgets and 11 for windows. The spacing defaults to the same as
the margin width for a top-level layout, or to the same as the
parent layout.
@@ -1078,7 +1079,7 @@ QGridLayout::QGridLayout()
#ifdef QT3_SUPPORT
/*!
- \obsolete
+ \obsolete
Constructs a new QGridLayout with \a nRows rows, \a nCols columns
and parent widget, \a parent. \a parent may not be 0. The grid
layout is called \a name.
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 223e36b..3d4164a 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -74,6 +74,7 @@
****************************************************************************/
#include <private/qcore_mac_p.h>
+#include <qaction.h>
#include <qwidget.h>
#include <qdesktopwidget.h>
#include <qevent.h>
@@ -1193,4 +1194,32 @@ void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayI
}
}
+void qt_mac_menu_collapseSeparators(void */*NSMenu **/ theMenu, bool collapse)
+{
+ OSMenuRef menu = static_cast<OSMenuRef>(theMenu);
+ if (collapse) {
+ bool previousIsSeparator = true; // setting to true kills all the separators placed at the top.
+ NSMenuItem *previousItem = nil;
+ for (NSMenuItem *item in [menu itemArray]) {
+ if ([item isSeparatorItem]) {
+ [item setHidden:previousIsSeparator];
+ }
+
+ if (![item isHidden]) {
+ previousItem = item;
+ previousIsSeparator = ([previousItem isSeparatorItem]);
+ }
+ }
+
+ // We now need to check the final item since we don't want any separators at the end of the list.
+ if (previousItem && previousIsSeparator)
+ [previousItem setHidden:YES];
+ } else {
+ for (NSMenuItem *item in [menu itemArray]) {
+ if (QAction *action = reinterpret_cast<QAction *>([item tag]))
+ [item setHidden:!action->isVisible()];
+ }
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index af3b4cb..2cc7dee 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -133,6 +133,7 @@ void qt_dispatchTabletProximityEvent(void * /*NSEvent * */ tabletEvent);
#ifdef QT_MAC_USE_COCOA
bool qt_dispatchKeyEventWithCocoa(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
#endif
+void qt_mac_menu_collapseSeparators(void * /*NSMenu */ menu, bool collapse);
bool qt_dispatchKeyEvent(void * /*NSEvent * */ keyEvent, QWidget *widgetToGetEvent);
void qt_dispatchModifiersChanged(void * /*NSEvent * */flagsChangedEvent, QWidget *widgetToGetEvent);
void qt_mac_dispatchNCMouseMessage(void */* NSWindow* */eventWindow, void */* NSEvent* */mouseEvent,
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 1717fbd..70eea3a 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1116,23 +1116,9 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
//update handles
GrafPtr qd = 0;
CGContextRef cg = 0;
-#ifndef QT_MAC_NO_QUICKDRAW
- {
- if(GetEventParameter(event, kEventParamGrafPort, typeGrafPtr, 0, sizeof(qd), 0, &qd) != noErr) {
- GDHandle dev = 0;
- GetGWorld(&qd, &dev); //just use the global port..
- }
- }
- bool end_cg_context = false;
- if(GetEventParameter(event, kEventParamCGContextRef, typeCGContextRef, 0, sizeof(cg), 0, &cg) != noErr && qd) {
- end_cg_context = true;
- QDBeginCGContext(qd, &cg);
- }
-#else
if(GetEventParameter(event, kEventParamCGContextRef, typeCGContextRef, 0, sizeof(cg), 0, &cg) != noErr) {
Q_ASSERT(false);
}
-#endif
widget->d_func()->hd = cg;
widget->d_func()->qd_hd = qd;
CGContextSaveGState(cg);
@@ -1252,10 +1238,6 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
widget->d_func()->hd = 0;
widget->d_func()->qd_hd = 0;
CGContextRestoreGState(cg);
-#ifndef QT_MAC_NO_QUICKDRAW
- if(end_cg_context)
- QDEndCGContext(qd, &cg);
-#endif
} else if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget)) {
CallNextEventHandler(er, event);
}
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 881f47c..c1f5a3e 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -513,7 +513,8 @@ QVector4D QVector3D::toVector4D() const
/*!
\fn QPoint QVector3D::toPoint() const
- Returns the QPoint form of this 3D vector.
+ Returns the QPoint form of this 3D vector. The z coordinate
+ is dropped.
\sa toPointF(), toVector2D()
*/
@@ -521,7 +522,8 @@ QVector4D QVector3D::toVector4D() const
/*!
\fn QPointF QVector3D::toPointF() const
- Returns the QPointF form of this 3D vector.
+ Returns the QPointF form of this 3D vector. The z coordinate
+ is dropped.
\sa toPoint(), toVector2D()
*/
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index 1a84db6..ae03bc7 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -484,7 +484,8 @@ QVector3D QVector4D::toVector3DAffine() const
/*!
\fn QPoint QVector4D::toPoint() const
- Returns the QPoint form of this 4D vector.
+ Returns the QPoint form of this 4D vector. The z and w coordinates
+ are dropped.
\sa toPointF(), toVector2D()
*/
@@ -492,7 +493,8 @@ QVector3D QVector4D::toVector3DAffine() const
/*!
\fn QPointF QVector4D::toPointF() const
- Returns the QPointF form of this 4D vector.
+ Returns the QPointF form of this 4D vector. The z and w coordinates
+ are dropped.
\sa toPoint(), toVector2D()
*/
diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp
index 221267f..bc08235 100644
--- a/src/gui/painting/qmatrix.cpp
+++ b/src/gui/painting/qmatrix.cpp
@@ -60,6 +60,9 @@ QT_BEGIN_NAMESPACE
A matrix specifies how to translate, scale, shear or rotate the
coordinate system, and is typically used when rendering graphics.
+ QMatrix, in contrast to QTransform, does not allow perspective
+ transformations. QTransform is the recommended transformation
+ class in Qt.
A QMatrix object can be built using the setMatrix(), scale(),
rotate(), translate() and shear() functions. Alternatively, it
@@ -172,8 +175,8 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/matrix/matrix.cpp 2
\endtable
- \sa QPainter, {The Coordinate System}, {demos/affine}{Affine
- Transformations Demo}, {Transformations Example}
+ \sa QPainter, QTransform, {The Coordinate System},
+ {demos/affine}{Affine Transformations Demo}, {Transformations Example}
*/
diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h
index 755b7b1..20a4a08 100644
--- a/src/gui/painting/qpaintengine_mac_p.h
+++ b/src/gui/painting/qpaintengine_mac_p.h
@@ -58,9 +58,6 @@
#include "private/qpaintengine_p.h"
#include "private/qpolygonclipper_p.h"
#include "QtCore/qhash.h"
-#ifndef QT_MAC_NO_QUICKDRAW
-#include <private/qwidget_p.h>
-#endif
typedef struct CGColorSpace *CGColorSpaceRef;
QT_BEGIN_NAMESPACE
@@ -69,108 +66,6 @@ extern int qt_defaultDpi();
extern int qt_defaultDpiX();
extern int qt_defaultDpiY();
-#ifndef QT_MAC_NO_QUICKDRAW
-class QMacSavedPortInfo
-{
- RgnHandle clip;
- GWorldPtr world;
- GDHandle handle;
- PenState pen; //go pennstate
- RGBColor back, fore;
- bool valid_gworld;
- void init();
-
-public:
- inline QMacSavedPortInfo() { init(); }
- inline QMacSavedPortInfo(QPaintDevice *pd) { init(); setPaintDevice(pd); }
- inline QMacSavedPortInfo(QPaintDevice *pd, const QRect &r)
- { init(); setPaintDevice(pd); setClipRegion(r); }
- inline QMacSavedPortInfo(QPaintDevice *pd, const QRegion &r)
- { init(); setPaintDevice(pd); setClipRegion(r); }
- ~QMacSavedPortInfo();
- static inline bool setClipRegion(const QRect &r);
- static inline bool setClipRegion(const QRegion &r);
- static inline bool setPaintDevice(QPaintDevice *);
-};
-
-inline bool
-QMacSavedPortInfo::setClipRegion(const QRect &rect)
-{
- Rect r;
- SetRect(&r, rect.x(), rect.y(), rect.right()+1, rect.bottom()+1);
- ClipRect(&r);
- return true;
-}
-
-inline bool
-QMacSavedPortInfo::setClipRegion(const QRegion &r)
-{
- if(r.isEmpty())
- return setClipRegion(QRect());
- QMacSmartQuickDrawRegion rgn(r.toQDRgn());
- SetClip(rgn);
- return true;
-}
-
-inline bool
-QMacSavedPortInfo::setPaintDevice(QPaintDevice *pd)
-{
- if(!pd)
- return false;
- bool ret = true;
- extern GrafPtr qt_mac_qd_context(const QPaintDevice *); // qpaintdevice_mac.cpp
- if(pd->devType() == QInternal::Widget)
- SetPortWindowPort(qt_mac_window_for(static_cast<QWidget*>(pd)));
- else if(pd->devType() == QInternal::Pixmap || pd->devType() == QInternal::Printer)
- SetGWorld((GrafPtr)qt_mac_qd_context(pd), 0); //set the gworld
- return ret;
-}
-
-inline void
-QMacSavedPortInfo::init()
-{
- GetBackColor(&back);
- GetForeColor(&fore);
- GetGWorld(&world, &handle);
- valid_gworld = true;
- clip = NewRgn();
- GetClip(clip);
- GetPenState(&pen);
-}
-
-inline QMacSavedPortInfo::~QMacSavedPortInfo()
-{
- bool set_state = false;
- if(valid_gworld) {
- set_state = IsValidPort(world);
- if(set_state)
- SetGWorld(world,handle); //always do this one first
- } else {
- setPaintDevice(qt_mac_safe_pdev);
- }
- if(set_state) {
- SetClip(clip);
- SetPenState(&pen);
- RGBForeColor(&fore);
- RGBBackColor(&back);
- }
- DisposeRgn(clip);
-}
-#else
-class QMacSavedPortInfo
-{
-public:
- inline QMacSavedPortInfo() { }
- inline QMacSavedPortInfo(QPaintDevice *) { }
- inline QMacSavedPortInfo(QPaintDevice *, const QRect &) { }
- inline QMacSavedPortInfo(QPaintDevice *, const QRegion &) { }
- ~QMacSavedPortInfo() { }
- static inline bool setClipRegion(const QRect &) { return false; }
- static inline bool setClipRegion(const QRegion &) { return false; }
- static inline bool setPaintDevice(QPaintDevice *) { return false; }
-};
-#endif
-
class QCoreGraphicsPaintEnginePrivate;
class QCoreGraphicsPaintEngine : public QPaintEngine
{
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 2febdfa..3d8e349 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1104,6 +1104,9 @@ void QRasterPaintEnginePrivate::systemStateChanged()
#ifdef QT_DEBUG_DRAW
qDebug() << "systemStateChanged" << this << "deviceRect" << deviceRect << clipRect << systemClip;
#endif
+
+ exDeviceRect = deviceRect;
+
Q_Q(QRasterPaintEngine);
q->state()->strokeFlags |= QPaintEngine::DirtyClipRegion;
q->state()->fillFlags |= QPaintEngine::DirtyClipRegion;
@@ -1711,11 +1714,30 @@ void QRasterPaintEngine::stroke(const QVectorPath &path, const QPen &pen)
if (!s->penData.blend)
return;
- if (s->flags.fast_pen && path.shape() <= QVectorPath::NonCurvedShapeHint && s->lastPen.brush().isOpaque()) {
- strokePolygonCosmetic((QPointF *) path.points(), path.elementCount(),
- path.hasImplicitClose()
- ? WindingMode
- : PolylineMode);
+ if (s->flags.fast_pen && path.shape() <= QVectorPath::NonCurvedShapeHint
+ && s->lastPen.brush().isOpaque()) {
+ int count = path.elementCount();
+ QPointF *points = (QPointF *) path.points();
+ const QPainterPath::ElementType *types = path.elements();
+ if (types) {
+ int first = 0;
+ int last;
+ while (first < count) {
+ while (first < count && types[first] != QPainterPath::MoveToElement) ++first;
+ last = first + 1;
+ while (last < count && types[last] == QPainterPath::LineToElement) ++last;
+ strokePolygonCosmetic(points + first, last - first,
+ path.hasImplicitClose() && last == count // only close last one..
+ ? WindingMode
+ : PolylineMode);
+ first = last;
+ }
+ } else {
+ strokePolygonCosmetic(points, count,
+ path.hasImplicitClose()
+ ? WindingMode
+ : PolylineMode);
+ }
} else if (s->flags.non_complex_pen && path.shape() == QVectorPath::LinesHint) {
qreal width = s->lastPen.isCosmetic()
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 2fc23f9..a71fe52 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -362,12 +362,12 @@ void QPaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
d->activeStroker = 0;
} else {
// ### re-enable...
-// if (pen.isCosmetic()) {
-// d->dashStroker->setClipRect(d->deviceRect);
-// } else {
-// QRectF clipRect = s->matrix.inverted().mapRect(QRectF(d->deviceRect));
-// d->dashStroker->setClipRect(clipRect);
-// }
+ if (pen.isCosmetic()) {
+ d->dasher.setClipRect(d->exDeviceRect);
+ } else {
+ QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect));
+ d->dasher.setClipRect(clipRect);
+ }
d->dasher.setDashPattern(pen.dashPattern());
d->dasher.setDashOffset(pen.dashOffset());
d->activeStroker = &d->dasher;
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 2a50a51..22354bc 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -225,6 +225,8 @@ public:
StrokeHandler *strokeHandler;
QStrokerOps *activeStroker;
QPen strokerPen;
+
+ QRect exDeviceRect;
};
inline uint QVectorPath::polygonFlags(QPaintEngine::PolygonDrawMode mode) {
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 8738f54..1b128bd 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -196,7 +196,7 @@ void QPainterPrivate::checkEmulation()
extended = emulationEngine;
extended->setState(state);
}
- } else if (emulationEngine && emulationEngine != extended) {
+ } else if (emulationEngine == extended) {
extended = emulationEngine->real_engine;
}
}
@@ -1031,7 +1031,7 @@ void QPainterPrivate::updateState(QPainterState *newState)
\o layoutDirection() defines the layout direction used by the
painter when drawing text.
- \o matrixEnabled() tells whether world transformation is enabled.
+ \o worldMatrixEnabled() tells whether world transformation is enabled.
\o viewTransformEnabled() tells whether view transformation is
enabled.
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index ec8a46c..b5301d1 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -3165,7 +3165,7 @@ void QPainterPath::addRoundRect(const QRectF &r, int xRnd, int yRnd)
Set operations on paths will treat the paths as areas. Non-closed
paths will be treated as implicitly closed.
- \sa intersected(), subtracted(), subtractedInverted()
+ \sa intersected(), subtracted()
*/
QPainterPath QPainterPath::united(const QPainterPath &p) const
{
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index efaeb43..bc54b5c 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -2161,8 +2161,8 @@ bool QPrinter::collateCopiesEnabled() const
}
/*!
- Use QPrintDialog::addEnabledOption(QPrintDialog::PrintCollateCopies)
- or QPrintDialog::setEnabledOptions(QPrintDialog::enabledOptions()
+ Use QPrintDialog::setOption(QPrintDialog::PrintCollateCopies)
+ or QPrintDialog::setOptions(QPrintDialog::options()
& ~QPrintDialog::PrintCollateCopies) instead, depending on \a
enable.
*/
diff --git a/src/gui/painting/qstroker.cpp b/src/gui/painting/qstroker.cpp
index 0649589..b24bf86 100644
--- a/src/gui/painting/qstroker.cpp
+++ b/src/gui/painting/qstroker.cpp
@@ -1012,10 +1012,13 @@ void QDashStroker::processCurrentSubpath()
int dashCount = qMin(m_dashPattern.size(), 32);
qfixed dashes[32];
+ qreal longestLength = 0;
qreal sumLength = 0;
for (int i=0; i<dashCount; ++i) {
dashes[i] = qMax(m_dashPattern.at(i), qreal(0)) * m_stroker->strokeWidth();
sumLength += dashes[i];
+ if (dashes[i] > longestLength)
+ longestLength = dashes[i];
}
if (qFuzzyIsNull(sumLength))
@@ -1053,7 +1056,7 @@ void QDashStroker::processCurrentSubpath()
qfixed2d line_to_pos;
// Pad to avoid clipping the borders of thick pens.
- qfixed padding = qMax(m_stroker->strokeWidth(), m_stroker->miterLimit());
+ qfixed padding = qt_real_to_fixed(qMax(m_stroker->strokeWidth(), m_stroker->miterLimit()) * longestLength);
qfixed2d clip_tl = { qt_real_to_fixed(m_clip_rect.left()) - padding,
qt_real_to_fixed(m_clip_rect.top()) - padding };
qfixed2d clip_br = { qt_real_to_fixed(m_clip_rect.right()) + padding ,
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 308a0b8..ba28e75 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -2960,6 +2960,9 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
horizontalShift *= -1;
verticalShift *= -1;
}
+ if (tab->shape == QTabBar::RoundedWest || tab->shape == QTabBar::TriangularWest)
+ horizontalShift = -horizontalShift;
+
tr.adjust(0, 0, horizontalShift, verticalShift);
if (selected)
{
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index a5ab80e..c869976 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -1108,7 +1108,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value CC_ScrollBar A scroll bar, like QScrollBar.
\value CC_Slider A slider, like QSlider.
\value CC_ToolButton A tool button, like QToolButton.
- \value CC_TitleBar A Title bar, like those used in QWorkspace.
+ \value CC_TitleBar A Title bar, like those used in QMdiSubWindow.
\value CC_Q3ListView Used for drawing the Q3ListView class.
\value CC_GroupBox A group box, like QGroupBox.
\value CC_Dial A dial, like QDial.
@@ -1894,7 +1894,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
can follow some existing GUI style or guideline.
\value SP_TitleBarMinButton Minimize button on title bars (e.g.,
- in QWorkspace).
+ in QMdiSubWindow).
\value SP_TitleBarMenuButton Menu button on a title bar.
\value SP_TitleBarMaxButton Maximize button on title bars.
\value SP_TitleBarCloseButton Close button on title bars.
@@ -1966,22 +1966,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SP_CustomBase Base value for custom standard pixmaps;
custom values must be greater than this value.
- \sa standardPixmap() standardIcon()
-*/
-
-/*###
- \enum QStyle::IconMode
-
- This enum represents the effects performed on a pixmap to achieve a
- GUI style's perferred way of representing the image in different
- states.
-
- \value IM_Disabled A disabled pixmap (drawn on disabled widgets)
- \value IM_Active An active pixmap (drawn on active tool buttons and menu items)
- \value IM_CustomBase Base value for custom PixmapTypes; custom
- values must be greater than this value
-
- \sa generatedIconPixmap()
+ \sa standardIcon()
*/
/*!
@@ -2264,7 +2249,7 @@ QPalette QStyle::standardPalette() const
slot in your subclass instead. The standardIcon() function will
dynamically detect the slot and call it.
- \sa standardIconImplementation(), standardPixmap()
+ \sa standardIconImplementation()
*/
QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *option,
const QWidget *widget) const
@@ -2289,8 +2274,7 @@ QIcon QStyle::standardIcon(StandardPixmap standardIcon, const QStyleOption *opti
subclass; because of binary compatibility constraints, the
standardIcon() function (introduced in Qt 4.1) is not
virtual. Instead, standardIcon() will dynamically detect and call
- \e this slot. The default implementation simply calls the
- standardPixmap() function with the given parameters.
+ \e this slot.
The \a standardIcon is a standard pixmap which can follow some
existing GUI style or guideline. The \a option argument can be
diff --git a/src/gui/styles/qstyleoption.cpp b/src/gui/styles/qstyleoption.cpp
index e174370..0ff1ccf 100644
--- a/src/gui/styles/qstyleoption.cpp
+++ b/src/gui/styles/qstyleoption.cpp
@@ -4258,8 +4258,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
parameters for drawing a title bar.
QStyleOptionTitleBar contains all the information that QStyle
- functions need to draw the title bars of QWorkspace's MDI
- children.
+ functions need to draw the title bar of a QMdiSubWindow.
For performance reasons, the access to the member variables is
direct (i.e., using the \c . or \c -> operator). This low-level feel
@@ -4269,7 +4268,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
For an example demonstrating how style options can be used, see
the \l {widgets/styles}{Styles} example.
- \sa QStyleOption, QStyleOptionComplex, QWorkspace
+ \sa QStyleOption, QStyleOptionComplex, QMdiSubWindow
*/
/*!
@@ -4983,8 +4982,7 @@ QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
*/
/*!
- Constructs a QStyleOptionGraphicsItem. The levelOfDetail parameter is
- initialized to 1.
+ Constructs a QStyleOptionGraphicsItem.
*/
QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
: QStyleOption(Version, Type), levelOfDetail(1)
@@ -5054,7 +5052,7 @@ qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &wor
To find the dimentions of an item in screen coordinates (i.e., pixels),
you can use the mapping functions of QMatrix, such as QMatrix::map().
- \sa QStyleOptionGraphicsItem::levelOfDetail
+ \sa QStyleOptionGraphicsItem::levelOfDetailFromTransform()
*/
/*!
diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp
index 78fd13b..88f8028 100644
--- a/src/gui/text/qtextcontrol.cpp
+++ b/src/gui/text/qtextcontrol.cpp
@@ -1245,8 +1245,7 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e)
process:
{
QString text = e->text();
- if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t')) &&
- ((e->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) {
+ if (!text.isEmpty() && (text.at(0).isPrint() || text.at(0) == QLatin1Char('\t'))) {
if (overwriteMode
// no need to call deleteChar() if we have a selection, insertText
// does it already
diff --git a/src/gui/text/qtextlist.cpp b/src/gui/text/qtextlist.cpp
index 02b1c63..5e9898a 100644
--- a/src/gui/text/qtextlist.cpp
+++ b/src/gui/text/qtextlist.cpp
@@ -129,8 +129,6 @@ QTextList::~QTextList()
/*!
Returns the number of items in the list.
-
- \sa isEmpty()
*/
int QTextList::count() const
{
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index 85eae26..a0648a1 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -106,6 +106,7 @@ public:
private:
uint notifyIconSize;
int maxTipLength;
+ bool ignoreNextMouseRelease;
};
bool QSystemTrayIconSys::allowsMessages()
@@ -128,7 +129,8 @@ bool QSystemTrayIconSys::supportsMessages()
}
QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
- : hIcon(0), q(object)
+ : hIcon(0), q(object), ignoreNextMouseRelease(false)
+
{
#ifndef Q_OS_WINCE
notifyIconSize = FIELD_OFFSET(NOTIFYICONDATA, guidItem); // NOTIFYICONDATAW_V2_SIZE;
@@ -311,10 +313,15 @@ bool QSystemTrayIconSys::winEvent( MSG *m, long *result )
switch (m->lParam) {
case WM_LBUTTONUP:
- emit q->activated(QSystemTrayIcon::Trigger);
+ if (ignoreNextMouseRelease)
+ ignoreNextMouseRelease = false;
+ else
+ emit q->activated(QSystemTrayIcon::Trigger);
break;
case WM_LBUTTONDBLCLK:
+ ignoreNextMouseRelease = true; // Since DBLCLICK Generates a second mouse
+ // release we must ignore it
emit q->activated(QSystemTrayIcon::DoubleClick);
break;
diff --git a/src/gui/widgets/qcocoamenu_mac.mm b/src/gui/widgets/qcocoamenu_mac.mm
index 3338fd8..f3bb73e 100644
--- a/src/gui/widgets/qcocoamenu_mac.mm
+++ b/src/gui/widgets/qcocoamenu_mac.mm
@@ -98,7 +98,9 @@ QT_USE_NAMESPACE
while (QWidget *popup
= QApplication::activePopupWidget())
popup->close();
- qt_mac_emit_menuSignals(((QT_MANGLE_NAMESPACE(QCocoaMenu) *)menu)->qmenu, true);
+ QMenu *qtmenu = static_cast<QT_MANGLE_NAMESPACE(QCocoaMenu) *>(menu)->qmenu;
+ qt_mac_emit_menuSignals(qtmenu, true);
+ qt_mac_menu_collapseSeparators(menu, qtmenu->separatorsCollapsible());
}
- (void)menuWillClose:(NSMenu*)menu;
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 01d5711..4d69a9f 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -2181,8 +2181,7 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
if (unknown && !d->readOnly) {
QString t = event->text();
- if (!t.isEmpty() && t.at(0).isPrint() &&
- ((event->modifiers() & (Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier)) == Qt::NoModifier)) {
+ if (!t.isEmpty() && t.at(0).isPrint()) {
insert(t);
#ifndef QT_NO_COMPLETER
d->complete(event->key());
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index b69e8bb..4a969db 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -3050,12 +3050,19 @@ bool QMenu::separatorsCollapsible() const
void QMenu::setSeparatorsCollapsible(bool collapse)
{
Q_D(QMenu);
+ if (d->collapsibleSeparators == collapse)
+ return;
+
d->collapsibleSeparators = collapse;
d->itemsDirty = 1;
if (isVisible()) {
d->updateActionRects();
update();
}
+#ifdef Q_WS_MAC
+ if (d->mac_menu)
+ d->syncSeparatorsCollapsible(collapse);
+#endif
}
#ifdef QT3_SUPPORT
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 87f6f82..e6239f4 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -458,7 +458,8 @@ OSStatus qt_mac_menu_event(EventHandlerCallRef er, EventRef event, void *)
int merged = 0;
const QMenuPrivate::QMacMenuPrivate *mac_menu = qmenu->d_func()->mac_menu;
- for(int i = 0; i < mac_menu->actionItems.size(); ++i) {
+ const int ActionItemsCount = mac_menu->actionItems.size();
+ for(int i = 0; i < ActionItemsCount; ++i) {
QMacMenuAction *action = mac_menu->actionItems.at(i);
if (action->action->isSeparator()) {
bool hide = false;
@@ -972,7 +973,7 @@ void Q_GUI_EXPORT qt_mac_set_menubar_merge(bool b) { qt_mac_no_menubar_merge = !
/*****************************************************************************
QMenu bindings
*****************************************************************************/
-QMenuPrivate::QMacMenuPrivate::QMacMenuPrivate(QMenuPrivate *menu) : menu(0), qmenu(menu)
+QMenuPrivate::QMacMenuPrivate::QMacMenuPrivate() : menu(0)
{
}
@@ -1300,61 +1301,22 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action)
#else
int itemIndex = [menu indexOfItem:item];
Q_ASSERT(itemIndex != -1);
-
- // Separator handling: Menu items and separators can be added to a QMenu in
- // any order (for example, add all the separators first and then "fill inn"
- // the menu items). Create NSMenuItem seperatorItems for the Qt separators,
- // and make sure that there are no double separators and no seprators
- // at the top or bottom of the menu.
- bool itemIsSeparator = action->action->isSeparator();
- bool previousItemIsSeparator = false;
- if (itemIndex > 0) {
- if ([[menu itemAtIndex : itemIndex - 1] isSeparatorItem])
- previousItemIsSeparator = true;
- }
- bool nexItemIsSeparator = false;
- if (itemIndex > 0 && itemIndex < [menu numberOfItems] -1) {
- if ([[menu itemAtIndex : itemIndex + 1] isSeparatorItem])
- nexItemIsSeparator = true;
- }
- bool itemIsAtBottomOfMenu = (itemIndex == [menu numberOfItems] - 1);
- bool itemIsAtTopOfMenu = (itemIndex == 0);
-
-
- if (itemIsSeparator) {
- // Create separators items for actions that are now separators
+ if (action->action->isSeparator()) {
action->menuItem = [NSMenuItem separatorItem];
[action->menuItem retain];
-
- // Hide duplicate/top/bottom separators.
- if (qmenu->collapsibleSeparators && (previousItemIsSeparator || itemIsAtBottomOfMenu || itemIsAtTopOfMenu)) {
- [action->menuItem setHidden : true];
- }
-
[menu insertItem: action->menuItem atIndex:itemIndex];
[menu removeItem:item];
[item release];
item = action->menuItem;
return;
- } else {
- // Create standard menu items for actions that are no longer separators
- if ([item isSeparatorItem]) {
- action->menuItem = createNSMenuItem(action->action->text());
- [menu insertItem:action->menuItem atIndex:itemIndex];
- [menu removeItem:item];
- [item release];
- item = action->menuItem;
- }
-
- // Show separators that should now be visible since a non-separator
- // item (the current item) was added.
- if (previousItemIsSeparator) {
- [[menu itemAtIndex : itemIndex - 1] setHidden : false];
- } else if (itemIsAtTopOfMenu && nexItemIsSeparator) {
- [[menu itemAtIndex : itemIndex + 1] setHidden : false];
- }
+ } else if ([item isSeparatorItem]) {
+ // I'm no longer a separator...
+ action->menuItem = createNSMenuItem(action->action->text());
+ [menu insertItem:action->menuItem atIndex:itemIndex];
+ [menu removeItem:item];
+ [item release];
+ item = action->menuItem;
}
-
#endif
//find text (and accel)
@@ -1540,7 +1502,7 @@ QMenuPrivate::macMenu(OSMenuRef merge)
if (mac_menu && mac_menu->menu)
return mac_menu->menu;
if (!mac_menu)
- mac_menu = new QMacMenuPrivate(this);
+ mac_menu = new QMacMenuPrivate;
mac_menu->menu = qt_mac_create_menu(q);
if (merge) {
#ifndef QT_MAC_USE_COCOA
@@ -1552,12 +1514,31 @@ QMenuPrivate::macMenu(OSMenuRef merge)
QList<QAction*> items = q->actions();
for(int i = 0; i < items.count(); i++)
mac_menu->addAction(items[i], 0, this);
+ syncSeparatorsCollapsible(collapsibleSeparators);
return mac_menu->menu;
}
/*!
\internal
*/
+void
+QMenuPrivate::syncSeparatorsCollapsible(bool collapse)
+{
+#ifndef QT_MAC_USE_COCOA
+ if (collapse)
+ ChangeMenuAttributes(mac_menu->menu, kMenuAttrCondenseSeparators, 0);
+ else
+ ChangeMenuAttributes(mac_menu->menu, 0, kMenuAttrCondenseSeparators);
+#else
+ qt_mac_menu_collapseSeparators(mac_menu->menu, collapse);
+#endif
+}
+
+
+
+/*!
+ \internal
+*/
void QMenuPrivate::setMacMenuEnabled(bool enable)
{
if (!macMenu(0))
diff --git a/src/gui/widgets/qmenu_p.h b/src/gui/widgets/qmenu_p.h
index 355ecb4..0218dc7 100644
--- a/src/gui/widgets/qmenu_p.h
+++ b/src/gui/widgets/qmenu_p.h
@@ -282,9 +282,8 @@ public:
struct QMacMenuPrivate {
QList<QMacMenuAction*> actionItems;
OSMenuRef menu;
- QMenuPrivate *qmenu;
- QMacMenuPrivate(QMenuPrivate *menu);
- ~QMacMenuPrivate();
+ QMacMenuPrivate();
+ ~QMacMenuPrivate();
bool merged(const QAction *action) const;
void addAction(QAction *, QMacMenuAction* =0, QMenuPrivate *qmenu = 0);
@@ -304,6 +303,7 @@ public:
} *mac_menu;
OSMenuRef macMenu(OSMenuRef merge);
void setMacMenuEnabled(bool enable = true);
+ void syncSeparatorsCollapsible(bool collapsible);
static QHash<OSMenuRef, OSMenuRef> mergeMenuHash;
static QHash<OSMenuRef, QMenuMergeList*> mergeMenuItemsHash;
#endif
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index bb1dd29..3f7675b 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -1790,6 +1790,9 @@ void QMenuBarPrivate::_q_internalShortcutActivated(int id)
activateAction(act, QAction::Trigger);
//100 is the same as the default value in QPushButton::animateClick
autoReleaseTimer.start(100, q);
+ } else if (act && q->style()->styleHint(QStyle::SH_MenuBar_AltKeyNavigation, 0, q)) {
+ // When we open a menu using a shortcut, we should end up in keyboard state
+ setKeyboardMode(true);
}
}
diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp
index 6593cd6..7e40c0d 100644
--- a/src/gui/widgets/qprogressbar.cpp
+++ b/src/gui/widgets/qprogressbar.cpp
@@ -190,10 +190,11 @@ bool QProgressBarPrivate::repaintRequired() const
with setValue(). The progress bar can be rewound to the
beginning with reset().
- If minimum and maximum both are set to 0, the bar shows a busy indicator
- instead of a percentage of steps. This is useful, for example, when using
- QFtp or QHttp to download items when they are unable to determine the
- size of the item being downloaded.
+ If minimum and maximum both are set to 0, the bar shows a busy
+ indicator instead of a percentage of steps. This is useful, for
+ example, when using QFtp or QNetworkAccessManager to download
+ items when they are unable to determine the size of the item being
+ downloaded.
\table
\row \o \inlineimage macintosh-progressbar.png Screenshot of a Macintosh style progress bar
diff --git a/src/gui/widgets/qworkspace.cpp b/src/gui/widgets/qworkspace.cpp
index 2833c08..3184140 100644
--- a/src/gui/widgets/qworkspace.cpp
+++ b/src/gui/widgets/qworkspace.cpp
@@ -110,11 +110,11 @@ bool QMDIControl::event(QEvent *event)
QStyle::SubControl ctrl = style()->hitTestComplexControl(QStyle::CC_MdiControls, &opt,
helpEvent->pos(), this);
if (ctrl == QStyle::SC_MdiCloseButton)
- QToolTip::showText(helpEvent->globalPos(), QWorkspace::tr("Close"));
+ QToolTip::showText(helpEvent->globalPos(), QWorkspace::tr("Close"), this);
else if (ctrl == QStyle::SC_MdiMinButton)
- QToolTip::showText(helpEvent->globalPos(), QWorkspace::tr("Minimize"));
+ QToolTip::showText(helpEvent->globalPos(), QWorkspace::tr("Minimize"), this);
else if (ctrl == QStyle::SC_MdiNormalButton)
- QToolTip::showText(helpEvent->globalPos(), QWorkspace::tr("Restore Down"));
+ QToolTip::showText(helpEvent->globalPos(), QWorkspace::tr("Restore Down"), this);
else
QToolTip::hideText();
#endif // QT_NO_TOOLTIP