summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/ChangeLog13
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp4
-rw-r--r--src/3rdparty/webkit/VERSION2
-rw-r--r--src/corelib/arch/sparc/arch.pri2
-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/qcocoaview_mac.mm3
-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
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp11
-rw-r--r--src/sql/drivers/odbc/qsql_odbc.cpp37
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp16
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h1
-rw-r--r--tools/shared/qtpropertybrowser/qtpropertymanager.cpp82
21 files changed, 142 insertions, 69 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
index b943840..6446773 100644
--- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog
+++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog
@@ -1,3 +1,16 @@
+2010-02-09 Janne Koskinen <janne.p.koskinen@digia.com>
+
+ Reviewed by Laszlo Gombos.
+
+ [Qt] use nanval() for Symbian as nonInlineNaN
+ https://bugs.webkit.org/show_bug.cgi?id=34170
+
+ numeric_limits<double>::quiet_NaN is broken in Symbian
+ causing NaN to be evaluated as a number.
+
+ * runtime/JSValue.cpp:
+ (JSC::nonInlineNaN):
+
2010-01-07 Norbert Leser <norbert.leser@nokia.com>
Reviewed by NOBODY (OOPS!).
diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp
index 699c1cd..bafb85b 100644
--- a/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp
+++ b/src/3rdparty/webkit/JavaScriptCore/runtime/JSValue.cpp
@@ -174,7 +174,11 @@ uint32_t toUInt32SlowCase(double d, bool& ok)
NEVER_INLINE double nonInlineNaN()
{
+#if PLATFORM(SYMBIAN)
+ return nanval();
+#else
return std::numeric_limits<double>::quiet_NaN();
+#endif
}
} // namespace JSC
diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION
index 2b39e81..cc0e04f 100644
--- a/src/3rdparty/webkit/VERSION
+++ b/src/3rdparty/webkit/VERSION
@@ -8,4 +8,4 @@ The commit imported was from the
and has the sha1 checksum
- 36fe058a9001e6d47f0fd41c6304cdfdf3a735ed
+ ffae5e11181a3961193fa21ea405851cad714d4b
diff --git a/src/corelib/arch/sparc/arch.pri b/src/corelib/arch/sparc/arch.pri
index 3113dd3..9bb3a88 100644
--- a/src/corelib/arch/sparc/arch.pri
+++ b/src/corelib/arch/sparc/arch.pri
@@ -1,7 +1,7 @@
#
# SPARC architecture
#
-*-64 {
+*-64* {
SOURCES += $$QT_ARCH_CPP/qatomic64.s
}
else {
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index e8b821af..54a4901 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 9c001ab..b3ec732 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 2a1f655..afd927b 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/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 756cf92..ad64a91 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];
}
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 26c7c1e..af91603 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 b881f68..e8bf197 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 a645050..82b4325 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 73c17db..4bd7b5a 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 059943a..6c062c0 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 f332d31..9b19a66 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 5a6a5c7..47dff2b 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 3eed3a9..4eff260 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;
}
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index f27440e..ba50329 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -593,6 +593,17 @@ void QDirectFBPixmapData::invalidate()
imageFormat = QImage::Format_Invalid;
}
+#ifndef QT_DIRECTFB_PLUGIN
+Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap)
+{
+ const QPixmapData *data = pixmap.pixmapData();
+ if (!data || data->classId() != QPixmapData::DirectFBClass)
+ return 0;
+ const QDirectFBPixmapData *dfbData = static_cast<const QDirectFBPixmapData*>(data);
+ return dfbData->directFBSurface();
+}
+#endif
+
QT_END_NAMESPACE
#endif // QT_NO_QWS_DIRECTFB
diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp
index 4d3663e..2049a76 100644
--- a/src/sql/drivers/odbc/qsql_odbc.cpp
+++ b/src/sql/drivers/odbc/qsql_odbc.cpp
@@ -144,7 +144,6 @@ public:
QSqlRecord rInf;
QVector<QVariant> fieldCache;
- QVector<wchar_t *> paramCache;
int fieldCacheIdx;
int disconnectCount;
bool hasSQLFetchScroll;
@@ -203,7 +202,7 @@ static QString qWarnODBCHandle(int handleType, SQLHANDLE handle, int *nativeCode
*nativeCode = nativeCode_;
QString tmpstore;
#ifdef UNICODE
- tmpstore = QString::fromWCharArray((const wchar_t*)description_, msgLen);
+ tmpstore = QString((const QChar*)description_.data(), msgLen);
#else
tmpstore = QString::fromLocal8Bit((const char*)description_.data(), msgLen);
#endif
@@ -333,7 +332,7 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
} else {
colSize++; // make sure there is room for more than the 0 termination
if (unicode) {
- colSize *= sizeof(wchar_t); // a tiny bit faster, since it saves a SQLGetData() call
+ colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call
}
}
QVarLengthArray<char> buf(colSize);
@@ -354,9 +353,9 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni
// contain the number of bytes returned - it contains the
// total number of bytes that CAN be fetched
// colSize-1: remove 0 termination when there is more data to fetch
- int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-sizeof(wchar_t) : colSize-1) : lengthIndicator;
+ int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator;
if (unicode) {
- fieldVal += QString::fromWCharArray((wchar_t*)buf.constData(), rSize / sizeof(wchar_t));
+ fieldVal += QString((const QChar*) buf.constData(), rSize / 2);
} else {
fieldVal += QString::fromAscii(buf.constData(), rSize);
}
@@ -552,7 +551,7 @@ static QSqlField qMakeFieldInfo(const QODBCPrivate* p, int i )
}
#ifdef UNICODE
- QString qColName = QString::fromWCharArray((const wchar_t*)colName, colNameLen);
+ QString qColName((const QChar*)colName, colNameLen);
#else
QString qColName = QString::fromLocal8Bit((const char*)colName);
#endif
@@ -1271,12 +1270,9 @@ bool QODBCResult::exec()
// bind parameters - only positional binding allowed
QVector<QVariant>& values = boundValues();
- QVector<wchar_t *> wcharstorage;
-
int i;
SQLRETURN r;
for (i = 0; i < values.count(); ++i) {
- wcharstorage.append(NULL);
if (bindValueType(i) & QSql::Out)
values[i].detach();
const QVariant &val = values.at(i);
@@ -1439,14 +1435,13 @@ bool QODBCResult::exec()
#ifndef Q_ODBC_VERSION_2
if (d->unicode) {
QString str = val.toString();
- int strSize = str.length() * sizeof(wchar_t);
+ str.utf16();
if (*ind != SQL_NULL_DATA)
- *ind = strSize;
+ *ind = str.length() * sizeof(QChar);
+ int strSize = str.length() * sizeof(QChar);
if (bindValueType(i) & QSql::Out) {
- wchar_t *temp=new wchar_t[str.capacity()*sizeof(wchar_t)];
- str.toWCharArray(temp);
- QByteArray ba((char*)temp, str.capacity() * sizeof(wchar_t));
+ QByteArray ba((char*)str.constData(), str.capacity() * sizeof(QChar));
r = SQLBindParameter(d->hStmt,
i + 1,
qParamType[(QFlag)(bindValueType(i)) & QSql::InOut],
@@ -1458,13 +1453,9 @@ bool QODBCResult::exec()
ba.size(),
ind);
tmpStorage.append(ba);
- wcharstorage.replace(i,temp);
break;
}
- wchar_t *temp=new wchar_t[(1+str.length())*sizeof(wchar_t)];
- str.toWCharArray(temp);
- temp[str.length()]=0;
r = SQLBindParameter(d->hStmt,
i + 1,
qParamType[(QFlag)(bindValueType(i)) & QSql::InOut],
@@ -1472,10 +1463,9 @@ bool QODBCResult::exec()
strSize > 254 ? SQL_WLONGVARCHAR : SQL_WVARCHAR,
strSize,
0,
- (void *)temp,
+ (void *)str.constData(),
strSize,
ind);
- wcharstorage.replace(i,temp);
break;
}
else
@@ -1525,13 +1515,6 @@ bool QODBCResult::exec()
}
}
r = SQLExecute(d->hStmt);
-
- for(int i=0;i<wcharstorage.size();i++)
- {
- if(wcharstorage.at(i))
- delete [](wcharstorage.at(i));
- }
-
if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
qWarning() << "QODBCResult::exec: Unable to execute statement:" << qODBCWarn(d);
setLastError(qMakeError(QCoreApplication::translate("QODBCResult",
diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
index b84de11..0b14292 100644
--- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
+++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils.cpp
@@ -93,15 +93,23 @@ QtCursorDatabase::QtCursorDatabase()
QApplication::UnicodeUTF8), QIcon(QLatin1String(":/trolltech/qtpropertybrowser/images/cursor-busy.png")));
}
+void QtCursorDatabase::clear()
+{
+ m_cursorNames.clear();
+ m_cursorIcons.clear();
+ m_valueToCursorShape.clear();
+ m_cursorShapeToValue.clear();
+}
+
void QtCursorDatabase::appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon)
{
if (m_cursorShapeToValue.contains(shape))
return;
- int value = m_cursorNames.count();
+ const int value = m_cursorNames.count();
m_cursorNames.append(name);
- m_cursorIcons[value] = icon;
- m_valueToCursorShape[value] = shape;
- m_cursorShapeToValue[shape] = value;
+ m_cursorIcons.insert(value, icon);
+ m_valueToCursorShape.insert(value, shape);
+ m_cursorShapeToValue.insert(shape, value);
}
QStringList QtCursorDatabase::cursorShapeNames() const
diff --git a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
index b60fb94..baa7a4a 100644
--- a/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
+++ b/tools/shared/qtpropertybrowser/qtpropertybrowserutils_p.h
@@ -68,6 +68,7 @@ class QtCursorDatabase
{
public:
QtCursorDatabase();
+ void clear();
QStringList cursorShapeNames() const;
QMap<int, QIcon> cursorShapeIcons() const;
diff --git a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
index 67ab2fb..d9ff10a 100644
--- a/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
+++ b/tools/shared/qtpropertybrowser/qtpropertymanager.cpp
@@ -1391,16 +1391,54 @@ void QtStringPropertyManager::uninitializeProperty(QtProperty *property)
}
// QtBoolPropertyManager
+// Return an icon containing a check box indicator
+static QIcon drawCheckBox(bool value)
+{
+ QStyleOptionButton opt;
+ opt.state |= value ? QStyle::State_On : QStyle::State_Off;
+ opt.state |= QStyle::State_Enabled;
+ const QStyle *style = QApplication::style();
+ // Figure out size of an indicator and make sure it is not scaled down in a list view item
+ // by making the pixmap as big as a list view icon and centering the indicator in it.
+ // (if it is smaller, it can't be helped)
+ const int indicatorWidth = style->pixelMetric(QStyle::PM_IndicatorWidth, &opt);
+ const int indicatorHeight = style->pixelMetric(QStyle::PM_IndicatorHeight, &opt);
+ const int listViewIconSize = indicatorWidth;
+ const int pixmapWidth = indicatorWidth;
+ const int pixmapHeight = qMax(indicatorHeight, listViewIconSize);
+
+ opt.rect = QRect(0, 0, indicatorWidth, indicatorHeight);
+ QPixmap pixmap = QPixmap(pixmapWidth, pixmapHeight);
+ pixmap.fill(Qt::transparent);
+ {
+ // Center?
+ const int xoff = (pixmapWidth > indicatorWidth) ? (pixmapWidth - indicatorWidth) / 2 : 0;
+ const int yoff = (pixmapHeight > indicatorHeight) ? (pixmapHeight - indicatorHeight) / 2 : 0;
+ QPainter painter(&pixmap);
+ painter.translate(xoff, yoff);
+ style->drawPrimitive(QStyle::PE_IndicatorCheckBox, &opt, &painter);
+ }
+ return QIcon(pixmap);
+}
class QtBoolPropertyManagerPrivate
{
QtBoolPropertyManager *q_ptr;
Q_DECLARE_PUBLIC(QtBoolPropertyManager)
public:
+ QtBoolPropertyManagerPrivate();
QMap<const QtProperty *, bool> m_values;
+ const QIcon m_checkedIcon;
+ const QIcon m_uncheckedIcon;
};
+QtBoolPropertyManagerPrivate::QtBoolPropertyManagerPrivate() :
+ m_checkedIcon(drawCheckBox(true)),
+ m_uncheckedIcon(drawCheckBox(false))
+{
+}
+
/*!
\class QtBoolPropertyManager
\internal
@@ -1471,36 +1509,6 @@ QString QtBoolPropertyManager::valueText(const QtProperty *property) const
return it.value() ? trueText : falseText;
}
-// Return an icon containing a check box indicator
-static QIcon drawCheckBox(bool value)
-{
- QStyleOptionButton opt;
- opt.state |= value ? QStyle::State_On : QStyle::State_Off;
- opt.state |= QStyle::State_Enabled;
- const QStyle *style = QApplication::style();
- // Figure out size of an indicator and make sure it is not scaled down in a list view item
- // by making the pixmap as big as a list view icon and centering the indicator in it.
- // (if it is smaller, it can't be helped)
- const int indicatorWidth = style->pixelMetric(QStyle::PM_IndicatorWidth, &opt);
- const int indicatorHeight = style->pixelMetric(QStyle::PM_IndicatorHeight, &opt);
- const int listViewIconSize = indicatorWidth;
- const int pixmapWidth = indicatorWidth;
- const int pixmapHeight = qMax(indicatorHeight, listViewIconSize);
-
- opt.rect = QRect(0, 0, indicatorWidth, indicatorHeight);
- QPixmap pixmap = QPixmap(pixmapWidth, pixmapHeight);
- pixmap.fill(Qt::transparent);
- {
- // Center?
- const int xoff = (pixmapWidth > indicatorWidth) ? (pixmapWidth - indicatorWidth) / 2 : 0;
- const int yoff = (pixmapHeight > indicatorHeight) ? (pixmapHeight - indicatorHeight) / 2 : 0;
- QPainter painter(&pixmap);
- painter.translate(xoff, yoff);
- style->drawPrimitive(QStyle::PE_IndicatorCheckBox, &opt, &painter);
- }
- return QIcon(pixmap);
-}
-
/*!
\reimp
*/
@@ -1510,9 +1518,7 @@ QIcon QtBoolPropertyManager::valueIcon(const QtProperty *property) const
if (it == d_ptr->m_values.constEnd())
return QIcon();
- static const QIcon checkedIcon = drawCheckBox(true);
- static const QIcon uncheckedIcon = drawCheckBox(false);
- return it.value() ? checkedIcon : uncheckedIcon;
+ return it.value() ? d_ptr->m_checkedIcon : d_ptr->m_uncheckedIcon;
}
/*!
@@ -6287,7 +6293,15 @@ void QtColorPropertyManager::uninitializeProperty(QtProperty *property)
// QtCursorPropertyManager
-Q_GLOBAL_STATIC(QtCursorDatabase, cursorDatabase)
+// Make sure icons are removed as soon as QApplication is destroyed, otherwise,
+// handles are leaked on X11.
+static void clearCursorDatabase();
+Q_GLOBAL_STATIC_WITH_INITIALIZER(QtCursorDatabase, cursorDatabase, qAddPostRoutine(clearCursorDatabase))
+
+static void clearCursorDatabase()
+{
+ cursorDatabase()->clear();
+}
class QtCursorPropertyManagerPrivate
{