summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-04-12 12:23:40 (GMT)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com>2010-04-12 12:23:40 (GMT)
commit0f790634c57400f4ddffd36f5e3443c712d1a1c3 (patch)
tree2b9f01a1798c5700f3c82e72a3db97dac6a625d5 /src/gui
parent67e8e5baeec38d592596f259894e6dda420728ea (diff)
parent119d7dddc8da189ccd1cbc55ed3292f311c30e0c (diff)
downloadQt-0f790634c57400f4ddffd36f5e3443c712d1a1c3.zip
Qt-0f790634c57400f4ddffd36f5e3443c712d1a1c3.tar.gz
Qt-0f790634c57400f4ddffd36f5e3443c712d1a1c3.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/animation/qguivariantanimation.cpp5
-rw-r--r--src/gui/dialogs/qfiledialog.cpp4
-rw-r--r--src/gui/dialogs/qprintdialog_unix.cpp2
-rw-r--r--src/gui/egl/qegl_p.h9
-rw-r--r--src/gui/egl/qegl_x11.cpp77
-rw-r--r--src/gui/embedded/qscreenlinuxfb_qws.cpp72
-rw-r--r--src/gui/embedded/qscreenlinuxfb_qws.h4
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp6
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp21
-rw-r--r--src/gui/itemviews/qitemselectionmodel.h2
-rw-r--r--src/gui/itemviews/qtableview.cpp4
-rw-r--r--src/gui/itemviews/qtreeview.cpp4
-rw-r--r--src/gui/itemviews/qtreewidget.cpp6
-rw-r--r--src/gui/kernel/qapplication.cpp4
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm9
-rw-r--r--src/gui/kernel/qgridlayout.cpp2
-rw-r--r--src/gui/kernel/qlayoutitem.cpp4
-rw-r--r--src/gui/kernel/qsoftkeymanager.cpp1
-rw-r--r--src/gui/kernel/qsoftkeymanager_common_p.h3
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp13
-rw-r--r--src/gui/kernel/qstackedlayout.cpp26
-rw-r--r--src/gui/kernel/qstackedlayout.h2
-rw-r--r--src/gui/kernel/qwidget.cpp17
-rw-r--r--src/gui/kernel/qwidget.h1
-rw-r--r--src/gui/kernel/qwidget_p.h1
-rw-r--r--src/gui/painting/qbezier.cpp4
-rw-r--r--src/gui/painting/qbrush.cpp3
-rw-r--r--src/gui/painting/qdrawhelper.cpp363
-rw-r--r--src/gui/painting/qpathclipper.cpp7
-rw-r--r--src/gui/styles/qgtkstyle_p.h5
-rw-r--r--src/gui/text/qfont.cpp4
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp9
-rw-r--r--src/gui/text/qfontengine_s60.cpp30
-rw-r--r--src/gui/text/qfontengine_s60_p.h2
-rw-r--r--src/gui/text/qtextengine.cpp2
-rw-r--r--src/gui/util/qcompleter.cpp2
-rw-r--r--src/gui/widgets/qdialogbuttonbox.cpp15
-rw-r--r--src/gui/widgets/qframe.cpp2
-rw-r--r--src/gui/widgets/qmenubar.cpp11
-rw-r--r--src/gui/widgets/qsizegrip.cpp17
-rw-r--r--src/gui/widgets/qtabwidget.cpp49
-rw-r--r--src/gui/widgets/qtabwidget.h1
44 files changed, 475 insertions, 355 deletions
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index 52303f5..28cde3e 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -38,12 +38,11 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-
-#ifndef QT_NO_ANIMATION
-
#include <QtCore/qvariantanimation.h>
#include <private/qvariantanimation_p.h>
+#ifndef QT_NO_ANIMATION
+
#include <QtGui/qcolor.h>
#include <QtGui/qvector2d.h>
#include <QtGui/qvector3d.h>
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 3b5fb9f..cb74a3c 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -723,15 +723,19 @@ void QFileDialog::setVisible(bool visible)
// Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below
// updates the state correctly, but skips showing the non-native version:
setAttribute(Qt::WA_DontShowOnScreen);
+#ifndef QT_NO_FSCOMPLETER
//So the completer don't try to complete and therefore to show a popup
d->completer->setModel(0);
+#endif
} else {
d->nativeDialogInUse = false;
setAttribute(Qt::WA_DontShowOnScreen, false);
+#ifndef QT_NO_FSCOMPLETER
if (d->proxyModel != 0)
d->completer->setModel(d->proxyModel);
else
d->completer->setModel(d->model);
+#endif
}
}
diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp
index 9b4d6e8..e3c62be 100644
--- a/src/gui/dialogs/qprintdialog_unix.cpp
+++ b/src/gui/dialogs/qprintdialog_unix.cpp
@@ -703,7 +703,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p)
}
#endif
-#ifndef QT_NO_FILESYSTEMMODEL
+#if !defined(QT_NO_FILESYSTEMMODEL) && !defined(QT_NO_COMPLETER)
QFileSystemModel *fsm = new QFileSystemModel(widget.filename);
fsm->setRootPath(QDir::homePath());
widget.filename->setCompleter(new QCompleter(fsm, widget.filename));
diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h
index 540cd3d..f81add6 100644
--- a/src/gui/egl/qegl_p.h
+++ b/src/gui/egl/qegl_p.h
@@ -139,6 +139,12 @@ QT_BEGIN_NAMESPACE
typedef void *EGLImageKHR;
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
+#define EGL_KHR_image_base
+#endif
+
+#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap)
+#define EGL_NATIVE_PIXMAP_KHR 0x30B0
+#define EGL_KHR_image_pixmap
#endif
// It is possible that something has included eglext.h (like Symbian 10.1's broken egl.h), in
@@ -154,9 +160,6 @@ extern Q_GUI_EXPORT _eglCreateImageKHR eglCreateImageKHR;
extern Q_GUI_EXPORT _eglDestroyImageKHR eglDestroyImageKHR;
#endif // (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES)
-#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap)
-#define EGL_NATIVE_PIXMAP_KHR 0x30B0
-#endif
class QEglProperties;
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 91423c8..5341ea1 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -147,9 +147,6 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
EGLint configAlphaSize = 0;
eglGetConfigAttrib(display(), config, EGL_ALPHA_SIZE, &configAlphaSize);
- eglGetConfigAttrib(display(), config, EGL_BUFFER_SIZE, &eglValue);
- int configBitDepth = eglValue;
-
eglGetConfigAttrib(display(), config, EGL_CONFIG_ID, &eglValue);
int configId = eglValue;
@@ -166,28 +163,53 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
int matchingCount = 0;
chosenVisualInfo = XGetVisualInfo(X11->display, VisualIDMask, &visualInfoTemplate, &matchingCount);
if (chosenVisualInfo) {
- if (configBitDepth == chosenVisualInfo->depth) {
+ int visualRedSize = countBits(chosenVisualInfo->red_mask);
+ int visualGreenSize = countBits(chosenVisualInfo->green_mask);
+ int visualBlueSize = countBits(chosenVisualInfo->blue_mask);
+ int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size
+
#if !defined(QT_NO_XRENDER)
+ if (X11->use_xrender) {
// If we have XRender, actually check the visual supplied by EGL is ARGB
- if (configAlphaSize > 0) {
- XRenderPictFormat *format;
- format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual);
- if (!format || (format->type != PictTypeDirect) || (!format->direct.alphaMask)) {
- qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this is not ARGB",
- (int)visualId, configId);
- visualId = 0;
- }
- }
+ XRenderPictFormat *format;
+ format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual);
+ if (format && (format->type == PictTypeDirect))
+ visualAlphaSize = countBits(format->direct.alphaMask);
+ }
#endif
- } else {
- qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!",
- (int)visualId, chosenVisualInfo->depth, configId, configBitDepth);
+
+ bool visualMatchesConfig = false;
+ if ( visualRedSize == configRedSize &&
+ visualGreenSize == configGreenSize &&
+ visualBlueSize == configBlueSize )
+ {
+ // We need XRender to check the alpha channel size of the visual. If we don't have
+ // the alpha size, we don't check it against the EGL config's alpha size.
+ if (visualAlphaSize >= 0)
+ visualMatchesConfig = visualAlphaSize == configAlphaSize;
+ else
+ visualMatchesConfig = true;
+ }
+
+ if (!visualMatchesConfig) {
+ if (visualAlphaSize >= 0) {
+ qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable",
+ (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize,
+ configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize);
+ } else {
+ qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable",
+ (int)visualId, visualRedSize, visualGreenSize, visualBlueSize,
+ configId, configRedSize, configGreenSize, configBlueSize);
+ }
visualId = 0;
}
+ } else {
+ qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID",
+ (int)visualId, configId);
+ visualId = 0;
}
XFree(chosenVisualInfo);
}
-
if (visualId) {
#ifdef QT_DEBUG_X11_VISUAL_SELECTION
if (configAlphaSize > 0)
@@ -201,17 +223,16 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
// If EGL didn't give us a valid visual ID, try XRender
#if !defined(QT_NO_XRENDER)
- if (!visualId) {
+ if (!visualId && X11->use_xrender) {
XVisualInfo visualInfoTemplate;
memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
- visualInfoTemplate.depth = configBitDepth;
visualInfoTemplate.c_class = TrueColor;
XVisualInfo *matchingVisuals;
int matchingCount = 0;
matchingVisuals = XGetVisualInfo(X11->display,
- VisualDepthMask|VisualClassMask,
+ VisualClassMask,
&visualInfoTemplate,
&matchingCount);
@@ -246,19 +267,27 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
// Finally, if XRender also failed to find a visual (or isn't present), try to
- // use XGetVisualInfo and only use the bit depth to match on:
+ // use XGetVisualInfo and only use the bit depths to match on:
if (!visualId) {
XVisualInfo visualInfoTemplate;
memset(&visualInfoTemplate, 0, sizeof(XVisualInfo));
-
- visualInfoTemplate.depth = configBitDepth;
-
XVisualInfo *matchingVisuals;
int matchingCount = 0;
+
+ visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize;
matchingVisuals = XGetVisualInfo(X11->display,
VisualDepthMask,
&visualInfoTemplate,
&matchingCount);
+ if (!matchingVisuals) {
+ // Try again without taking the alpha channel into account:
+ visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize;
+ matchingVisuals = XGetVisualInfo(X11->display,
+ VisualDepthMask,
+ &visualInfoTemplate,
+ &matchingCount);
+ }
+
if (matchingVisuals) {
visualId = matchingVisuals[0].visualid;
XFree(matchingVisuals);
diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp
index 8a21022..1effcfa 100644
--- a/src/gui/embedded/qscreenlinuxfb_qws.cpp
+++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp
@@ -91,6 +91,7 @@ public:
int startuph;
int startupd;
bool blank;
+ QLinuxFbScreen::DriverTypes driverType;
bool doGraphicsMode;
#ifdef QT_QWS_DEPTH_GENERIC
@@ -165,6 +166,36 @@ void QLinuxFbScreenPrivate::closeTty()
}
/*!
+ \enum QLinuxFbScreen::DriverTypes
+
+ This enum describes the driver type.
+
+ \value GenericDriver Generic Linux framebuffer driver
+ \value EInk8Track e-Ink framebuffer driver using the 8Track chipset
+ */
+
+/*!
+ \fn QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo)
+
+ Adjust the values returned by the framebuffer driver, to work
+ around driver bugs or nonstandard behavior in certain drivers.
+ \a finfo and \a vinfo specify the fixed and variable screen info
+ returned by the driver.
+ */
+void QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo)
+{
+ // 8Track e-ink devices (as found in Sony PRS-505) lie
+ // about their bit depth -- they claim they're 1 bit per
+ // pixel while the only supported mode is 8 bit per pixel
+ // grayscale.
+ // Caused by this, they also miscalculate their line length.
+ if(!strcmp(finfo.id, "8TRACKFB") && vinfo.bits_per_pixel == 1) {
+ vinfo.bits_per_pixel = 8;
+ finfo.line_length = vinfo.xres;
+ }
+}
+
+/*!
\internal
\class QLinuxFbScreen
@@ -306,6 +337,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec)
return false;
}
+ d_ptr->driverType = strcmp(finfo.id, "8TRACKFB") ? GenericDriver : EInk8Track;
+
if (finfo.type == FB_TYPE_VGA_PLANES) {
qWarning("VGA16 video mode not supported");
return false;
@@ -318,6 +351,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec)
return false;
}
+ fixupScreenInfo(finfo, vinfo);
+
grayscale = vinfo.grayscale;
d = vinfo.bits_per_pixel;
if (d == 24) {
@@ -664,11 +699,6 @@ bool QLinuxFbScreen::initDevice()
vinfo.transp.msb_right);
#endif
- d_ptr->startupw=vinfo.xres;
- d_ptr->startuph=vinfo.yres;
- d_ptr->startupd=vinfo.bits_per_pixel;
- grayscale = vinfo.grayscale;
-
if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) {
perror("QLinuxFbScreen::initDevice");
qCritical("Error reading fixed information in card init");
@@ -677,6 +707,13 @@ bool QLinuxFbScreen::initDevice()
return true;
}
+ fixupScreenInfo(finfo, vinfo);
+
+ d_ptr->startupw=vinfo.xres;
+ d_ptr->startuph=vinfo.yres;
+ d_ptr->startupd=vinfo.bits_per_pixel;
+ grayscale = vinfo.grayscale;
+
#ifdef __i386__
// Now init mtrr
if(!::getenv("QWS_NOMTRR")) {
@@ -1122,6 +1159,7 @@ void QLinuxFbScreen::setMode(int nw,int nh,int nd)
qFatal("Error reading fixed information");
}
+ fixupScreenInfo(finfo, vinfo);
disconnect();
connect(d_ptr->displaySpec);
exposeRegion(region(), 0);
@@ -1200,6 +1238,26 @@ int QLinuxFbScreen::sharedRamSize(void * end)
/*!
\reimp
*/
+void QLinuxFbScreen::setDirty(const QRect &r)
+{
+ if(d_ptr->driverType == EInk8Track) {
+ // e-Ink displays need a trigger to actually show what is
+ // in their framebuffer memory. The 8-Track driver does this
+ // by adding custom IOCTLs - FBIO_EINK_DISP_PIC (0x46a2) takes
+ // an argument specifying whether or not to flash the screen
+ // while updating.
+ // There doesn't seem to be a way to tell it to just update
+ // a subset of the screen.
+ if(r.left() == 0 && r.top() == 0 && r.width() == dw && r.height() == dh)
+ ioctl(d_ptr->fd, 0x46a2, 1);
+ else
+ ioctl(d_ptr->fd, 0x46a2, 0);
+ }
+}
+
+/*!
+ \reimp
+*/
void QLinuxFbScreen::blank(bool on)
{
if (d_ptr->blank == on)
@@ -1315,7 +1373,9 @@ void QLinuxFbScreen::setPixelFormat(struct fb_var_screeninfo info)
bool QLinuxFbScreen::useOffscreen()
{
- if ((mapsize - size) < 16*1024)
+ // Not done for 8Track because on e-Ink displays,
+ // everything is offscreen anyway
+ if (d_ptr->driverType == EInk8Track || ((mapsize - size) < 16*1024))
return false;
return true;
diff --git a/src/gui/embedded/qscreenlinuxfb_qws.h b/src/gui/embedded/qscreenlinuxfb_qws.h
index ac488b7..6abadbf 100644
--- a/src/gui/embedded/qscreenlinuxfb_qws.h
+++ b/src/gui/embedded/qscreenlinuxfb_qws.h
@@ -88,6 +88,8 @@ public:
virtual bool useOffscreen();
+ enum DriverTypes { GenericDriver, EInk8Track };
+
virtual void disconnect();
virtual void shutdownDevice();
virtual void setMode(int,int,int);
@@ -98,6 +100,7 @@ public:
virtual uchar * cache(int);
virtual void uncache(uchar *);
virtual int sharedRamSize(void *);
+ virtual void setDirty(const QRect&);
QLinuxFb_Shared * shared;
@@ -109,6 +112,7 @@ protected:
int dataoffset;
int cacheStart;
+ virtual void fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo);
static void clearCache(QScreen *instance, int);
private:
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index f106b3d..d6daf4d 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7112,7 +7112,8 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
// Root items that ignore transformations need to
// calculate their diff by mapping viewport coordinates
// directly to parent coordinates.
- QTransform viewToParentTransform = (item->transform().translate(item->d_ptr->pos.x(), item->d_ptr->pos.y()))
+ // COMBINE
+ QTransform viewToParentTransform = (item->d_func()->transformData->computedFullTransform().translate(item->d_ptr->pos.x(), item->d_ptr->pos.y()))
* (item->sceneTransform() * view->viewportTransform()).inverted();
currentParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->screenPos())));
buttonDownParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->buttonDownScreenPos(Qt::LeftButton))));
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index b22f732..300a03f 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -55,7 +55,7 @@ DEFINES += Q_INTERNAL_QAPP_SRC
symbian {
TARGET.UID3=0x2001B2DD
- symbian-abld:symbian-sbsv2 {
+ symbian-abld|symbian-sbsv2 {
# ro-section in gui can exceed default allocated space, so move rw-section a little further
QMAKE_LFLAGS.ARMCC += --rw-base 0x800000
QMAKE_LFLAGS.GCCE += -Tdata 0xC00000
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index f321ab3..5dbd1f0 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -254,7 +254,9 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
sizeof(SHFILEINFO), SHGFI_SMALLICON|SHGFI_SYSICONINDEX);
#endif
- if (val) {
+
+ // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases
+ if (val && info.hIcon) {
if (fileInfo.isDir() && !fileInfo.isRoot()) {
//using the unique icon index provided by windows save us from duplicate keys
key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon);
@@ -293,7 +295,7 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(), 0, &info,
sizeof(SHFILEINFO), SHGFI_LARGEICON|SHGFI_SYSICONINDEX);
#endif
- if (val) {
+ if (val && info.hIcon) {
if (fileInfo.isDir() && !fileInfo.isRoot()) {
//using the unique icon index provided by windows save us from duplicate keys
key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon);
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index d6e68f6..f848321 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -292,6 +292,27 @@ static void indexesFromRange(const QItemSelectionRange &range, QModelIndexList &
}
/*!
+ Returns true if the selection range contains no selectable item
+ \since 4.7
+*/
+
+bool QItemSelectionRange::isEmpty() const
+{
+ if (!isValid() || !model())
+ return true;
+
+ for (int column = left(); column <= right(); ++column) {
+ for (int row = top(); row <= bottom(); ++row) {
+ QModelIndex index = model()->index(row, column, parent());
+ Qt::ItemFlags flags = model()->flags(index);
+ if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))
+ return false;
+ }
+ }
+ return true;
+}
+
+/*!
Returns the list of model index items stored in the selection.
*/
diff --git a/src/gui/itemviews/qitemselectionmodel.h b/src/gui/itemviews/qitemselectionmodel.h
index 9980d0f..436514f 100644
--- a/src/gui/itemviews/qitemselectionmodel.h
+++ b/src/gui/itemviews/qitemselectionmodel.h
@@ -108,6 +108,8 @@ public:
&& top() <= bottom() && left() <= right());
}
+ bool isEmpty() const;
+
QModelIndexList indexes() const;
private:
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index 43445b4..f49f273 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1847,7 +1847,9 @@ void QTableView::setSelection(const QRect &rect, QItemSelectionModel::SelectionF
selection.append(QItemSelectionRange(topLeft, bottomRight));
}
} else { // nothing moved
- selection.append(QItemSelectionRange(tl, br));
+ QItemSelectionRange range(tl, br);
+ if (!range.isEmpty())
+ selection.append(range);
}
d->selectionModel->select(selection, command);
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index d934683..c3ff2bd 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -3194,12 +3194,16 @@ void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninit
int QTreeViewPrivate::pageUp(int i) const
{
int index = itemAtCoordinate(coordinateForItem(i) - viewport->height());
+ while (isItemHiddenOrDisabled(index))
+ index--;
return index == -1 ? 0 : index;
}
int QTreeViewPrivate::pageDown(int i) const
{
int index = itemAtCoordinate(coordinateForItem(i) + viewport->height());
+ while (isItemHiddenOrDisabled(index))
+ index++;
return index == -1 ? viewItems.count() - 1 : index;
}
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 19ed10b..4c80325 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -3039,10 +3039,14 @@ QList<QTreeWidgetItem*> QTreeWidget::selectedItems() const
Q_D(const QTreeWidget);
QModelIndexList indexes = selectionModel()->selectedIndexes();
QList<QTreeWidgetItem*> items;
+ items.reserve(indexes.count());
+ QSet<QTreeWidgetItem *> seen;
+ seen.reserve(indexes.count());
for (int i = 0; i < indexes.count(); ++i) {
QTreeWidgetItem *item = d->item(indexes.at(i));
- if (isItemHidden(item) || items.contains(item)) // ### slow, optimize later
+ if (isItemHidden(item) || seen.contains(item))
continue;
+ seen.insert(item);
items.append(item);
}
return items;
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index be2683d..b0a23d4 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -5292,9 +5292,9 @@ QInputContext *QApplication::inputContext() const
QApplication *that = const_cast<QApplication *>(this);
const QStringList keys = QInputContextFactory::keys();
// Try hbim and coefep first, then try others.
- if (keys.contains("hbim")) {
+ if (keys.contains(QLatin1String("hbim"))) {
that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("hbim"), that);
- } else if (keys.contains("coefep")) {
+ } else if (keys.contains(QLatin1String("coefep"))) {
that->d_func()->inputContext = QInputContextFactory::create(QLatin1String("coefep"), that);
} else {
for (int c = 0; c < keys.size() && !d->inputContext; ++c) {
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 62e1e81..a7f1224 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -831,7 +831,14 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
QBoolBlocker block1(blockSendPostedEvents, true);
info.nswindow = window;
[(NSWindow*) info.nswindow retain];
- info.session = [NSApp beginModalSessionForWindow:window];
+ // When creating a modal session cocoa will rearrange the windows.
+ // In order to avoid windows to be put behind another we need to
+ // keep the window level.
+ {
+ int level = [window level];
+ info.session = [NSApp beginModalSessionForWindow:window];
+ [window setLevel:level];
+ }
}
currentModalSessionCached = info.session;
}
diff --git a/src/gui/kernel/qgridlayout.cpp b/src/gui/kernel/qgridlayout.cpp
index dbd3c01..81a4d04 100644
--- a/src/gui/kernel/qgridlayout.cpp
+++ b/src/gui/kernel/qgridlayout.cpp
@@ -1852,7 +1852,7 @@ void QGridLayout::invalidate()
/*!
\fn int QGridLayout::colSpacing(int col) const
- Use columnSpacing() instead.
+ Use columnMinimumWidth() instead.
*/
/*!
diff --git a/src/gui/kernel/qlayoutitem.cpp b/src/gui/kernel/qlayoutitem.cpp
index 6a91d95..e615b2d 100644
--- a/src/gui/kernel/qlayoutitem.cpp
+++ b/src/gui/kernel/qlayoutitem.cpp
@@ -516,9 +516,7 @@ bool QWidgetItem::hasHeightForWidth() const
{
if (isEmpty())
return false;
- if (wid->layout())
- return wid->layout()->hasHeightForWidth();
- return wid->sizePolicy().hasHeightForWidth();
+ return wid->hasHeightForWidth();
}
/*!
diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp
index 923144a..23f1481 100644
--- a/src/gui/kernel/qsoftkeymanager.cpp
+++ b/src/gui/kernel/qsoftkeymanager.cpp
@@ -242,6 +242,7 @@ bool QSoftKeyManager::handleUpdateSoftKeys()
d->requestedSoftKeyActions.clear();
bool recursiveMerging = false;
QWidget *source = softkeySource(NULL, recursiveMerging);
+ d->initialSoftKeySource = source;
while (source) {
if (appendSoftkeys(*source, level))
++level;
diff --git a/src/gui/kernel/qsoftkeymanager_common_p.h b/src/gui/kernel/qsoftkeymanager_common_p.h
index 460d0dc..04ddf7d 100644
--- a/src/gui/kernel/qsoftkeymanager_common_p.h
+++ b/src/gui/kernel/qsoftkeymanager_common_p.h
@@ -70,6 +70,7 @@ protected:
static QSoftKeyManager *self;
QHash<QAction*, Qt::Key> keyedActions;
QMultiHash<int, QAction*> requestedSoftKeyActions;
+ QWidget *initialSoftKeySource;
};
@@ -79,4 +80,4 @@ QT_END_NAMESPACE
QT_END_HEADER
-#endif // QSOFTKEYMANAGER_COMMON_P_H \ No newline at end of file
+#endif // QSOFTKEYMANAGER_COMMON_P_H
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index 9812d72..7d643c2 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -312,17 +312,8 @@ bool QSoftKeyManagerPrivateS60::setMiddleSoftkey(CEikButtonGroupContainer &cba)
bool QSoftKeyManagerPrivateS60::setRightSoftkey(CEikButtonGroupContainer &cba)
{
if (!setSoftkey(cba, QAction::NegativeSoftKey, RSK_POSITION)) {
- Qt::WindowType windowType = Qt::Window;
- QAction *action = requestedSoftKeyActions.value(0);
- if (action) {
- QWidget *actionParent = action->parentWidget();
- Q_ASSERT_X(actionParent, Q_FUNC_INFO, "No parent set for softkey action!");
-
- QWidget *actionWindow = actionParent->window();
- Q_ASSERT_X(actionWindow, Q_FUNC_INFO, "Softkey action does not have window!");
- windowType = actionWindow->windowType();
- }
-
+ const Qt::WindowType windowType = initialSoftKeySource
+ ? initialSoftKeySource->window()->windowType() : Qt::Window;
if (windowType != Qt::Dialog && windowType != Qt::Popup) {
QString text(QSoftKeyManager::tr("Exit"));
TPtrC nativeText = qt_QString2TPtrC(text);
diff --git a/src/gui/kernel/qstackedlayout.cpp b/src/gui/kernel/qstackedlayout.cpp
index 7559066..4b49638 100644
--- a/src/gui/kernel/qstackedlayout.cpp
+++ b/src/gui/kernel/qstackedlayout.cpp
@@ -475,6 +475,32 @@ void QStackedLayout::setGeometry(const QRect &rect)
}
}
+bool QStackedLayout::hasHeightForWidth() const
+{
+ const int n = count();
+
+ for (int i = 0; i < n; ++i) {
+ if (QLayoutItem *item = itemAt(i)) {
+ if (item->hasHeightForWidth())
+ return true;
+ }
+ }
+ return false;
+}
+
+int QStackedLayout::heightForWidth(int width) const
+{
+ const int n = count();
+
+ int hfw = 0;
+ for (int i = 0; i < n; ++i) {
+ if (QLayoutItem *item = itemAt(i)) {
+ hfw = qMax(hfw, item->heightForWidth(width));
+ }
+ }
+ return hfw;
+}
+
/*!
\enum QStackedLayout::StackingMode
\since 4.4
diff --git a/src/gui/kernel/qstackedlayout.h b/src/gui/kernel/qstackedlayout.h
index c069149..842b62b 100644
--- a/src/gui/kernel/qstackedlayout.h
+++ b/src/gui/kernel/qstackedlayout.h
@@ -95,6 +95,8 @@ public:
QLayoutItem *itemAt(int) const;
QLayoutItem *takeAt(int);
void setGeometry(const QRect &rect);
+ bool hasHeightForWidth() const;
+ int heightForWidth(int width) const;
Q_SIGNALS:
void widgetRemoved(int index);
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index e88026c..7a8b700 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -3816,6 +3816,11 @@ void QWidget::setMaximumSize(int maxw, int maxh)
d->updateGeometry_helper(d->extra->minw == d->extra->maxw && d->extra->minh == d->extra->maxh);
}
+bool QWidgetPrivate::hasHeightForWidth() const
+{
+ return layout ? layout->hasHeightForWidth() : size_policy.hasHeightForWidth();
+}
+
/*!
\overload
@@ -7961,6 +7966,18 @@ QSize QWidget::minimumSizeHint() const
return QSize(-1, -1);
}
+/*!
+ \internal
+ This is a bit hackish, but ideally this would have been a virtual
+ function so that subclasses could reimplement their own function.
+ Instead we add a virtual function to QWidgetPrivate.
+*/
+bool QWidget::hasHeightForWidth() const
+{
+ Q_D(const QWidget);
+ return d->hasHeightForWidth();
+}
+
/*!
\fn QWidget *QWidget::parentWidget() const
diff --git a/src/gui/kernel/qwidget.h b/src/gui/kernel/qwidget.h
index e12148b..6e5de7d 100644
--- a/src/gui/kernel/qwidget.h
+++ b/src/gui/kernel/qwidget.h
@@ -524,6 +524,7 @@ public:
virtual QSize sizeHint() const;
virtual QSize minimumSizeHint() const;
+ bool hasHeightForWidth() const;
QSizePolicy sizePolicy() const;
void setSizePolicy(QSizePolicy);
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index 89ea256..05a859c 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -493,6 +493,7 @@ public:
bool setMinimumSize_helper(int &minw, int &minh);
bool setMaximumSize_helper(int &maxw, int &maxh);
+ virtual bool hasHeightForWidth() const;
void setConstraints_sys();
QWidget *childAt_helper(const QPoint &, bool) const;
void updateGeometry_helper(bool forceUpdate);
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp
index ea7fe4f..a08c79e 100644
--- a/src/gui/painting/qbezier.cpp
+++ b/src/gui/painting/qbezier.cpp
@@ -117,8 +117,8 @@ QBezier QBezier::mapBy(const QTransform &transform) const
return QBezier::fromPoints(transform.map(pt1()), transform.map(pt2()), transform.map(pt3()), transform.map(pt4()));
}
-//0.5 is really low
-static const qreal flatness = 0.5;
+//0.05 is really low, but required for scaled-up beziers...
+static const qreal flatness = 0.05;
//based on "Fast, precise flattening of cubic Bezier path and offset curves"
// by T. F. Hain, A. L. Ahmad, S. V. R. Racherla and D. D. Langan
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index a82d0f9..182cce9 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -989,7 +989,8 @@ QDebug operator<<(QDebug dbg, const QBrush &b)
"LinearGradientPattern",
"RadialGradientPattern",
"ConicalGradientPattern",
- "TexturePattern"
+ 0, 0, 0, 0, 0, 0,
+ "TexturePattern" // 24
};
dbg.nospace() << "QBrush(" << b.color() << ',' << BRUSH_STYLES[b.style()] << ')';
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 917b910..a0c9828 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -70,8 +70,10 @@ static uint gccBug(uint value)
constants and structures
*/
-static const int fixed_scale = 1 << 16;
-static const int half_point = 1 << 15;
+enum {
+ fixed_scale = 1 << 16,
+ half_point = 1 << 15
+};
static const int buffer_size = 2048;
struct LinearGradientValues
@@ -691,37 +693,32 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
fy -= half_point;
while (b < end) {
int x1 = (fx >> 16);
- int x2 = x1 + 1;
+ int x2;
int y1 = (fy >> 16);
- int y2 = y1 + 1;
-
- int distx = ((fx - (x1 << 16)) >> 8);
- int disty = ((fy - (y1 << 16)) >> 8);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
+ int y2;
if (blendType == BlendTransformedBilinearTiled) {
x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
+ y1 %= image_height;
if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
+ y2 = y1 + 1;
+ y2 %= image_height;
} else {
x1 = qBound(0, x1, image_width - 1);
- x2 = qBound(0, x2, image_width - 1);
+ x2 = qMin(x1 + 1, image_width - 1);
y1 = qBound(0, y1, image_height - 1);
- y2 = qBound(0, y2, image_height - 1);
+ y2 = qMin(y1 + 1, image_height - 1);
}
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
@@ -730,6 +727,11 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
uint bl = fetch(s2, x1, data->texture.colorTable);
uint br = fetch(s2, x2, data->texture.colorTable);
+ int distx = (fx & 0x0000ffff) >> 8;
+ int disty = (fy & 0x0000ffff) >> 8;
+ int idistx = 256 - distx;
+ int idisty = 256 - disty;
+
uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
*b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
@@ -753,9 +755,9 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
const qreal py = fy * iw - 0.5;
int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
+ int x2;
int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
+ int y2;
int distx = int((px - x1) * 256);
int disty = int((py - y1) * 256);
@@ -764,26 +766,26 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
if (blendType == BlendTransformedBilinearTiled) {
x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
+ y1 %= image_height;
if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
+ y2 = y1 + 1;
+ y2 %= image_height;
} else {
x1 = qBound(0, x1, image_width - 1);
- x2 = qBound(0, x2, image_width - 1);
+ x2 = qMin(x1 + 1, image_width - 1);
y1 = qBound(0, y1, image_height - 1);
- y2 = qBound(0, y2, image_height - 1);
+ y2 = qMin(y1 + 1, image_height - 1);
}
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
@@ -5141,7 +5143,7 @@ static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData)
}
-template <SpanMethod spanMethod>
+template <SpanMethod spanMethod, TextureBlendType blendType> /* blendType must be either BlendTransformedBilinear or BlendTransformedBilinearTiled */
Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
@@ -5154,10 +5156,12 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
uint buffer[buffer_size];
- int image_x1 = data->texture.x1;
- int image_y1 = data->texture.y1;
- int image_x2 = data->texture.x2;
- int image_y2 = data->texture.y2;
+ const int image_x1 = data->texture.x1;
+ const int image_y1 = data->texture.y1;
+ const int image_x2 = data->texture.x2;
+ const int image_y2 = data->texture.y2;
+ const int image_width = data->texture.width;
+ const int image_height = data->texture.height;
const int scanline_offset = data->texture.bytesPerLine / 4;
if (data->fast_matrix) {
@@ -5187,19 +5191,31 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
uint *b = buffer;
while (b < end) {
int x1 = (x >> 16);
- int x2 = x1 + 1;
+ int x2;
int y1 = (y >> 16);
- int y2 = y1 + 1;
-
- int distx = ((x - (x1 << 16)) >> 8);
- int disty = ((y - (y1 << 16)) >> 8);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- x1 = qBound(image_x1, x1, image_x2 - 1);
- x2 = qBound(image_x1, x2, image_x2 - 1);
- y1 = qBound(image_y1, y1, image_y2 - 1);
- y2 = qBound(image_y1, y2, image_y2 - 1);
+ int y2;
+
+ if (blendType == BlendTransformedBilinearTiled) {
+ x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
+ x2 %= image_width;
+
+ y1 %= image_height;
+ if (y1 < 0) y1 += image_height;
+ y2 = y1 + 1;
+ y2 %= image_height;
+
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+ } else {
+ x1 = qBound(image_x1, x1, image_x2 - 1);
+ x2 = qMin(x1 + 1, image_x2 - 1);
+ y1 = qBound(image_y1, y1, image_y2 - 1);
+ y2 = qMin(y1 + 1, image_y2 - 1);
+ }
int y1_offset = y1 * scanline_offset;
int y2_offset = y2 * scanline_offset;
@@ -5216,6 +5232,11 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
uint br = image_bits[y2_offset + x2];
#endif
+ int distx = (x & 0x0000ffff) >> 8;
+ int disty = (y & 0x0000ffff) >> 8;
+ int idistx = 256 - distx;
+ int idisty = 256 - disty;
+
uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
*b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
@@ -5265,19 +5286,36 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const
const qreal py = y * iw - 0.5;
int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
+ int x2;
int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
+ int y2;
int distx = int((px - x1) * 256);
int disty = int((py - y1) * 256);
int idistx = 256 - distx;
int idisty = 256 - disty;
- x1 = qBound(image_x1, x1, image_x2 - 1);
- x2 = qBound(image_x1, x2, image_x2 - 1);
- y1 = qBound(image_y1, y1, image_y2 - 1);
- y2 = qBound(image_y1, y2, image_y2 - 1);
+ if (blendType == BlendTransformedBilinearTiled) {
+ x1 %= image_width;
+ if (x1 < 0) x1 += image_width;
+ x2 = x1 + 1;
+ x2 %= image_width;
+
+ y1 %= image_height;
+ if (y1 < 0) y1 += image_height;
+ y2 = y1 + 1;
+ y2 %= image_height;
+
+ Q_ASSERT(x1 >= 0 && x1 < image_width);
+ Q_ASSERT(x2 >= 0 && x2 < image_width);
+ Q_ASSERT(y1 >= 0 && y1 < image_height);
+ Q_ASSERT(y2 >= 0 && y2 < image_height);
+ } else {
+ x1 = qBound(image_x1, x1, image_x2 - 1);
+ x2 = qMin(x1 + 1, image_x2 - 1);
+ y1 = qBound(image_y1, y1, image_y2 - 1);
+ y2 = qMin(y1 + 1, image_y2 - 1);
+ }
int y1_offset = y1 * scanline_offset;
int y2_offset = y2 * scanline_offset;
@@ -5370,8 +5408,9 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan
int y1 = (y >> 16);
int y2 = y1 + 1;
- const int distx = ((x - (x1 << 16)) >> 8);
- const int disty = ((y - (y1 << 16)) >> 8);
+ const int distx = (x & 0x0000ffff) >> 8;
+ const int disty = (y & 0x0000ffff) >> 8;
+
x1 = qBound(src_minx, x1, src_maxx);
x2 = qBound(src_minx, x2, src_maxx);
y1 = qBound(src_miny, y1, src_maxy);
@@ -5646,197 +5685,6 @@ static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, voi
}
template <SpanMethod spanMethod>
-Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_tiled_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- if (data->texture.format != QImage::Format_ARGB32_Premultiplied
- && data->texture.format != QImage::Format_RGB32) {
- blend_src_generic<spanMethod>(count, spans, userData);
- return;
- }
-
- CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
- uint buffer[buffer_size];
-
- int image_width = data->texture.width;
- int image_height = data->texture.height;
- const int scanline_offset = data->texture.bytesPerLine / 4;
-
- if (data->fast_matrix) {
- // The increment pr x in the scanline
- int fdx = (int)(data->m11 * fixed_scale);
- int fdy = (int)(data->m12 * fixed_scale);
-
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + 0.5;
- const qreal cy = spans->y + 0.5;
-
- int x = int((data->m21 * cy
- + data->m11 * cx + data->dx) * fixed_scale) - half_point;
- int y = int((data->m22 * cy
- + data->m12 * cx + data->dy) * fixed_scale) - half_point;
-
- int length = spans->len;
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- int x1 = (x >> 16);
- int x2 = (x1 + 1);
- int y1 = (y >> 16);
- int y2 = (y1 + 1);
-
- int distx = ((x - (x1 << 16)) >> 8);
- int disty = ((y - (y1 << 16)) >> 8);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- x1 %= image_width;
- x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
-
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
- if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
-
- int y1_offset = y1 * scanline_offset;
- int y2_offset = y2 * scanline_offset;
-
-#if defined(Q_IRIX_GCC3_3_WORKAROUND)
- uint tl = gccBug(image_bits[y1_offset + x1]);
- uint tr = gccBug(image_bits[y1_offset + x2]);
- uint bl = gccBug(image_bits[y2_offset + x1]);
- uint br = gccBug(image_bits[y2_offset + x2]);
-#else
- uint tl = image_bits[y1_offset + x1];
- uint tr = image_bits[y1_offset + x2];
- uint bl = image_bits[y2_offset + x1];
- uint br = image_bits[y2_offset + x2];
-#endif
-
- uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
- uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
- *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
- ++b;
- x += fdx;
- y += fdy;
- }
- if (spanMethod == RegularSpans)
- func(target, buffer, l, coverage);
- else
- drawBufferSpan(data, buffer, buffer_size,
- spans->x + spans->len - length,
- spans->y, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
- } else {
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + 0.5;
- const qreal cy = spans->y + 0.5;
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- int length = spans->len;
- const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal px = x * iw - 0.5;
- const qreal py = y * iw - 0.5;
-
- int x1 = int(px) - (px < 0);
- int x2 = x1 + 1;
- int y1 = int(py) - (py < 0);
- int y2 = y1 + 1;
-
- int distx = int((px - x1) * 256);
- int disty = int((py - y1) * 256);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- x1 %= image_width;
- x2 %= image_width;
- y1 %= image_height;
- y2 %= image_height;
-
- if (x1 < 0) x1 += image_width;
- if (x2 < 0) x2 += image_width;
- if (y1 < 0) y1 += image_height;
- if (y2 < 0) y2 += image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
-
- int y1_offset = y1 * scanline_offset;
- int y2_offset = y2 * scanline_offset;
-
-#if defined(Q_IRIX_GCC3_3_WORKAROUND)
- uint tl = gccBug(image_bits[y1_offset + x1]);
- uint tr = gccBug(image_bits[y1_offset + x2]);
- uint bl = gccBug(image_bits[y2_offset + x1]);
- uint br = gccBug(image_bits[y2_offset + x2]);
-#else
- uint tl = image_bits[y1_offset + x1];
- uint tr = image_bits[y1_offset + x2];
- uint bl = image_bits[y2_offset + x1];
- uint br = image_bits[y2_offset + x2];
-#endif
-
- uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
- uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
- *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
- ++b;
- x += fdx;
- y += fdy;
- w += fdw;
- }
- if (spanMethod == RegularSpans)
- func(target, buffer, l, coverage);
- else
- drawBufferSpan(data, buffer, buffer_size,
- spans->x + spans->len - length,
- spans->y, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
- }
-}
-
-template <SpanMethod spanMethod>
Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_argb(int count, const QSpan *spans, void *userData)
{
QSpanData *data = reinterpret_cast<QSpanData *>(userData);
@@ -6738,7 +6586,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32
- SPANFUNC_POINTER(blend_transformed_bilinear_argb, RegularSpans), // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied
blend_transformed_bilinear_rgb565,
blend_transformed_bilinear_argb8565,
blend_transformed_bilinear_rgb666,
@@ -6757,7 +6605,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32
- SPANFUNC_POINTER(blend_transformed_bilinear_tiled_argb, RegularSpans), // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB16
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB8565_Premultiplied
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB666
@@ -6856,7 +6704,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag
blend_src_generic<CallbackSpans>, // Indexed8
blend_src_generic<CallbackSpans>, // RGB32
blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_bilinear_argb<CallbackSpans>, // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied
blend_src_generic<CallbackSpans>, // RGB16
blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
blend_src_generic<CallbackSpans>, // RGB666
@@ -6875,7 +6723,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag
blend_src_generic<CallbackSpans>, // Indexed8
blend_src_generic<CallbackSpans>, // RGB32
blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_bilinear_tiled_argb<CallbackSpans>, // ARGB32_Premultiplied
+ blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
blend_src_generic<CallbackSpans>, // RGB16
blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
blend_src_generic<CallbackSpans>, // RGB666
@@ -7135,6 +6983,11 @@ void qt_build_pow_tables() {
int winSmooth;
if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0))
smoothing = winSmooth / 1000.0;
+
+ // Safeguard ourselves against corrupt registry values...
+ if (smoothing > 5 || smoothing < 1)
+ smoothing = 1.4;
+
#endif
#ifdef Q_WS_X11
diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp
index 949a820..00e74ba 100644
--- a/src/gui/painting/qpathclipper.cpp
+++ b/src/gui/painting/qpathclipper.cpp
@@ -935,10 +935,9 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const
qreal result = b_angle - a_angle;
- if (qFuzzyIsNull(result) || qFuzzyCompare(result, 128))
- return 0;
-
- if (result < 0)
+ if (result >= 128.)
+ return result - 128.;
+ else if (result < 0)
return result + 128.;
else
return result;
diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h
index 5bb7550..68a04e9 100644
--- a/src/gui/styles/qgtkstyle_p.h
+++ b/src/gui/styles/qgtkstyle_p.h
@@ -85,9 +85,14 @@ public:
int size() const { return m_size; }
const char *data() const { return m_data; }
+#ifdef __SUNPRO_CC
+ QHashableLatin1Literal(const char* str)
+ : m_size(strlen(str)), m_data(str) {}
+#else
template <int N>
QHashableLatin1Literal(const char (&str)[N])
: m_size(N - 1), m_data(str) {}
+#endif
QHashableLatin1Literal(const QHashableLatin1Literal &other)
: m_size(other.m_size), m_data(other.m_data)
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 99b9f40..cb16a16 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2614,8 +2614,10 @@ void QFontCache::cleanup()
} QT_CATCH (const std::bad_alloc &) {
// no cache - just ignore
}
- if (cache && cache->hasLocalData())
+ if (cache && cache->hasLocalData()) {
+ cache->localData()->clear();
cache->setLocalData(0);
+ }
}
#endif // QT_NO_THREAD
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index b1ab478..3b2e4e9 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -1939,8 +1939,13 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
fe = loadFc(d, script, req);
if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize) {
- delete fe;
- fe = loadXlfd(d->screen, script, req);
+ QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req);
+ if (xlfdFontEngine->fontDef.family == fe->fontDef.family) {
+ delete fe;
+ fe = xlfdFontEngine;
+ } else {
+ delete xlfdFontEngine;
+ }
}
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 3ea084b..c9ff661 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -79,6 +79,31 @@ QByteArray QFontEngineS60Extensions::getSfntTable(uint tag) const
return result;
}
+bool QFontEngineS60Extensions::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+{
+ if (!m_trueTypeExtension->HasTrueTypeTable(tag))
+ return false;
+
+ bool result = true;
+ TInt error = KErrNone;
+ TInt tableByteLength;
+ TAny *table =
+ q_check_ptr(m_trueTypeExtension->GetTrueTypeTable(error, tag, &tableByteLength));
+
+ if (error != KErrNone) {
+ return false;
+ } else if (*length > 0 && *length < tableByteLength) {
+ result = false; // Caller did not allocate enough memory
+ } else {
+ *length = tableByteLength;
+ if (buffer)
+ qMemCopy(buffer, table, tableByteLength);
+ }
+
+ m_trueTypeExtension->ReleaseTrueTypeTable(table);
+ return result;
+}
+
const unsigned char *QFontEngineS60Extensions::cmap() const
{
if (!m_cmap) {
@@ -326,6 +351,11 @@ QByteArray QFontEngineS60::getSfntTable(uint tag) const
return m_extensions->getSfntTable(tag);
}
+bool QFontEngineS60::getSfntTableData(uint tag, uchar *buffer, uint *length) const
+{
+ return m_extensions->getSfntTableData(tag, buffer, length);
+}
+
QFontEngine::Type QFontEngineS60::type() const
{
return QFontEngine::S60FontEngine;
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index 5834cc4..a80af4d 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -69,6 +69,7 @@ public:
QFontEngineS60Extensions(CFont* fontOwner, COpenFont *font);
QByteArray getSfntTable(uint tag) const;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
const unsigned char *cmap() const;
QPainterPath glyphOutline(glyph_t glyph) const;
CFont *fontOwner() const;
@@ -106,6 +107,7 @@ public:
qreal minRightBearing() const { return 0; }
QByteArray getSfntTable(uint tag) const;
+ bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
static qreal pixelsToPoints(qreal pixels, Qt::Orientation orientation = Qt::Horizontal);
static qreal pointsToPixels(qreal points, Qt::Orientation orientation = Qt::Horizontal);
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 7dc2c26..6485966 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1647,7 +1647,7 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const
}
}
- glyph_t glyph = glyphs.glyphs[logClusters[pos + ilen - 1]];
+ glyph_t glyph = glyphs.glyphs[logClusters[ilen - 1]];
glyph_metrics_t gi = fe->boundingBox(glyph);
if (gi.isValid())
gm.width -= qRound(gi.xoff - gi.x - gi.width);
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index c095b3b..8e7ec80 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -1689,8 +1689,10 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const
QString t;
if (isDirModel)
t = sourceModel->data(idx, Qt::EditRole).toString();
+#ifndef QT_NO_FILESYSTEMMODEL
else
t = sourceModel->data(idx, QFileSystemModel::FileNameRole).toString();
+#endif
list.prepend(t);
QModelIndex parent = idx.parent();
idx = parent.sibling(parent.row(), index.column());
diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp
index cc74a53..732dbc9 100644
--- a/src/gui/widgets/qdialogbuttonbox.cpp
+++ b/src/gui/widgets/qdialogbuttonbox.cpp
@@ -258,6 +258,7 @@ static const int layouts[2][5][14] =
}
};
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
class QDialogButtonEnabledProxy : public QObject
{
public:
@@ -281,7 +282,7 @@ private:
QWidget *source;
QAction *target;
};
-
+#endif
class QDialogButtonBoxPrivate : public QWidgetPrivate
{
@@ -314,7 +315,7 @@ public:
void addButtonsToLayout(const QList<QAbstractButton *> &buttonList, bool reverse);
void retranslateStrings();
const char *standardButtonText(QDialogButtonBox::StandardButton sbutton) const;
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role);
#endif
};
@@ -571,7 +572,7 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked()));
QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed()));
buttonLists[role].append(button);
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *action = createSoftKey(button, role);
softKeyActions.insert(button, action);
new QDialogButtonEnabledProxy(action, button, action);
@@ -580,7 +581,7 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo
layoutButtons();
}
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role)
{
Q_Q(QDialogButtonBox);
@@ -718,7 +719,7 @@ void QDialogButtonBoxPrivate::retranslateStrings()
if (buttonText) {
QPushButton *button = it.key();
button->setText(QDialogButtonBox::tr(buttonText));
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *action = softKeyActions.value(button, 0);
if (action)
action->setText(button->text());
@@ -997,7 +998,7 @@ void QDialogButtonBox::removeButton(QAbstractButton *button)
}
}
}
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
QAction *action = d->softKeyActions.value(button, 0);
if (action) {
d->softKeyActions.remove(button);
@@ -1243,7 +1244,7 @@ bool QDialogButtonBox::event(QEvent *event)
}else if (event->type() == QEvent::LanguageChange) {
d->retranslateStrings();
}
-#ifdef QT_SOFTKEYS_ENABLED
+#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION)
else if (event->type() == QEvent::ParentChange) {
QWidget *dialog = 0;
QWidget *p = this;
diff --git a/src/gui/widgets/qframe.cpp b/src/gui/widgets/qframe.cpp
index c2e4b35..f51ddfd 100644
--- a/src/gui/widgets/qframe.cpp
+++ b/src/gui/widgets/qframe.cpp
@@ -244,7 +244,7 @@ QFrame::~QFrame()
/*!
Returns the frame style.
- The default value is QFrame::NoFrame.
+ The default value is QFrame::Plain.
\sa setFrameStyle(), frameShape(), frameShadow()
*/
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index e368d3d..a13a2fa 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -268,19 +268,15 @@ void QMenuBarPrivate::updateGeometries()
QRect QMenuBarPrivate::actionRect(QAction *act) const
{
- Q_Q(const QMenuBar);
const int index = actions.indexOf(act);
- if (index == -1)
- return QRect();
//makes sure the geometries are up-to-date
const_cast<QMenuBarPrivate*>(this)->updateGeometries();
- if (index >= actionRects.count())
+ if (index < 0 || index >= actionRects.count())
return QRect(); // that can happen in case of native menubar
- QRect ret = actionRects.at(index);
- return QStyle::visualRect(q->layoutDirection(), q->rect(), ret);
+ return actionRects.at(index);
}
void QMenuBarPrivate::focusFirstAction()
@@ -505,6 +501,9 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const
//keep moving along..
x += rect.width() + itemSpacing;
+
+ //make sure we follow the layout direction
+ rect = QStyle::visualRect(q->layoutDirection(), q->rect(), rect);
}
}
diff --git a/src/gui/widgets/qsizegrip.cpp b/src/gui/widgets/qsizegrip.cpp
index c9d613a..40f3129 100644
--- a/src/gui/widgets/qsizegrip.cpp
+++ b/src/gui/widgets/qsizegrip.cpp
@@ -78,15 +78,6 @@ static QWidget *qt_sizegrip_topLevelWidget(QWidget* w)
return w;
}
-static inline bool hasHeightForWidth(QWidget *widget)
-{
- if (!widget)
- return false;
- if (QLayout *layout = widget->layout())
- return layout->hasHeightForWidth();
- return widget->sizePolicy().hasHeightForWidth();
-}
-
class QSizeGripPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QSizeGrip)
@@ -318,7 +309,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
#ifdef Q_WS_X11
// Use a native X11 sizegrip for "real" top-level windows if supported.
if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE))
- && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw)) {
+ && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth()) {
XEvent xev;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = ATOM(_NET_WM_MOVERESIZE);
@@ -340,7 +331,7 @@ void QSizeGrip::mousePressEvent(QMouseEvent * e)
}
#endif // Q_WS_X11
#ifdef Q_WS_WIN
- if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw)) {
+ if (tlw->isWindow() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth()) {
uint orientation = 0;
if (d->atBottom())
orientation = d->atLeft() ? SZ_SIZEBOTTOMLEFT : SZ_SIZEBOTTOMRIGHT;
@@ -429,12 +420,12 @@ void QSizeGrip::mouseMoveEvent(QMouseEvent * e)
#ifdef Q_WS_X11
if (tlw->isWindow() && X11->isSupportedByWM(ATOM(_NET_WM_MOVERESIZE))
- && tlw->isTopLevel() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw))
+ && tlw->isTopLevel() && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth())
return;
#endif
#ifdef Q_WS_WIN
if (tlw->isWindow() && GetSystemMenu(tlw->winId(), FALSE) != 0 && internalWinId()
- && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !hasHeightForWidth(tlw)) {
+ && !tlw->testAttribute(Qt::WA_DontShowOnScreen) && !tlw->hasHeightForWidth()) {
MSG msg;
while(PeekMessage(&msg, winId(), WM_MOUSEMOVE, WM_MOUSEMOVE, PM_REMOVE));
return;
diff --git a/src/gui/widgets/qtabwidget.cpp b/src/gui/widgets/qtabwidget.cpp
index 047a905..fb7ca64 100644
--- a/src/gui/widgets/qtabwidget.cpp
+++ b/src/gui/widgets/qtabwidget.cpp
@@ -195,6 +195,7 @@ public:
void _q_removeTab(int);
void _q_tabMoved(int from, int to);
void init();
+ bool hasHeightForWidth() const;
QTabBar *tabs;
QStackedWidget *stack;
@@ -871,6 +872,46 @@ QSize QTabWidget::minimumSizeHint() const
.expandedTo(QApplication::globalStrut());
}
+int QTabWidget::heightForWidth(int width) const
+{
+ Q_D(const QTabWidget);
+ QStyleOption opt(0);
+ opt.init(this);
+ opt.state = QStyle::State_None;
+
+ QSize zero(0,0);
+ const QSize padding = style()->sizeFromContents(QStyle::CT_TabWidget, &opt, zero, this)
+ .expandedTo(QApplication::globalStrut());
+
+ QSize lc(0, 0), rc(0, 0);
+ if (d->leftCornerWidget)
+ lc = d->leftCornerWidget->sizeHint();
+ if(d->rightCornerWidget)
+ rc = d->rightCornerWidget->sizeHint();
+ if (!d->dirty) {
+ QTabWidget *that = (QTabWidget*)this;
+ that->setUpLayout(true);
+ }
+ QSize t(d->tabs->sizeHint());
+
+ if(usesScrollButtons())
+ t = t.boundedTo(QSize(200,200));
+ else
+ t = t.boundedTo(QApplication::desktop()->size());
+
+ const bool tabIsHorizontal = (d->pos == North || d->pos == South);
+ const int contentsWidth = width - padding.width();
+ int stackWidth = contentsWidth;
+ if (!tabIsHorizontal)
+ stackWidth -= qMax(t.width(), qMax(lc.width(), rc.width()));
+
+ int stackHeight = d->stack->heightForWidth(stackWidth);
+ QSize s(stackWidth, stackHeight);
+
+ QSize contentSize = basicSize(tabIsHorizontal, lc, rc, s, t);
+ return (contentSize + padding).expandedTo(QApplication::globalStrut()).height();
+}
+
/*!
\reimp
*/
@@ -903,6 +944,14 @@ void QTabWidgetPrivate::updateTabBarPosition()
q->setUpLayout();
}
+bool QTabWidgetPrivate::hasHeightForWidth() const
+{
+ bool has = size_policy.hasHeightForWidth();
+ if (!has && stack)
+ has = stack->hasHeightForWidth();
+ return has;
+}
+
/*!
\property QTabWidget::tabPosition
\brief the position of the tabs in this tab widget
diff --git a/src/gui/widgets/qtabwidget.h b/src/gui/widgets/qtabwidget.h
index 68200c8..ee50655 100644
--- a/src/gui/widgets/qtabwidget.h
+++ b/src/gui/widgets/qtabwidget.h
@@ -129,6 +129,7 @@ public:
QSize sizeHint() const;
QSize minimumSizeHint() const;
+ int heightForWidth(int width) const;
void setCornerWidget(QWidget * w, Qt::Corner corner = Qt::TopRightCorner);
QWidget * cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;