summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-03-05 09:26:07 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-03-05 09:26:07 (GMT)
commitdd1f2a39b90e22337773153b9f655ee74717b57c (patch)
treee2ed2eed4ff3039a0e6222590c66bb54f0dbdd6b /src
parent5d7aaf0a63b01b2fbdd952b0e37442cce62456a9 (diff)
parent0f89d7ef7b5e961cfc6ee7960ad6bf07eff71691 (diff)
downloadQt-dd1f2a39b90e22337773153b9f655ee74717b57c.zip
Qt-dd1f2a39b90e22337773153b9f655ee74717b57c.tar.gz
Qt-dd1f2a39b90e22337773153b9f655ee74717b57c.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Wrong dirty region after row selection in right-to-left mode in QTableView Fixes: Mysql truncation of integer values + some autotest cleanup
Diffstat (limited to 'src')
-rw-r--r--src/gui/itemviews/qtableview.cpp14
-rw-r--r--src/sql/drivers/mysql/qsql_mysql.cpp17
2 files changed, 28 insertions, 3 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index 3111896..cf1b542 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1908,6 +1908,7 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co
width, rowHeight(r)));
}
} else { // nothing moved
+ const int gridAdjust = showGrid() ? 1 : 0;
for (int i = 0; i < selection.count(); ++i) {
QItemSelectionRange range = selection.at(i);
if (range.parent() != d->root || !range.isValid())
@@ -1916,9 +1917,16 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co
const int rtop = rowViewportPosition(range.top());
const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom());
- const int rleft = columnViewportPosition(range.left());
- const int rright = columnViewportPosition(range.right()) + columnWidth(range.right());
- selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright, rbottom));
+ int rleft;
+ int rright;
+ if (isLeftToRight()) {
+ rleft = columnViewportPosition(range.left());
+ rright = columnViewportPosition(range.right()) + columnWidth(range.right());
+ } else {
+ rleft = columnViewportPosition(range.right());
+ rright = columnViewportPosition(range.left()) + columnWidth(range.left());
+ }
+ selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust));
if (d->hasSpans()) {
foreach (QSpanCollection::Span *s,
d->spans.spansInRect(range.left(), range.top(), range.width(), range.height())) {
diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp
index c0f866e..2261887 100644
--- a/src/sql/drivers/mysql/qsql_mysql.cpp
+++ b/src/sql/drivers/mysql/qsql_mysql.cpp
@@ -320,6 +320,16 @@ static bool qIsBlob(int t)
|| t == MYSQL_TYPE_LONG_BLOB;
}
+static bool qIsInteger(int t)
+{
+ return t == MYSQL_TYPE_TINY
+ || t == MYSQL_TYPE_SHORT
+ || t == MYSQL_TYPE_LONG
+ || t == MYSQL_TYPE_LONGLONG
+ || t == MYSQL_TYPE_INT24;
+}
+
+
void QMYSQLResultPrivate::bindBlobs()
{
int i;
@@ -368,6 +378,13 @@ bool QMYSQLResultPrivate::bindInValues()
fieldInfo->length = 0;
hasBlobs = true;
} else {
+ // fieldInfo->length specifies the display width, which may be too
+ // small to hold valid integer values (see
+ // http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html ), so
+ // always use the MAX_BIGINT_WIDTH for integer types
+ if (qIsInteger(fieldInfo->type)) {
+ fieldInfo->length = MAX_BIGINT_WIDTH;
+ }
fieldInfo->type = MYSQL_TYPE_STRING;
}
bind = &inBinds[i];