summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-02-11 15:18:38 +0100
committerGunnar Sletta <gunnar@trolltech.com>2010-02-11 15:18:38 +0100
commita35186a00ed789ac98c193c4ded2bab62f2a018a (patch)
tree393311979e198e8d081c45711fb009c521c6356e /src/gui
parent2acc883b3a339b716da9249a1366b08225acbd8a (diff)
parent52a65fde8e97f1f6dc26192058fadc1d2275983a (diff)
downloadqt4-tools-a35186a00ed789ac98c193c4ded2bab62f2a018a.tar.gz
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qpixmapfilter.cpp3
-rw-r--r--src/gui/kernel/qapplication_mac.mm6
-rw-r--r--src/gui/kernel/qapplication_p.h2
-rw-r--r--src/gui/kernel/qapplication_x11.cpp8
-rw-r--r--src/gui/kernel/qclipboard_mac.cpp12
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm5
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp3
-rw-r--r--src/gui/painting/qpainter.cpp7
-rw-r--r--src/gui/text/qfont.cpp5
-rw-r--r--src/gui/text/qfontengine_s60.cpp2
-rw-r--r--src/gui/text/qtextlayout.cpp6
-rw-r--r--src/gui/util/qsystemtrayicon_p.h2
-rw-r--r--src/gui/util/qsystemtrayicon_x11.cpp2
-rw-r--r--src/gui/widgets/qabstractslider.cpp6
-rw-r--r--src/gui/widgets/qabstractspinbox.h2
-rw-r--r--src/gui/widgets/qcombobox.h2
-rw-r--r--src/gui/widgets/qmenu.h2
-rw-r--r--src/gui/widgets/qscrollbar.cpp2
18 files changed, 67 insertions, 10 deletions
diff --git a/src/gui/image/qpixmapfilter.cpp b/src/gui/image/qpixmapfilter.cpp
index 7cf942c9aa..2792e458e0 100644
--- a/src/gui/image/qpixmapfilter.cpp
+++ b/src/gui/image/qpixmapfilter.cpp
@@ -713,7 +713,8 @@ void expblur(QImage &img, qreal radius, bool improvedQuality = false, int transp
radius *= qreal(0.5);
Q_ASSERT(img.format() == QImage::Format_ARGB32_Premultiplied
- || img.format() == QImage::Format_RGB32);
+ || img.format() == QImage::Format_RGB32
+ || img.format() == QImage::Format_Indexed8);
// choose the alpha such that pixels at radius distance from a fully
// saturated pixel will have an alpha component of no greater than
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index e8b821af67..54a490137e 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -2143,6 +2143,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
}
if (wheel_deltaX || wheel_deltaY) {
+#ifndef QT_NO_WHEELEVENT
if (wheel_deltaX) {
QWheelEvent qwe(plocal, p, wheel_deltaX, buttons, modifiers, Qt::Horizontal);
QApplication::sendSpontaneousEvent(widget, &qwe);
@@ -2165,6 +2166,7 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event
handled_event = false;
}
}
+#endif // QT_NO_WHEELEVENT
} else {
#ifdef QMAC_SPEAK_TO_ME
const int speak_keys = Qt::AltModifier | Qt::ShiftModifier;
@@ -2717,6 +2719,7 @@ int QApplication::keyboardInputInterval()
return QApplicationPrivate::keyboard_input_time;
}
+#ifndef QT_NO_WHEELEVENT
void QApplication::setWheelScrollLines(int n)
{
QApplicationPrivate::wheel_scroll_lines = n;
@@ -2726,6 +2729,7 @@ int QApplication::wheelScrollLines()
{
return QApplicationPrivate::wheel_scroll_lines;
}
+#endif
void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
{
@@ -2888,9 +2892,11 @@ bool QApplicationPrivate::qt_mac_apply_settings()
QApplication::cursorFlashTime()).toInt();
QApplication::setCursorFlashTime(num);
+#ifndef QT_NO_WHEELEVENT
num = settings.value(QLatin1String("wheelScrollLines"),
QApplication::wheelScrollLines()).toInt();
QApplication::setWheelScrollLines(num);
+#endif
QString colorspec = settings.value(QLatin1String("colorSpec"),
QVariant(QLatin1String("default"))).toString();
diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h
index 9c001ab584..b3ec732525 100644
--- a/src/gui/kernel/qapplication_p.h
+++ b/src/gui/kernel/qapplication_p.h
@@ -427,7 +427,9 @@ public:
static int cursor_flash_time;
static int mouse_double_click_time;
static int keyboard_input_time;
+#ifndef QT_NO_WHEELEVENT
static int wheel_scroll_lines;
+#endif
static bool animate_ui;
static bool animate_menu;
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 2a1f655373..afd927b47b 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -944,10 +944,12 @@ bool QApplicationPrivate::x11_apply_settings()
QApplication::cursorFlashTime()).toInt();
QApplication::setCursorFlashTime(num);
+#ifndef QT_NO_WHEELEVENT
num =
settings.value(QLatin1String("wheelScrollLines"),
QApplication::wheelScrollLines()).toInt();
QApplication::setWheelScrollLines(num);
+#endif
QString colorspec = settings.value(QLatin1String("colorSpec"),
QVariant(QLatin1String("default"))).toString();
@@ -4401,8 +4403,10 @@ bool QETWidget::translateWheelEvent(int global_x, int global_y, int delta,
QWidget* popup = qApp->activePopupWidget();
if (popup && window() != popup)
popup->close();
+#ifndef QT_NO_WHEELEVENT
QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
if (QApplication::sendSpontaneousEvent(widget, &e))
+#endif
return true;
}
@@ -4413,8 +4417,10 @@ bool QETWidget::translateWheelEvent(int global_x, int global_y, int delta,
QWidget* popup = qApp->activePopupWidget();
if (popup && widget != popup)
popup->hide();
+#ifndef QT_NO_WHEELEVENT
QWheelEvent e(pos, globalPos, delta, buttons, modifiers, orient);
if (QApplication::sendSpontaneousEvent(widget, &e))
+#endif
return true;
}
return false;
@@ -5313,6 +5319,7 @@ int QApplication::keyboardInputInterval()
return QApplicationPrivate::keyboard_input_time;
}
+#ifndef QT_NO_WHEELEVENT
void QApplication::setWheelScrollLines(int n)
{
QApplicationPrivate::wheel_scroll_lines = n;
@@ -5322,6 +5329,7 @@ int QApplication::wheelScrollLines()
{
return QApplicationPrivate::wheel_scroll_lines;
}
+#endif
void QApplication::setEffectEnabled(Qt::UIEffect effect, bool enable)
{
diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp
index f3a971dc1b..49a6cc81d7 100644
--- a/src/gui/kernel/qclipboard_mac.cpp
+++ b/src/gui/kernel/qclipboard_mac.cpp
@@ -388,6 +388,18 @@ QMacPasteboard::setMimeData(QMimeData *mime_src)
clear_helper();
QStringList formats = mime_src->formats();
+#ifdef QT_MAC_USE_COCOA
+ // QMimeData sub classes reimplementing the formats() might not expose the
+ // temporary "application/x-qt-mime-type-name" mimetype. So check the existence
+ // of this mime type while doing drag and drop.
+ QString dummyMimeType(QLatin1String("application/x-qt-mime-type-name"));
+ if (!formats.contains(dummyMimeType)) {
+ QByteArray dummyType = mime_src->data(dummyMimeType);
+ if (!dummyType.isEmpty()) {
+ formats.append(dummyMimeType);
+ }
+ }
+#endif
for(int f = 0; f < formats.size(); ++f) {
QString mimeType = formats.at(f);
for (QList<QMacPasteboardMime *>::Iterator it = availableConverters.begin(); it != availableConverters.end(); ++it) {
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 2c35be2135..ad64a91251 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -828,6 +828,7 @@ extern "C" {
deltaZ = qBound(-120, int([theEvent deltaZ] * 10000), 120);
}
+#ifndef QT_NO_WHEELEVENT
if (deltaX != 0) {
QWheelEvent qwe(qlocal, qglobal, deltaX, buttons, keyMods, Qt::Horizontal);
qt_sendSpontaneousEvent(widgetToGetMouse, &qwe);
@@ -868,6 +869,8 @@ extern "C" {
wheelOK = qwe2.isAccepted();
}
}
+#endif //QT_NO_WHEELEVENT
+
if (!wheelOK) {
return [super scrollWheel:theEvent];
}
@@ -1404,7 +1407,7 @@ Qt::DropAction QDragManager::drag(QDrag *o)
// setup the data
QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacPasteboardMime::MIME_DND);
- dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray());
+ dragPrivate()->data->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
dragBoard.setMimeData(dragPrivate()->data);
// create the image
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 147491e6a6..da48fcb0b3 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -1989,6 +1989,9 @@ void QX11PaintEngine::drawPixmap(const QRectF &r, const QPixmap &px, const QRect
}
XFillRectangle(d->dpy, d->hd, d->gc, x, y, sw, sh);
restore_clip = true;
+ } else if (mono_dst && !mono_src) {
+ QBitmap bitmap(pixmap);
+ XCopyArea(d->dpy, bitmap.handle(), d->hd, d->gc, sx, sy, sw, sh, x, y);
} else {
XCopyArea(d->dpy, pixmap.handle(), d->hd, d->gc, sx, sy, sw, sh, x, y);
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 3bcaf8c605..075c457e3b 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -708,13 +708,14 @@ void QPainterPrivate::updateEmulationSpecifier(QPainterState *s)
bool penTextureAlpha = false;
if (penBrush.style() == Qt::TexturePattern)
penTextureAlpha = qHasPixmapTexture(penBrush)
- ? penBrush.texture().hasAlpha()
+ ? (penBrush.texture().depth() > 1) && penBrush.texture().hasAlpha()
: penBrush.textureImage().hasAlphaChannel();
bool brushTextureAlpha = false;
- if (s->brush.style() == Qt::TexturePattern)
+ if (s->brush.style() == Qt::TexturePattern) {
brushTextureAlpha = qHasPixmapTexture(s->brush)
- ? s->brush.texture().hasAlpha()
+ ? (s->brush.texture().depth() > 1) && s->brush.texture().hasAlpha()
: s->brush.textureImage().hasAlphaChannel();
+ }
if (((penBrush.style() == Qt::TexturePattern && penTextureAlpha)
|| (s->brush.style() == Qt::TexturePattern && brushTextureAlpha))
&& !engine->hasFeature(QPaintEngine::MaskedBrush))
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index bbd35f18cd..dd9e69e195 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -629,8 +629,9 @@ QFontEngineData::~QFontEngineData()
Returns the name of the font within the underlying window system.
- Only on X11 when Qt was built without FontConfig support the XLFD (X Logical Font Description)
- is returned; otherwise an empty string.
+ On X11, this function will return an empty string if Qt is built with
+ FontConfig support; otherwise the XLFD (X Logical Font Description) is
+ returned.
Using the return value of this function is usually \e not \e
portable.
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 9dd4af7579..3ea084b525 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -44,7 +44,7 @@
#include "qglobal.h"
#include <private/qapplication_p.h>
#include "qimage.h"
-#include "qt_s60_p.h"
+#include <private/qt_s60_p.h>
#include <e32base.h>
#include <e32std.h>
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 26c7c1e965..af916030f9 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -1331,7 +1331,7 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
QTextLine l(line, d);
const QScriptLine &sl = d->lines[line];
- const qreal x = position.x() + l.cursorToX(cursorPosition);
+ qreal x = position.x() + l.cursorToX(cursorPosition);
int itm = d->findItem(cursorPosition - 1);
QFixed base = sl.base();
@@ -1350,6 +1350,10 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition
&& (p->transform().type() > QTransform::TxTranslate);
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing);
+#if defined(QT_MAC_USE_COCOA)
+ // Always draw the cursor aligned to pixel boundary.
+ x = qRound(x);
+#endif
p->fillRect(QRectF(x, y, qreal(width), (base + descent + 1).toReal()), p->pen().brush());
if (toggleAntialiasing)
p->setRenderHint(QPainter::Antialiasing, false);
diff --git a/src/gui/util/qsystemtrayicon_p.h b/src/gui/util/qsystemtrayicon_p.h
index b881f68dcf..e8bf1978f5 100644
--- a/src/gui/util/qsystemtrayicon_p.h
+++ b/src/gui/util/qsystemtrayicon_p.h
@@ -164,7 +164,9 @@ protected:
bool x11Event(XEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseDoubleClickEvent(QMouseEvent *event);
+#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *event);
+#endif
bool event(QEvent *e);
private:
diff --git a/src/gui/util/qsystemtrayicon_x11.cpp b/src/gui/util/qsystemtrayicon_x11.cpp
index a645050b9d..82b4325233 100644
--- a/src/gui/util/qsystemtrayicon_x11.cpp
+++ b/src/gui/util/qsystemtrayicon_x11.cpp
@@ -308,10 +308,12 @@ void QSystemTrayIconSys::mouseDoubleClickEvent(QMouseEvent *ev)
emit q->activated(QSystemTrayIcon::DoubleClick);
}
+#ifndef QT_NO_WHEELEVENT
void QSystemTrayIconSys::wheelEvent(QWheelEvent *e)
{
QApplication::sendEvent(q, e);
}
+#endif
bool QSystemTrayIconSys::event(QEvent *e)
{
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index 73c17dba8e..4bd7b5ab8f 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -705,7 +705,11 @@ bool QAbstractSliderPrivate::scrollByDelta(Qt::Orientation orientation, Qt::Keyb
// Calculate how many lines to scroll. Depending on what delta is (and
// offset), we might end up with a fraction (e.g. scroll 1.3 lines). We can
// only scroll whole lines, so we keep the reminder until next event.
- qreal stepsToScrollF = offset * QApplication::wheelScrollLines() * effectiveSingleStep();
+ qreal stepsToScrollF =
+#ifndef QT_NO_WHEELEVENT
+ QApplication::wheelScrollLines() *
+#endif
+ offset * effectiveSingleStep();
// Check if wheel changed direction since last event:
if (offset_accumulated != 0 && (offset / offset_accumulated) < 0)
offset_accumulated = 0;
diff --git a/src/gui/widgets/qabstractspinbox.h b/src/gui/widgets/qabstractspinbox.h
index 059943a892..6c062c0d43 100644
--- a/src/gui/widgets/qabstractspinbox.h
+++ b/src/gui/widgets/qabstractspinbox.h
@@ -137,7 +137,9 @@ protected:
void resizeEvent(QResizeEvent *event);
void keyPressEvent(QKeyEvent *event);
void keyReleaseEvent(QKeyEvent *event);
+#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *event);
+#endif
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
diff --git a/src/gui/widgets/qcombobox.h b/src/gui/widgets/qcombobox.h
index f332d3130c..9b19a66f1a 100644
--- a/src/gui/widgets/qcombobox.h
+++ b/src/gui/widgets/qcombobox.h
@@ -245,7 +245,9 @@ protected:
void mouseReleaseEvent(QMouseEvent *e);
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
+#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *e);
+#endif
void contextMenuEvent(QContextMenuEvent *e);
void inputMethodEvent(QInputMethodEvent *);
QVariant inputMethodQuery(Qt::InputMethodQuery) const;
diff --git a/src/gui/widgets/qmenu.h b/src/gui/widgets/qmenu.h
index 5a6a5c786f..47dff2b4ee 100644
--- a/src/gui/widgets/qmenu.h
+++ b/src/gui/widgets/qmenu.h
@@ -162,7 +162,9 @@ protected:
void mouseReleaseEvent(QMouseEvent *);
void mousePressEvent(QMouseEvent *);
void mouseMoveEvent(QMouseEvent *);
+#ifndef QT_NO_WHEELEVENT
void wheelEvent(QWheelEvent *);
+#endif
void enterEvent(QEvent *);
void leaveEvent(QEvent *);
void hideEvent(QHideEvent *);
diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp
index 3eed3a92a3..4eff260588 100644
--- a/src/gui/widgets/qscrollbar.cpp
+++ b/src/gui/widgets/qscrollbar.cpp
@@ -521,6 +521,7 @@ bool QScrollBar::event(QEvent *event)
if (const QHoverEvent *he = static_cast<const QHoverEvent *>(event))
d_func()->updateHoverControl(he->pos());
break;
+#ifndef QT_NO_WHEELEVENT
case QEvent::Wheel: {
// override wheel event without adding virtual function override
QWheelEvent *ev = static_cast<QWheelEvent *>(event);
@@ -537,6 +538,7 @@ bool QScrollBar::event(QEvent *event)
event->accept();
return true;
}
+#endif
default:
break;
}