summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-12 19:21:35 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-12 19:21:35 (GMT)
commit7a45927166ae9d29e7f440b255f3463d5350c220 (patch)
tree1a4d1e4a0405280af999f59c15ba8e8cc9f87ab0 /src/gui
parente9a0067ef4b272f1893522959dc15561970590ea (diff)
parent8576aa104528f9a2863fd097abc8bac5c956fdb8 (diff)
downloadQt-7a45927166ae9d29e7f440b255f3463d5350c220.zip
Qt-7a45927166ae9d29e7f440b255f3463d5350c220.tar.gz
Qt-7a45927166ae9d29e7f440b255f3463d5350c220.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (44 commits) QSlider and StyleSheet: fix one pixel error while drawing the SliderAddPage accelerate QWindowsPipeWriter for bigger chunks of data Fix antialiasing with transformed text in OpenGL2 paint engine Fix flattening of largely scaled, thin, dashed beziers. Increased the precision used to flatten beziers Fix QT_NO_MOVIE Fix compile error with QT_NO_ACTION in QtGui Fix QT_NO_COMPLETER Fix QT_NO_FSCOMPLETER Fix QT_NO_FILESYSTEMMODEL Build fix Safeguard ourselves against corrupt registry values for cleartype gamma fix cetest build properly qdrawhelper: optimize the fetch transformed bilinear functions Compile fix for WinCE Make sure the selectionChanged signal is not called too much Implement heightForWidth support for QTabWidget and QStackedLayout. Fix the doc for QFrame::frameStyle Don't use texture-from-pixmap if the target isn't GL_TEXTURE_2D Add runtime check for GLX >= 1.3 before using glXCreatePixmap ...
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/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/qlayoutitem.cpp4
-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/qdrawhelper.cpp363
-rw-r--r--src/gui/painting/qpathclipper.cpp7
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp7
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h1
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp4
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp9
-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
32 files changed, 416 insertions, 337 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/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 31be224..80334a6 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1846,7 +1846,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/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/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 72ffe87..2150b56 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -3820,6 +3820,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
@@ -7965,6 +7970,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/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/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 9eda0ef..631a9cf 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -79,6 +79,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
m_current_fontengine = fontEngine;
const int margin = glyphMargin();
+ const int paddingDoubled = glyphPadding() * 2;
QHash<glyph_t, Coord> listItemCoordinates;
int rowHeight = 0;
@@ -124,7 +125,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
if (listItemCoordinates.isEmpty())
return;
- rowHeight += margin * 2;
+ rowHeight += margin * 2 + paddingDoubled;
if (isNull())
createCache(QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH, qt_next_power_of_two(rowHeight));
@@ -138,7 +139,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
if (m_cx + c.w > m_w) {
// no room on the current line, start new glyph strip
m_cx = 0;
- m_cy += m_currentRowHeight;
+ m_cy += m_currentRowHeight + paddingDoubled;
m_currentRowHeight = 0; // New row
}
if (m_cy + c.h > m_h) {
@@ -156,7 +157,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
fillTexture(c, iter.key());
coords.insert(iter.key(), c);
- m_cx += c.w;
+ m_cx += c.w + paddingDoubled;
++iter;
}
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 8c2f5b4..390fe51 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -98,6 +98,7 @@ public:
virtual void createTextureData(int width, int height) = 0;
virtual void resizeTextureData(int width, int height) = 0;
virtual int glyphMargin() const { return 0; }
+ virtual int glyphPadding() const { return 0; }
virtual void fillTexture(const Coord &coord, glyph_t glyph) = 0;
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index cc0ce08..a1a98ba 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -3169,8 +3169,8 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC
if (subRule1.hasDrawable()) {
QRect r(gr.topLeft(),
slider->orientation == Qt::Horizontal
- ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height())
- : QPoint(gr.x()+gr.width(), hr.y()+hr.height()/2));
+ ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height() - 1)
+ : QPoint(gr.x()+gr.width() - 1, hr.y()+hr.height()/2));
subRule1.drawRule(p, r);
}
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/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;