summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp22
-rw-r--r--src/gui/embedded/qvfbhdr.h18
-rw-r--r--src/gui/image/qimage_p.h2
-rw-r--r--src/gui/image/qpixmap_s60.cpp4
-rw-r--r--src/gui/image/qpixmap_x11.cpp33
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp27
-rw-r--r--src/gui/itemviews/qabstractitemview.h5
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h9
-rw-r--r--src/gui/kernel/qapplication_qws.cpp2
-rw-r--r--src/gui/kernel/qwidget.cpp10
-rw-r--r--src/gui/painting/qdrawutil.cpp36
-rw-r--r--src/gui/painting/qdrawutil.h18
-rw-r--r--src/gui/styles/qstylesheetstyle.cpp2
-rw-r--r--src/gui/widgets/qabstractslider.cpp21
-rw-r--r--src/gui/widgets/qlabel.cpp13
-rw-r--r--src/gui/widgets/qtextedit.cpp5
16 files changed, 169 insertions, 58 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 297c900..eb5fed0 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -3022,6 +3022,12 @@ bool QFileDialogPrivate::itemViewKeyboardEvent(QKeyEvent *event) {
case Qt::Key_Escape:
q->hide();
return true;
+#ifdef QT_KEYPAD_NAVIGATION
+ case Qt::Key_Down:
+ case Qt::Key_Up:
+ return (QApplication::navigationMode() != Qt::NavigationModeKeypadTabOrder
+ && QApplication::navigationMode() != Qt::NavigationModeKeypadDirectional);
+#endif
default:
break;
}
@@ -3142,7 +3148,17 @@ void QFileDialogListView::keyPressEvent(QKeyEvent *e)
if (!d_ptr->itemViewKeyboardEvent(e)) {
QListView::keyPressEvent(e);
}
+#ifdef QT_KEYPAD_NAVIGATION
+ if ((QApplication::navigationMode() == Qt::NavigationModeKeypadTabOrder
+ || QApplication::navigationMode() == Qt::NavigationModeKeypadDirectional)
+ && !hasEditFocus()) {
+ e->ignore();
+ } else {
+ e->accept();
+ }
+#else
e->accept();
+#endif
}
QFileDialogTreeView::QFileDialogTreeView(QWidget *parent) : QTreeView(parent)
@@ -3189,7 +3205,11 @@ void QFileDialogLineEdit::keyPressEvent(QKeyEvent *e)
{
int key = e->key();
QLineEdit::keyPressEvent(e);
- if (key != Qt::Key_Escape)
+ if (key != Qt::Key_Escape
+#ifdef QT_KEYPAD_NAVIGATION
+ && QApplication::navigationMode() == Qt::NavigationModeNone
+#endif
+ )
e->accept();
if (hideOnEsc && (key == Qt::Key_Escape || key == Qt::Key_Return || key == Qt::Key_Enter)) {
e->accept();
diff --git a/src/gui/embedded/qvfbhdr.h b/src/gui/embedded/qvfbhdr.h
index f02286e..eff5fc2 100644
--- a/src/gui/embedded/qvfbhdr.h
+++ b/src/gui/embedded/qvfbhdr.h
@@ -56,6 +56,7 @@ QT_MODULE(Gui)
#define QT_QWS_TEMP_DIR "/tmp"
#endif
+#ifdef QT_PRIVATE_QWS
#define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2-%3") \
.arg(QT_QWS_TEMP_DIR).arg(getuid()).arg(DISPLAY)
@@ -67,7 +68,22 @@ QT_MODULE(Gui)
.append("/qtvfb_map")
#define QT_VFB_SOUND_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
.append("/qt_soundserver")
-#define QTE_PIPE "QtEmbedded"
+#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/QtEmbedded")
+#define QTE_PIPE_QVFB QTE_PIPE
+#else
+#define QT_VFB_DATADIR(DISPLAY) QString("%1/qtembedded-%2") \
+ .arg(QT_QWS_TEMP_DIR).arg(DISPLAY)
+#define QT_VFB_MOUSE_PIPE(DISPLAY) QString("/tmp/.qtvfb_mouse-%1").arg(DISPLAY)
+#define QT_VFB_KEYBOARD_PIPE(DISPLAY) QString("/tmp/.qtvfb_keyboard-%1").arg(DISPLAY)
+#define QT_VFB_MAP(DISPLAY) QString("/tmp/.qtvfb_map-%1").arg(DISPLAY)
+#define QT_VFB_SOUND_PIPE(DISPLAY) QString("/tmp/.qt_soundserver-%1").arg(DISPLAY)
+#define QTE_PIPE(DISPLAY) QT_VFB_DATADIR(DISPLAY) \
+ .append("/QtEmbedded-%1") \
+ .arg(DISPLAY)
+#define QTE_PIPE_QVFB(DISPLAY) QString("/tmp/qtembedded-%1/QtEmbedded-%1") \
+ .arg(DISPLAY)
+#endif
struct QVFbHeader
{
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index 4f44109..bea1e8d 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -63,7 +63,7 @@
QT_BEGIN_NAMESPACE
-struct QImageData { // internal image data
+struct Q_GUI_EXPORT QImageData { // internal image data
QImageData();
~QImageData();
static QImageData *create(const QSize &size, QImage::Format format, int numColors = 0);
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 4938442..326dd10 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -64,7 +64,7 @@ const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
0x10, 0x20, 0x40, 0x80 };
-/*!
+/*
\class QSymbianFbsClient
\since 4.6
\internal
@@ -145,7 +145,7 @@ void QSymbianFbsHeapLock::relock()
qt_symbianFbsClient()->lockHeap();
}
-/*!
+/*
\class QSymbianBitmapDataAccess
\since 4.6
\internal
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index f77d200..6cde898 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -67,6 +67,7 @@
#include <private/qt_x11_p.h>
#include "qx11info_x11.h"
#include <private/qdrawhelper_p.h>
+#include <private/qimage_p.h>
#include <stdlib.h>
@@ -369,6 +370,30 @@ void QX11PixmapData::resize(int width, int height)
#endif // QT_NO_XRENDER
}
+struct QX11AlphaDetector
+{
+ bool hasAlpha() const {
+ if (checked)
+ return has;
+ // Will implicitly also check format and return quickly for opaque types...
+ checked = true;
+ has = const_cast<QImage *>(image)->data_ptr()->checkForAlphaPixels();
+ return has;
+ }
+
+ bool hasXRenderAndAlpha() const {
+ if (!X11->use_xrender)
+ return false;
+ return hasAlpha();
+ }
+
+ QX11AlphaDetector(const QImage *i) : image(i), checked(false), has(false) { }
+
+ const QImage *image;
+ mutable bool checked;
+ mutable bool has;
+};
+
void QX11PixmapData::fromImage(const QImage &img,
Qt::ImageConversionFlags flags)
{
@@ -402,7 +427,9 @@ void QX11PixmapData::fromImage(const QImage &img,
return;
}
- int dd = X11->use_xrender && img.hasAlphaChannel() ? 32 : xinfo.depth();
+ QX11AlphaDetector alphaCheck(&img);
+ int dd = alphaCheck.hasXRenderAndAlpha() ? 32 : xinfo.depth();
+
if (qt_x11_preferred_pixmap_depth)
dd = qt_x11_preferred_pixmap_depth;
@@ -454,7 +481,7 @@ void QX11PixmapData::fromImage(const QImage &img,
uchar *newbits= 0;
#ifndef QT_NO_XRENDER
- if (X11->use_xrender && image.hasAlphaChannel()) {
+ if (alphaCheck.hasXRenderAndAlpha()) {
const QImage &cimage = image;
d = 32;
@@ -1091,7 +1118,7 @@ void QX11PixmapData::fromImage(const QImage &img,
}
#endif
- if (image.hasAlphaChannel()) {
+ if (alphaCheck.hasAlpha()) {
QBitmap m = QBitmap::fromImage(image.createAlphaMask(flags));
setMask(m);
}
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 0fae959..18cab13 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -87,6 +87,7 @@ QAbstractItemViewPrivate::QAbstractItemViewPrivate()
dragDropMode(QAbstractItemView::NoDragDrop),
overwrite(false),
dropIndicatorPosition(QAbstractItemView::OnItem),
+ defaultDropAction(Qt::IgnoreAction),
#endif
#ifdef QT_SOFTKEYS_ENABLED
doneSoftKey(0),
@@ -1371,6 +1372,28 @@ QAbstractItemView::DragDropMode QAbstractItemView::dragDropMode() const
return NoDragDrop;
}
+/*!
+ \property QAbstractItemView::defaultDropAction
+ \brief the drop action that will be used by default in QAbstractItemView::drag()
+
+ If the property is not set, the drop action is CopyAction when the supported
+ actions support CopyAction.
+
+ \since 4.6
+ \sa showDropIndicator dragDropOverwriteMode
+*/
+void QAbstractItemView::setDefaultDropAction(Qt::DropAction dropAction)
+{
+ Q_D(QAbstractItemView);
+ d->defaultDropAction = dropAction;
+}
+
+Qt::DropAction QAbstractItemView::defaultDropAction() const
+{
+ Q_D(const QAbstractItemView);
+ return d->defaultDropAction;
+}
+
#endif // QT_NO_DRAGANDDROP
/*!
@@ -3297,7 +3320,9 @@ void QAbstractItemView::startDrag(Qt::DropActions supportedActions)
drag->setMimeData(data);
drag->setHotSpot(d->pressedPosition - rect.topLeft());
Qt::DropAction defaultDropAction = Qt::IgnoreAction;
- if (supportedActions & Qt::CopyAction && dragDropMode() != QAbstractItemView::InternalMove)
+ if (d->defaultDropAction != Qt::IgnoreAction && (supportedActions & d->defaultDropAction))
+ defaultDropAction = d->defaultDropAction;
+ else if (supportedActions & Qt::CopyAction && dragDropMode() != QAbstractItemView::InternalMove)
defaultDropAction = Qt::CopyAction;
if (drag->exec(supportedActions, defaultDropAction) == Qt::MoveAction)
d->clearOrRemove();
diff --git a/src/gui/itemviews/qabstractitemview.h b/src/gui/itemviews/qabstractitemview.h
index 7d5c765..b4f0957 100644
--- a/src/gui/itemviews/qabstractitemview.h
+++ b/src/gui/itemviews/qabstractitemview.h
@@ -74,6 +74,7 @@ class Q_GUI_EXPORT QAbstractItemView : public QAbstractScrollArea
Q_PROPERTY(bool dragEnabled READ dragEnabled WRITE setDragEnabled)
Q_PROPERTY(bool dragDropOverwriteMode READ dragDropOverwriteMode WRITE setDragDropOverwriteMode)
Q_PROPERTY(DragDropMode dragDropMode READ dragDropMode WRITE setDragDropMode)
+ Q_PROPERTY(Qt::DropAction defaultDropAction READ defaultDropAction WRITE setDefaultDropAction)
#endif
Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors)
Q_PROPERTY(SelectionMode selectionMode READ selectionMode WRITE setSelectionMode)
@@ -181,7 +182,11 @@ public:
void setDragDropMode(DragDropMode behavior);
DragDropMode dragDropMode() const;
+
+ void setDefaultDropAction(Qt::DropAction dropAction);
+ Qt::DropAction defaultDropAction() const;
#endif
+
void setAlternatingRowColors(bool enable);
bool alternatingRowColors() const;
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 84c0892..fcf381a 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -117,7 +117,7 @@ public:
virtual void _q_columnsInserted(const QModelIndex &parent, int start, int end);
virtual void _q_modelDestroyed();
virtual void _q_layoutChanged();
-
+
void fetchMore();
bool shouldEdit(QAbstractItemView::EditTrigger trigger, const QModelIndex &index) const;
@@ -315,7 +315,7 @@ public:
}
return ref;
}
-
+
/**
* return true if the index is registered as a QPersistentModelIndex
*/
@@ -356,8 +356,8 @@ public:
Qt::KeyboardModifiers pressedModifiers;
QPoint pressedPosition;
bool pressedAlreadySelected;
-
- //forces the next mouseMoveEvent to send the viewportEntered signal
+
+ //forces the next mouseMoveEvent to send the viewportEntered signal
//if the mouse is over the viewport and not over an item
bool viewportEnteredNeeded;
@@ -377,6 +377,7 @@ public:
QAbstractItemView::DragDropMode dragDropMode;
bool overwrite;
QAbstractItemView::DropIndicatorPosition dropIndicatorPosition;
+ Qt::DropAction defaultDropAction;
#endif
#ifdef QT_SOFTKEYS_ENABLED
diff --git a/src/gui/kernel/qapplication_qws.cpp b/src/gui/kernel/qapplication_qws.cpp
index 01c64f1..634f23a 100644
--- a/src/gui/kernel/qapplication_qws.cpp
+++ b/src/gui/kernel/qapplication_qws.cpp
@@ -232,7 +232,7 @@ QString qws_dataDir()
// Get the filename of the pipe Qt for Embedded Linux uses for server/client comms
Q_GUI_EXPORT QString qws_qtePipeFilename()
{
- return (qws_dataDir().append(QTE_PIPE));
+ return QTE_PIPE(qws_display_id);
}
static void setMaxWindowRect(const QRect &rect)
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 0b75b06..3cfbb09 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11444,11 +11444,15 @@ QWidget *QWidgetPrivate::widgetInNavigationDirection(Direction direction)
QWidget *targetWidget = 0;
int shortestDistance = INT_MAX;
foreach(QWidget *targetCandidate, QApplication::allWidgets()) {
-
- if (targetCandidate->focusProxy()) //skip if focus proxy set
- continue;
const QRect targetCandidateRect = targetCandidate->rect().translated(targetCandidate->mapToGlobal(QPoint()));
+
+ // For focus proxies, the child widget handling the focus can have keypad navigation focus,
+ // but the owner of the proxy cannot.
+ // Additionally, empty widgets should be ignored.
+ if (targetCandidate->focusProxy() || targetCandidateRect.isEmpty())
+ continue;
+
if ( targetCandidate != sourceWidget
&& targetCandidate->focusPolicy() & Qt::TabFocus
&& !(direction == DirectionNorth && targetCandidateRect.bottom() > sourceRect.top())
diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp
index 716300e..ac3796a 100644
--- a/src/gui/painting/qdrawutil.cpp
+++ b/src/gui/painting/qdrawutil.cpp
@@ -1225,7 +1225,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
// horizontal edges
switch (rules.horizontal) {
- case Qt::Stretch:
+ case Qt::StretchTile:
if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top
const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top());
const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top());
@@ -1237,7 +1237,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
qDrawPixmap(painter, targetBottomRect, pixmap, sourceBottomRect);
}
break;
- case Qt::Repeat:
+ case Qt::RepeatTile:
if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top
const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top());
const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top());
@@ -1249,7 +1249,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
qDrawHorizontallyRepeatedPixmap(painter, targetBottomRect, pixmap, sourceBottomRect);
}
break;
- case Qt::Round:
+ case Qt::RoundTile:
if (targetMargins.top() > 0 && sourceMargins.top() > 0) { // top
const QRect targetTopRect(targetCenterLeft, targetTop, targetCenterWidth, targetMargins.top());
const QRect sourceTopRect(sourceCenterLeft, sourceTop, sourceCenterWidth, sourceMargins.top());
@@ -1265,7 +1265,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
// vertical edges
switch (rules.vertical) {
- case Qt::Stretch:
+ case Qt::StretchTile:
if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left
const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left(), targetCenterHeight);
const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left(), sourceCenterHeight);
@@ -1277,7 +1277,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
qDrawPixmap(painter, targetRightRect, pixmap, sourceRightRect);
}
break;
- case Qt::Repeat:
+ case Qt::RepeatTile:
if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left
const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left(), targetCenterHeight);
const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left(), sourceCenterHeight);
@@ -1289,7 +1289,7 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
qDrawVerticallyRepeatedPixmap(painter, targetRightRect, pixmap, sourceRightRect);
}
break;
- case Qt::Round:
+ case Qt::RoundTile:
if (targetMargins.left() > 0 && sourceMargins.left() > 0) { // left
const QRect targetLeftRect(targetLeft, targetCenterTop, targetMargins.left(), targetCenterHeight);
const QRect sourceLeftRect(sourceLeft, sourceCenterTop, sourceMargins.left(), sourceCenterHeight);
@@ -1308,41 +1308,41 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin
const QRect targetCenterRect(targetCenterLeft, targetCenterTop, targetCenterWidth, targetCenterHeight);
const QRect sourceCenterRect(sourceCenterLeft, sourceCenterTop, sourceCenterWidth, sourceCenterHeight);
switch (rules.horizontal) {
- case Qt::Stretch:
+ case Qt::StretchTile:
switch (rules.vertical) {
- case Qt::Stretch: // stretch stretch
+ case Qt::StretchTile: // stretch stretch
qDrawPixmap(painter, targetCenterRect, pixmap, sourceCenterRect);
break;
- case Qt::Repeat: // stretch repeat
+ case Qt::RepeatTile: // stretch repeat
qVerticalRepeat(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawPixmap);
break;
- case Qt::Round: // stretch round
+ case Qt::RoundTile: // stretch round
qVerticalRound(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawPixmap);
break;
}
break;
- case Qt::Repeat:
+ case Qt::RepeatTile:
switch (rules.vertical) {
- case Qt::Stretch: // repeat stretch
+ case Qt::StretchTile: // repeat stretch
qHorizontalRepeat(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawPixmap);
break;
- case Qt::Repeat: // repeat repeat
+ case Qt::RepeatTile: // repeat repeat
qVerticalRepeat(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawHorizontallyRepeatedPixmap);
break;
- case Qt::Round: // repeat round
+ case Qt::RoundTile: // repeat round
qVerticalRound(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawHorizontallyRepeatedPixmap);
break;
}
break;
- case Qt::Round:
+ case Qt::RoundTile:
switch (rules.vertical) {
- case Qt::Stretch: // round stretch
+ case Qt::StretchTile: // round stretch
qHorizontalRound(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawPixmap);
break;
- case Qt::Repeat: // round repeat
+ case Qt::RepeatTile: // round repeat
qHorizontalRound(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawVerticallyRepeatedPixmap);
break;
- case Qt::Round: // round round
+ case Qt::RoundTile: // round round
qHorizontalRound(painter, targetCenterRect, pixmap, sourceCenterRect, qDrawVerticallyRoundedPixmap);
break;
}
diff --git a/src/gui/painting/qdrawutil.h b/src/gui/painting/qdrawutil.h
index 3a2dd0e..22a57e9 100644
--- a/src/gui/painting/qdrawutil.h
+++ b/src/gui/painting/qdrawutil.h
@@ -137,22 +137,22 @@ struct QTileRules
{
inline QTileRules(Qt::TileRule horizontalRule, Qt::TileRule verticalRule)
: horizontal(horizontalRule), vertical(verticalRule) {}
- inline QTileRules(Qt::TileRule rule = Qt::Stretch)
+ inline QTileRules(Qt::TileRule rule = Qt::StretchTile)
: horizontal(rule), vertical(rule) {}
Qt::TileRule horizontal;
Qt::TileRule vertical;
};
-Q_GUI_EXPORT void qDrawBorderPixmap(QPainter *painter,
- const QRect &targetRect,
- const QMargins &targetMargins,
+Q_GUI_EXPORT void qDrawBorderPixmap(QPainter *painter,
+ const QRect &targetRect,
+ const QMargins &targetMargins,
const QPixmap &pixmap,
- const QRect &sourceRect,
- const QMargins &sourceMargins,
+ const QRect &sourceRect,
+ const QMargins &sourceMargins,
const QTileRules &rules = QTileRules());
-inline void qDrawBorderPixmap(QPainter *painter,
- const QRect &target,
- const QMargins &margins,
+inline void qDrawBorderPixmap(QPainter *painter,
+ const QRect &target,
+ const QMargins &margins,
const QPixmap &pixmap)
{
qDrawBorderPixmap(painter, target, margins, pixmap, pixmap.rect(), margins);
diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp
index 0f3a88b..707b05e 100644
--- a/src/gui/styles/qstylesheetstyle.cpp
+++ b/src/gui/styles/qstylesheetstyle.cpp
@@ -1126,7 +1126,7 @@ void QRenderRule::fixupBorder(int nativeWidth)
void QRenderRule::drawBorderImage(QPainter *p, const QRect& rect)
{
static const Qt::TileRule tileMode2TileRule[] = {
- Qt::Stretch, Qt::Round, Qt::Stretch, Qt::Repeat, Qt::Stretch };
+ Qt::StretchTile, Qt::RoundTile, Qt::StretchTile, Qt::RepeatTile, Qt::StretchTile };
const QStyleSheetBorderImageData *borderImageData = border()->borderImage();
const int *targetBorders = border()->borders;
diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp
index c3289b4..28f3be3 100644
--- a/src/gui/widgets/qabstractslider.cpp
+++ b/src/gui/widgets/qabstractslider.cpp
@@ -693,13 +693,8 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
if (e->orientation() != d->orientation && !rect().contains(e->pos()))
return;
- int step = qMin(QApplication::wheelScrollLines() * d->singleStep, d->pageStep);
- if ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::ShiftModifier))
- step = d->pageStep;
-
- qreal currentOffset = qreal(e->delta()) * step / 120;
+ qreal currentOffset = qreal(e->delta()) / 120;
d->offset_accumulated += d->invertedControls ? -currentOffset : currentOffset;
-
if (int(d->offset_accumulated) == 0) {
// QAbstractSlider works on integer values. So if the accumulated
// offset is less than +/- 1, we need to wait until we get more
@@ -708,8 +703,20 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e)
return;
}
+ // Calculate the number of steps to scroll (per 15 degrees of rotate):
+#ifdef Q_OS_MAC
+ // On mac, since mouse wheel scrolling is accelerated and
+ // fine tuned by the OS, we skip applying acceleration:
+ int stepsToScroll = int(d->offset_accumulated);
+#else
+ int step = qMin(QApplication::wheelScrollLines() * d->singleStep, d->pageStep);
+ if ((e->modifiers() & Qt::ControlModifier) || (e->modifiers() & Qt::ShiftModifier))
+ step = d->pageStep;
+ int stepsToScroll = step * int(d->offset_accumulated);
+#endif
+
int prevValue = d->value;
- d->position = d->overflowSafeAdd(int(d->offset_accumulated)); // value will be updated by triggerAction()
+ d->position = d->overflowSafeAdd(stepsToScroll); // value will be updated by triggerAction()
triggerAction(SliderMove);
if (prevValue == d->value) {
diff --git a/src/gui/widgets/qlabel.cpp b/src/gui/widgets/qlabel.cpp
index 5ff323a..5ba0571 100644
--- a/src/gui/widgets/qlabel.cpp
+++ b/src/gui/widgets/qlabel.cpp
@@ -886,7 +886,18 @@ void QLabel::focusInEvent(QFocusEvent *ev)
void QLabel::focusOutEvent(QFocusEvent *ev)
{
Q_D(QLabel);
- d->sendControlEvent(ev);
+ if (d->control) {
+ d->sendControlEvent(ev);
+ QTextCursor cursor = d->control->textCursor();
+ Qt::FocusReason reason = ev->reason();
+ if (reason != Qt::ActiveWindowFocusReason
+ && reason != Qt::PopupFocusReason
+ && cursor.hasSelection()) {
+ cursor.clearSelection();
+ d->control->setTextCursor(cursor);
+ }
+ }
+
QFrame::focusOutEvent(ev);
}
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 3fe9bb4..dc78fd5 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -174,13 +174,8 @@ void QTextEditPrivate::init(const QString &html)
if (!html.isEmpty())
control->setHtml(html);
-#ifdef Q_OS_MAC
- hbar->setSingleStep(1);
- vbar->setSingleStep(1);
-#else
hbar->setSingleStep(20);
vbar->setSingleStep(20);
-#endif
viewport->setBackgroundRole(QPalette::Base);
q->setAcceptDrops(true);