summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-05-07 00:04:41 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2009-05-07 00:04:41 +0200
commit014b5d404b19ad3d81686ba490eb7dd93efee573 (patch)
tree8fce9f8b172d4982270c5a91da0aa66fcb589f05 /src/gui
parent2eb0312c96ab828809158802d4cb7e0980227389 (diff)
parent311978919f63c2c23dd09b4743ff12cf2a8a47bb (diff)
Merge branch '4.5' of git@scm.dev.troll.no:qt/qt
Conflicts: src/gui/kernel/qcocoaview_mac_p.h src/gui/widgets/qmainwindow.cpp
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qabstractprintdialog.cpp2
-rw-r--r--src/gui/embedded/qscreentransformed_qws.cpp12
-rw-r--r--src/gui/embedded/qscreenvfb_qws.cpp3
-rw-r--r--src/gui/embedded/qwindowsystem_qws.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/qlistview.cpp7
-rw-r--r--src/gui/kernel/qapplication_win.cpp4
-rw-r--r--src/gui/kernel/qapplication_x11.cpp35
-rw-r--r--src/gui/kernel/qcocoaapplicationdelegate_mac.mm9
-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/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/painting/qblendfunctions.cpp12
-rw-r--r--src/gui/painting/qmemrotate.cpp28
-rw-r--r--src/gui/painting/qmemrotate_p.h8
-rw-r--r--src/gui/painting/qpaintengine_mac.cpp5
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp22
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp26
-rw-r--r--src/gui/painting/qpainter.cpp63
-rw-r--r--src/gui/styles/qcommonstyle.cpp73
-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
34 files changed, 332 insertions, 153 deletions
diff --git a/src/gui/dialogs/qabstractprintdialog.cpp b/src/gui/dialogs/qabstractprintdialog.cpp
index 0dc16c90b3..5ed88529ca 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/embedded/qscreentransformed_qws.cpp b/src/gui/embedded/qscreentransformed_qws.cpp
index 46ac1d1b1a..e22ea1f7cf 100644
--- a/src/gui/embedded/qscreentransformed_qws.cpp
+++ b/src/gui/embedded/qscreentransformed_qws.cpp
@@ -400,7 +400,19 @@ void QTransformedScreen::blit(const QImage &image, const QPoint &topLeft,
#endif
#if defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15) || defined(QT_QWS_DEPTH_12)
case 16:
+#if defined QT_QWS_ROTATE_BGR
+ if (pixelType() == BGRPixel && image.depth() == 16) {
+ SET_BLIT_FUNC(qbgr565, quint16, trans, func);
+ break;
+ } //fall-through here!!!
+#endif
case 15:
+#if defined QT_QWS_ROTATE_BGR
+ if (pixelType() == BGRPixel && image.format() == QImage::Format_RGB555) {
+ SET_BLIT_FUNC(qbgr555, qrgb555, trans, func);
+ break;
+ } //fall-through here!!!
+#endif
case 12:
if (image.depth() == 16)
SET_BLIT_FUNC(quint16, quint16, trans, func);
diff --git a/src/gui/embedded/qscreenvfb_qws.cpp b/src/gui/embedded/qscreenvfb_qws.cpp
index abbe73bd91..accfe1f169 100644
--- a/src/gui/embedded/qscreenvfb_qws.cpp
+++ b/src/gui/embedded/qscreenvfb_qws.cpp
@@ -310,6 +310,9 @@ bool QVFbScreen::connect(const QString &displaySpec)
connected = this;
+ if (qgetenv("QT_QVFB_BGR").toInt())
+ pixeltype = BGRPixel;
+
return true;
}
diff --git a/src/gui/embedded/qwindowsystem_qws.cpp b/src/gui/embedded/qwindowsystem_qws.cpp
index dffebf2781..fdcd1936a1 100644
--- a/src/gui/embedded/qwindowsystem_qws.cpp
+++ b/src/gui/embedded/qwindowsystem_qws.cpp
@@ -4044,7 +4044,7 @@ void QWSServer::setDesktopBackground(const QImage &img)
*/
void QWSServer::setDesktopBackground(const QColor &c)
{
- setDesktopBackground(QBrush(c));
+ setBackground(QBrush(c));
}
#endif //QT3_SUPPORT
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 65d1e0a966..7be7df5f0e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1961,7 +1961,7 @@ void QGraphicsItem::setOpacity(qreal opacity)
itemChange(ItemOpacityHasChanged, newOpacity);
// Update.
- d_ptr->fullUpdateHelper();
+ d_ptr->fullUpdateHelper(/*childrenOnly=*/false, /*maybeDirtyClipPath=*/false, /*ignoreOpacity=*/true);
}
/*!
@@ -3276,10 +3276,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
@@ -3334,6 +3340,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
@@ -3374,11 +3385,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
{
@@ -3662,9 +3674,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.
@@ -3673,7 +3684,7 @@ bool QGraphicsItemPrivate::discardUpdateRequest(bool ignoreClipping,
|| !scene
|| (scene->d_func()->updateAll && scene->d_func()->hasSceneRect)
|| (!ignoreClipping && (childrenClippedToShape() && isClippedAway()))
- || (childrenCombineOpacity() && isFullyTransparent());
+ || (!ignoreOpacity && childrenCombineOpacity() && isFullyTransparent());
}
/*!
@@ -3703,11 +3714,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 940e566e25..2936cf1d65 100644
--- a/src/gui/graphicsview/qgraphicsitem_p.h
+++ b/src/gui/graphicsview/qgraphicsitem_p.h
@@ -166,11 +166,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 644e843099..2876016ef4 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 5de39d94e3..7f36be90c7 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/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index a5a194f8f4..3e00cd0de5 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1997,14 +1997,15 @@ bool QListViewPrivate::doItemsLayout(int delta)
int first = batchStartRow();
int last = qMin(first + delta - 1, max);
- if (max < 0 || last < first)
- return true; // nothing to do
-
if (first == 0) {
layoutChildren(); // make sure the viewport has the right size
prepareItemsLayout();
}
+ if (max < 0 || last < first) {
+ return true; // nothing to do
+ }
+
QListViewLayoutInfo info;
info.bounds = layoutBounds;
info.grid = gridSize();
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 07b386522d..f1ab90fd58 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -2429,10 +2429,12 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
widget = (QETWidget*)qApp->focusWidget();
HWND focus = ::GetFocus();
//if there is a current widget and the new widget belongs to the same toplevel window
+ //or if the current widget was embedded into non-qt window (i.e. we won't get WM_ACTIVATEAPP)
//then we clear the focus on the widget
//in case the new widget belongs to a different widget hierarchy, clearing the focus
//will be handled because the active window will change
- if (widget && ::IsChild(widget->window()->internalWinId(), focus)) {
+ const bool embedded = widget && ((QETWidget*)widget->window())->topData()->embedded;
+ if (widget && (embedded || ::IsChild(widget->window()->internalWinId(), focus))) {
widget->clearFocus();
result = true;
} else {
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index d7ca2f4d2d..25356daa5f 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -3168,43 +3168,48 @@ int QApplication::x11ProcessEvent(XEvent* event)
#ifdef ALIEN_DEBUG
//qDebug() << "QApplication::x11ProcessEvent:" << event->type;
#endif
+ Time time = 0, userTime = 0;
switch (event->type) {
case ButtonPress:
pressed_window = event->xbutton.window;
- X11->userTime = event->xbutton.time;
+ userTime = event->xbutton.time;
// fallthrough intended
case ButtonRelease:
- X11->time = event->xbutton.time;
+ time = event->xbutton.time;
break;
case MotionNotify:
- X11->time = event->xmotion.time;
+ time = event->xmotion.time;
break;
case XKeyPress:
- X11->userTime = event->xkey.time;
+ userTime = event->xkey.time;
// fallthrough intended
case XKeyRelease:
- X11->time = event->xkey.time;
+ time = event->xkey.time;
break;
case PropertyNotify:
- X11->time = event->xproperty.time;
+ time = event->xproperty.time;
break;
case EnterNotify:
case LeaveNotify:
- X11->time = event->xcrossing.time;
+ time = event->xcrossing.time;
break;
case SelectionClear:
- X11->time = event->xselectionclear.time;
+ time = event->xselectionclear.time;
break;
default:
- break;
- }
#ifndef QT_NO_XFIXES
- if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) {
- XFixesSelectionNotifyEvent *req =
- reinterpret_cast<XFixesSelectionNotifyEvent *>(event);
- X11->time = req->selection_timestamp;
- }
+ if (X11->use_xfixes && event->type == (X11->xfixes_eventbase + XFixesSelectionNotify)) {
+ XFixesSelectionNotifyEvent *req =
+ reinterpret_cast<XFixesSelectionNotifyEvent *>(event);
+ time = req->selection_timestamp;
+ }
#endif
+ break;
+ }
+ if (time > X11->time)
+ X11->time = time;
+ if (userTime > X11->userTime)
+ X11->userTime = userTime;
QETWidget *widget = (QETWidget*)QWidget::find((WId)event->xany.window);
diff --git a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
index dad15d945e..9a246455c2 100644
--- a/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+++ b/src/gui/kernel/qcocoaapplicationdelegate_mac.mm
@@ -183,21 +183,24 @@ static void cleanupCocoaApplicationDelegate()
{
Q_UNUSED(sender);
// The reflection delegate gets precedence
- NSApplicationTerminateReply reply = NSTerminateCancel;
if (reflectionDelegate
&& [reflectionDelegate respondsToSelector:@selector(applicationShouldTerminate:)]) {
return [reflectionDelegate applicationShouldTerminate:sender];
}
if (qtPrivate->canQuit()) {
- reply = NSTerminateNow;
if (!startedQuit) {
startedQuit = true;
qAppInstance()->quit();
startedQuit = false;
}
}
- return reply;
+
+ // Prevent Cocoa from terminating the application, since this simply
+ // exits the program whithout allowing QApplication::exec() to return.
+ // The call to QApplication::quit() above will instead quit the
+ // application from the Qt side.
+ return NSTerminateCancel;
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 60ac062ff8..1cbc960b46 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 ec1281eaed..1d4e3e40ed 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/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index f000292949..9165836574 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 dd95053270..cbf9585612 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 9da0b6be0d..1896b97be8 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/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 16dd61730f..8f4a2bfb84 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/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp
index 40581439ee..471f544538 100644
--- a/src/gui/painting/qmemrotate.cpp
+++ b/src/gui/painting/qmemrotate.cpp
@@ -528,6 +528,26 @@ void qt_memrotate270(const srctype *src, int w, int h, int sstride, \
qt_memrotate270_template(src, w, h, sstride, dest, dstride); \
}
+#define QT_IMPL_SIMPLE_MEMROTATE(srctype, desttype) \
+void qt_memrotate90(const srctype *src, int w, int h, int sstride, \
+ desttype *dest, int dstride) \
+{ \
+ qt_memrotate90_tiled_unpacked<desttype,srctype>(src, w, h, sstride, dest, dstride); \
+} \
+void qt_memrotate180(const srctype *src, int w, int h, int sstride, \
+ desttype *dest, int dstride) \
+{ \
+ qt_memrotate180_template(src, w, h, sstride, dest, dstride); \
+} \
+void qt_memrotate270(const srctype *src, int w, int h, int sstride, \
+ desttype *dest, int dstride) \
+{ \
+ qt_memrotate270_tiled_unpacked<desttype,srctype>(src, w, h, sstride, dest, dstride); \
+}
+
+
+
+
QT_IMPL_MEMROTATE(quint32, quint32)
QT_IMPL_MEMROTATE(quint32, quint16)
QT_IMPL_MEMROTATE(quint16, quint32)
@@ -539,6 +559,14 @@ QT_IMPL_MEMROTATE(quint32, quint8)
QT_IMPL_MEMROTATE(quint16, quint8)
QT_IMPL_MEMROTATE(qrgb444, quint8)
QT_IMPL_MEMROTATE(quint8, quint8)
+
+#if defined(QT_QWS_ROTATE_BGR)
+QT_IMPL_SIMPLE_MEMROTATE(quint16, qbgr565)
+QT_IMPL_SIMPLE_MEMROTATE(quint32, qbgr565)
+QT_IMPL_SIMPLE_MEMROTATE(qrgb555, qbgr555)
+QT_IMPL_SIMPLE_MEMROTATE(quint32, qbgr555)
+#endif
+
#ifdef QT_QWS_DEPTH_GENERIC
QT_IMPL_MEMROTATE(quint32, qrgb_generic16)
QT_IMPL_MEMROTATE(quint16, qrgb_generic16)
diff --git a/src/gui/painting/qmemrotate_p.h b/src/gui/painting/qmemrotate_p.h
index c1eb93e147..87cfb1a874 100644
--- a/src/gui/painting/qmemrotate_p.h
+++ b/src/gui/painting/qmemrotate_p.h
@@ -92,6 +92,14 @@ QT_DECL_MEMROTATE(quint32, quint8);
QT_DECL_MEMROTATE(quint16, quint8);
QT_DECL_MEMROTATE(qrgb444, quint8);
QT_DECL_MEMROTATE(quint8, quint8);
+
+#ifdef QT_QWS_ROTATE_BGR
+QT_DECL_MEMROTATE(quint16, qbgr565);
+QT_DECL_MEMROTATE(quint32, qbgr565);
+QT_DECL_MEMROTATE(qrgb555, qbgr555);
+QT_DECL_MEMROTATE(quint32, qbgr555);
+#endif
+
#ifdef QT_QWS_DEPTH_GENERIC
QT_DECL_MEMROTATE(quint32, qrgb_generic16);
QT_DECL_MEMROTATE(quint16, qrgb_generic16);
diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp
index 0644a02ac6..588938893f 100644
--- a/src/gui/painting/qpaintengine_mac.cpp
+++ b/src/gui/painting/qpaintengine_mac.cpp
@@ -996,15 +996,14 @@ void QCoreGraphicsPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, co
} else if (differentSize) {
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_4) {
- CGImageRef img = (CGImageRef)pm.macCGHandle();
+ QCFType<CGImageRef> img = pm.toMacCGImageRef();
image = CGImageCreateWithImageInRect(img, CGRectMake(qRound(sr.x()), qRound(sr.y()), qRound(sr.width()), qRound(sr.height())));
- CGImageRelease(img);
} else
#endif
{
const int sx = qRound(sr.x()), sy = qRound(sr.y()), sw = qRound(sr.width()), sh = qRound(sr.height());
const QMacPixmapData *pmData = static_cast<const QMacPixmapData*>(pm.data);
- quint32 *pantherData = pmData->pixels + (sy * pm.width() + sx);
+ quint32 *pantherData = pmData->pixels + sy * (pmData->bytesPerRow / 4) + sx;
QCFType<CGDataProviderRef> provider = CGDataProviderCreateWithData(0, pantherData, sw*sh*pmData->bytesPerRow, 0);
image = CGImageCreate(sw, sh, 8, 32, pmData->bytesPerRow,
macGenericColorSpace(),
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 9b13352813..3428fafdfd 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1026,7 +1026,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
int alpha,
const QRect &sr)
{
- if (!clip.isValid())
+ if (alpha == 0 || !clip.isValid())
return;
Q_ASSERT(img.depth() >= 8);
@@ -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;
}
@@ -2668,7 +2672,13 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe
QRectF rr = r;
rr.translate(s->matrix.dx(), s->matrix.dy());
- fillRect_normalized(toRect_normalized(rr), &d->image_filler, d);
+
+ const int x1 = qRound(rr.x());
+ const int y1 = qRound(rr.y());
+ const int x2 = qRound(rr.right());
+ const int y2 = qRound(rr.bottom());
+
+ fillRect_normalized(QRect(x1, y1, x2-x1, y2-y1), &d->image_filler, d);
}
}
@@ -5151,7 +5161,11 @@ void QSpanData::adjustSpanMethods()
void QSpanData::setupMatrix(const QTransform &matrix, int bilin)
{
- QTransform inv = matrix.inverted();
+ QTransform delta;
+ // make sure we round off correctly in qdrawhelper.cpp
+ delta.translate(1.0 / 65536, 1.0 / 65536);
+
+ QTransform inv = (delta * matrix).inverted();
m11 = inv.m11();
m12 = inv.m12();
m13 = inv.m13();
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 4b2fbca599..9cc96836ef 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/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index b158392e68..413d25ca6c 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -5142,6 +5142,11 @@ void QPainter::drawConvexPolygon(const QPointF *points, int pointCount)
d->engine->drawPolygon(points, pointCount, QPaintEngine::ConvexMode);
}
+static inline QPointF roundInDeviceCoordinates(const QPointF &p, const QTransform &m)
+{
+ return m.inverted().map(QPointF(m.map(p).toPoint()));
+}
+
/*!
\fn void QPainter::drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
@@ -5210,11 +5215,12 @@ void QPainter::drawPixmap(const QPointF &p, const QPixmap &pm)
|| (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity)))
{
save();
- // If there is no scaling or transformation involved we have to make sure we use the
+ // If there is no rotation involved we have to make sure we use the
// antialiased and not the aliased coordinate system by rounding the coordinates.
- if (d->state->matrix.type() <= QTransform::TxTranslate) {
- x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx();
- y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy();
+ if (d->state->matrix.type() <= QTransform::TxScale) {
+ const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix);
+ x = p.x();
+ y = p.y();
}
translate(x, y);
setBackgroundMode(Qt::TransparentMode);
@@ -5324,16 +5330,21 @@ void QPainter::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
|| ((sw != w || sh != h) && !d->engine->hasFeature(QPaintEngine::PixmapTransform)))
{
save();
- // If there is no scaling or transformation involved we have to make sure we use the
+ // If there is no rotation involved we have to make sure we use the
// antialiased and not the aliased coordinate system by rounding the coordinates.
+ if (d->state->matrix.type() <= QTransform::TxScale) {
+ const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix);
+ x = p.x();
+ y = p.y();
+ }
+
if (d->state->matrix.type() <= QTransform::TxTranslate && sw == w && sh == h) {
- x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx();
- y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy();
sx = qRound(sx);
sy = qRound(sy);
sw = qRound(sw);
sh = qRound(sh);
}
+
translate(x, y);
scale(w / sw, h / sh);
setBackgroundMode(Qt::TransparentMode);
@@ -5483,11 +5494,12 @@ void QPainter::drawImage(const QPointF &p, const QImage &image)
|| (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity)))
{
save();
- // If there is no scaling or transformation involved we have to make sure we use the
+ // If there is no rotation involved we have to make sure we use the
// antialiased and not the aliased coordinate system by rounding the coordinates.
- if (d->state->matrix.type() <= QTransform::TxTranslate) {
- x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx();
- y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy();
+ if (d->state->matrix.type() <= QTransform::TxScale) {
+ const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix);
+ x = p.x();
+ y = p.y();
}
translate(x, y);
setBackgroundMode(Qt::TransparentMode);
@@ -5586,11 +5598,15 @@ void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QR
|| (d->state->opacity != 1.0 && !d->engine->hasFeature(QPaintEngine::ConstantOpacity)))
{
save();
- // If there is no scaling or transformation involved we have to make sure we use the
+ // If there is no rotation involved we have to make sure we use the
// antialiased and not the aliased coordinate system by rounding the coordinates.
+ if (d->state->matrix.type() <= QTransform::TxScale) {
+ const QPointF p = roundInDeviceCoordinates(QPointF(x, y), d->state->matrix);
+ x = p.x();
+ y = p.y();
+ }
+
if (d->state->matrix.type() <= QTransform::TxTranslate && sw == w && sh == h) {
- x = qRound(x + d->state->matrix.dx()) - d->state->matrix.dx();
- y = qRound(y + d->state->matrix.dy()) - d->state->matrix.dy();
sx = qRound(sx);
sy = qRound(sy);
sw = qRound(sw);
@@ -6333,17 +6349,18 @@ void QPainter::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPo
setBrush(QBrush(d->state->pen.color(), pixmap));
setPen(Qt::NoPen);
- // If there is no scaling or transformation involved we have to make sure we use the
+ // If there is no rotation involved we have to make sure we use the
// antialiased and not the aliased coordinate system by rounding the coordinates.
- if (d->state->matrix.type() <= QTransform::TxTranslate) {
- qreal x = qRound(r.x() + d->state->matrix.dx()) - d->state->matrix.dx();
- qreal y = qRound(r.y() + d->state->matrix.dy()) - d->state->matrix.dy();
- qreal w = qRound(r.width());
- qreal h = qRound(r.height());
- sx = qRound(sx);
- sy = qRound(sy);
+ if (d->state->matrix.type() <= QTransform::TxScale) {
+ const QPointF p = roundInDeviceCoordinates(r.topLeft(), d->state->matrix);
+
+ if (d->state->matrix.type() <= QTransform::TxTranslate) {
+ sx = qRound(sx);
+ sy = qRound(sy);
+ }
+
setBrushOrigin(QPointF(r.x()-sx, r.y()-sy));
- drawRect(QRectF(x, y, w, h));
+ drawRect(QRectF(p, r.size()));
} else {
setBrushOrigin(QPointF(r.x()-sx, r.y()-sy));
drawRect(r);
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index e1535f8e9f..1d12beda83 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -1780,46 +1780,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case CE_TabBarTab:
if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
drawControl(CE_TabBarTabShape, tab, p, widget);
-
- QStyleOptionTabV3 tabV3(*tab);
- QRect labelRect = tabV3.rect;
- QSize &left= tabV3.leftButtonSize;
- QSize &right = tabV3.rightButtonSize;
- const int spacing = 6 + 2;
-
- // left widget
- if (!left.isEmpty()) {
- if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast )
- labelRect.setTop(labelRect.top() + spacing + left.height());
- else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest)
- labelRect.setBottom(labelRect.bottom() - spacing - left.height());
- else
- labelRect.setLeft(labelRect.left() + spacing + left.width());
- }
-
- // right widget
- if (!right.isEmpty()) {
- if (tabV3.shape == QTabBar::RoundedEast || tabV3.shape == QTabBar::TriangularEast )
- labelRect.setBottom(labelRect.bottom() - spacing - right.height());
- else if (tabV3.shape == QTabBar::RoundedWest|| tabV3.shape == QTabBar::TriangularWest)
- labelRect.setTop(labelRect.top() + spacing + right.height());
- else
- labelRect.setRight(labelRect.right() - spacing - right.width());
- }
-
- tabV3.rect = visualRect(opt->direction, opt->rect, labelRect);
- drawControl(CE_TabBarTabLabel, &tabV3, p, widget);
- if (tabV3.state & State_HasFocus) {
- const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth);
- int x1, x2;
- x1 = tab->rect.left();
- x2 = tab->rect.right() - 1;
- QStyleOptionFocusRect fropt;
- fropt.QStyleOption::operator=(*tab);
- fropt.rect.setRect(x1 + 1 + OFFSET, tab->rect.y() + OFFSET,
- x2 - x1 - 2*OFFSET, tab->rect.height() - 2*OFFSET);
- drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
- }
+ drawControl(CE_TabBarTabLabel, tab, p, widget);
}
break;
case CE_TabBarTabShape:
@@ -2023,8 +1984,12 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
(tabV2.state & State_Selected) ? QIcon::On
: QIcon::Off);
- int offset = 6;
+ int offset = 4;
int left = opt->rect.left();
+ if (tabV2.leftButtonSize.isEmpty())
+ offset += 2;
+ else
+ left += tabV2.leftButtonSize.width() + (6 + 2) + 2;
QRect iconRect = QRect(left + offset, tr.center().y() - tabIcon.height() / 2,
tabIconSize.width(), tabIconSize.height());
if (!verticalTabs)
@@ -2035,6 +2000,20 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
drawItemText(p, tr, alignment, tab->palette, tab->state & State_Enabled, tab->text, QPalette::WindowText);
if (verticalTabs)
p->restore();
+
+ if (tabV2.state & State_HasFocus) {
+ const int OFFSET = 1 + pixelMetric(PM_DefaultFrameWidth);
+
+ int x1, x2;
+ x1 = tabV2.rect.left();
+ x2 = tabV2.rect.right() - 1;
+
+ QStyleOptionFocusRect fropt;
+ fropt.QStyleOption::operator=(*tab);
+ fropt.rect.setRect(x1 + 1 + OFFSET, tabV2.rect.y() + OFFSET,
+ x2 - x1 - 2*OFFSET, tabV2.rect.height() - 2*OFFSET);
+ drawPrimitive(PE_FrameFocusRect, &fropt, p, widget);
+ }
}
break;
#endif // QT_NO_TABBAR
@@ -2884,6 +2863,12 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
tr.setRight(tr.right() - horizontalShift);
}
+ // left widget
+ if (!tabV2.leftButtonSize.isEmpty()) {
+ tr.setLeft(tr.left() + 6 + 2 +
+ (verticalTabs ? tabV2.leftButtonSize.height() : tabV2.leftButtonSize.width()));
+ }
+
// icon
if (!tabV2.icon.isNull()) {
QSize iconSize = tabV2.iconSize;
@@ -2905,6 +2890,12 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
tr.setLeft(tr.left() + tabIconSize.width() + offset + 2);
}
+ // right widget
+ if (!tabV2.rightButtonSize.isEmpty()) {
+ tr.setRight(tr.right() - 6 - 2 -
+ (verticalTabs ? tabV2.rightButtonSize.height() : tabV2.rightButtonSize.width()));
+ }
+
if (!verticalTabs)
tr = visualRect(opt->direction, opt->rect, tr);
r = tr;
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 47fe5c2836..d7a9c236d0 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 cb0b43654e..de03a3c29f 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 8f6b92a824..92efb6c811 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 c327b9f2c9..48963bbe24 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 e84b3240ff..873f846316 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 3f4c8e51fd..71b68e01e7 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 1afb28a51b..502c1e9949 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 a51ed2d69f..14efd235d8 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 ce1ac0948d..0b4ce9d0ac 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();
}