summaryrefslogtreecommitdiffstats
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2009-12-16 14:21:08 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2009-12-16 14:21:08 (GMT)
commit6b07987e030deb402f51eda69b640ffd07f372d5 (patch)
tree200f06b10bc154a1adf1a5dcd374738d7fd26ea1 /src/gui/widgets
parent4d34dc665a5145237801e46cc0a502e32b1a5dad (diff)
parenta2ec72ee604181892050093669b870580708842d (diff)
downloadQt-6b07987e030deb402f51eda69b640ffd07f372d5.zip
Qt-6b07987e030deb402f51eda69b640ffd07f372d5.tar.gz
Qt-6b07987e030deb402f51eda69b640ffd07f372d5.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/qt-s60-public: (31 commits) Fixed qstylesheetstyle benchmark for Symbian Fixed qdiriterator benchmark for Symbian Fixed events benchmark postEvent function Fix for QTBUG-4908 SVG transparency rendering problem. Long informative texts causes messagebox to grow outside of screen area qreal-ization qreal-ization qreal-ization QS60Style: Remove layouts with mirrored information Fixed qgraphicsview autotest build for winscw. Enabled input method update code for all platforms. (ODBC) Fixes segfault when error string is larger than 256 chars. Fixed QGraphicsView benchmark for Symbian. FEP indicator shown in status pane when it should not Skipped the most memory intensive tests in QByteArray benchmark. qreal-ization qreal-ization QS60Style: Theme graphics for QSlider in 3.1 QS60Style: Groove changes caused build break of S60 3.1 Slow spinbox on N95 when using keys Up/Down ...
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/qabstractspinbox.cpp67
-rw-r--r--src/gui/widgets/qabstractspinbox_p.h3
-rw-r--r--src/gui/widgets/qcombobox.cpp5
-rw-r--r--src/gui/widgets/qdial.cpp3
-rw-r--r--src/gui/widgets/qlineedit_p.cpp3
-rw-r--r--src/gui/widgets/qplaintextedit.cpp1
-rw-r--r--src/gui/widgets/qtextedit.cpp2
7 files changed, 70 insertions, 14 deletions
diff --git a/src/gui/widgets/qabstractspinbox.cpp b/src/gui/widgets/qabstractspinbox.cpp
index c015589..c036c32 100644
--- a/src/gui/widgets/qabstractspinbox.cpp
+++ b/src/gui/widgets/qabstractspinbox.cpp
@@ -65,6 +65,11 @@
#include <limits.h>
#endif
+#if defined(Q_OS_SYMBIAN)
+#include <W32STD.H>
+#include <private/qt_s60_p.h>
+#endif
+
//#define QABSTRACTSPINBOX_QSBDEBUG
#ifdef QABSTRACTSPINBOX_QSBDEBUG
# define QASBDEBUG qDebug
@@ -939,10 +944,12 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
d->edit->setCursorPosition(d->prefix.size());
int steps = 1;
+ bool isPgUpOrDown = false;
switch (event->key()) {
case Qt::Key_PageUp:
case Qt::Key_PageDown:
steps *= 10;
+ isPgUpOrDown = true;
case Qt::Key_Up:
case Qt::Key_Down: {
#ifdef QT_KEYPAD_NAVIGATION
@@ -964,7 +971,13 @@ void QAbstractSpinBox::keyPressEvent(QKeyEvent *event)
if (style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) {
d->buttonState = (Keyboard | (up ? Up : Down));
}
- stepBy(steps);
+ if (d->spinClickTimerId == -1)
+ stepBy(steps);
+ if(event->isAutoRepeat() && !isPgUpOrDown) {
+ if(d->spinClickThresholdTimerId == -1 && d->spinClickTimerId == -1) {
+ d->updateState(up, true);
+ }
+ }
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::ValueChanged);
#endif
@@ -1061,8 +1074,7 @@ void QAbstractSpinBox::keyReleaseEvent(QKeyEvent *event)
{
Q_D(QAbstractSpinBox);
- if (d->buttonState & Keyboard && !event->isAutoRepeat()
- && style()->styleHint(QStyle::SH_SpinBox_AnimateButton, 0, this)) {
+ if (d->buttonState & Keyboard && !event->isAutoRepeat()) {
d->reset();
} else {
d->edit->event(event);
@@ -1148,6 +1160,36 @@ void QAbstractSpinBox::hideEvent(QHideEvent *event)
QWidget::hideEvent(event);
}
+
+/*!
+ \internal
+
+ Used when acceleration is turned on. We need to get the
+ keyboard auto repeat rate from OS. This value is used as
+ argument when starting acceleration related timers.
+
+ Every platform should, either, use native calls to obtain
+ the value or hard code some reasonable rate.
+
+ Remember that time value should be given in msecs.
+*/
+static int getKeyboardAutoRepeatRate() {
+ int ret = 30;
+#if defined(Q_OS_SYMBIAN)
+ TTimeIntervalMicroSeconds32 initialTime;
+ TTimeIntervalMicroSeconds32 time;
+ S60->wsSession().GetKeyboardRepeatRate(initialTime, time);
+ ret = time.Int() / 1000; // msecs
+#elif defined(Q_OS_WIN)
+ DWORD time;
+ if (SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &time, 0) != FALSE)
+ ret = static_cast<int>(1000 / static_cast<int>(time)); // msecs
+#else
+#pragma message("Using default guesstimated value for keyboard repeat rate")
+#endif
+ return ret; // msecs
+}
+
/*!
\reimp
*/
@@ -1160,14 +1202,17 @@ void QAbstractSpinBox::timerEvent(QTimerEvent *event)
if (event->timerId() == d->spinClickThresholdTimerId) {
killTimer(d->spinClickThresholdTimerId);
d->spinClickThresholdTimerId = -1;
- d->spinClickTimerId = startTimer(d->spinClickTimerInterval);
+ d->effectiveSpinRepeatRate = d->buttonState & Keyboard
+ ? getKeyboardAutoRepeatRate()
+ : d->spinClickTimerInterval;
+ d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate);
doStep = true;
} else if (event->timerId() == d->spinClickTimerId) {
if (d->accelerate) {
- d->acceleration = d->acceleration + (int)(d->spinClickTimerInterval * 0.05);
- if (d->spinClickTimerInterval - d->acceleration >= 10) {
+ d->acceleration = d->acceleration + (int)(d->effectiveSpinRepeatRate * 0.05);
+ if (d->effectiveSpinRepeatRate - d->acceleration >= 10) {
killTimer(d->spinClickTimerId);
- d->spinClickTimerId = startTimer(d->spinClickTimerInterval - d->acceleration);
+ d->spinClickTimerId = startTimer(d->effectiveSpinRepeatRate - d->acceleration);
}
}
doStep = true;
@@ -1308,8 +1353,8 @@ void QAbstractSpinBox::mouseReleaseEvent(QMouseEvent *event)
QAbstractSpinBoxPrivate::QAbstractSpinBoxPrivate()
: edit(0), type(QVariant::Invalid), spinClickTimerId(-1),
spinClickTimerInterval(100), spinClickThresholdTimerId(-1), spinClickThresholdTimerInterval(-1),
- buttonState(None), cachedText(QLatin1String("\x01")), cachedState(QValidator::Invalid),
- pendingEmit(false), readOnly(false), wrapping(false),
+ effectiveSpinRepeatRate(1), buttonState(None), cachedText(QLatin1String("\x01")),
+ cachedState(QValidator::Invalid), pendingEmit(false), readOnly(false), wrapping(false),
ignoreCursorPositionChanged(false), frame(true), accelerate(false), keyboardTracking(true),
cleared(false), ignoreUpdateEdit(false), correctionMode(QAbstractSpinBox::CorrectToPreviousValue),
acceleration(0), hoverControl(QStyle::SC_None), buttonSymbols(QAbstractSpinBox::UpDownArrows), validator(0)
@@ -1554,7 +1599,7 @@ void QAbstractSpinBoxPrivate::reset()
Updates the state of the spinbox.
*/
-void QAbstractSpinBoxPrivate::updateState(bool up)
+void QAbstractSpinBoxPrivate::updateState(bool up, bool fromKeyboard /* = false */)
{
Q_Q(QAbstractSpinBox);
if ((up && (buttonState & Up)) || (!up && (buttonState & Down)))
@@ -1563,7 +1608,7 @@ void QAbstractSpinBoxPrivate::updateState(bool up)
if (q && (q->stepEnabled() & (up ? QAbstractSpinBox::StepUpEnabled
: QAbstractSpinBox::StepDownEnabled))) {
spinClickThresholdTimerId = q->startTimer(spinClickThresholdTimerInterval);
- buttonState = (up ? (Mouse | Up) : (Mouse | Down));
+ buttonState = (up ? Up : Down) | (fromKeyboard ? Keyboard : Mouse);
q->stepBy(up ? 1 : -1);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(q, 0, QAccessible::ValueChanged);
diff --git a/src/gui/widgets/qabstractspinbox_p.h b/src/gui/widgets/qabstractspinbox_p.h
index 3020cbc..55f94d7 100644
--- a/src/gui/widgets/qabstractspinbox_p.h
+++ b/src/gui/widgets/qabstractspinbox_p.h
@@ -98,7 +98,7 @@ public:
void init();
void reset();
- void updateState(bool up);
+ void updateState(bool up, bool fromKeyboard = false);
QString stripped(const QString &text, int *pos = 0) const;
bool specialValue() const;
virtual QVariant getZeroVariant() const;
@@ -129,6 +129,7 @@ public:
QVariant value, minimum, maximum, singleStep;
QVariant::Type type;
int spinClickTimerId, spinClickTimerInterval, spinClickThresholdTimerId, spinClickThresholdTimerInterval;
+ int effectiveSpinRepeatRate;
uint buttonState;
mutable QString cachedText;
mutable QVariant cachedValue;
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index bd1d8ba..b7dd20c 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -931,7 +931,10 @@ void QComboBoxPrivate::init()
QSizePolicy::ComboBox));
setLayoutItemMargins(QStyle::SE_ComboBoxLayoutItem);
q->setModel(new QStandardItemModel(0, 1, q));
- q->setAttribute(Qt::WA_InputMethodEnabled);
+ if (!q->isEditable())
+ q->setAttribute(Qt::WA_InputMethodEnabled, false);
+ else
+ q->setAttribute(Qt::WA_InputMethodEnabled);
}
QComboBoxPrivateContainer* QComboBoxPrivate::viewContainer()
diff --git a/src/gui/widgets/qdial.cpp b/src/gui/widgets/qdial.cpp
index 95e6ed5..dc02c02 100644
--- a/src/gui/widgets/qdial.cpp
+++ b/src/gui/widgets/qdial.cpp
@@ -59,6 +59,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
+#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -135,7 +136,7 @@ int QDialPrivate::valueFromPoint(const QPoint &p) const
Q_Q(const QDial);
double yy = (double)q->height()/2.0 - p.y();
double xx = (double)p.x() - q->width()/2.0;
- double a = (xx || yy) ? atan2(yy, xx) : 0;
+ double a = (xx || yy) ? qAtan2(yy, xx) : 0;
if (a < Q_PI / -2)
a = a + Q_PI * 2;
diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp
index 4437fef..4122bc4 100644
--- a/src/gui/widgets/qlineedit_p.cpp
+++ b/src/gui/widgets/qlineedit_p.cpp
@@ -149,6 +149,9 @@ void QLineEditPrivate::init(const QString& txt)
#endif
QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(updateMicroFocus()));
+
+ QObject::connect(control, SIGNAL(textChanged(const QString &)),
+ q, SLOT(updateMicroFocus()));
// for now, going completely overboard with updates.
QObject::connect(control, SIGNAL(selectionChanged()),
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 028ffe8..5e7d06e 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -765,6 +765,7 @@ void QPlainTextEditPrivate::init(const QString &txt)
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(_q_cursorPositionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus()));
// set a null page size initially to avoid any relayouting until the textedit
// is shown. relayoutDocument() will take care of setting the page size to the
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 1bc0bf1..63fac2a 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -158,6 +158,8 @@ void QTextEditPrivate::init(const QString &html)
QObject::connect(control, SIGNAL(selectionChanged()), q, SIGNAL(selectionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
+ QObject::connect(control, SIGNAL(textChanged(const QString &)), q, SLOT(updateMicroFocus()));
+
QTextDocument *doc = control->document();
// set a null page size initially to avoid any relayouting until the textedit
// is shown. relayoutDocument() will take care of setting the page size to the