summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qtextstream.cpp3
-rw-r--r--src/declarative/fx/qfxpathview.cpp2
-rw-r--r--src/gui/dialogs/qabstractprintdialog.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp44
-rw-r--r--src/gui/graphicsview/qgraphicsitem_p.h7
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp6
-rw-r--r--src/gui/image/qimagereader.cpp1
-rw-r--r--src/gui/itemviews/qtreeview.cpp38
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm18
-rw-r--r--src/gui/kernel/qcocoaview_mac_p.h3
-rw-r--r--src/gui/kernel/qformlayout.cpp6
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm23
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/kernel/qwidget_mac.mm4
-rw-r--r--src/gui/kernel/qx11embed_x11.cpp19
-rw-r--r--src/gui/painting/qblendfunctions.cpp12
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp6
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp26
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp39
-rw-r--r--src/gui/text/qfontengine_ft.cpp8
-rw-r--r--src/gui/text/qfontengine_p.h2
-rw-r--r--src/gui/text/qtextcursor.cpp5
-rw-r--r--src/gui/text/qtextdocument.cpp2
-rw-r--r--src/gui/text/qtextobject.cpp2
-rw-r--r--src/gui/widgets/qmainwindow.cpp3
-rw-r--r--src/gui/widgets/qplaintextedit.cpp2
-rw-r--r--src/gui/widgets/qtabbar.cpp3
-rw-r--r--src/network/access/qnetworkdiskcache.cpp8
-rw-r--r--src/network/socket/qlocalserver.cpp8
-rw-r--r--src/network/socket/qlocalserver.h8
-rw-r--r--src/network/socket/qlocalserver_p.h61
-rw-r--r--src/network/socket/qlocalserver_unix.cpp6
-rw-r--r--src/network/socket/qlocalserver_win.cpp221
-rw-r--r--src/network/ssl/qsslcipher.cpp2
-rw-r--r--src/opengl/qpaintengine_opengl.cpp5
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp6
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp16
-rw-r--r--src/testlib/qtestlogger.cpp5
-rw-r--r--src/testlib/qtestxmlstreamer.cpp2
40 files changed, 333 insertions, 305 deletions
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index 3c015da..f63d29e 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -67,7 +67,8 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
\snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 1
Note that you cannot use QTextStream::atEnd(), which returns true when you
- have reached the end of the data stream, with stdin.
+ have reached the end of the data stream, with stdin because as long as the
+ application is running, stdin has no end.
Besides using QTextStream's constructors, you can also set the
device or string QTextStream operates on by calling setDevice() or
diff --git a/src/declarative/fx/qfxpathview.cpp b/src/declarative/fx/qfxpathview.cpp
index ca6379f..715ae5a 100644
--- a/src/declarative/fx/qfxpathview.cpp
+++ b/src/declarative/fx/qfxpathview.cpp
@@ -700,7 +700,7 @@ void QFxPathView::itemsRemoved(int modelIndex, int count)
}
if (d->model->count() == 0) {
- d->currentIndex == -1;
+ d->currentIndex = -1;
d->moveOffset.setValue(0);
return;
}
diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp
index 0dc16c9..5ed8852 100644
--- a/src/gui/dialogs/qabstractprintdialog.cpp
+++ b/src/gui/dialogs/qabstractprintdialog.cpp
@@ -400,7 +400,7 @@ void QAbstractPrintDialogPrivate::setPrinter(QPrinter *newPrinter)
QAbstractPrintDialog::setEnabledOptions() and
QAbstractPrintDialog::addEnabledOption() have no effect.
- In Qt 4.4, it was possible to use the satic functions to show a sheet on
+ 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
functionality, use QPrintDialog::open().
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 92be62f..bc9b2fa 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1966,7 +1966,7 @@ void QGraphicsItem::setOpacity(qreal opacity)
itemChange(ItemOpacityHasChanged, newOpacity);
// Update.
- d_ptr->fullUpdateHelper();
+ d_ptr->fullUpdateHelper(/*childrenOnly=*/false, /*maybeDirtyClipPath=*/false, /*ignoreOpacity=*/true);
}
/*!
@@ -3512,10 +3512,16 @@ bool QGraphicsItem::contains(const QPointF &point) const
}
/*!
- Returns true if this item collides with \a other; otherwise returns false.
- The ways items collide is determined by \a mode. The default value for \a
- mode is Qt::IntersectsItemShape; \a other collides with this item if it
- either intersects, contains, or is contained by this item's shape.
+
+ Returns true if this item collides with \a other; otherwise
+ returns false.
+
+ The \a mode is applied to \a other, and the resulting shape or
+ bounding rectangle is then compared to this item's shape. The
+ default value for \a mode is Qt::IntersectsItemShape; \a other
+ collides with this item if it either intersects, contains, or is
+ contained by this item's shape (see Qt::ItemSelectionMode for
+ details).
The default implementation is based on shape intersection, and it calls
shape() on both items. Because the complexity of arbitrary shape-shape
@@ -3570,6 +3576,11 @@ bool QGraphicsItem::collidesWithItem(const QGraphicsItem *other, Qt::ItemSelecti
Qt::IntersectsItemShape; \a path collides with this item if it either
intersects, contains, or is contained by this item's shape.
+ Note that this function checks whether the item's shape or
+ bounding rectangle (depending on \a mode) is contained within \a
+ path, and not whether \a path is contained within the items shape
+ or bounding rectangle.
+
\sa collidesWithItem(), contains(), shape()
*/
bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelectionMode mode) const
@@ -3610,11 +3621,12 @@ bool QGraphicsItem::collidesWithPath(const QPainterPath &path, Qt::ItemSelection
/*!
Returns a list of all items that collide with this item.
- The way collisions are detected is determined by \a mode. The default
- value for \a mode is Qt::IntersectsItemShape; All items whose shape
- intersects or is contained by this item's shape are returned.
+ The way collisions are detected is determined by applying \a mode
+ to items that are compared to this item, i.e., each item's shape
+ or bounding rectangle is checked against this item's shape. The
+ default value for \a mode is Qt::IntersectsItemShape.
- \sa QGraphicsScene::collidingItems(), collidesWithItem()
+ \sa collidesWithItem()
*/
QList<QGraphicsItem *> QGraphicsItem::collidingItems(Qt::ItemSelectionMode mode) const
{
@@ -3898,9 +3910,8 @@ void QGraphicsItem::setBoundingRegionGranularity(qreal granularity)
\internal
Returns true if we can discard an update request; otherwise false.
*/
-bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping,
- bool ignoreVisibleBit,
- bool ignoreDirtyBit) const
+bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping, bool ignoreVisibleBit,
+ bool ignoreDirtyBit, bool ignoreOpacity) const
{
// No scene, or if the scene is updating everything, means we have nothing
// to do. The only exception is if the scene tracks the growing scene rect.
@@ -3909,7 +3920,7 @@ bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping,
|| !scene
|| (scene->d_func()->updateAll && scene->d_func()->hasSceneRect)
|| (!ignoreClipping && (childrenClippedToShape() && isClippedAway()))
- || (childrenCombineOpacity() && isFullyTransparent());
+ || (!ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
}
/*!
@@ -3939,11 +3950,10 @@ void QGraphicsItemPrivate::updateHelper(const QRectF &rect, bool force, bool may
Propagates updates to \a item and all its children.
*/
-void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly, bool maybeDirtyClipPath)
+void QGraphicsItemPrivate::fullUpdateHelper(bool childrenOnly, bool maybeDirtyClipPath, bool ignoreOpacity)
{
- if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath,
- /*ignoreVisibleBit=*/false,
- /*ignoreDirtyBit=*/true)) {
+ if (discardUpdateRequest(/*ignoreClipping=*/maybeDirtyClipPath, /*ignoreVisibleBit=*/false,
+ /*ignoreDirtyBit=*/true, ignoreOpacity)) {
return;
}
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h
index bcbd737..062274f 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -175,11 +175,10 @@ public:
void setPosHelper(const QPointF &pos);
void setVisibleHelper(bool newVisible, bool explicitly, bool update = true);
void setEnabledHelper(bool newEnabled, bool explicitly, bool update = true);
- bool discardUpdateRequest(bool ignoreClipping = false,
- bool ignoreVisibleBit = false,
- bool ignoreDirtyBit = false) const;
+ bool discardUpdateRequest(bool ignoreClipping = false, bool ignoreVisibleBit = false,
+ bool ignoreDirtyBit = false, bool ignoreOpacity = false) const;
void updateHelper(const QRectF &rect = QRectF(), bool force = false, bool maybeDirtyClipPath = false);
- void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false);
+ void fullUpdateHelper(bool childrenOnly = false, bool maybeDirtyClipPath = false, bool ignoreOpacity = false);
void updateEffectiveOpacity();
void resolveEffectiveOpacity(qreal effectiveParentOpacity);
void resolveDepth(int parentDepth);
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 644e843..2876016 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -1081,8 +1081,12 @@ QList<QGraphicsItem *> QGraphicsViewPrivate::findItems(const QRegion &exposedReg
QList<QGraphicsItem *> itemList(scene->items());
int i = 0;
while (i < itemList.size()) {
+ const QGraphicsItem *item = itemList.at(i);
// But we only want to include items that are visible
- if (!itemList.at(i)->isVisible())
+ // The following check is basically the same as item->d_ptr->isInvisible(), except
+ // that we don't check whether the item clips children to shape or propagates its
+ // opacity (we loop through all items, so those checks are wrong in this context).
+ if (!item->isVisible() || item->d_ptr->isClippedAway() || item->d_ptr->isFullyTransparent())
itemList.removeAt(i);
else
++i;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index 5de39d9..7f36be9 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -1337,6 +1337,7 @@ QByteArray QImageReader::imageFormat(QIODevice *device)
\row \o TIFF \o Tagged Image File Format
\row \o XBM \o X11 Bitmap
\row \o XPM \o X11 Pixmap
+ \row \o SVG \o Scalable Vector Graphics
\endtable
Reading and writing SVG files is supported through Qt's
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index 61f1b5b..ab03fea 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -680,10 +680,9 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
// refresh the height cache here; we don't really lose anything by getting the size hint,
// since QAbstractItemView::dataChanged() will get the visualRect for the items anyway
- QModelIndex top = topLeft.sibling(topLeft.row(), 0);
- int topViewIndex = d->viewIndex(top);
+ int topViewIndex = d->viewIndex(topLeft);
if (topViewIndex == 0)
- d->defaultItemHeight = indexRowSizeHint(top);
+ d->defaultItemHeight = indexRowSizeHint(topLeft);
bool sizeChanged = false;
if (topViewIndex != -1) {
if (topLeft == bottomRight) {
@@ -691,8 +690,7 @@ void QTreeView::dataChanged(const QModelIndex &topLeft, const QModelIndex &botto
d->invalidateHeightCache(topViewIndex);
sizeChanged = (oldHeight != d->itemHeight(topViewIndex));
} else {
- QModelIndex bottom = bottomRight.sibling(bottomRight.row(), 0);
- int bottomViewIndex = d->viewIndex(bottom);
+ int bottomViewIndex = d->viewIndex(bottomRight);
for (int i = topViewIndex; i <= bottomViewIndex; ++i) {
int oldHeight = d->itemHeight(i);
d->invalidateHeightCache(i);
@@ -1815,10 +1813,10 @@ void QTreeView::mouseDoubleClickEvent(QMouseEvent *event)
if (i == -1)
return; // user clicked outside the items
- const QModelIndex &index = d->viewItems.at(i).index;
+ const QPersistentModelIndex firstColumnIndex = d->viewItems.at(i).index;
int column = d->header->logicalIndexAt(event->x());
- QPersistentModelIndex persistent = index.sibling(index.row(), column);
+ QPersistentModelIndex persistent = firstColumnIndex.sibling(firstColumnIndex.row(), column);
if (d->pressedIndex != persistent) {
mousePressEvent(event);
@@ -1841,10 +1839,10 @@ void QTreeView::mouseDoubleClickEvent(QMouseEvent *event)
if (d->itemsExpandable
&& d->expandsOnDoubleClick
&& d->hasVisibleChildren(persistent)) {
- if (!((i < d->viewItems.count()) && (d->viewItems.at(i).index == persistent))) {
+ if (!((i < d->viewItems.count()) && (d->viewItems.at(i).index == firstColumnIndex))) {
// find the new index of the item
for (i = 0; i < d->viewItems.count(); ++i) {
- if (d->viewItems.at(i).index == persistent)
+ if (d->viewItems.at(i).index == firstColumnIndex)
break;
}
if (i == d->viewItems.count())
@@ -2422,14 +2420,10 @@ void QTreeView::rowsInserted(const QModelIndex &parent, int start, int end)
? d->viewItems.count()
: d->viewItems.at(parentItem).total) - 1;
- int firstColumn = 0;
- while (isColumnHidden(firstColumn) && firstColumn < header()->count() - 1)
- ++firstColumn;
-
const int delta = end - start + 1;
QVector<QTreeViewItem> insertedItems(delta);
for (int i = 0; i < delta; ++i) {
- insertedItems[i].index = d->model->index(i + start, firstColumn, parent);
+ insertedItems[i].index = d->model->index(i + start, 0, parent);
insertedItems[i].level = childLevel;
}
if (d->viewItems.isEmpty())
@@ -2612,7 +2606,7 @@ void QTreeView::expandAll()
d->viewItems[i].expanded = true;
d->layout(i);
QModelIndex idx = d->viewItems.at(i).index;
- d->expandedIndexes.insert(idx.sibling(idx.row(), 0));
+ d->expandedIndexes.insert(idx);
}
updateGeometries();
d->viewport->update();
@@ -3130,13 +3124,9 @@ void QTreeViewPrivate::layout(int i)
int last = 0;
int children = 0;
- int firstColumn = 0;
- while (header->isSectionHidden(firstColumn) && firstColumn < header->count())
- ++firstColumn;
-
for (int j = first; j < first + count; ++j) {
- current = model->index(j - first, firstColumn, parent);
- if (isRowHidden(current.sibling(current.row(), 0))) {
+ current = model->index(j - first, 0, parent);
+ if (isRowHidden(current)) {
++hidden;
last = j - hidden + children;
} else {
@@ -3319,15 +3309,11 @@ int QTreeViewPrivate::itemAtCoordinate(int coordinate) const
int QTreeViewPrivate::viewIndex(const QModelIndex &_index) const
{
- Q_Q(const QTreeView);
if (!_index.isValid() || viewItems.isEmpty())
return -1;
const int totalCount = viewItems.count();
- int firstColumn = 0;
- while (q->isColumnHidden(firstColumn) && firstColumn < header->count())
- ++firstColumn;
- const QModelIndex index = _index.sibling(_index.row(), firstColumn);
+ const QModelIndex index = _index.sibling(_index.row(), 0);
// A quick check near the last item to see if we are just incrementing
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 60ac062..1cbc960 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -199,6 +199,7 @@ extern "C" {
composingText = new QString();
composing = false;
sendKeyEvents = true;
+ currentCustomTypes = 0;
[self setHidden:YES];
return self;
}
@@ -213,10 +214,16 @@ extern "C" {
object:self];
}
--(void)registerDragTypes:(bool)accept
+-(void)registerDragTypes
{
QMacCocoaAutoReleasePool pool;
- if (accept) {
+ // Calling registerForDraggedTypes is slow, so only do it once for each widget
+ // or when the custom types change.
+ const QStringList& customTypes = qEnabledDraggedTypes();
+ if (currentCustomTypes == 0 || *currentCustomTypes != customTypes) {
+ if (currentCustomTypes == 0)
+ currentCustomTypes = new QStringList();
+ *currentCustomTypes = customTypes;
const NSString* mimeTypeGeneric = @"com.trolltech.qt.MimeTypeName";
NSMutableArray *supportedTypes = [NSMutableArray arrayWithObjects:NSColorPboardType,
NSFilenamesPboardType, NSStringPboardType,
@@ -228,13 +235,10 @@ extern "C" {
NSFilesPromisePboardType, NSInkTextPboardType,
NSMultipleTextSelectionPboardType, mimeTypeGeneric, nil];
// Add custom types supported by the application.
- const QStringList& customTypes = qEnabledDraggedTypes();
for (int i = 0; i < customTypes.size(); i++) {
[supportedTypes addObject:reinterpret_cast<const NSString *>(QCFString::toCFStringRef(customTypes[i]))];
}
[self registerForDraggedTypes:supportedTypes];
- } else {
- [self unregisterDraggedTypes];
}
}
@@ -283,6 +287,8 @@ extern "C" {
- (NSDragOperation)draggingEntered:(id <NSDraggingInfo>)sender
{
+ if (qwidget->testAttribute(Qt::WA_DropSiteRegistered) == false)
+ return NSDragOperationNone;
[self addDropData:sender];
QMimeData *mimeData = dropData;
if (QDragManager::self()->source())
@@ -416,6 +422,8 @@ extern "C" {
{
delete composingText;
[[NSNotificationCenter defaultCenter] removeObserver:self];
+ delete currentCustomTypes;
+ [self unregisterDraggedTypes];
[super dealloc];
}
diff --git a/src/gui/kernel/qcocoaview_mac_p.h b/src/gui/kernel/qcocoaview_mac_p.h
index ec1281e..1d4e3e4 100644
--- a/src/gui/kernel/qcocoaview_mac_p.h
+++ b/src/gui/kernel/qcocoaview_mac_p.h
@@ -84,6 +84,7 @@ Q_GUI_EXPORT
int composingLength;
bool sendKeyEvents;
QString *composingText;
+ QStringList *currentCustomTypes;
}
- (id)initWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate;
- (void) finishInitWithQWidget:(QWidget *)widget widgetPrivate:(QWidgetPrivate *)widgetprivate;
@@ -92,7 +93,7 @@ Q_GUI_EXPORT
- (NSDragOperation)draggingUpdated:(id < NSDraggingInfo >)sender;
- (void)draggingExited:(id < NSDraggingInfo >)sender;
- (BOOL)performDragOperation:(id <NSDraggingInfo>)sender;
-- (void)registerDragTypes:(bool)accept;
+- (void)registerDragTypes;
- (void)removeDropData;
- (void)addDropData:(id <NSDraggingInfo>)sender;
- (void)setSupportedActions:(NSDragOperation)actions;
diff --git a/src/gui/kernel/qformlayout.cpp b/src/gui/kernel/qformlayout.cpp
index e2d6108..a665c89 100644
--- a/src/gui/kernel/qformlayout.cpp
+++ b/src/gui/kernel/qformlayout.cpp
@@ -689,12 +689,16 @@ void QFormLayoutPrivate::setupVerticalLayoutData(int width)
// are split.
maxLabelWidth = 0;
if (!wrapAllRows) {
+ int maxFieldMinWidth = 0; //the maximum minimum size of the field
for (int i = 0; i < rr; ++i) {
const QFormLayoutItem *label = m_matrix(i, 0);
const QFormLayoutItem *field = m_matrix(i, 1);
- if (label && (label->sizeHint.width() + (field ? field->minSize.width() : 0) <= width))
+ if (label && field && label->sideBySide)
maxLabelWidth = qMax(maxLabelWidth, label->sizeHint.width());
+ if (field)
+ maxFieldMinWidth = qMax(maxFieldMinWidth, field->minSize.width() + field->sbsHSpace);
}
+ maxLabelWidth = qMin(maxLabelWidth, width - maxFieldMinWidth);
} else {
maxLabelWidth = width;
}
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index f000292..9165836 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -826,13 +826,28 @@ bool qt_mac_handleMouseEvent(void * /* NSView * */view, void * /* NSEvent * */ev
QWidget *qwidget = [theView qt_qwidget];
QWidget *widgetToGetMouse = qwidget;
QWidget *popup = qAppInstance()->activePopupWidget();
- if (popup && popup != qwidget->window())
- widgetToGetMouse = popup;
NSView *tmpView = theView;
- if (widgetToGetMouse != qwidget) {
- tmpView = qt_mac_nativeview_for(widgetToGetMouse);
+
+ if (popup && popup != qwidget->window()) {
+ widgetToGetMouse = popup;
+ tmpView = qt_mac_nativeview_for(popup);
windowPoint = [[tmpView window] convertScreenToBase:globalPoint];
+
+ QPoint qWindowPoint(windowPoint.x, windowPoint.y);
+ if (widgetToGetMouse->rect().contains(qWindowPoint)) {
+ // Keeping the mouse pressed on a combobox button will make
+ // the popup pop in front of the mouse. But all mouse events
+ // will be sendt to the button. Since we want mouse events
+ // to be sendt to widgets inside the popup, we search for the
+ // widget in front of the mouse:
+ tmpView = [tmpView hitTest:windowPoint];
+ if (!tmpView)
+ return false;
+ widgetToGetMouse =
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(tmpView) qt_qwidget];
+ }
}
+
NSPoint localPoint = [tmpView convertPoint:windowPoint fromView:nil];
QPoint qlocalPoint(localPoint.x, localPoint.y);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index dd95053..cbf9585 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -4810,7 +4810,7 @@ void QWidget::render(QPainter *painter, const QPoint &targetOffset,
Q_ASSERT(engine);
QPaintEnginePrivate *enginePriv = engine->d_func();
Q_ASSERT(enginePriv);
- QPaintDevice *target = painter->worldMatrixEnabled() ? engine->paintDevice() : painter->device();
+ QPaintDevice *target = engine->paintDevice();
Q_ASSERT(target);
// Render via a pixmap when dealing with non-opaque painters or printers.
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 9da0b6b..1896b97 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4491,8 +4491,8 @@ void QWidgetPrivate::registerDropSite(bool on)
SetControlDragTrackingEnabled(qt_mac_nativeview_for(q), on);
#else
NSView *view = qt_mac_nativeview_for(q);
- if ([view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) {
- [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) registerDragTypes:on];
+ if (on && [view isKindOfClass:[QT_MANGLE_NAMESPACE(QCocoaView) class]]) {
+ [static_cast<QT_MANGLE_NAMESPACE(QCocoaView) *>(view) registerDragTypes];
}
#endif
}
diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp
index 6329135..ae93efe 100644
--- a/src/gui/kernel/qx11embed_x11.cpp
+++ b/src/gui/kernel/qx11embed_x11.cpp
@@ -1297,9 +1297,6 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
// focus is set to our focus proxy. We want to intercept all
// keypresses.
if (o == window() && d->client) {
- if (!d->isEmbedded() && d->activeContainer == this)
- d->moveInputToProxy();
-
if (d->clientIsXEmbed) {
sendXEmbedMessage(d->client, x11Info().display(), XEMBED_WINDOW_ACTIVATE);
} else {
@@ -1307,6 +1304,8 @@ bool QX11EmbedContainer::eventFilter(QObject *o, QEvent *event)
if (hasFocus())
XSetInputFocus(x11Info().display(), d->client, XRevertToParent, x11Time());
}
+ if (!d->isEmbedded())
+ d->moveInputToProxy();
}
break;
case QEvent::WindowDeactivate:
@@ -1729,10 +1728,10 @@ void QX11EmbedContainerPrivate::acceptClient(WId window)
checkGrab();
if (q->hasFocus()) {
XSetInputFocus(q->x11Info().display(), client, XRevertToParent, x11Time());
- } else {
- if (!isEmbedded())
- moveInputToProxy();
}
+ } else {
+ if (!isEmbedded())
+ moveInputToProxy();
}
emit q->clientIsEmbedded();
@@ -1749,11 +1748,9 @@ void QX11EmbedContainerPrivate::acceptClient(WId window)
void QX11EmbedContainerPrivate::moveInputToProxy()
{
Q_Q(QX11EmbedContainer);
- WId focus;
- int revert_to;
- XGetInputFocus(q->x11Info().display(), &focus, &revert_to);
- if (focus != focusProxy->internalWinId())
- XSetInputFocus(q->x11Info().display(), focusProxy->internalWinId(), XRevertToParent, x11Time());
+ // Following Owen Taylor's advice from the XEmbed specification to
+ // always use CurrentTime when no explicit user action is involved.
+ XSetInputFocus(q->x11Info().display(), focusProxy->internalWinId(), XRevertToParent, CurrentTime);
}
/*! \internal
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 16dd617..8f4a2bf 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -44,8 +44,6 @@
QT_BEGIN_NAMESPACE
-static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
-
struct SourceOnlyAlpha
{
inline uchar alpha(uchar src) const { return src; }
@@ -140,14 +138,11 @@ struct Blend_ARGB32_on_RGB16_SourceAndConstAlpha {
template <typename SRC, typename T>
void qt_scale_image_16bit(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
- const QRectF &target,
+ const QRectF &targetRect,
const QRectF &srcRect,
const QRect &clip,
T blender)
{
- const QRectF targetRect = target.translated(aliasedCoordinateDelta,
- aliasedCoordinateDelta);
-
qreal sx = targetRect.width() / (qreal) srcRect.width();
qreal sy = targetRect.height() / (qreal) srcRect.height();
@@ -617,14 +612,11 @@ struct Blend_ARGB32_on_ARGB32_SourceAndConstAlpha {
template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
- const QRectF &target,
+ const QRectF &targetRect,
const QRectF &srcRect,
const QRect &clip,
T blender)
{
- const QRectF targetRect = target.translated(aliasedCoordinateDelta,
- aliasedCoordinateDelta);
-
qreal sx = targetRect.width() / (qreal) srcRect.width();
qreal sy = targetRect.height() / (qreal) srcRect.height();
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 8077b9b..3428faf 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -2577,7 +2577,11 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
QRasterPaintEngineState *s = state();
const bool aa = s->flags.antialiased || s->flags.bilinear;
if (!aa && sr.size() == QSize(1, 1)) {
- fillRect(r, QColor::fromRgba(img.pixel(sr.x(), sr.y())));
+ // as fillRect will apply the aliased coordinate delta we need to
+ // subtract it here as we don't use it for image drawing
+ const QRectF targetRect = r.translated(-aliasedCoordinateDelta,
+ -aliasedCoordinateDelta);
+ fillRect(targetRect, QColor::fromRgba(img.pixel(sr.x(), sr.y())));
return;
}
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 4b2fbca..9cc9683 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -1543,6 +1543,8 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p
QX11PaintEnginePrivate::GCMode gcMode,
QPaintEngine::PolygonDrawMode mode)
{
+ Q_Q(QX11PaintEngine);
+
int clippedCount = 0;
qt_float_point *clippedPoints = 0;
@@ -1617,7 +1619,29 @@ void QX11PaintEnginePrivate::fillPolygon_dev(const QPointF *polygonPoints, int p
} else
#endif
if (fill.style() != Qt::NoBrush) {
- if (clippedCount > 0) {
+ if (clippedCount > 200000) {
+ QPolygon poly;
+ for (int i = 0; i < clippedCount; ++i)
+ poly << QPoint(qFloor(clippedPoints[i].x), qFloor(clippedPoints[i].y));
+
+ const QRect bounds = poly.boundingRect();
+ const QRect aligned = bounds
+ & QRect(QPoint(), QSize(pdev->width(), pdev->height()));
+
+ QImage img(aligned.size(), QImage::Format_ARGB32_Premultiplied);
+ img.fill(0);
+
+ QPainter painter(&img);
+ painter.translate(-aligned.x(), -aligned.y());
+ painter.setPen(Qt::NoPen);
+ painter.setBrush(fill);
+ if (gcMode == BrushGC)
+ painter.setBrushOrigin(q->painter()->brushOrigin());
+ painter.drawPolygon(poly);
+ painter.end();
+
+ q->drawImage(aligned, img, img.rect(), Qt::AutoColor);
+ } else if (clippedCount > 0) {
QVarLengthArray<XPoint> xpoints(clippedCount);
for (int i = 0; i < clippedCount; ++i) {
xpoints[i].x = qFloor(clippedPoints[i].x);
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index ebddfd5..dcc11b8 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -4758,7 +4758,7 @@ QSize QStyleSheetStyle::sizeFromContents(ContentsType ct, const QStyleOption *op
case CT_LineEdit:
#ifndef QT_NO_SPINBOX
// ### hopelessly broken QAbstractSpinBox (part 2)
- if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w->parentWidget())) {
+ if (QAbstractSpinBox *spinBox = qobject_cast<QAbstractSpinBox *>(w ? w->parentWidget() : 0)) {
QRenderRule rule = renderRule(spinBox, opt);
if (rule.hasBox() || !rule.hasNativeBorder())
return csz;
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 47fe5c2..d7a9c23 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -624,6 +624,45 @@ QImage QFontEngine::alphaRGBMapForGlyph(glyph_t glyph, int /* margin */, const Q
return rgbMask;
}
+QImage QFontEngine::alphaMapForGlyph(glyph_t glyph)
+{
+ glyph_metrics_t gm = boundingBox(glyph);
+ int glyph_x = qFloor(gm.x.toReal());
+ int glyph_y = qFloor(gm.y.toReal());
+ int glyph_width = qCeil((gm.x + gm.width).toReal()) - glyph_x;
+ int glyph_height = qCeil((gm.y + gm.height).toReal()) - glyph_y;
+
+ if (glyph_width <= 0 || glyph_height <= 0)
+ return QImage();
+ QFixedPoint pt;
+ pt.x = 0;
+ pt.y = -glyph_y; // the baseline
+ QPainterPath path;
+ QImage im(glyph_width + qAbs(glyph_x) + 4, glyph_height, QImage::Format_ARGB32_Premultiplied);
+ im.fill(Qt::transparent);
+ QPainter p(&im);
+ p.setRenderHint(QPainter::Antialiasing);
+ addGlyphsToPath(&glyph, &pt, 1, &path, 0);
+ p.setPen(Qt::NoPen);
+ p.setBrush(Qt::black);
+ p.drawPath(path);
+ p.end();
+
+ QImage indexed(im.width(), im.height(), QImage::Format_Indexed8);
+ QVector<QRgb> colors(256);
+ for (int i=0; i<256; ++i)
+ colors[i] = qRgba(0, 0, 0, i);
+ indexed.setColorTable(colors);
+
+ for (int y=0; y<im.height(); ++y) {
+ uchar *dst = (uchar *) indexed.scanLine(y);
+ uint *src = (uint *) im.scanLine(y);
+ for (int x=0; x<im.width(); ++x)
+ dst[x] = qAlpha(src[x]);
+ }
+
+ return indexed;
+}
void QFontEngine::removeGlyphFromCache(glyph_t)
{
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index cb0b436..de03a3c 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1788,9 +1788,11 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g)
GlyphFormat glyph_format = antialias ? Format_A8 : Format_Mono;
- Glyph *glyph = loadGlyph(g, glyph_format);
- if (!glyph)
- return QImage();
+ Glyph *glyph = defaultGlyphSet.outline_drawing ? 0 : loadGlyph(g, glyph_format);
+ if (!glyph) {
+ unlockFace();
+ return QFontEngine::alphaMapForGlyph(g);
+ }
const int pitch = antialias ? (glyph->width + 3) & ~3 : ((glyph->width + 31)/32) * 4;
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 8f6b92a..92efb6c 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -178,7 +178,7 @@ public:
* Create a qimage with the alpha values for the glyph.
* Returns an image indexed_8 with index values ranging from 0=fully transparant to 255=opaque
*/
- virtual QImage alphaMapForGlyph(glyph_t) = 0;
+ virtual QImage alphaMapForGlyph(glyph_t);
virtual QImage alphaMapForGlyph(glyph_t, const QTransform &t);
virtual QImage alphaRGBMapForGlyph(glyph_t, int margin, const QTransform &t);
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index c327b9f..48963bb 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -1074,7 +1074,10 @@ QTextCursor::QTextCursor(const QTextCursor &cursor)
}
/*!
- Makes a copy of \a cursor and assigns it to this QTextCursor.
+ Makes a copy of \a cursor and assigns it to this QTextCursor. Note
+ that QTextCursor is an \l{Implicitly Shared Classes}{implicitly
+ shared} class.
+
*/
QTextCursor &QTextCursor::operator=(const QTextCursor &cursor)
{
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index e84b324..873f846 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -287,7 +287,7 @@ QTextCodec *Qt::codecForHtml(const QByteArray &ba)
that inform connected editor widgets about the state of the undo/redo
system.
- \sa QTextCursor QTextEdit \link richtext.html Rich Text Processing\endlink
+ \sa QTextCursor, QTextEdit, \link richtext.html Rich Text Processing\endlink , {Text Object Example}
*/
/*!
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp
index 3f4c8e5..71b68e0 100644
--- a/src/gui/text/qtextobject.cpp
+++ b/src/gui/text/qtextobject.cpp
@@ -76,7 +76,7 @@ QT_BEGIN_NAMESPACE
objects, you will also need to reimplement QTextDocument::createObject()
which acts as a factory method for creating text objects.
- \sa QTextDocument
+ \sa QTextDocument, {Text Object Example}
*/
/*!
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 1afb28a..502c1e9 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -480,9 +480,6 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar)
oldMenuBar->hide();
oldMenuBar->deleteLater();
}
-#ifdef Q_WS_WINCE
- if (menuBar && menuBar->size().height() > 0)
-#endif
d->layout->setMenuBar(menuBar);
}
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index a51ed2d..14efd23 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -629,7 +629,7 @@ void QPlainTextEditPrivate::setTopBlock(int blockNumber, int lineNumber, int dx)
if (viewport->updatesEnabled() && viewport->isVisible()) {
int dy = 0;
- if (doc->findBlockByLineNumber(control->topBlock).isValid()) {
+ if (doc->findBlockByNumber(control->topBlock).isValid()) {
dy = (int)(-q->blockBoundingGeometry(block).y())
+ verticalOffset() - verticalOffset(blockNumber, lineNumber);
}
diff --git a/src/gui/widgets/qtabbar.cpp b/src/gui/widgets/qtabbar.cpp
index ce1ac09..0b4ce9d 100644
--- a/src/gui/widgets/qtabbar.cpp
+++ b/src/gui/widgets/qtabbar.cpp
@@ -1084,7 +1084,7 @@ void QTabBar::setTabData(int index, const QVariant & data)
}
/*!
- Returns the datad of the tab at position \a index, or a null
+ Returns the data of the tab at position \a index, or a null
variant if \a index is out of range.
*/
QVariant QTabBar::tabData(int index) const
@@ -2223,6 +2223,7 @@ void QTabBar::setTabButton(int index, ButtonPosition position, QWidget *widget)
d->tabList[index].rightWidget = widget;
}
d->layoutTabs();
+ d->refresh();
update();
}
diff --git a/src/network/access/qnetworkdiskcache.cpp b/src/network/access/qnetworkdiskcache.cpp
index 14a04f1..d42370d 100644
--- a/src/network/access/qnetworkdiskcache.cpp
+++ b/src/network/access/qnetworkdiskcache.cpp
@@ -193,7 +193,11 @@ QIODevice *QNetworkDiskCache::prepare(const QNetworkCacheMetaData &metaData)
} else {
QString templateName = d->tmpCacheFileName();
cacheItem->file = new QTemporaryFile(templateName, &cacheItem->data);
- cacheItem->file->open();
+ if (!cacheItem->file->open()) {
+ qWarning() << "QNetworkDiskCache::prepare() unable to open temporary file";
+ delete cacheItem;
+ return 0;
+ }
cacheItem->writeHeader(cacheItem->file);
device = cacheItem->file;
}
@@ -231,7 +235,7 @@ void QNetworkDiskCachePrivate::storeItem(QCacheItem *cacheItem)
if (QFile::exists(fileName)) {
if (!QFile::remove(fileName)) {
- qWarning() << "QNetworkDiskCache: could't remove the cache file " << fileName;
+ qWarning() << "QNetworkDiskCache: couldn't remove the cache file " << fileName;
return;
}
}
diff --git a/src/network/socket/qlocalserver.cpp b/src/network/socket/qlocalserver.cpp
index d6b1507..77a999b 100644
--- a/src/network/socket/qlocalserver.cpp
+++ b/src/network/socket/qlocalserver.cpp
@@ -276,9 +276,13 @@ QLocalSocket *QLocalServer::nextPendingConnection()
if (d->pendingConnections.isEmpty())
return 0;
QLocalSocket *nextSocket = d->pendingConnections.dequeue();
+#ifndef QT_LOCALSOCKET_TCP
+ if (d->pendingConnections.size() <= d->maxPendingConnections)
#ifndef Q_OS_WIN
- d->socketNotifier->setEnabled(d->pendingConnections.size()
- <= d->maxPendingConnections);
+ d->socketNotifier->setEnabled(true);
+#else
+ d->connectionEventNotifier->setEnabled(true);
+#endif
#endif
return nextSocket;
}
diff --git a/src/network/socket/qlocalserver.h b/src/network/socket/qlocalserver.h
index 8e8babd..1488a75 100644
--- a/src/network/socket/qlocalserver.h
+++ b/src/network/socket/qlocalserver.h
@@ -86,15 +86,7 @@ protected:
private:
Q_DISABLE_COPY(QLocalServer)
-#if defined(QT_LOCALSOCKET_TCP)
Q_PRIVATE_SLOT(d_func(), void _q_onNewConnection())
-#elif defined(Q_OS_WIN)
- Q_PRIVATE_SLOT(d_func(), void _q_openSocket(HANDLE handle))
- Q_PRIVATE_SLOT(d_func(), void _q_stoppedListening())
- Q_PRIVATE_SLOT(d_func(), void _q_setError(QAbstractSocket::SocketError error, const QString &errorString))
-#else
- Q_PRIVATE_SLOT(d_func(), void _q_socketActivated())
-#endif
};
#endif // QT_NO_LOCALSERVER
diff --git a/src/network/socket/qlocalserver_p.h b/src/network/socket/qlocalserver_p.h
index 8e96401..7b31082 100644
--- a/src/network/socket/qlocalserver_p.h
+++ b/src/network/socket/qlocalserver_p.h
@@ -63,7 +63,7 @@
# include <qtcpserver.h>
#elif defined(Q_OS_WIN)
# include <qt_windows.h>
-# include <qthread.h>
+# include <private/qwineventnotifier_p.h>
#else
# include <private/qnativesocketengine_p.h>
# include <qsocketnotifier.h>
@@ -71,52 +71,13 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP)
-
-/*!
- \internal
- QLocalServerThread exists because Windows does not have a
- way to provide notifications when there is a new connections to
- the server.
- */
-class QLocalServerThread : public QThread
-{
- Q_OBJECT
-
-Q_SIGNALS:
- void connected(HANDLE newSocket);
- void error(QAbstractSocket::SocketError error, const QString &errorString);
-
-public:
- QLocalServerThread(QObject *parent = 0);
- ~QLocalServerThread();
- void closeServer();
-
-public:
- QString setName(const QString &name);
- void run();
- void stop();
- bool makeHandle();
-
- HANDLE gotConnectionEvent;
- QQueue<HANDLE> pendingHandles;
- int maxPendingConnections;
-private:
- HANDLE stopEvent;
- QString fullServerName;
-};
-
-#endif
-
class QLocalServerPrivate : public QObjectPrivate
{
Q_DECLARE_PUBLIC(QLocalServer)
public:
QLocalServerPrivate() :
-#if defined(Q_OS_WIN) && !defined(QT_LOCALSOCKET_TCP)
- inWaitingFunction(false),
-#elif !defined(QT_LOCALSOCKET_TCP)
+#if !defined(QT_LOCALSOCKET_TCP) && !defined(Q_OS_WIN)
listenSocket(-1), socketNotifier(0),
#endif
maxPendingConnections(30), error(QAbstractSocket::UnknownSocketError)
@@ -128,22 +89,26 @@ public:
static bool removeServer(const QString &name);
void closeServer();
void waitForNewConnection(int msec, bool *timedOut);
+ void _q_onNewConnection();
#if defined(QT_LOCALSOCKET_TCP)
- void _q_onNewConnection();
QTcpServer tcpServer;
QMap<quintptr, QTcpSocket*> socketMap;
#elif defined(Q_OS_WIN)
- void _q_openSocket(HANDLE socket);
- void _q_stoppedListening();
- void _q_setError(QAbstractSocket::SocketError error, const QString &errorString);
+ struct Listener {
+ HANDLE handle;
+ OVERLAPPED overlapped;
+ };
+
+ void setError(const QString &function);
+ bool addListener();
- QLocalServerThread waitForConnection;
- bool inWaitingFunction;
+ QList<Listener> listeners;
+ HANDLE eventHandle;
+ QWinEventNotifier *connectionEventNotifier;
#else
void setError(const QString &function);
- void _q_socketActivated();
int listenSocket;
QSocketNotifier *socketNotifier;
diff --git a/src/network/socket/qlocalserver_unix.cpp b/src/network/socket/qlocalserver_unix.cpp
index e7d2252..53ee6b6 100644
--- a/src/network/socket/qlocalserver_unix.cpp
+++ b/src/network/socket/qlocalserver_unix.cpp
@@ -132,7 +132,7 @@ bool QLocalServerPrivate::listen(const QString &requestedServerName)
socketNotifier = new QSocketNotifier(listenSocket,
QSocketNotifier::Read, q);
q->connect(socketNotifier, SIGNAL(activated(int)),
- q, SLOT(_q_socketActivated()));
+ q, SLOT(_q_onNewConnection()));
socketNotifier->setEnabled(maxPendingConnections > 0);
return true;
}
@@ -164,7 +164,7 @@ void QLocalServerPrivate::closeServer()
We have received a notification that we can read on the listen socket.
Accept the new socket.
*/
-void QLocalServerPrivate::_q_socketActivated()
+void QLocalServerPrivate::_q_onNewConnection()
{
Q_Q(QLocalServer);
if (-1 == listenSocket)
@@ -209,7 +209,7 @@ void QLocalServerPrivate::waitForNewConnection(int msec, bool *timedOut)
break;
}
if (result > 0)
- _q_socketActivated();
+ _q_onNewConnection();
}
if (timedOut)
*timedOut = (result == 0);
diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp
index 880cd7e..b14bbf7 100644
--- a/src/network/socket/qlocalserver_win.cpp
+++ b/src/network/socket/qlocalserver_win.cpp
@@ -44,68 +44,26 @@
#include "qlocalsocket.h"
#include <qdebug.h>
-#include <qdatetime.h>
-#include <qcoreapplication.h>
-#include <QMetaType>
// The buffer size need to be 0 otherwise data could be
// lost if the socket that has written data closes the connection
// before it is read. Pipewriter is used for write buffering.
#define BUFSIZE 0
-QT_BEGIN_NAMESPACE
-
-QLocalServerThread::QLocalServerThread(QObject *parent) : QThread(parent),
- maxPendingConnections(1)
-{
- stopEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- gotConnectionEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
-}
+// ###: This should be a property. Should replace the insane 50 on unix as well.
+#define SYSTEM_MAX_PENDING_SOCKETS 8
-QLocalServerThread::~QLocalServerThread()
-{
- stop();
- closeServer();
- CloseHandle(stopEvent);
- CloseHandle(gotConnectionEvent);
-}
-
-void QLocalServerThread::stop()
-{
- if (isRunning()) {
- SetEvent(stopEvent);
- wait();
- ResetEvent(stopEvent);
- }
-}
-
-void QLocalServerThread::closeServer()
-{
- while (!pendingHandles.isEmpty())
- CloseHandle(pendingHandles.dequeue());
-}
-
-QString QLocalServerThread::setName(const QString &name)
-{
- QString pipePath = QLatin1String("\\\\.\\pipe\\");
- if (name.startsWith(pipePath))
- fullServerName = name;
- else
- fullServerName = pipePath + name;
- for (int i = pendingHandles.count(); i < maxPendingConnections; ++i)
- if (!makeHandle())
- break;
- return fullServerName;
-}
+QT_BEGIN_NAMESPACE
-bool QLocalServerThread::makeHandle()
+bool QLocalServerPrivate::addListener()
{
- if (pendingHandles.count() >= maxPendingConnections)
- return false;
+ // The object must not change its address once the
+ // contained OVERLAPPED struct is passed to Windows.
+ listeners << Listener();
+ Listener &listener = listeners.last();
- HANDLE handle = INVALID_HANDLE_VALUE;
QT_WA({
- handle = CreateNamedPipeW(
+ listener.handle = CreateNamedPipeW(
(TCHAR*)fullServerName.utf16(), // pipe name
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
@@ -117,7 +75,7 @@ bool QLocalServerThread::makeHandle()
3000, // client time-out
NULL);
}, {
- handle = CreateNamedPipeA(
+ listener.handle = CreateNamedPipeA(
fullServerName.toLocal8Bit().constData(), // pipe name
PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access
PIPE_TYPE_MESSAGE | // message type pipe
@@ -129,68 +87,43 @@ bool QLocalServerThread::makeHandle()
3000, // client time-out
NULL);
});
-
- if (INVALID_HANDLE_VALUE == handle) {
+ if (listener.handle == INVALID_HANDLE_VALUE) {
+ setError(QLatin1String("QLocalServerPrivate::addListener"));
+ listeners.removeLast();
return false;
}
- pendingHandles.enqueue(handle);
+
+ memset(&listener.overlapped, 0, sizeof(listener.overlapped));
+ listener.overlapped.hEvent = eventHandle;
+ if (!ConnectNamedPipe(listener.handle, &listener.overlapped)) {
+ switch (GetLastError()) {
+ case ERROR_IO_PENDING:
+ break;
+ case ERROR_PIPE_CONNECTED:
+ SetEvent(eventHandle);
+ break;
+ default:
+ CloseHandle(listener.handle);
+ setError(QLatin1String("QLocalServerPrivate::addListener"));
+ listeners.removeLast();
+ return false;
+ }
+ } else {
+ Q_ASSERT_X(false, "QLocalServerPrivate::addListener", "The impossible happened");
+ SetEvent(eventHandle);
+ }
return true;
}
-void QLocalServerThread::run()
+void QLocalServerPrivate::setError(const QString &function)
{
- OVERLAPPED op;
- HANDLE handleArray[2];
- memset(&op, 0, sizeof(op));
- handleArray[0] = op.hEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
- handleArray[1] = stopEvent;
- HANDLE handle = INVALID_HANDLE_VALUE;
-
- forever {
- if (INVALID_HANDLE_VALUE == handle) {
- makeHandle();
- if (!pendingHandles.isEmpty())
- handle = pendingHandles.dequeue();
- }
- if (INVALID_HANDLE_VALUE == handle) {
- int windowsError = GetLastError();
- QString function = QLatin1String("QLocalServer::run");
- QString errorString = QLocalServer::tr("%1: Unknown error %2").arg(function).arg(windowsError);
- emit error(QAbstractSocket::UnknownSocketError, errorString);
- CloseHandle(handleArray[0]);
- SetEvent(gotConnectionEvent);
- return;
- }
-
- BOOL isConnected = ConnectNamedPipe(handle, &op) ? TRUE : (GetLastError() == ERROR_PIPE_CONNECTED);
- if (!isConnected) {
- switch (WaitForMultipleObjects(2, handleArray, FALSE, INFINITE))
- {
- case WAIT_OBJECT_0 + 1:
- CloseHandle(handle);
- CloseHandle(handleArray[0]);
- return;
- }
- }
- emit connected(handle);
- handle = INVALID_HANDLE_VALUE;
- ResetEvent(handleArray[0]);
- SetEvent(gotConnectionEvent);
- }
+ int windowsError = GetLastError();
+ errorString = QString::fromLatin1("%1: %2").arg(function).arg(qt_error_string(windowsError));
+ error = QAbstractSocket::UnknownSocketError;
}
void QLocalServerPrivate::init()
{
- Q_Q(QLocalServer);
- qRegisterMetaType<HANDLE>("HANDLE");
- q->connect(&waitForConnection, SIGNAL(connected(HANDLE)),
- q, SLOT(_q_openSocket(HANDLE)), Qt::QueuedConnection);
- q->connect(&waitForConnection, SIGNAL(finished()),
- q, SLOT(_q_stoppedListening()), Qt::QueuedConnection);
- q->connect(&waitForConnection, SIGNAL(terminated()),
- q, SLOT(_q_stoppedListening()), Qt::QueuedConnection);
- q->connect(&waitForConnection, SIGNAL(error(QAbstractSocket::SocketError, const QString &)),
- q, SLOT(_q_setError(QAbstractSocket::SocketError, const QString &)));
}
bool QLocalServerPrivate::removeServer(const QString &name)
@@ -201,35 +134,71 @@ bool QLocalServerPrivate::removeServer(const QString &name)
bool QLocalServerPrivate::listen(const QString &name)
{
- fullServerName = waitForConnection.setName(name);
- serverName = name;
- waitForConnection.start();
- return true;
-}
+ Q_Q(QLocalServer);
-void QLocalServerPrivate::_q_setError(QAbstractSocket::SocketError e, const QString &eString)
-{
- error = e;
- errorString = eString;
-}
+ QString pipePath = QLatin1String("\\\\.\\pipe\\");
+ if (name.startsWith(pipePath))
+ fullServerName = name;
+ else
+ fullServerName = pipePath + name;
-void QLocalServerPrivate::_q_stoppedListening()
-{
- Q_Q(QLocalServer);
- if (!inWaitingFunction)
- q->close();
+ // Use only one event for all listeners of one socket.
+ // The idea is that listener events are rare, so polling all listeners once in a while is
+ // cheap compared to waiting for N additional events in each iteration of the main loop.
+ eventHandle = CreateEvent(NULL, TRUE, FALSE, NULL);
+ connectionEventNotifier = new QWinEventNotifier(eventHandle , q);
+ q->connect(connectionEventNotifier, SIGNAL(activated(HANDLE)), q, SLOT(_q_onNewConnection()));
+
+ for (int i = 0; i < SYSTEM_MAX_PENDING_SOCKETS; ++i)
+ if (!addListener())
+ return false;
+ return true;
}
-void QLocalServerPrivate::_q_openSocket(HANDLE handle)
+void QLocalServerPrivate::_q_onNewConnection()
{
Q_Q(QLocalServer);
- q->incomingConnection((int)handle);
+ DWORD dummy;
+
+ // Reset first, otherwise we could reset an event which was asserted
+ // immediately after we checked the conn status.
+ ResetEvent(eventHandle);
+
+ // Testing shows that there is indeed absolutely no guarantee which listener gets
+ // a client connection first, so there is no way around polling all of them.
+ for (int i = 0; i < listeners.size(); ) {
+ HANDLE handle = listeners[i].handle;
+ if (GetOverlappedResult(handle, &listeners[i].overlapped, &dummy, FALSE)) {
+ listeners.removeAt(i);
+
+ addListener();
+
+ if (pendingConnections.size() > maxPendingConnections)
+ connectionEventNotifier->setEnabled(false);
+
+ // Make this the last thing so connected slots can wreak the least havoc
+ q->incomingConnection((quintptr)handle);
+ } else {
+ if (GetLastError() != ERROR_IO_INCOMPLETE) {
+ setError(QLatin1String("QLocalServerPrivate::_q_onNewConnection"));
+ closeServer();
+ return;
+ }
+
+ ++i;
+ }
+ }
}
void QLocalServerPrivate::closeServer()
{
- waitForConnection.stop();
- waitForConnection.closeServer();
+ connectionEventNotifier->setEnabled(false); // Otherwise, closed handle is checked before deleter runs
+ connectionEventNotifier->deleteLater();
+ connectionEventNotifier = 0;
+ CloseHandle(eventHandle);
+ for (int i = 0; i < listeners.size(); ++i)
+ CloseHandle(listeners[i].handle);
+ listeners.clear();
}
void QLocalServerPrivate::waitForNewConnection(int msecs, bool *timedOut)
@@ -238,14 +207,12 @@ void QLocalServerPrivate::waitForNewConnection(int msecs, bool *timedOut)
if (!pendingConnections.isEmpty() || !q->isListening())
return;
- DWORD result = WaitForSingleObject(waitForConnection.gotConnectionEvent,
- (msecs == -1) ? INFINITE : msecs);
+ DWORD result = WaitForSingleObject(eventHandle, (msecs == -1) ? INFINITE : msecs);
if (result == WAIT_TIMEOUT) {
if (timedOut)
*timedOut = true;
} else {
- ResetEvent(waitForConnection.gotConnectionEvent);
- QCoreApplication::instance()->processEvents();
+ _q_onNewConnection();
}
}
diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp
index 505c662..7fec2df 100644
--- a/src/network/ssl/qsslcipher.cpp
+++ b/src/network/ssl/qsslcipher.cpp
@@ -64,9 +64,9 @@
#ifndef QT_NO_DEBUG_STREAM
#include <QtCore/qdebug.h>
+#endif
QT_BEGIN_NAMESPACE
-#endif
/*!
Constructs an empty QSslCipher object.
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 77ff9fb..aee351d 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -5067,9 +5067,8 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
// fall back to drawing a polygon if the scale factor is large, or
// we use a gradient pen
- if (ti.fontEngine->fontDef.pixelSize >= 64
- || (d->matrix.det() > 1) || (d->pen_brush_style >= Qt::LinearGradientPattern
- && d->pen_brush_style <= Qt::ConicalGradientPattern)) {
+ if ((d->matrix.det() > 1) || (d->pen_brush_style >= Qt::LinearGradientPattern
+ && d->pen_brush_style <= Qt::ConicalGradientPattern)) {
QPaintEngine::drawTextItem(p, textItem);
return;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index 6d8f617..91a60e7 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -80,7 +80,7 @@ template <typename T> inline const T *ptr(const T &t) { return &t; }
template <> inline const bool* ptr<bool>(const bool &) { return 0; }
template <typename device, typename T1, typename T2, typename T3>
static void rasterFallbackWarn(const char *msg, const char *func, const device *dev,
- QDirectFBPaintEnginePrivate::Scale scale, bool matrixRotShear, bool simplePen,
+ int scale, bool matrixRotShear, bool simplePen,
bool dfbHandledClip, bool forceRasterPrimitives,
const char *nameOne, const T1 &one,
const char *nameTwo, const T2 &two,
@@ -211,6 +211,8 @@ static QCache<qint64, CachedImage> imageCache(4*1024*1024); // 4 MB
class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate
{
public:
+ enum Scale { NoScale, Scaled, NegativeScale };
+
QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p);
~QDirectFBPaintEnginePrivate();
@@ -266,7 +268,7 @@ private:
bool simplePen;
bool matrixRotShear;
- enum Scale { NoScale, Scaled, NegativeScale } scale;
+ Scale scale;
SurfaceCache *surfaceCache;
QTransform transform;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 25e24fd..f571d1b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -818,7 +818,7 @@ static const QByteArray flagDescriptions(uint mask, const FlagDescription *flags
-static void printDirectFBInfo(IDirectFB *fb)
+static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface)
{
DFBResult result;
DFBGraphicsDeviceDescription dev;
@@ -829,10 +829,14 @@ static void printDirectFBInfo(IDirectFB *fb)
return;
}
- qDebug("Device: %s (%s), Driver: %s v%i.%i (%s)\n"
+ DFBSurfacePixelFormat pixelFormat;
+ primarySurface->GetPixelFormat(primarySurface, &pixelFormat);
+
+ qDebug("Device: %s (%s), Driver: %s v%i.%i (%s) Pixelformat: %d (%d)\n"
"acceleration: 0x%x%s\nblit: 0x%x%s\ndraw: 0x%0x%s\nvideo: %iKB\n",
dev.name, dev.vendor, dev.driver.name, dev.driver.major,
- dev.driver.minor, dev.driver.vendor, dev.acceleration_mask,
+ dev.driver.minor, dev.driver.vendor, DFB_PIXELFORMAT_INDEX(pixelFormat),
+ QDirectFBScreen::getImageFormat(primarySurface), dev.acceleration_mask,
::flagDescriptions(dev.acceleration_mask, accelerationDescriptions).constData(),
dev.blitting_flags, ::flagDescriptions(dev.blitting_flags, blitDescriptions).constData(),
dev.drawing_flags, ::flagDescriptions(dev.drawing_flags, drawDescriptions).constData(),
@@ -883,9 +887,6 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
return false;
}
- if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
- printDirectFBInfo(d_ptr->dfb);
-
if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive))
d_ptr->directFBFlags |= VideoOnly;
@@ -952,6 +953,9 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
return false;
}
+ if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive))
+ printDirectFBInfo(d_ptr->dfb, d_ptr->dfbSurface);
+
// Work out what format we're going to use for surfaces with an alpha channel
d_ptr->alphaPixmapFormat = QDirectFBScreen::getImageFormat(d_ptr->dfbSurface);
setPixelFormat(d_ptr->alphaPixmapFormat);
diff --git a/src/testlib/qtestlogger.cpp b/src/testlib/qtestlogger.cpp
index c053c30..a1a6d52 100644
--- a/src/testlib/qtestlogger.cpp
+++ b/src/testlib/qtestlogger.cpp
@@ -158,7 +158,10 @@ void QTestLogger::addIncident(IncidentTypes type, const char *description,
if (type == QAbstractTestLogger::Fail || type == QAbstractTestLogger::XFail) {
QTestElement *failureElement = new QTestElement(QTest::LET_Failure);
failureElement->addAttribute(QTest::AI_Result, typeBuf);
- failureElement->addAttribute(QTest::AI_File, file);
+ if(file)
+ failureElement->addAttribute(QTest::AI_File, file);
+ else
+ failureElement->addAttribute(QTest::AI_File, "");
QTest::qt_snprintf(buf, sizeof(buf), "%i", line);
failureElement->addAttribute(QTest::AI_Line, buf);
failureElement->addAttribute(QTest::AI_Description, description);
diff --git a/src/testlib/qtestxmlstreamer.cpp b/src/testlib/qtestxmlstreamer.cpp
index cf99b96..055abe0 100644
--- a/src/testlib/qtestxmlstreamer.cpp
+++ b/src/testlib/qtestxmlstreamer.cpp
@@ -54,7 +54,7 @@ void QTestXmlStreamer::formatStart(const QTestElement *element, char *formatted)
QXmlTestLogger::xmlCdata(cdataTag, element->attributeValue(QTest::AI_Tag),
sizeof(cdataTag));
QTest::qt_snprintf(formatted, 1024, "<Incident type=\"%s\" %s>\n"
- " <DataTag><![CDATA[%s]]></Description>\n"
+ " <DataTag><![CDATA[%s]]></DataTag>\n"
" <Description><![CDATA[%s]]></Description>\n"
"</Incident>\n", element->attributeValue(QTest::AI_Result),
location, cdataTag, cdataDesc);