diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-09-01 08:25:54 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-09-01 08:25:54 (GMT) |
commit | 1051e9d0dc5cbad27b89756839f3619cae2d44fe (patch) | |
tree | cd25969458735e14c0b5de365760c3fd7747659d | |
parent | 0d411622521a89c04a416e2aaf3da44b6015b183 (diff) | |
parent | 8f1596ae9b64870c54958611552c71b0b390038f (diff) | |
download | Qt-1051e9d0dc5cbad27b89756839f3619cae2d44fe.zip Qt-1051e9d0dc5cbad27b89756839f3619cae2d44fe.tar.gz Qt-1051e9d0dc5cbad27b89756839f3619cae2d44fe.tar.bz2 |
Merge branch '4.6' of git:qt/qt into 4.6
39 files changed, 594 insertions, 211 deletions
diff --git a/examples/widgets/tablet/tabletcanvas.cpp b/examples/widgets/tablet/tabletcanvas.cpp index abb667c..612a635 100644 --- a/examples/widgets/tablet/tabletcanvas.cpp +++ b/examples/widgets/tablet/tabletcanvas.cpp @@ -98,8 +98,10 @@ void TabletCanvas::tabletEvent(QTabletEvent *event) switch (event->type()) { case QEvent::TabletPress: - if (!deviceDown) + if (!deviceDown) { deviceDown = true; + polyLine[0] = polyLine[1] = polyLine[2] = event->pos(); + } break; case QEvent::TabletRelease: if (deviceDown) diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index 30f1cc8..c311465 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -943,7 +943,7 @@ QByteArray QMetaObject::normalizedType(const char *type) if (!type || !*type) return result; - QVarLengthArray<char> stackbuf((int)strlen(type)); + QVarLengthArray<char> stackbuf(int(strlen(type)) + 1); qRemoveWhitespace(type, stackbuf.data()); int templdepth = 0; qNormalizeType(stackbuf.data(), templdepth, result); @@ -968,10 +968,9 @@ QByteArray QMetaObject::normalizedSignature(const char *method) if (!method || !*method) return result; int len = int(strlen(method)); - char stackbuf[64]; - char *buf = (len >= 64 ? new char[len+1] : stackbuf); - qRemoveWhitespace(method, buf); - char *d = buf; + QVarLengthArray<char> stackbuf(len + 1); + char *d = stackbuf.data(); + qRemoveWhitespace(method, d); result.reserve(len); @@ -987,8 +986,6 @@ QByteArray QMetaObject::normalizedSignature(const char *method) result += *d++; } - if (buf != stackbuf) - delete [] buf; return result; } diff --git a/src/corelib/tools/qmargins.cpp b/src/corelib/tools/qmargins.cpp index df08da1..747ea5e 100644 --- a/src/corelib/tools/qmargins.cpp +++ b/src/corelib/tools/qmargins.cpp @@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE \class QMargins \ingroup painting - \brief The QMargins + \brief The QMargins class defines the four margins of a rectangle. QMargin defines a set of four margins; left, top, right and bottom, that describe the size of the borders surrounding a rectangle. @@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE Constructs a margins object with all margins set to 0. - \sa isValid() + \sa isNull() */ /*! @@ -78,7 +78,7 @@ QT_BEGIN_NAMESPACE Constructs margins with the given \a left, \a top, \a right, \a bottom - \sa setWidth(), setHeight() + \sa setLeft(), setRight(), setTop(), setBottom() */ /*! @@ -86,8 +86,6 @@ QT_BEGIN_NAMESPACE Returns true if all margins are is 0; otherwise returns false. - - \sa isValid(), isEmpty() */ diff --git a/src/corelib/tools/qmargins.h b/src/corelib/tools/qmargins.h index be918cc..2691c62 100644 --- a/src/corelib/tools/qmargins.h +++ b/src/corelib/tools/qmargins.h @@ -68,11 +68,6 @@ public: void setRight(int right); void setBottom(int bottom); - int &rleft(); - int &rtop(); - int &rright(); - int &rbottom(); - private: int m_left; int m_top; diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index a1c3e4e..4dbd6dc 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -1047,7 +1047,9 @@ int QHeaderView::visualIndex(int logicalIndex) const /*! Returns the logicalIndex for the section at the given \a visualIndex - position, or -1 otherwise. + position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count(). + + Note that the visualIndex is not affected by hidden sections. \sa visualIndex(), sectionPosition() */ diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index 69dba40..0056b9e 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -4510,7 +4510,9 @@ void fetchWacomToolId(int &deviceType, qint64 &serialId) struct qt_tablet_motion_data { - Time timestamp; + bool filterByWidget; + const QWidget *widget; + const QWidget *etWidget; int tabletMotionType; bool error; // found a reason to stop searching }; @@ -4533,15 +4535,20 @@ static Bool qt_tabletMotion_scanner(Display *, XEvent *event, XPointer arg) qt_tablet_motion_data *data = (qt_tablet_motion_data *) arg; if (data->error) return false; - if (event->type == data->tabletMotionType) { - if (data->timestamp > 0) { - if ((reinterpret_cast<const XDeviceMotionEvent*>(event))->time > data->timestamp) { - data->error = true; - return false; + const XDeviceMotionEvent *const motion = reinterpret_cast<const XDeviceMotionEvent*>(event); + if (data->filterByWidget) { + const QPoint curr(motion->x, motion->y); + const QWidget *w = data->etWidget; + const QWidget *const child = w->childAt(curr); + if (child) { + w = child; } + if (w == data->widget) + return true; + } else { + return true; } - return true; } data->error = event->type != MotionNotify; // we stop compression when another event gets in between. @@ -4574,57 +4581,17 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet qreal rotation = 0; int deviceType = QTabletEvent::NoDevice; int pointerType = QTabletEvent::UnknownPointer; - XEvent mouseMotionEvent; - XEvent dummy; const XDeviceMotionEvent *motion = 0; XDeviceButtonEvent *button = 0; const XProximityNotifyEvent *proximity = 0; QEvent::Type t; Qt::KeyboardModifiers modifiers = 0; - bool reinsertMouseEvent = false; - XEvent mouseMotionEventSave; #if !defined (Q_OS_IRIX) XID device_id; #endif if (ev->type == tablet->xinput_motion) { motion = reinterpret_cast<const XDeviceMotionEvent*>(ev); - - // Do event compression. Skip over tablet+mouse move events if there are newer ones. - qt_tablet_motion_data tabletMotionData; - tabletMotionData.tabletMotionType = tablet->xinput_motion; - while (true) { - // Find first mouse event since we expect them in pairs inside Qt - tabletMotionData.error =false; - tabletMotionData.timestamp = 0; - if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) { - mouseMotionEventSave = mouseMotionEvent; - reinsertMouseEvent = true; - } else { - break; - } - - // Now discard any duplicate tablet events. - tabletMotionData.error = false; - tabletMotionData.timestamp = mouseMotionEvent.xmotion.time; - while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { - motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy); - } - - // now check if there are more recent tablet motion events since we'll compress the current one with - // newer ones in that case - tabletMotionData.error = false; - tabletMotionData.timestamp = 0; - if (! XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { - break; // done with compression - } - motion = reinterpret_cast<const XDeviceMotionEvent*>(&dummy); - } - - if (reinsertMouseEvent) { - XPutBackEvent(X11->display, &mouseMotionEventSave); - } - t = QEvent::TabletMove; global = QPoint(motion->x_root, motion->y_root); curr = QPoint(motion->x, motion->y); @@ -4777,11 +4744,14 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet } #endif - QWidget *child = w->childAt(curr); - if (child) { - w = child; - curr = w->mapFromGlobal(global); + if (tablet->widgetToGetPress) { + w = tablet->widgetToGetPress; + } else { + QWidget *child = w->childAt(curr); + if (child) + w = child; } + curr = w->mapFromGlobal(global); if (t == QEvent::TabletPress) { tablet->widgetToGetPress = w; @@ -4795,10 +4765,45 @@ bool QETWidget::translateXinputEvent(const XEvent *ev, QTabletDeviceData *tablet deviceType, pointerType, qreal(pressure / qreal(tablet->maxPressure - tablet->minPressure)), xTilt, yTilt, tangentialPressure, rotation, z, modifiers, uid); - if (proximity) + if (proximity) { QApplication::sendSpontaneousEvent(qApp, &e); - else + } else { QApplication::sendSpontaneousEvent(w, &e); + const bool accepted = e.isAccepted(); + if (!accepted && ev->type == tablet->xinput_motion) { + // If the widget does not accept tablet events, we drop the next ones from the event queue + // for this widget so it is not overloaded with the numerous tablet events. + qt_tablet_motion_data tabletMotionData; + tabletMotionData.tabletMotionType = tablet->xinput_motion; + tabletMotionData.widget = w; + tabletMotionData.etWidget = this; + // if nothing is pressed, the events are filtered by position + tabletMotionData.filterByWidget = (tablet->widgetToGetPress == 0); + + bool reinsertMouseEvent = false; + XEvent mouseMotionEvent; + while (true) { + // Find first mouse event since we expect them in pairs inside Qt + tabletMotionData.error =false; + if (XCheckIfEvent(X11->display, &mouseMotionEvent, &qt_mouseMotion_scanner, (XPointer) &tabletMotionData)) { + reinsertMouseEvent = true; + } else { + break; + } + + // Now discard any duplicate tablet events. + tabletMotionData.error = false; + XEvent dummy; + while (XCheckIfEvent(X11->display, &dummy, &qt_tabletMotion_scanner, (XPointer) &tabletMotionData)) { + // just discard the event + } + } + + if (reinsertMouseEvent) { + XPutBackEvent(X11->display, &mouseMotionEvent); + } + } + } return true; } #endif diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 666770d..c128da9 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -250,6 +250,10 @@ void QSslCertificate::clear() */ QByteArray QSslCertificate::version() const { + if (d->versionString.isEmpty() && d->x509) + d->versionString = + QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->version))); + return d->versionString; } @@ -258,6 +262,10 @@ QByteArray QSslCertificate::version() const */ QByteArray QSslCertificate::serialNumber() const { + if (d->serialNumberString.isEmpty() && d->x509) + d->serialNumberString = + QByteArray::number(qlonglong(q_ASN1_INTEGER_get(d->x509->cert_info->serialNumber)) + 1); + return d->serialNumberString; } diff --git a/src/network/ssl/qsslerror.cpp b/src/network/ssl/qsslerror.cpp index 69d2ccd..d47c91d 100644 --- a/src/network/ssl/qsslerror.cpp +++ b/src/network/ssl/qsslerror.cpp @@ -105,10 +105,8 @@ public: }; /*! - Constructs a QSslError object. The two optional arguments specify the \a - error that occurred, and which \a certificate the error relates to. + Constructs a QSslError object with no error and default certificate. - \sa QSslCertificate */ // RVCT compiler in debug build does not like about default values in const- @@ -120,6 +118,11 @@ QSslError::QSslError() d->certificate = QSslCertificate(); } +/*! + Constructs a QSslError object. The argument specifies the \a + error that occurred. + +*/ QSslError::QSslError(SslError error) : d(new QSslErrorPrivate) { @@ -127,6 +130,12 @@ QSslError::QSslError(SslError error) d->certificate = QSslCertificate(); } +/*! + Constructs a QSslError object. The two arguments specify the \a + error that occurred, and which \a certificate the error relates to. + + \sa QSslCertificate +*/ QSslError::QSslError(SslError error, const QSslCertificate &certificate) : d(new QSslErrorPrivate) { diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index 5b04a57..d3dcd51 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -94,6 +94,7 @@ QT_BEGIN_NAMESPACE #ifdef SSLEAY_MACROS DEFINEFUNC3(void *, ASN1_dup, i2d_of_void *a, a, d2i_of_void *b, b, char *c, c, return 0, return) #endif +DEFINEFUNC(long, ASN1_INTEGER_get, ASN1_INTEGER *a, a, return 0, return) DEFINEFUNC(unsigned char *, ASN1_STRING_data, ASN1_STRING *a, a, return 0, return) DEFINEFUNC(int, ASN1_STRING_length, ASN1_STRING *a, a, return 0, return) DEFINEFUNC4(long, BIO_ctrl, BIO *a, a, int b, b, long c, c, void *d, d, return -1, return) @@ -608,6 +609,7 @@ bool q_resolveOpenSslSymbols() #ifdef SSLEAY_MACROS RESOLVEFUNC(ASN1_dup) #endif + RESOLVEFUNC(ASN1_INTEGER_get) RESOLVEFUNC(ASN1_STRING_data) RESOLVEFUNC(ASN1_STRING_length) RESOLVEFUNC(BIO_ctrl) diff --git a/src/network/ssl/qsslsocket_openssl_symbols_p.h b/src/network/ssl/qsslsocket_openssl_symbols_p.h index f9c92e5..30762ca 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols_p.h +++ b/src/network/ssl/qsslsocket_openssl_symbols_p.h @@ -201,6 +201,7 @@ QT_BEGIN_NAMESPACE #endif // !defined QT_LINKED_OPENSSL bool q_resolveOpenSslSymbols(); +long q_ASN1_INTEGER_get(ASN1_INTEGER *a); unsigned char * q_ASN1_STRING_data(ASN1_STRING *a); int q_ASN1_STRING_length(ASN1_STRING *a); long q_BIO_ctrl(BIO *a, int b, long c, void *d); diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp index e1ab6a4..a883c42 100644 --- a/src/opengl/qglextensions.cpp +++ b/src/opengl/qglextensions.cpp @@ -175,10 +175,10 @@ bool qt_resolve_glsl_extensions(QGLContext *ctx) #if defined(QT_OPENGL_ES_2) // The GLSL shader functions are always present in OpenGL/ES 2.0. // The only exceptions are glGetProgramBinaryOES and glProgramBinaryOES. - if (!QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved) { + if (!QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved) { glGetProgramBinaryOES = (_glGetProgramBinaryOES) ctx->getProcAddress(QLatin1String("glGetProgramBinaryOES")); glProgramBinaryOES = (_glProgramBinaryOES) ctx->getProcAddress(QLatin1String("glProgramBinaryOES")); - QGLContextPrivate::qt_get_extension_funcs(ctx).qt_glslResolved = true; + QGLContextPrivate::extensionFuncs(ctx).qt_glslResolved = true; } return true; #else diff --git a/src/opengl/qglshaderprogram.cpp b/src/opengl/qglshaderprogram.cpp index 61d8b10..56b55d0 100644 --- a/src/opengl/qglshaderprogram.cpp +++ b/src/opengl/qglshaderprogram.cpp @@ -501,6 +501,25 @@ bool QGLShader::compile(const char *source) return d->compile(this); } else if (d->shader) { QVarLengthArray<const char *> src; + int headerLen = 0; + while (source && source[headerLen] == '#') { + // Skip #version and #extension directives at the start of + // the shader code. We need to insert the qualifierDefines + // and redefineHighp just after them. + if (qstrncmp(source + headerLen, "#version", 8) != 0 && + qstrncmp(source + headerLen, "#extension", 10) != 0) { + break; + } + while (source[headerLen] != '\0' && source[headerLen] != '\n') + ++headerLen; + if (source[headerLen] == '\n') + ++headerLen; + } + QByteArray header; + if (headerLen > 0) { + header = QByteArray(source, headerLen); + src.append(header.constData()); + } #ifdef QGL_DEFINE_QUALIFIERS src.append(qualifierDefines); #endif @@ -509,7 +528,7 @@ bool QGLShader::compile(const char *source) d->shaderType == PartialFragmentShader) src.append(redefineHighp); #endif - src.append(source); + src.append(source + headerLen); QGLContextGroup *ctx = d->ctx; glShaderSource(d->shader, src.size(), src.data(), 0); return d->compile(this); @@ -1094,6 +1113,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const if (!isLinked()) return QByteArray(); + QGLContextGroup *ctx = d->ctx; +#ifndef QT_NO_DEBUG + if (!qt_check_sharing_with_current_context(ctx)) + qWarning("QGLShaderProgram::programBinary: Program is not associated with current context."); +#endif + // Get the length of the binary data, bailing out if there is none. GLint length = 0; glGetProgramiv(d->program, GL_PROGRAM_BINARY_LENGTH_OES, &length); @@ -1124,6 +1149,12 @@ QByteArray QGLShaderProgram::programBinary(int *format) const bool QGLShaderProgram::setProgramBinary(int format, const QByteArray& binary) { #if defined(QT_OPENGL_ES_2) + QGLContextGroup *ctx = d->ctx; +#ifndef QT_NO_DEBUG + if (!qt_check_sharing_with_current_context(ctx)) + qWarning("QGLShaderProgram::setProgramBinary: Program is not associated with current context."); +#endif + // Load the binary and check that it was linked correctly. glProgramBinaryOES(d->program, (GLenum)format, binary.constData(), binary.size()); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp index fe77fd1..f207ebc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp @@ -41,7 +41,7 @@ #include "qdirectfbkeyboard.h" -#ifndef QT_NO_DIRECTFB +#ifndef QT_NO_QWS_DIRECTFB #include "qdirectfbscreen.h" #include <qobject.h> @@ -53,6 +53,8 @@ #include <fcntl.h> #include <errno.h> +QT_BEGIN_NAMESPACE + class KeyMap : public QHash<DFBInputDeviceKeySymbol, Qt::Key> { public: @@ -429,6 +431,6 @@ KeyMap::KeyMap() insert(DIKS_TILDE , Qt::Key_AsciiTilde); } +QT_END_NAMESPACE #include "qdirectfbkeyboard.moc" - -#endif // QT_NO_DIRECTFB +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h index 756892f..96d73ac 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.h @@ -42,13 +42,16 @@ #ifndef QDIRECTFBKEYBOARD_H #define QDIRECTFBKEYBOARD_H +#include <qglobal.h> #include <QtGui/qkbd_qws.h> +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER -QT_MODULE(Gui) +QT_BEGIN_NAMESPACE -#ifndef QT_NO_DIRECTFB +QT_MODULE(Gui) class QDirectFBKeyboardHandlerPrivate; @@ -62,7 +65,9 @@ private: QDirectFBKeyboardHandlerPrivate *d; }; -#endif // QT_NO_DIRECTFB +QT_END_NAMESPACE + +#endif // QT_NO_QWS_DIRECTFB QT_END_HEADER diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp index 1f2b363..2fb1520 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp @@ -41,6 +41,8 @@ #include "qdirectfbmouse.h" +#ifndef QT_NO_QWS_DIRECTFB + #include "qdirectfbscreen.h" #include <qsocketnotifier.h> @@ -49,6 +51,8 @@ #include <fcntl.h> #include <errno.h> +QT_BEGIN_NAMESPACE + class QDirectFBMouseHandlerPrivate : public QObject { Q_OBJECT @@ -269,5 +273,8 @@ void QDirectFBMouseHandler::resume() d->setEnabled(true); } +QT_END_NAMESPACE #include "qdirectfbmouse.moc" +#endif // QT_NO_QWS_DIRECTFB + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h index 14026ee..5ef229c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.h @@ -42,13 +42,16 @@ #ifndef QDIRECTFBMOUSE_H #define QDIRECTFBMOUSE_H +#include <qglobal.h> #include <QtGui/qmouse_qws.h> +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER -QT_MODULE(Gui) +QT_BEGIN_NAMESPACE -#ifndef QT_NO_DIRECTFB +QT_MODULE(Gui) class QDirectFBMouseHandlerPrivate; @@ -65,8 +68,8 @@ protected: QDirectFBMouseHandlerPrivate *d; }; -#endif // QT_NO_DIRECTFB +QT_END_NAMESPACE QT_END_HEADER - +#endif // QT_NO_QWS_DIRECTFB #endif // QDIRECTFBMOUSE_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index dec4bdd..106de0d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -39,12 +39,14 @@ ** ****************************************************************************/ -#ifndef QT_NO_DIRECTFB - #include "qdirectfbscreen.h" #include "qdirectfbpaintdevice.h" #include "qdirectfbpaintengine.h" +#ifndef QT_NO_QWS_DIRECTFB + +QT_BEGIN_NAMESPACE + QDirectFBPaintDevice::QDirectFBPaintDevice(QDirectFBScreen *scr) : QCustomRasterPaintDevice(0), dfbSurface(0), lockedImage(0), screen(scr), bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), @@ -169,5 +171,6 @@ QPaintEngine *QDirectFBPaintDevice::paintEngine() const return engine; } -#endif +QT_END_NAMESPACE +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h index ca958c8..f5de44b 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.h @@ -43,11 +43,14 @@ #define QDIRECTFBPAINTDEVICE_H #include <private/qpaintengine_raster_p.h> -#include <directfb.h> #include "qdirectfbscreen.h" +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) // Inherited by both window surface and pixmap @@ -57,7 +60,7 @@ class QDirectFBPaintDevice : public QCustomRasterPaintDevice public: ~QDirectFBPaintDevice(); - IDirectFBSurface *directFBSurface() const; + virtual IDirectFBSurface *directFBSurface() const; void lockDirectFB(DFBSurfaceLockFlags lock); void unlockDirectFB(); @@ -94,6 +97,9 @@ private: Q_DISABLE_COPY(QDirectFBPaintDevice); }; +QT_END_NAMESPACE + QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB #endif //QDIRECTFBPAINTDEVICE_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 337e75a..9a9553e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -41,7 +41,7 @@ #include "qdirectfbpaintengine.h" -#ifndef QT_NO_DIRECTFB +#ifndef QT_NO_QWS_DIRECTFB #include "qdirectfbwindowsurface.h" #include "qdirectfbscreen.h" @@ -55,6 +55,8 @@ #include <private/qpixmap_raster_p.h> #include <private/qimagepixmapcleanuphooks_p.h> +QT_BEGIN_NAMESPACE + class SurfaceCache; class QDirectFBPaintEnginePrivate : public QRasterPaintEnginePrivate { @@ -145,7 +147,9 @@ private: #ifdef QT_DIRECTFB_IMAGECACHE +QT_BEGIN_INCLUDE_NAMESPACE #include <private/qimage_p.h> +QT_END_INCLUDE_NAMESPACE struct CachedImage { IDirectFBSurface *surface; @@ -1246,4 +1250,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * } #endif // QT_DIRECTFB_WARN_ON_RASTERFALLBACKS -#endif // QT_NO_DIRECTFB + +QT_END_NAMESPACE + +#endif // QT_NO_QWS_DIRECTFB diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h index 51468ad..b4f0b5d 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.h @@ -45,8 +45,12 @@ #include <QtGui/qpaintengine.h> #include <private/qpaintengine_raster_p.h> +#ifndef QT_NO_QWS_DIRECTFB + QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) class QDirectFBPaintEnginePrivate; @@ -107,6 +111,10 @@ public: static void initImageCache(int size); }; +QT_END_NAMESPACE + QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB + #endif // QPAINTENGINE_DIRECTFB_P_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 2e3d32d..0717020 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -41,6 +41,8 @@ #include "qdirectfbpixmap.h" +#ifndef QT_NO_QWS_DIRECTFB + #include "qdirectfbscreen.h" #include "qdirectfbpaintengine.h" @@ -48,6 +50,9 @@ #include <QtCore/qfile.h> #include <directfb.h> + +QT_BEGIN_NAMESPACE + static int global_ser_no = 0; QDirectFBPixmapData::QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType) @@ -574,3 +579,9 @@ void QDirectFBPixmapData::invalidate() imageFormat = QImage::Format_Invalid; } +QT_END_NAMESPACE + +#endif // QT_NO_QWS_DIRECTFB + + + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index 8bf1e73..7b4ae47 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -42,6 +42,10 @@ #ifndef QDIRECTFBPIXMAP_H #define QDIRECTFBPIXMAP_H +#include <qglobal.h> + +#ifndef QT_NO_QWS_DIRECTFB + #include <QtGui/private/qpixmapdata_p.h> #include <QtGui/private/qpaintengine_raster_p.h> #include "qdirectfbpaintdevice.h" @@ -49,6 +53,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) class QDirectFBPaintEngine; @@ -91,6 +97,10 @@ private: bool alpha; }; +QT_END_NAMESPACE + QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB + #endif // QDIRECTFBPIXMAP_H diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 8be0355..59fa191 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -54,6 +54,10 @@ #include <QtCore/qvector.h> #include <QtCore/qrect.h> +#ifndef QT_NO_QWS_DIRECTFB + +QT_BEGIN_NAMESPACE + class QDirectFBScreenPrivate : public QObject, public QWSGraphicsSystem { Q_OBJECT @@ -94,8 +98,6 @@ public: QDirectFBScreen *q; }; -#include "qdirectfbscreen.moc" - QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr) : QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE), directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid), @@ -494,14 +496,6 @@ void QDirectFBScreen::setSurfaceColorTable(IDirectFBSurface *surface, #endif // QT_NO_DIRECTFB_PALETTE -#ifndef QT_NO_QWS_CURSOR -#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR -#define QT_DIRECTFB_CURSOR -#elif defined QT_DIRECTFB_LAYER -#define QT_DIRECTFB_CURSOR -#endif -#endif - #if defined QT_DIRECTFB_CURSOR class Q_GUI_EXPORT QDirectFBScreenCursor : public QScreenCursor { @@ -1015,7 +1009,7 @@ static void printDirectFBInfo(IDirectFB *fb, IDirectFBSurface *primarySurface) static inline bool setIntOption(const QStringList &arguments, const QString &variable, int *value) { Q_ASSERT(value); - QRegExp rx(QString("%1=?(\\d+)").arg(variable)); + QRegExp rx(QString::fromLatin1("%1=?(\\d+)").arg(variable)); rx.setCaseSensitivity(Qt::CaseInsensitive); if (arguments.indexOf(rx) != -1) { *value = rx.cap(1).toInt(); @@ -1024,36 +1018,6 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var return false; } -static inline int depth(QImage::Format format) -{ - switch (format) { - case QImage::Format_Mono: - case QImage::Format_MonoLSB: - return 1; - case QImage::Format_Indexed8: - return 8; - case QImage::Format_RGB32: - case QImage::Format_ARGB32: - case QImage::Format_ARGB32_Premultiplied: - return 32; - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_RGB666: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_RGB888: - return 24; - case QImage::Format_RGB555: - case QImage::Format_RGB444: - case QImage::Format_RGB16: - case QImage::Format_ARGB4444_Premultiplied: - return 16; - case QImage::Format_Invalid: - case QImage::NImageFormats: - break; - } - return -1; -} - bool QDirectFBScreen::connect(const QString &displaySpec) { DFBResult result = DFB_OK; @@ -1199,7 +1163,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) break; } setPixelFormat(pixelFormat); - QScreen::d = ::depth(pixelFormat); + QScreen::d = QDirectFBScreen::depth(pixelFormat); data = 0; lstep = 0; size = 0; @@ -1227,6 +1191,8 @@ bool QDirectFBScreen::connect(const QString &displaySpec) "Unable to get screen size!", result); return false; } + ::setIntOption(displayArgs, QLatin1String("width"), &w); + ::setIntOption(displayArgs, QLatin1String("height"), &h); dw = w; dh = h; @@ -1252,7 +1218,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec) surface->Release(surface); #endif - QRegExp backgroundColorRegExp("bgcolor=?(.+)"); + QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)")); backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive); if (displayArgs.indexOf(backgroundColorRegExp) != -1) { d_ptr->backgroundColor.setNamedColor(backgroundColorRegExp.cap(1)); @@ -1305,12 +1271,10 @@ bool QDirectFBScreen::initDevice() } #endif -#ifndef QT_NO_QWS_CURSOR -#if defined QT_NO_DIRECTFB_WM || defined QT_NO_DIRECTFB_LAYER - QScreenCursor::initSoftwareCursor(); -#else +#ifdef QT_DIRECTFB_CURSOR qt_screencursor = new QDirectFBScreenCursor; -#endif +#elif !defined QT_NO_QWS_CURSOR + QScreenCursor::initSoftwareCursor(); #endif return true; } @@ -1370,17 +1334,18 @@ QWSWindowSurface *QDirectFBScreen::createSurface(const QString &key) const // window surfaces. Normal, directFB surfaces are handled by DirectFB. void QDirectFBScreen::exposeRegion(QRegion r, int changing) { -#ifdef QT_NO_DIRECTFB_WM +#if defined QT_NO_DIRECTFB_WM const QList<QWSWindow*> windows = QWSServer::instance()->clientWindows(); - if (changing < 0 || changing >= windows.size()) + if (changing < 0 || changing >= windows.size()) { return; - + } QWSWindow *win = windows.at(changing); QWSWindowSurface *s = win->windowSurface(); r &= region(); - if (r.isEmpty()) + if (r.isEmpty()) { return; + } const QRect brect = r.boundingRect(); @@ -1398,15 +1363,18 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) ? static_cast<QDirectFBWindowSurface*>(s) : 0; if (dfbWindowSurface) { IDirectFBSurface *surface = dfbWindowSurface->directFBSurface(); + Q_ASSERT(surface); const int n = insideWindow.numRects(); if (n == 1 || d_ptr->directFBFlags & BoundingRectFlip) { const QRect source = (insideWindow.boundingRect().intersected(windowGeometry)).translated(-windowGeometry.topLeft()); const DFBRectangle rect = { source.x(), source.y(), source.width(), source.height() }; + d_ptr->primarySurface->Blit(d_ptr->primarySurface, surface, &rect, windowGeometry.x() + source.x(), windowGeometry.y() + source.y()); + } else { const QVector<QRect> rects = insideWindow.rects(); QVarLengthArray<DFBRectangle, 16> dfbRectangles(n); @@ -1429,6 +1397,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) } } +#ifdef QT_NO_DIRECTFB_CURSOR if (QScreenCursor *cursor = QScreenCursor::instance()) { const QRect cursorRectangle = cursor->boundingRect(); if (cursor->isVisible() && !cursor->isAccelerated() && cursorRectangle.intersects(brect)) { @@ -1442,6 +1411,7 @@ void QDirectFBScreen::exposeRegion(QRegion r, int changing) #endif } } +#endif flipSurface(d_ptr->primarySurface, d_ptr->flipFlags, r, QPoint()); #else Q_UNUSED(r); @@ -1459,8 +1429,8 @@ void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) return; d_ptr->primarySurface->SetColor(d_ptr->primarySurface, - color.red(), color.green(), color.blue(), - color.alpha()); + color.red(), color.green(), color.blue(), + color.alpha()); const int n = region.numRects(); if (n > 1) { const QRect r = region.boundingRect(); @@ -1590,3 +1560,8 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co return subSurface; } +QT_END_NAMESPACE + +#include "qdirectfbscreen.moc" +#endif // QT_NO_QWS_DIRECTFB + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index df0eea4..e74adb1 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -42,12 +42,16 @@ #ifndef QDIRECTFBSCREEN_H #define QDIRECTFBSCREEN_H +#include <qglobal.h> +#ifndef QT_NO_QWS_DIRECTFB #include <QtGui/qscreen_qws.h> #include <directfb.h> #include <directfb_version.h> QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) #if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER @@ -83,6 +87,16 @@ QT_MODULE(Gui) #if !defined QT_NO_DIRECTFB_OPAQUE_DETECTION && !defined QT_DIRECTFB_OPAQUE_DETECTION #define QT_DIRECTFB_OPAQUE_DETECTION #endif +#ifndef QT_NO_QWS_CURSOR +#if defined QT_DIRECTFB_WM && defined QT_DIRECTFB_WINDOW_AS_CURSOR +#define QT_DIRECTFB_CURSOR +#elif defined QT_DIRECTFB_LAYER +#define QT_DIRECTFB_CURSOR +#endif +#endif +#ifndef QT_DIRECTFB_CURSOR +#define QT_NO_DIRECTFB_CURSOR +#endif #if defined QT_NO_DIRECTFB_LAYER && defined QT_DIRECTFB_WM #error QT_NO_DIRECTFB_LAYER requires QT_NO_DIRECTFB_WM #endif @@ -269,6 +283,10 @@ inline bool QDirectFBScreen::hasAlphaChannel(IDirectFBSurface *surface) return QDirectFBScreen::hasAlphaChannel(format); } +QT_END_NAMESPACE + QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB #endif // QDIRECTFBSCREEN_H + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp index 4caee414..05fe70f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreenplugin.cpp @@ -43,6 +43,7 @@ #include <QtGui/qscreendriverplugin_qws.h> #include <QtCore/qstringlist.h> +#ifndef QT_NO_QWS_DIRECTFB class DirectFBScreenDriverPlugin : public QScreenDriverPlugin { @@ -73,3 +74,5 @@ QScreen* DirectFBScreenDriverPlugin::create(const QString& driver, } Q_EXPORT_PLUGIN2(qdirectfbscreen, DirectFBScreenDriverPlugin) + +#endif diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index a05ad21..73a6dd7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -48,11 +48,15 @@ #include <qpaintdevice.h> #include <qvarlengtharray.h> +#ifndef QT_NO_QWS_DIRECTFB + +QT_BEGIN_NAMESPACE + QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr) : QDirectFBPaintDevice(scr) + , sibling(0) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) - , sibling(0) #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) @@ -69,9 +73,9 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirectFBScreen *scr, QWidget *widget) : QWSWindowSurface(widget), QDirectFBPaintDevice(scr) + , sibling(0) #ifndef QT_NO_DIRECTFB_WM , dfbWindow(0) - , sibling(0) #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) @@ -243,23 +247,16 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) QByteArray QDirectFBWindowSurface::permanentState() const { -#ifdef QT_DIRECTFB_WM QByteArray state(sizeof(this), 0); *reinterpret_cast<const QDirectFBWindowSurface**>(state.data()) = this; return state; -#endif - return QByteArray(); } void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) { -#ifdef QT_DIRECTFB_WM if (state.size() == sizeof(this)) { sibling = *reinterpret_cast<QDirectFBWindowSurface *const*>(state.constData()); } -#else - Q_UNUSED(state); -#endif } static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) @@ -381,6 +378,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, } } +#ifdef QT_NO_DIRECTFB_CURSOR if (QScreenCursor *cursor = QScreenCursor::instance()) { const QRect cursorRectangle = cursor->boundingRect(); if (cursor->isVisible() && !cursor->isAccelerated() @@ -396,6 +394,7 @@ void QDirectFBWindowSurface::flush(QWidget *, const QRegion ®ion, #endif } } +#endif if (mode == Offscreen) { screen->flipSurface(primarySurface, flipFlags, region, offset + windowGeometry.topLeft()); } else @@ -424,6 +423,14 @@ void QDirectFBWindowSurface::endPaint(const QRegion &) unlockDirectFB(); } +IDirectFBSurface *QDirectFBWindowSurface::directFBSurface() const +{ + if (!dfbSurface && sibling && sibling->dfbSurface) + return sibling->dfbSurface; + return dfbSurface; +} + + IDirectFBSurface *QDirectFBWindowSurface::surfaceForWidget(const QWidget *widget, QRect *rect) const { Q_ASSERT(widget); @@ -449,3 +456,9 @@ void QDirectFBWindowSurface::updateFormat() { imageFormat = dfbSurface ? QDirectFBScreen::getImageFormat(dfbSurface) : QImage::Format_Invalid; } + +QT_END_NAMESPACE + +#endif // QT_NO_QWS_DIRECTFB + + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index a2861e5..ca76613 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -46,9 +46,10 @@ #include "qdirectfbpaintdevice.h" #include "qdirectfbscreen.h" +#ifndef QT_NO_QWS_DIRECTFB + #include <private/qpaintengine_raster_p.h> #include <private/qwindowsurface_qws_p.h> -#include <directfb.h> #ifdef QT_DIRECTFB_TIMING #include <qdatetime.h> @@ -56,6 +57,8 @@ QT_BEGIN_HEADER +QT_BEGIN_NAMESPACE + QT_MODULE(Gui) class QDirectFBWindowSurface : public QWSWindowSurface, public QDirectFBPaintDevice @@ -89,12 +92,14 @@ public: void endPaint(const QRegion &); IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const; + IDirectFBSurface *directFBSurface() const; private: void updateFormat(); + QDirectFBWindowSurface *sibling; + #ifdef QT_DIRECTFB_WM void createWindow(); IDirectFBWindow *dfbWindow; - QDirectFBWindowSurface *sibling; #else enum Mode { Primary, @@ -110,6 +115,10 @@ private: #endif }; +QT_END_NAMESPACE + QT_END_HEADER +#endif // QT_NO_QWS_DIRECTFB + #endif // QDIRECFBWINDOWSURFACE_H diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index 742d596..2692c96 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -323,12 +323,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni colSize *= 2; // a tiny bit faster, since it saves a SQLGetData() call } } - char* buf = new char[colSize]; + QVarLengthArray<char> buf(colSize); while (true) { r = SQLGetData(hStmt, column+1, unicode ? SQL_C_WCHAR : SQL_C_CHAR, - (SQLPOINTER)buf, + (SQLPOINTER)buf.data(), colSize, &lengthIndicator); if (r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) { @@ -343,11 +343,12 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni // colSize-1: remove 0 termination when there is more data to fetch int rSize = (r == SQL_SUCCESS_WITH_INFO) ? (unicode ? colSize-2 : colSize-1) : lengthIndicator; if (unicode) { - fieldVal += QString((QChar*) buf, rSize / 2); + fieldVal += QString((const QChar*) buf.constData(), rSize / 2); } else { - fieldVal += QString::fromAscii(buf, rSize); + fieldVal += QString::fromAscii(buf.constData(), rSize); } - if (lengthIndicator - fieldVal.size() <= 0) { + memset(buf.data(), 0, colSize); + if (lengthIndicator < colSize) { // workaround for Drivermanagers that don't return SQL_NO_DATA break; } @@ -359,7 +360,6 @@ static QString qGetStringData(SQLHANDLE hStmt, int column, int colSize, bool uni break; } } - delete[] buf; return fieldVal; } diff --git a/tests/auto/qmargins/tst_qmargins.cpp b/tests/auto/qmargins/tst_qmargins.cpp index 070aa19..6ee2495 100644 --- a/tests/auto/qmargins/tst_qmargins.cpp +++ b/tests/auto/qmargins/tst_qmargins.cpp @@ -9,8 +9,8 @@ ** No Commercial Usage ** This file contains pre-release code and may not be distributed. ** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. +** contained in the Technology Preview License Agreement accompanying +** this package. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser @@ -21,25 +21,24 @@ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this ** package. ** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** ** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at http://qt.nokia.com/contact. ** $QT_END_LICENSE$ ** ****************************************************************************/ - #include <QtTest/QtTest> #include <qmargins.h> diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index a6b887a..e9a0670 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -180,6 +180,8 @@ private slots: void odbc_uintfield(); void odbc_bindBoolean_data() { generic_data("QODBC"); } void odbc_bindBoolean(); + void odbc_testqGetString_data() { generic_data("QODBC"); } + void odbc_testqGetString(); void oci_serverDetach_data() { generic_data("QOCI"); } void oci_serverDetach(); // For task 154518 @@ -347,6 +349,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) << qTableName("numericfields") << qTableName("qtest_ibaseblobs") << qTableName("qtestBindBool") + << qTableName("testqGetString") << qTableName("qtest_sqlguid") << qTableName("uint_table") << qTableName("uint_test") @@ -2024,6 +2027,44 @@ void tst_QSqlDatabase::odbc_bindBoolean() QCOMPARE(q.value(1).toBool(), false); } +void tst_QSqlDatabase::odbc_testqGetString() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + + QSqlQuery q(db); + QVERIFY_SQL(q, exec("CREATE TABLE " + qTableName("testqGetString") + "(id int, vcvalue varchar(65538))")); + + QString largeString; + largeString.fill('A', 65536); + + // Bind and insert + QVERIFY_SQL(q, prepare("INSERT INTO " + qTableName("testqGetString") + " VALUES(?, ?)")); + q.bindValue(0, 1); + q.bindValue(1, largeString); + QVERIFY_SQL(q, exec()); + q.bindValue(0, 2); + q.bindValue(1, largeString+QLatin1Char('B')); + QVERIFY_SQL(q, exec()); + q.bindValue(0, 3); + q.bindValue(1, largeString+QLatin1Char('B')+QLatin1Char('C')); + QVERIFY_SQL(q, exec()); + + // Retrive + QVERIFY_SQL(q, exec("SELECT id, vcvalue FROM " + qTableName("testqGetString") + " ORDER BY id")); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 1); + QCOMPARE(q.value(1).toString().length(), 65536); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 2); + QCOMPARE(q.value(1).toString().length(), 65537); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 3); + QCOMPARE(q.value(1).toString().length(), 65538); +} + + void tst_QSqlDatabase::mysql_multiselect() { QFETCH(QString, dbName); diff --git a/tests/manual/qtabletevent/main.cpp b/tests/manual/qtabletevent/device_information/main.cpp index 44afcaf..69867bc 100644 --- a/tests/manual/qtabletevent/main.cpp +++ b/tests/manual/qtabletevent/device_information/main.cpp @@ -3,7 +3,7 @@ ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the test suite module of the Qt Toolkit. +** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -47,4 +47,4 @@ int main(int argc, char **argv) { TabletWidget tabletWidget; tabletWidget.showMaximized(); return app.exec(); -} +} diff --git a/tests/manual/qtabletevent/qtabletevent.pro b/tests/manual/qtabletevent/device_information/qtabletevent.pro index e0ed549..e0ed549 100644 --- a/tests/manual/qtabletevent/qtabletevent.pro +++ b/tests/manual/qtabletevent/device_information/qtabletevent.pro diff --git a/tests/manual/qtabletevent/tabletwidget.cpp b/tests/manual/qtabletevent/device_information/tabletwidget.cpp index 15a3d80..15a3d80 100644 --- a/tests/manual/qtabletevent/tabletwidget.cpp +++ b/tests/manual/qtabletevent/device_information/tabletwidget.cpp diff --git a/tests/manual/qtabletevent/tabletwidget.h b/tests/manual/qtabletevent/device_information/tabletwidget.h index d3ccb32..d3ccb32 100644 --- a/tests/manual/qtabletevent/tabletwidget.h +++ b/tests/manual/qtabletevent/device_information/tabletwidget.h diff --git a/tests/manual/qtabletevent/event_compression/event_compression.pro b/tests/manual/qtabletevent/event_compression/event_compression.pro new file mode 100644 index 0000000..273fd6c --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/event_compression.pro @@ -0,0 +1,7 @@ +TEMPLATE = app +QT += testlib + +# Input +SOURCES += main.cpp \ + mousestatwidget.cpp +HEADERS += mousestatwidget.h diff --git a/tests/manual/qtabletevent/event_compression/main.cpp b/tests/manual/qtabletevent/event_compression/main.cpp new file mode 100644 index 0000000..26611d3 --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "mousestatwidget.h" + +#include <QApplication> +#include <QWidget> +#include <QVBoxLayout> + +int main(int argc, char **argv){ + QApplication app(argc, argv); + + QWidget main; + QVBoxLayout *layout = new QVBoxLayout(&main); + layout->addWidget(new MouseStatWidget(true)); + layout->addWidget(new MouseStatWidget(false)); + main.resize(800, 600); + main.show(); + return app.exec(); +} diff --git a/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp new file mode 100644 index 0000000..024e14a --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/mousestatwidget.cpp @@ -0,0 +1,99 @@ +#include "mousestatwidget.h" + +#include <QTabletEvent> +#include <QPainter> +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QTextOption> +#include <QTest> + +MouseStatWidget::MouseStatWidget(bool acceptTabletEvent):acceptTabletEvent(acceptTabletEvent), + receivedMouseEventCount(0), + receivedMouseEventCountToPaint(0), + receivedTabletEventCount(0), + receivedTabletEventCountToPaint(0) +{ + startTimer(1000); +} + + +void MouseStatWidget::tabletEvent(QTabletEvent *event) +{ + ++receivedTabletEventCount; + if (acceptTabletEvent) + event->accept(); + else + event->ignore(); + // make sure the event loop is slow + QTest::qSleep(15); +} + +void MouseStatWidget::mouseMoveEvent(QMouseEvent *) +{ + ++receivedMouseEventCount; +} + +void MouseStatWidget::timerEvent(QTimerEvent *) +{ + receivedMouseEventCountToPaint = receivedMouseEventCount; + receivedTabletEventCountToPaint = receivedTabletEventCount; + receivedMouseEventCount = 0; + receivedTabletEventCount = 0; + update(); +} + +void MouseStatWidget::paintEvent(QPaintEvent *) +{ + QPainter painter(this); + painter.setPen(Qt::black); + painter.drawRect(rect()); + QStringList text; + text << ((acceptTabletEvent) ? " - tablet events accepted - " : " - tablet events ignored - "); + text << QString("Number of tablet events received in the last second: %1").arg(QString::number(receivedTabletEventCountToPaint)); + text << QString("Number of mouse events received in the last second: %1").arg(QString::number(receivedMouseEventCountToPaint)); + + QTextOption textOption(Qt::AlignCenter); + textOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere); + painter.drawText(rect(), + text.join("\n"), + textOption); +} diff --git a/tests/manual/qtabletevent/event_compression/mousestatwidget.h b/tests/manual/qtabletevent/event_compression/mousestatwidget.h new file mode 100644 index 0000000..22c0dff --- /dev/null +++ b/tests/manual/qtabletevent/event_compression/mousestatwidget.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the test suite module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.1, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOUSESTATWIDGET_H +#define MOUSESTATWIDGET_H + +#include <QWidget> + +class QTabletEvent; +class QMouseEvent; +class QTimerEvent; +class QPaintEvent; + +class MouseStatWidget : public QWidget +{ +public: + MouseStatWidget(bool acceptTabletEvent = true); +protected: + void tabletEvent(QTabletEvent *); + void mouseMoveEvent(QMouseEvent *); + void timerEvent(QTimerEvent *); + void paintEvent(QPaintEvent *); +private: + const bool acceptTabletEvent; + int receivedMouseEventCount; + int receivedMouseEventCountToPaint; + int receivedTabletEventCount; + int receivedTabletEventCountToPaint; +}; + +#endif // MOUSESTATWIDGET_H diff --git a/tools/qdoc3/test/classic.css b/tools/qdoc3/test/classic.css index f97bdbe..c0bc3d47 100644 --- a/tools/qdoc3/test/classic.css +++ b/tools/qdoc3/test/classic.css @@ -251,45 +251,25 @@ span.string,span.char .qmlname { white-space: nowrap; - font-weight: bold; - font-size: 125%; } .qmltype { - font-weight: bold; - font-size: 125%; -} - -.qmlproto, .qmldoc { - // border-top: 1px solid #84b0c7; + text-align: center; + font-size: 160%; } .qmlproto { - padding: 0; - //background-color: #e4e4e4;//#d5e1e8; - //font-weight: bold; - //-webkit-border-top-left-radius: 8px; - //-webkit-border-top-right-radius: 8px; - //-moz-border-radius-topleft: 8px; - //-moz-border-radius-topright: 8px; + background-color: #eee; + border-width: 1px; + border-style: solid; + border-color: #ddd; + font-weight: bold; + padding: 6px 0px 6px 10px; + margin: 42px 0px 0px 0px; } .qmldoc { - border-top: 1px solid #e4e4e4; - //padding: 2px 5px; - //background-color: #eef3f5; - //border-top-width: 0; - //-webkit-border-bottom-left-radius: 8px; - //-webkit-border-bottom-right-radius: 8px; - //-moz-border-radius-bottomleft: 8px; - //-moz-border-radius-bottomright: 8px; -} - -.qmldoc p, .qmldoc dl, .qmldoc ul { - //margin: 6px 0; } *.qmlitem p { - //margin-top: 0px; - //margin-bottom: 0px; } |