diff options
25 files changed, 412 insertions, 252 deletions
diff --git a/qmake/project.cpp b/qmake/project.cpp index eef32db..00bb2f0 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -57,7 +57,7 @@ #include <unistd.h> #include <sys/utsname.h> #elif defined(Q_OS_WIN32) -#include <Windows.h> +#include <windows.h> #endif #include <stdio.h> #include <stdlib.h> diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp index 522be20..63506c2 100644 --- a/src/corelib/io/qfsfileengine_win.cpp +++ b/src/corelib/io/qfsfileengine_win.cpp @@ -346,8 +346,15 @@ bool QFSFileEnginePrivate::uncListSharesOnServer(const QString &server, QStringL static bool isUncRoot(const QString &server) { QString localPath = QDir::toNativeSeparators(server); - QStringList parts = localPath.split(QLatin1Char('\\'), QString::SkipEmptyParts); - return localPath.startsWith(QLatin1String("\\\\")) && parts.count() <= 1; + if (!localPath.startsWith(QLatin1String("\\\\"))) + return false; + + int idx = localPath.indexOf(QLatin1Char('\\'), 2); + if (idx == -1 || idx + 1 == localPath.length()) + return true; + + localPath = localPath.right(localPath.length() - idx - 1).trimmed(); + return localPath.isEmpty(); } static bool isUncPath(const QString &path) diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 073c25b..2f524cb 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -96,9 +96,8 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook order to select one or many files or a directory. The easiest way to create a QFileDialog is to use the static - functions. On Windows, these static functions will call the native - Windows file dialog, and on Mac OS X these static function will call - the native Mac OS X file dialog. + functions. On Windows, Mac OS X, KDE and GNOME, these static functions will + call the native file dialog when possible. \snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 0 @@ -216,7 +215,7 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook are resolved. \value DontConfirmOverwrite Don't ask for confirmation if an existing file is selected. By default confirmation is requested. - \value DontUseNativeDialog Don't use the native file dialog. By default on Mac OS X and Windows, + \value DontUseNativeDialog Don't use the native file dialog. By default on Mac OS X, the native file dialog is used unless you use a subclass of QFileDialog that contains the Q_OBJECT macro. \value ReadOnly Indicates that the model is readonly. @@ -2793,7 +2792,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index) { Q_Q(QFileDialog); // My Computer or a directory - QModelIndex sourceIndex = mapToSource(index); + QModelIndex sourceIndex = index.model() == proxyModel ? mapToSource(index) : index; QString path = sourceIndex.data(QFileSystemModel::FilePathRole).toString(); if (path.isEmpty() || model->isDir(sourceIndex)) { q->setDirectory(path); diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index 456b480..5e59501 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -280,6 +280,9 @@ void QMessageBoxPrivate::updateSize() int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width()); #else int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this + // on small screens allows the messagebox be the same size as the screen + if (screenSize.width() <= 1024) + hardLimit = screenSize.width(); #endif #ifdef Q_WS_MAC int softLimit = qMin(screenSize.width()/2, 420); diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index b1aac37..cc14d3e 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1380,7 +1380,7 @@ bool QAbstractItemView::event(QEvent *event) d->executePostedLayout(); //make sure we set the layout properly break; case QEvent::Show: - { + if (d->delayedPendingLayout) { d->executePostedLayout(); //make sure we set the layout properly const QModelIndex current = currentIndex(); if (current.isValid() && (d->state == QAbstractItemView::EditingState || d->autoScroll)) diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index 1a3ae2d..8baefdf 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -1313,11 +1313,11 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par int left = sel.at(i).left(); int right = sel.at(i).right(); if (top <= row && bottom >= row) { - Qt::ItemFlags leftFlags = d->model->index(row, left, parent).flags(); - Qt::ItemFlags rightFlags = d->model->index(row, right, parent).flags(); - if ((leftFlags & Qt::ItemIsSelectable) && (leftFlags & Qt::ItemIsEnabled) - && (rightFlags & Qt::ItemIsSelectable) && (rightFlags & Qt::ItemIsEnabled)) - return true; + for (int j = left; j <= right; j++) { + const Qt::ItemFlags flags = d->model->index(row, j, parent).flags(); + if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled)) + return true; + } } } @@ -1342,11 +1342,11 @@ bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelInde int top = sel.at(i).top(); int bottom = sel.at(i).bottom(); if (left <= column && right >= column) { - Qt::ItemFlags topFlags = d->model->index(top, column, parent).flags(); - Qt::ItemFlags bottomFlags = d->model->index(bottom, column, parent).flags(); - if ((topFlags & Qt::ItemIsSelectable) && (topFlags & Qt::ItemIsEnabled) - && (bottomFlags & Qt::ItemIsSelectable) && (bottomFlags & Qt::ItemIsEnabled)) - return true; + for (int j = top; j <= bottom; j++) { + const Qt::ItemFlags flags = d->model->index(j, column, parent).flags(); + if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled)) + return true; + } } } diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index cf66605..60ac062 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -809,10 +809,10 @@ extern "C" { QWheelEvent qwe(qlocal, qglobal, deltaY, buttons, keyMods, Qt::Vertical); qt_sendSpontaneousEvent(qwidget, &qwe); wheelOK = qwe.isAccepted(); - if (wheelOK && QApplicationPrivate::focus_widget + if (!wheelOK && QApplicationPrivate::focus_widget && QApplicationPrivate::focus_widget != qwidget) { QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal, - deltaZ, buttons, keyMods, Qt::Vertical); + deltaY, buttons, keyMods, Qt::Vertical); qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2); wheelOK = qwe2.isAccepted(); } diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 03b2fce..fa325f4 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -194,7 +194,6 @@ static void cleanupCocoaWindowDelegate() { NSWindow *window = [notification object]; QWidget *qwidget = m_windowHash->value(window); - // Just here to handle the is zoomed method. QWidgetData *widgetData = qt_qwidget_data(qwidget); if (!(qwidget->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) && [window isZoomed]) { widgetData->window_state = widgetData->window_state | Qt::WindowMaximized; @@ -202,7 +201,6 @@ static void cleanupCocoaWindowDelegate() & ~Qt::WindowMaximized)); qt_sendSpontaneousEvent(qwidget, &e); } - [self checkForMove:[window frame] forWidget:qwidget]; NSRect rect = [[window contentView] frame]; const QSize newSize(rect.size.width, rect.size.height); const QSize &oldSize = widgetData->crect.size(); @@ -212,12 +210,18 @@ static void cleanupCocoaWindowDelegate() } } -- (void)checkForMove:(const NSRect &)newRect forWidget:(QWidget *)qwidget +- (void)windowDidMove:(NSNotification *)notification { - // newRect's origin is bottom left. + // The code underneath needs to translate the window location + // from bottom left (which is the origin used by Cocoa) to + // upper left (which is the origin used by Qt): + NSWindow *window = [notification object]; + NSRect newRect = [window frame]; + QWidget *qwidget = m_windowHash->value(window); QPoint qtPoint = flipPoint(NSMakePoint(newRect.origin.x, newRect.origin.y + newRect.size.height)).toPoint(); const QRect &oldRect = qwidget->frameGeometry(); + if (qtPoint.x() != oldRect.x() || qtPoint.y() != oldRect.y()) { QWidgetData *widgetData = qt_qwidget_data(qwidget); QRect oldCRect = widgetData->crect; @@ -233,11 +237,6 @@ static void cleanupCocoaWindowDelegate() } } -- (void)windowDidMove:(NSNotification *)notification -{ - [self windowDidResize:notification]; -} - -(BOOL)windowShouldClose:(id)windowThatWantsToClose { QWidget *qwidget = m_windowHash->value(windowThatWantsToClose); diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 0f74c32..b238279 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4033,7 +4033,11 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) QMacCocoaAutoReleasePool pool; bool realWindow = isRealWindow(); - if (realWindow && !(w == 0 && h == 0) && !q->testAttribute(Qt::WA_DontShowOnScreen)) { + if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen) +#ifndef QT_MAC_USE_COCOA + && !(w == 0 && h == 0) +#endif + ){ applyMaxAndMinSizeConstraints(w, h); topData()->isSetGeometry = 1; topData()->isMove = isMove; @@ -4048,7 +4052,24 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove) fStrut.top() + fStrut.bottom() + h)); NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1), frameRect.width(), frameRect.height()); - [window setFrame:cocoaFrameRect display:NO]; + + QPoint currTopLeft = data.crect.topLeft(); + if (currTopLeft.x() == x && currTopLeft.y() == y + && cocoaFrameRect.size.width != 0 + && cocoaFrameRect.size.height != 0) { + [window setFrame:cocoaFrameRect display:NO]; + } else { + // The window is moved and resized (or resized to zero). + // Since Cocoa usually only sends us a resize callback after + // setting a window frame, we issue an explicit move as + // well. To stop Cocoa from optimize away the move (since the move + // would have the same origin as the setFrame call) we shift the + // window back and forth inbetween. + cocoaFrameRect.origin.y += 1; + [window setFrame:cocoaFrameRect display:NO]; + cocoaFrameRect.origin.y -= 1; + [window setFrameOrigin:cocoaFrameRect.origin]; + } #endif topData()->isSetGeometry = 0; } else { diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index 39ce59f..4b2fbca 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -2352,7 +2352,9 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) GlyphSet glyphSet = set->id; const QColor &pen = d->cpen.color(); ::Picture src = X11->getSolidFill(d->scrn, pen); - XRenderPictFormat *maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format); + XRenderPictFormat *maskFormat = 0; + if (ft->xglyph_format != PictStandardA1) + maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format); enum { t_min = SHRT_MIN, t_max = SHRT_MAX }; diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro index 1ee9030..67f5d61 100644 --- a/src/plugins/gfxdrivers/directfb/directfb.pro +++ b/src/plugins/gfxdrivers/directfb/directfb.pro @@ -14,30 +14,29 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/gfxdrivers #DEFINES += QT_NO_DIRECTFB_KEYBOARD #DEFINES += QT_DIRECTFB_TIMING #DEFINES += QT_NO_DIRECTFB_OPAQUE_DETECTION -#DEFINES += QT_DIRECTFB_WARN_ON_RASTERFALLBACKS -#DEFINES += QT_DIRECTFB_DISABLE_RASTERFALLBACKS +#DIRECTFB_DRAWINGOPERATIONS=DRAW_RECTS|DRAW_LINES|DRAW_IMAGE|DRAW_PIXMAP|DRAW_TILED_PIXMAP|STROKE_PATH|DRAW_PATH|DRAW_POINTS|DRAW_ELLIPSE|DRAW_POLYGON|DRAW_TEXT|FILL_PATH|FILL_RECT|DRAW_COLORSPANS +#DEFINES += \"QT_DIRECTFB_WARN_ON_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" +#DEFINES += \"QT_DIRECTFB_DISABLE_RASTERFALLBACKS=$$DIRECTFB_DRAWINGOPERATIONS\" target.path = $$[QT_INSTALL_PLUGINS]/gfxdrivers INSTALLS += target -HEADERS = \ - qdirectfbscreen.h \ - qdirectfbsurface.h \ - qdirectfbpaintengine.h \ - qdirectfbpaintdevice.h \ - qdirectfbpixmap.h \ - qdirectfbkeyboard.h \ - qdirectfbmouse.h +HEADERS = qdirectfbscreen.h \ + qdirectfbsurface.h \ + qdirectfbpaintengine.h \ + qdirectfbpaintdevice.h \ + qdirectfbpixmap.h \ + qdirectfbkeyboard.h \ + qdirectfbmouse.h -SOURCES = \ - qdirectfbscreen.cpp \ - qdirectfbscreenplugin.cpp \ - qdirectfbsurface.cpp \ - qdirectfbpaintengine.cpp \ - qdirectfbpaintdevice.cpp \ - qdirectfbpixmap.cpp \ - qdirectfbkeyboard.cpp \ - qdirectfbmouse.cpp +SOURCES = qdirectfbscreen.cpp \ + qdirectfbscreenplugin.cpp \ + qdirectfbsurface.cpp \ + qdirectfbpaintengine.cpp \ + qdirectfbpaintdevice.cpp \ + qdirectfbpixmap.cpp \ + qdirectfbkeyboard.cpp \ + qdirectfbmouse.cpp QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB LIBS += $$QT_LIBS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index f4d9b46..b999dd2 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -56,9 +56,7 @@ public: QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler *h); ~QDirectFBMouseHandlerPrivate(); - void suspend(); - void resume(); - + void setEnabled(bool on); private: QDirectFBMouseHandler *handler; IDirectFBEventBuffer *eventBuffer; @@ -130,7 +128,7 @@ QDirectFBMouseHandlerPrivate::QDirectFBMouseHandlerPrivate(QDirectFBMouseHandler mouseNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(mouseNotifier, SIGNAL(activated(int)),this, SLOT(readMouseData())); - resume(); + setEnabled(true); } QDirectFBMouseHandlerPrivate::~QDirectFBMouseHandlerPrivate() @@ -139,15 +137,32 @@ QDirectFBMouseHandlerPrivate::~QDirectFBMouseHandlerPrivate() eventBuffer->Release(eventBuffer); } -void QDirectFBMouseHandlerPrivate::suspend() +void QDirectFBMouseHandlerPrivate::setEnabled(bool on) { - mouseNotifier->setEnabled(false); -} + if (mouseNotifier->isEnabled() != on) { +#ifndef QT_NO_DIRECTFB_LAYER + DFBResult result; + result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: " + "Unable to set cooperative level", result); + } + result = layer->EnableCursor(layer, on ? 1 : 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::QDirectFBScreenCursor: " + "Unable to enable cursor", result); + } -void QDirectFBMouseHandlerPrivate::resume() -{ - eventBuffer->Reset(eventBuffer); - mouseNotifier->setEnabled(true); + result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set cooperative level", result); + } + + layer->SetCooperativeLevel(layer, DLSCL_SHARED); +#endif + mouseNotifier->setEnabled(on); + } } void QDirectFBMouseHandlerPrivate::readMouseData() @@ -260,12 +275,12 @@ QDirectFBMouseHandler::~QDirectFBMouseHandler() void QDirectFBMouseHandler::suspend() { - d->suspend(); + d->setEnabled(false); } void QDirectFBMouseHandler::resume() { - d->resume(); + d->setEnabled(true); } #include "qdirectfbmouse.moc" diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h index e81a4ba..d2eccfc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h @@ -61,7 +61,6 @@ public: void suspend(); void resume(); - protected: QDirectFBMouseHandlerPrivate *d; }; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index ba5d71a..9e6f821 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -54,6 +54,27 @@ #include <private/qpixmapdata_p.h> #include <private/qpixmap_raster_p.h> +#if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS || defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS +#define VOID_ARG() static_cast<bool>(false) +enum PaintOperation { + DRAW_RECTS = 0x0001, + DRAW_LINES = 0x0002, + DRAW_IMAGE = 0x0004, + DRAW_PIXMAP = 0x0008, + DRAW_TILED_PIXMAP = 0x0010, + STROKE_PATH = 0x0020, + DRAW_PATH = 0x0040, + DRAW_POINTS = 0x0080, + DRAW_ELLIPSE = 0x0100, + DRAW_POLYGON = 0x0200, + DRAW_TEXT = 0x0400, + FILL_PATH = 0x0800, + FILL_RECT = 0x1000, + DRAW_COLORSPANS = 0x2000, + ALL = 0xffff +}; +#endif + #ifdef QT_DIRECTFB_WARN_ON_RASTERFALLBACKS template <typename T> inline const T *ptr(const T &t) { return &t; } template <> inline const bool* ptr<bool>(const bool &) { return 0; } @@ -98,24 +119,31 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * #endif #if defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS && defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS -#define RASTERFALLBACK(one, two, three) rasterFallbackWarn("Disabled raster engine operation", \ - __FUNCTION__, state()->painter->device(), \ - d_func()->matrixScale, d_func()->matrixRotShear, \ - d_func()->simplePen, d_func()->dfbCanHandleClip(), \ - d_func()->forceRasterPrimitives, \ - #one, one, #two, two, #three, three); \ - return; +#define RASTERFALLBACK(op, one, two, three) \ + if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \ + rasterFallbackWarn("Disabled raster engine operation", \ + __FUNCTION__, state()->painter->device(), \ + d_func()->matrixScale, d_func()->matrixRotShear, \ + d_func()->simplePen, d_func()->dfbCanHandleClip(), \ + d_func()->forceRasterPrimitives, \ + #one, one, #two, two, #three, three); \ + if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \ + return; #elif defined QT_DIRECTFB_DISABLE_RASTERFALLBACKS -#define RASTERFALLBACK(one, two, three) return; +#define RASTERFALLBACK(op, one, two, three) \ + if (op & (QT_DIRECTFB_DISABLE_RASTERFALLBACKS)) \ + return; #elif defined QT_DIRECTFB_WARN_ON_RASTERFALLBACKS -#define RASTERFALLBACK(one, two, three) rasterFallbackWarn("Falling back to raster engine for", \ - __FUNCTION__, state()->painter->device(), \ - d_func()->matrixScale, d_func()->matrixRotShear, \ - d_func()->simplePen, d_func()->dfbCanHandleClip(), \ - d_func()->forceRasterPrimitives, \ - #one, one, #two, two, #three, three); +#define RASTERFALLBACK(op, one, two, three) \ + if (op & (QT_DIRECTFB_WARN_ON_RASTERFALLBACKS)) \ + rasterFallbackWarn("Falling back to raster engine for", \ + __FUNCTION__, state()->painter->device(), \ + d_func()->matrixScale, d_func()->matrixRotShear, \ + d_func()->simplePen, d_func()->dfbCanHandleClip(), \ + d_func()->forceRasterPrimitives, \ + #one, one, #two, two, #three, three); #else -#define RASTERFALLBACK(one, two, three) +#define RASTERFALLBACK(op, one, two, three) #endif static inline uint ALPHA_MUL(uint x, uint a) @@ -270,14 +298,14 @@ public: inline bool dfbCanHandleClip() const; inline bool isSimpleBrush(const QBrush &brush) const; - void drawLines(const QLine *lines, int count) const; - void drawLines(const QLineF *lines, int count) const; + void drawLines(const QLine *lines, int count); + void drawLines(const QLineF *lines, int count); - void fillRegion(const QRegion &r) const; - void fillRects(const QRect *rects, int count) const; - void drawRects(const QRect *rects, int count) const; - void fillRects(const QRectF *rects, int count) const; - void drawRects(const QRectF *rects, int count) const; + void fillRegion(const QRegion &r); + void fillRects(const QRect *rects, int count); + void drawRects(const QRect *rects, int count); + void fillRects(const QRectF *rects, int count); + void drawRects(const QRectF *rects, int count); void drawPixmap(const QRectF &dest, @@ -309,6 +337,7 @@ private: bool dirtyClip; bool dfbHandledClip; + bool ignoreSystemClip; QDirectFBPaintDevice *dfbDevice; QDirectFBPaintEngine *q; @@ -322,6 +351,7 @@ QDirectFBPaintEnginePrivate::QDirectFBPaintEnginePrivate(QDirectFBPaintEngine *p dfbHandledClip(false), dfbDevice(0), q(p) { fb = QDirectFBScreen::instance()->dfb(); + ignoreSystemClip = QDirectFBScreen::instance()->directFBFlags() & QDirectFBScreen::IgnoreSystemClip; surfaceCache = new SurfaceCache; static int cacheLimit = qgetenv("QT_DIRECTFB_IMAGECACHE").toInt(); if (cacheLimit > 0) @@ -545,7 +575,7 @@ void QDirectFBPaintEnginePrivate::setDFBColor(const QColor &color) surface->SetDrawingFlags(surface, DFBSurfaceDrawingFlags(drawingFlags)); } -void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) const +void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) { for (int i = 0; i < n; ++i) { const QLine l = transform.map(lines[i]); @@ -553,7 +583,7 @@ void QDirectFBPaintEnginePrivate::drawLines(const QLine *lines, int n) const } } -void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) const +void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) { for (int i = 0; i < n; ++i) { const QLine l = transform.map(lines[i]).toLine(); @@ -561,14 +591,16 @@ void QDirectFBPaintEnginePrivate::drawLines(const QLineF *lines, int n) const } } -void QDirectFBPaintEnginePrivate::fillRegion(const QRegion ®ion) const +void QDirectFBPaintEnginePrivate::fillRegion(const QRegion ®ion) { + Q_ASSERT(isSimpleBrush(q->state()->brush)); + setDFBColor(q->state()->brush.color()); const QVector<QRect> rects = region.rects(); const int n = rects.size(); fillRects(rects.constData(), n); } -void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) const +void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) { for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]); @@ -577,7 +609,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRect *rects, int n) const } } -void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) const +void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) { for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]).toRect(); @@ -586,7 +618,7 @@ void QDirectFBPaintEnginePrivate::fillRects(const QRectF *rects, int n) const } } -void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const +void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) { for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]); @@ -595,7 +627,7 @@ void QDirectFBPaintEnginePrivate::drawRects(const QRect *rects, int n) const } } -void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) const +void QDirectFBPaintEnginePrivate::drawRects(const QRectF *rects, int n) { for (int i = 0; i < n; ++i) { const QRect r = transform.mapRect(rects[i]).toRect(); @@ -744,23 +776,24 @@ void QDirectFBPaintEnginePrivate::updateClip() if (!dirtyClip) return; - if (!clip() || !clip()->enabled) { + const QClipData *clipData = clip(); + if (!clipData || !clipData->enabled) { surface->SetClip(surface, NULL); dfbHandledClip = true; - } - else if (clip()->hasRectClip) { + } else if (clipData->hasRectClip) { const DFBRegion r = { - clip()->clipRect.x(), - clip()->clipRect.y(), - clip()->clipRect.x() + clip()->clipRect.width(), - clip()->clipRect.y() + clip()->clipRect.height() + clipData->clipRect.x(), + clipData->clipRect.y(), + clipData->clipRect.x() + clipData->clipRect.width(), + clipData->clipRect.y() + clipData->clipRect.height() }; surface->SetClip(surface, &r); - dfbHandledClip = true; - } - else + } else if (clipData->hasRegionClip && ignoreSystemClip && clipData->clipRegion == systemClip) { + dfbHandledClip = true; + } else { dfbHandledClip = false; + } dirtyClip = false; } @@ -890,7 +923,7 @@ void QDirectFBPaintEngine::drawRects(const QRect *rects, int rectCount) if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simplePen || d->forceRasterPrimitives || !d->isSimpleBrush(brush)) { - RASTERFALLBACK(rectCount, static_cast<bool>(false), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; @@ -916,6 +949,7 @@ void QDirectFBPaintEngine::drawRects(const QRectF *rects, int rectCount) if (!d->dfbCanHandleClip() || d->matrixRotShear || !d->simplePen || d->forceRasterPrimitives || !d->isSimpleBrush(brush)) { + RASTERFALLBACK(DRAW_RECTS, rectCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawRects(rects, rectCount); return; @@ -938,7 +972,7 @@ void QDirectFBPaintEngine::drawLines(const QLine *lines, int lineCount) Q_D(QDirectFBPaintEngine); d->updateClip(); if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) { - RASTERFALLBACK(lineCount, static_cast<bool>(false), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; @@ -956,7 +990,7 @@ void QDirectFBPaintEngine::drawLines(const QLineF *lines, int lineCount) Q_D(QDirectFBPaintEngine); d->updateClip(); if (!d->simplePen || !d->dfbCanHandleClip() || d->forceRasterPrimitives) { - RASTERFALLBACK(lineCount, static_cast<bool>(false), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_LINES, lineCount, VOID_ARG(), VOID_ARG()); d->lock(); QRasterPaintEngine::drawLines(lines, lineCount); return; @@ -982,7 +1016,7 @@ void QDirectFBPaintEngine::drawImage(const QRectF &r, const QImage &image, || QDirectFBScreen::getSurfacePixelFormat(image.format()) == DSPF_UNKNOWN) #endif { - RASTERFALLBACK(r, image.size(), sr); + RASTERFALLBACK(DRAW_IMAGE, r, image.size(), sr); d->lock(); QRasterPaintEngine::drawImage(r, image, sr, flags); return; @@ -1006,11 +1040,11 @@ void QDirectFBPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pixmap, d->updateClip(); if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { - // not using RASTERFALLBACK since this is the way we do bitmaps? + RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); d->lock(); QRasterPaintEngine::drawPixmap(r, pixmap, sr); } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear) { - RASTERFALLBACK(r, pixmap.size(), sr); + RASTERFALLBACK(DRAW_PIXMAP, r, pixmap.size(), sr); const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(); d->lock(); QRasterPaintEngine::drawImage(r, *img, sr); @@ -1032,10 +1066,11 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, Q_D(QDirectFBPaintEngine); d->updateClip(); if (pixmap.pixmapData()->classId() != QPixmapData::DirectFBClass) { + RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); d->lock(); QRasterPaintEngine::drawTiledPixmap(r, pixmap, sp); } else if (!d->dfbCanHandleClip(r) || d->matrixRotShear || !sp.isNull()) { - RASTERFALLBACK(r, pixmap.size(), sp); + RASTERFALLBACK(DRAW_TILED_PIXMAP, r, pixmap.size(), sp); const QImage *img = static_cast<QDirectFBPixmapData*>(pixmap.pixmapData())->buffer(); d->lock(); QRasterPixmapData *data = new QRasterPixmapData(QPixmapData::PixmapType); @@ -1051,6 +1086,7 @@ void QDirectFBPaintEngine::drawTiledPixmap(const QRectF &r, void QDirectFBPaintEngine::stroke(const QVectorPath &path, const QPen &pen) { + RASTERFALLBACK(STROKE_PATH, path, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::stroke(path, pen); @@ -1058,7 +1094,7 @@ void QDirectFBPaintEngine::stroke(const QVectorPath &path, const QPen &pen) void QDirectFBPaintEngine::drawPath(const QPainterPath &path) { - RASTERFALLBACK(path.boundingRect(), static_cast<bool>(false), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_PATH, path, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::drawPath(path); @@ -1066,7 +1102,7 @@ void QDirectFBPaintEngine::drawPath(const QPainterPath &path) void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount) { - RASTERFALLBACK(pointCount, static_cast<bool>(false), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::drawPoints(points, pointCount); @@ -1074,7 +1110,7 @@ void QDirectFBPaintEngine::drawPoints(const QPointF *points, int pointCount) void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount) { - RASTERFALLBACK(pointCount, static_cast<bool>(false), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_POINTS, pointCount, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::drawPoints(points, pointCount); @@ -1082,7 +1118,7 @@ void QDirectFBPaintEngine::drawPoints(const QPoint *points, int pointCount) void QDirectFBPaintEngine::drawEllipse(const QRectF &rect) { - RASTERFALLBACK(rect, static_cast<bool>(false), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_ELLIPSE, rect, VOID_ARG(), VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::drawEllipse(rect); @@ -1091,7 +1127,7 @@ void QDirectFBPaintEngine::drawEllipse(const QRectF &rect) void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount, PolygonDrawMode mode) { - RASTERFALLBACK(pointCount, mode, static_cast<bool>(false)); + RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::drawPolygon(points, pointCount, mode); @@ -1100,7 +1136,7 @@ void QDirectFBPaintEngine::drawPolygon(const QPointF *points, int pointCount, void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDrawMode mode) { - RASTERFALLBACK(pointCount, mode, static_cast<bool>(false)); + RASTERFALLBACK(DRAW_POLYGON, pointCount, mode, VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::drawPolygon(points, pointCount, mode); @@ -1109,7 +1145,7 @@ void QDirectFBPaintEngine::drawPolygon(const QPoint *points, int pointCount, void QDirectFBPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) { - RASTERFALLBACK(p, textItem.text(), static_cast<bool>(false)); + RASTERFALLBACK(DRAW_TEXT, p, textItem.text(), VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::drawTextItem(p, textItem); @@ -1117,7 +1153,7 @@ void QDirectFBPaintEngine::drawTextItem(const QPointF &p, void QDirectFBPaintEngine::fill(const QVectorPath &path, const QBrush &brush) { - RASTERFALLBACK(path, brush, static_cast<bool>(false)); + RASTERFALLBACK(FILL_PATH, path, brush, VOID_ARG()); Q_D(QDirectFBPaintEngine); d->lock(); QRasterPaintEngine::fill(path, brush); @@ -1151,7 +1187,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) break; } } - RASTERFALLBACK(rect, brush, static_cast<bool>(false)); + RASTERFALLBACK(FILL_RECT, rect, brush, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, brush); } @@ -1161,7 +1197,7 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QColor &color) Q_D(QDirectFBPaintEngine); d->updateClip(); if (!d->dfbCanHandleClip() || d->matrixRotShear || d->forceRasterPrimitives) { - RASTERFALLBACK(rect, color, static_cast<bool>(false)); + RASTERFALLBACK(FILL_RECT, rect, color, VOID_ARG()); d->lock(); QRasterPaintEngine::fillRect(rect, color); } else { @@ -1178,7 +1214,7 @@ void QDirectFBPaintEngine::drawColorSpans(const QSpan *spans, int count, { Q_D(QDirectFBPaintEngine); if (d->forceRasterPrimitives) { - RASTERFALLBACK(count, color, static_cast<bool>(false)); + RASTERFALLBACK(DRAW_COLORSPANS, count, color, VOID_ARG()); d->lock(); QRasterPaintEngine::drawColorSpans(spans, count, color); } else { diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 3e54e7f..a53b1c0 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -80,7 +80,7 @@ public: #ifndef QT_NO_DIRECTFB_KEYBOARD QDirectFBKeyboardHandler *keyboard; #endif - bool videoonly; + QDirectFBScreen::DirectFBFlags directFBFlags; QImage::Format alphaPixmapFormat; }; @@ -96,7 +96,7 @@ QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen* screen) #ifndef QT_NO_DIRECTFB_KEYBOARD , keyboard(0) #endif - , videoonly(false) + , directFBFlags(QDirectFBScreen::NoFlags) , alphaPixmapFormat(QImage::Format_Invalid) { #ifndef QT_NO_QWS_SIGNALHANDLER @@ -225,7 +225,7 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const DFBSurfaceDescription return 0; } - if (d_ptr->videoonly && !(desc->flags & DSDESC_PREALLOCATED)) { + if (d_ptr->directFBFlags & VideoOnly && !(desc->flags & DSDESC_PREALLOCATED)) { // Add the video only capability. This means the surface will be created in video ram DFBSurfaceDescription voDesc = *desc; if (!(voDesc.flags & DSDESC_CAPS)) { @@ -345,11 +345,10 @@ void QDirectFBScreen::releaseDFBSurface(IDirectFBSurface *surface) //qDebug("Released surface at %p. New count = %d", surface, d_ptr->allocatedSurfaces.count()); } -bool QDirectFBScreen::preferVideoOnly() const +QDirectFBScreen::DirectFBFlags QDirectFBScreen::directFBFlags() const { - return d_ptr->videoonly; + return d_ptr->directFBFlags; } - IDirectFB* QDirectFBScreen::dfb() { return d_ptr->dfb; @@ -539,16 +538,12 @@ class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor { public: QDirectFBScreenCursor(); - ~QDirectFBScreenCursor(); - - void set(const QImage &image, int hotx, int hoty); - void move(int x, int y); - void show(); - void hide(); - + virtual void set(const QImage &image, int hotx, int hoty); + virtual void move(int x, int y); + virtual void show(); + virtual void hide(); private: IDirectFBDisplayLayer *layer; - bool implicitHide; }; QDirectFBScreenCursor::QDirectFBScreenCursor() @@ -558,116 +553,101 @@ QDirectFBScreenCursor::QDirectFBScreenCursor() qFatal("QDirectFBScreenCursor: DirectFB not initialized"); layer = QDirectFBScreen::instance()->dfbDisplayLayer(); + Q_ASSERT(layer); - if (layer) - layer->SetCooperativeLevel(layer, DLSCL_SHARED); // XXX: hw: remove? - else - qFatal("QDirectFBScreenCursor: Unable to get primary display layer!"); - - enable = true; + enable = false; hwaccel = true; - implicitHide = false; supportsAlpha = true; - - set(QImage(), 0, 0); -} - -QDirectFBScreenCursor::~QDirectFBScreenCursor() -{ } -void QDirectFBScreenCursor::show() +void QDirectFBScreenCursor::move(int x, int y) { - DFBResult result; - result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to set cooperative level", result); - } - result = layer->EnableCursor(layer, 1); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to enable cursor", result); - } - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::show: " - "Unable to reset cooperative level", result); - } - implicitHide = false; + layer->WarpCursor(layer, x, y); } void QDirectFBScreenCursor::hide() { - DFBResult result; - result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to set cooperative level", result); - } - result = layer->EnableCursor(layer, 0); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to disable cursor", result); - } - result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); - if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::hide: " - "Unable to reset cooperative level", result); + if (enable) { + enable = false; + DFBResult result; + result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cooperative level", result); + } + result = layer->SetCursorOpacity(layer, 0); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cursor opacity", result); + } + result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::hide: " + "Unable to set cooperative level", result); + } } - implicitHide = true; } -void QDirectFBScreenCursor::move(int x, int y) +void QDirectFBScreenCursor::show() { - layer->WarpCursor(layer, x, y); + if (!enable) { + enable = true; + DFBResult result; + result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set cooperative level", result); + } + result = layer->SetCursorOpacity(layer, 255); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set cursor shape", result); + } + result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); + if (result != DFB_OK) { + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set cooperative level", result); + } + } } void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty) { - if (image.isNull() && isVisible()) { - hide(); - implicitHide = true; - } else if (!image.isNull() && implicitHide) { - show(); - } - cursor = image.convertToFormat(QDirectFBScreen::instance()->alphaPixmapFormat()); + QDirectFBScreen *screen = QDirectFBScreen::instance(); + if (!screen) + return; - if (!image.isNull()) { - Q_ASSERT(cursor.numColors() == 0); + if (image.isNull()) { + cursor = QImage(); + hide(); + } else { + cursor = image.convertToFormat(screen->alphaPixmapFormat()); size = cursor.size(); hotspot = QPoint(hotx, hoty); - - DFBSurfaceDescription description; - description = QDirectFBScreen::getSurfaceDescription(cursor); - - IDirectFBSurface *surface; - surface = QDirectFBScreen::instance()->createDFBSurface(&description, - QDirectFBScreen::TrackSurface); + IDirectFBSurface *surface = screen->createDFBSurface(cursor, QDirectFBScreen::DontTrackSurface); if (!surface) { qWarning("QDirectFBScreenCursor::set: Unable to create surface"); return; } DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE); if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: " + DirectFBError("QDirectFBScreenCursor::show: " "Unable to set cooperative level", result); } result = layer->SetCursorShape(layer, surface, hotx, hoty); if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: Unable to set cursor shape", - result); + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set cursor shape", result); } - + surface->Release(surface); result = layer->SetCooperativeLevel(layer, DLSCL_SHARED); if (result != DFB_OK) { - DirectFBError("QDirectFBScreenCursor::set: " - "Unable to reset cooperative level", result); + DirectFBError("QDirectFBScreenCursor::show: " + "Unable to set cooperative level", result); } - - if (surface) - QDirectFBScreen::instance()->releaseDFBSurface(surface); + show(); } + } #endif // QT_NO_DIRECTFB_LAYER @@ -823,8 +803,11 @@ bool QDirectFBScreen::connect(const QString &displaySpec) if (displayArgs.contains(QLatin1String("debug"), Qt::CaseInsensitive)) printDirectFBInfo(d_ptr->dfb); - if (displayArgs.contains(QLatin1String("videoonly"))) - d_ptr->videoonly = true; + if (displayArgs.contains(QLatin1String("videoonly"), Qt::CaseInsensitive)) + d_ptr->directFBFlags |= VideoOnly; + + if (displayArgs.contains(QLatin1String("ignoresystemclip"), Qt::CaseInsensitive)) + d_ptr->directFBFlags |= IgnoreSystemClip; #ifndef QT_NO_DIRECTFB_WM if (displayArgs.contains(QLatin1String("fullscreen"))) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index 8dd38dc..8e75277 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -59,6 +59,16 @@ public: QDirectFBScreen(int display_id); ~QDirectFBScreen(); + enum DirectFBFlag { + NoFlags = 0x00, + VideoOnly = 0x01, + IgnoreSystemClip = 0x02 + }; + + Q_DECLARE_FLAGS(DirectFBFlags, DirectFBFlag); + + DirectFBFlags directFBFlags() const; + bool connect(const QString &displaySpec); void disconnect(); bool initDevice(); @@ -108,8 +118,6 @@ public: SurfaceCreationOptions options); void releaseDFBSurface(IDirectFBSurface* surface); - bool preferVideoOnly() const; - static int depth(DFBSurfacePixelFormat format); static DFBSurfacePixelFormat getSurfacePixelFormat(QImage::Format format); @@ -138,6 +146,7 @@ private: }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::SurfaceCreationOptions); +Q_DECLARE_OPERATORS_FOR_FLAGS(QDirectFBScreen::DirectFBFlags); inline bool QDirectFBScreen::isPremultiplied(QImage::Format format) { diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp index 8ed308c..257efeb 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp @@ -110,7 +110,7 @@ void QDirectFBSurface::createWindow() |DWDESC_PIXELFORMAT); description.surface_caps = DSCAPS_NONE; - if (screen->preferVideoOnly()) + if (screen->directFBFlags() & QDirectFBScreen::VideoOnly) description.surface_caps = DFBSurfaceCapabilities(description.surface_caps|DSCAPS_VIDEOONLY); const QImage::Format format = screen->pixelFormat(); description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp index 0705722..9eeb41d 100644 --- a/src/sql/drivers/ibase/qsql_ibase.cpp +++ b/src/sql/drivers/ibase/qsql_ibase.cpp @@ -1270,27 +1270,27 @@ QSqlRecord QIBaseResult::record() const v = d->sqlda->sqlvar[i]; QSqlField f(QString::fromLatin1(v.aliasname, v.aliasname_length).simplified(), qIBaseTypeName2(v.sqltype, v.sqlscale < 0)); - QSqlQuery q(new QIBaseResult(d->db)); - q.setForwardOnly(true); - q.exec(QLatin1String("select b.RDB$FIELD_PRECISION, b.RDB$FIELD_SCALE, b.RDB$FIELD_LENGTH, a.RDB$NULL_FLAG " - "FROM RDB$RELATION_FIELDS a, RDB$FIELDS b " - "WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE " - "AND a.RDB$RELATION_NAME = '") + QString::fromAscii(v.relname, v.relname_length).toUpper() + QLatin1String("' " - "AND a.RDB$FIELD_NAME = '") + QString::fromAscii(v.sqlname, v.sqlname_length).toUpper() + QLatin1String("' ")); - if(q.first()) { - if(v.sqlscale < 0) { - f.setLength(q.value(0).toInt()); - f.setPrecision(qAbs(q.value(1).toInt())); - } else { - f.setLength(q.value(2).toInt()); - f.setPrecision(0); + f.setLength(v.sqllen); + f.setPrecision(qAbs(v.sqlscale)); + f.setRequiredStatus((v.sqltype & 1) == 0 ? QSqlField::Required : QSqlField::Optional); + if(v.sqlscale < 0) { + QSqlQuery q(new QIBaseResult(d->db)); + q.setForwardOnly(true); + q.exec(QLatin1String("select b.RDB$FIELD_PRECISION, b.RDB$FIELD_SCALE, b.RDB$FIELD_LENGTH, a.RDB$NULL_FLAG " + "FROM RDB$RELATION_FIELDS a, RDB$FIELDS b " + "WHERE b.RDB$FIELD_NAME = a.RDB$FIELD_SOURCE " + "AND a.RDB$RELATION_NAME = '") + QString::fromAscii(v.relname, v.relname_length).toUpper() + QLatin1String("' " + "AND a.RDB$FIELD_NAME = '") + QString::fromAscii(v.sqlname, v.sqlname_length).toUpper() + QLatin1String("' ")); + if(q.first()) { + if(v.sqlscale < 0) { + f.setLength(q.value(0).toInt()); + f.setPrecision(qAbs(q.value(1).toInt())); + } else { + f.setLength(q.value(2).toInt()); + f.setPrecision(0); + } + f.setRequiredStatus(q.value(3).toBool() ? QSqlField::Required : QSqlField::Optional); } - f.setRequiredStatus(q.value(3).toBool() ? QSqlField::Required : QSqlField::Optional); - } - else { - f.setLength(0); - f.setPrecision(0); - f.setRequiredStatus(QSqlField::Unknown); } f.setSqlType(v.sqltype); rec.append(f); diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 2a83fe6..4e90777 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -70,18 +70,16 @@ QT_BEGIN_NAMESPACE #endif // newer platform SDKs use SQLLEN instead of SQLINTEGER -#if defined(SQLLEN) || defined(Q_OS_WIN64) +//#if defined(SQLLEN) || defined(Q_OS_WIN64) +#if ODBCVER >= 0x0270 # define QSQLLEN SQLLEN -#else -# define QSQLLEN SQLINTEGER -#endif - -#if defined(SQLULEN) || defined(Q_OS_WIN64) # define QSQLULEN SQLULEN #else +# define QSQLLEN SQLINTEGER # define QSQLULEN SQLUINTEGER #endif + static const int COLNAMESIZE = 256; //Map Qt parameter types to ODBC types static const SQLSMALLINT qParamType[4] = { SQL_PARAM_INPUT, SQL_PARAM_INPUT, SQL_PARAM_OUTPUT, SQL_PARAM_INPUT_OUTPUT }; diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 3d702dd..47566ad 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1650,19 +1650,19 @@ QString WriteInitialization::writeIconProperties(const DomResourceIcon *i) if (i->hasElementNormalOff()) m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Normal, QIcon::Off);\n"; if (i->hasElementNormalOn()) - m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Normal, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOn()->text(), m_dindent) << "), QSize(), QIcon::Normal, QIcon::On);\n"; if (i->hasElementDisabledOff()) - m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::Off);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementDisabledOff()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::Off);\n"; if (i->hasElementDisabledOn()) - m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementDisabledOn()->text(), m_dindent) << "), QSize(), QIcon::Disabled, QIcon::On);\n"; if (i->hasElementActiveOff()) - m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::Off);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementActiveOff()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::Off);\n"; if (i->hasElementActiveOn()) - m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementActiveOn()->text(), m_dindent) << "), QSize(), QIcon::Active, QIcon::On);\n"; if (i->hasElementSelectedOff()) - m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::Off);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementSelectedOff()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::Off);\n"; if (i->hasElementSelectedOn()) - m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementNormalOff()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::On);\n"; + m_output << m_indent << iconName << ".addFile(QString::fromUtf8(" << fixString(i->elementSelectedOn()->text(), m_dindent) << "), QSize(), QIcon::Selected, QIcon::On);\n"; } else { // pre-4.4 legacy m_output << m_indent << "const QIcon " << iconName << " = " << pixCall(QLatin1String("QIcon"), i->text())<< ";\n"; } diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp index 13b13d6..689f73d 100644 --- a/tests/auto/qfiledialog/tst_qfiledialog.cpp +++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp @@ -1602,6 +1602,19 @@ void tst_QFiledialog::task227304_proxyOnFileDialog() QTest::keyClick(list, Qt::Key_Return); QTest::qWait(200); + dialog->close(); + fd.close(); + + QNonNativeFileDialog fd2(0, "I should not crash with a proxy", QDir::tempPath(), 0); + QSortFilterProxyModel *pm = new QSortFilterProxyModel; + fd2.setProxyModel(pm); + fd2.show(); + QSidebar *sidebar = qFindChild<QSidebar*>(&fd2, "sidebar"); + sidebar->setFocus(); + sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath())); + QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center()); + QTest::qWait(250); + //We shouldn't crash } void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior() diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index 15b36b8..9bd1ce3 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -89,6 +89,7 @@ private slots: void merge_data(); void merge(); void task119433_isRowSelected(); + void task252069_rowIntersectsSelection(); private: QAbstractItemModel *model; @@ -2140,6 +2141,51 @@ void tst_QItemSelectionModel::task119433_isRowSelected() QVERIFY(sel.isRowSelected(0, QModelIndex())); } +void tst_QItemSelectionModel::task252069_rowIntersectsSelection() +{ + QStandardItemModel m; + for (int i=0; i<8; ++i) { + for (int j=0; j<8; ++j) { + QStandardItem *item = new QStandardItem(QString("Item number %1").arg(i)); + if ((i % 2 == 0 && j == 0) || + (j % 2 == 0 && i == 0) || + j == 5 || i == 5 ) { + item->setEnabled(false); + //item->setSelectable(false); + } + m.setItem(i, j, item); + } + } + + QItemSelectionModel selected(&m); + //nothing is selected + QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex())); + QVERIFY(!selected.rowIntersectsSelection(2, QModelIndex())); + QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex())); + QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(2, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(3, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex())); + selected.select(m.index(2, 0), QItemSelectionModel::Select | QItemSelectionModel::Rows); + QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex())); + QVERIFY( selected.rowIntersectsSelection(2, QModelIndex())); + QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex())); + QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex())); + QVERIFY( selected.columnIntersectsSelection(2, QModelIndex())); + QVERIFY( selected.columnIntersectsSelection(3, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex())); + selected.select(m.index(0, 5), QItemSelectionModel::Select | QItemSelectionModel::Columns); + QVERIFY(!selected.rowIntersectsSelection(0, QModelIndex())); + QVERIFY( selected.rowIntersectsSelection(2, QModelIndex())); + QVERIFY(!selected.rowIntersectsSelection(3, QModelIndex())); + QVERIFY(!selected.rowIntersectsSelection(5, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(0, QModelIndex())); + QVERIFY( selected.columnIntersectsSelection(2, QModelIndex())); + QVERIFY( selected.columnIntersectsSelection(3, QModelIndex())); + QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex())); +} QTEST_MAIN(tst_QItemSelectionModel) #include "tst_qitemselectionmodel.moc" diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 2e7f412..c372475 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -105,6 +105,7 @@ private slots: void task203585_selectAll(); void task228566_infiniteRelayout(); void task248430_crashWith0SizedItem(); + void task250446_scrollChanged(); }; // Testing get/set functions @@ -1528,5 +1529,32 @@ void tst_QListView::task248430_crashWith0SizedItem() QTest::qWait(100); } +void tst_QListView::task250446_scrollChanged() +{ + QStandardItemModel model(200, 1); + QListView view; + view.setModel(&model); + QModelIndex index = model.index(0, 0); + QVERIFY(index.isValid()); + view.setCurrentIndex(index); + view.show(); + QTest::qWait(100); + const int scrollValue = view.verticalScrollBar()->maximum(); + view.verticalScrollBar()->setValue(scrollValue); + QCOMPARE(view.verticalScrollBar()->value(), scrollValue); + QCOMPARE(view.currentIndex(), index); + + view.showMinimized(); + QTest::qWait(100); + QCOMPARE(view.verticalScrollBar()->value(), scrollValue); + QCOMPARE(view.currentIndex(), index); + + view.showNormal(); + QTest::qWait(100); + QCOMPARE(view.verticalScrollBar()->value(), scrollValue); + QCOMPARE(view.currentIndex(), index); +} + + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" diff --git a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp index 33f85d5..1a4b639 100644 --- a/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -606,8 +606,9 @@ void tst_QStyleSheetStyle::palettePropagation() QVERIFY(COLOR(gb) == Qt::red); QVERIFY(COLOR(pb) == APPCOLOR(pb)); // palette shouldn't propagate gb.setStyleSheet("QGroupBox * { color: red }"); + QVERIFY(COLOR(pb) == Qt::red); - QVERIFY(COLOR(gb) == APPCOLOR(pb)); + QVERIFY(COLOR(gb) == APPCOLOR(gb)); QWidget window; window.setStyleSheet("* { color: white; }"); diff --git a/tools/assistant/tools/assistant/centralwidget.cpp b/tools/assistant/tools/assistant/centralwidget.cpp index f953ab7..4390a10 100644 --- a/tools/assistant/tools/assistant/centralwidget.cpp +++ b/tools/assistant/tools/assistant/centralwidget.cpp @@ -394,8 +394,10 @@ void CentralWidget::setLastShownPages() QString::SkipEmptyParts); const int pageCount = lastShownPageList.count(); - if (pageCount == 0 && usesDefaultCollection) - return setSource(QUrl(QLatin1String("help"))); + if (pageCount == 0 && usesDefaultCollection) { + setSource(QUrl(QLatin1String("help"))); + return; + } #if !defined(QT_NO_WEBKIT) const QLatin1String zoom("LastPagesZoomWebView"); |