Merge remote branch 'staging/master' into refactor

Conflicts:
	src/opengl/qgl_qpa.cpp
	src/plugins/platforms/glxconvenience/qglxconvenience.cpp
	src/plugins/platforms/platforms.pro
	src/plugins/platforms/wayland/qwaylandwindow.cpp
	src/plugins/platforms/xcb/qxcbwindow.cpp
	src/plugins/platforms/xcb/qxcbwindow.h
	src/plugins/platforms/xcb/qxcbwindowsurface.cpp
	src/widgets/kernel/qwidget_qpa.cpp
	tests/auto/qvariant/tst_qvariant.cpp
This commit is contained in:
Samuel Rødal 2011-05-20 19:45:38 +02:00
commit d671acd5b2
1260 changed files with 2546 additions and 17731 deletions

27
configure vendored
View File

@ -751,6 +751,7 @@ CFG_DECORATION_PLUGIN_AVAILABLE=
CFG_DECORATION_PLUGIN=
CFG_XINPUT=runtime
CFG_XKB=auto
CFG_XCB=no
CFG_NIS=auto
CFG_CUPS=auto
CFG_ICONV=auto
@ -1043,7 +1044,7 @@ while [ "$#" -gt 0 ]; do
VAL=no
;;
#Qt style yes options
-incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu)
-incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu)
VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
VAL=yes
;;
@ -1971,6 +1972,13 @@ while [ "$#" -gt 0 ]; do
UNKNOWN_OPT=yes
fi
;;
xcb)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_XCB="$VAL"
else
UNKNOWN_OPT=yes
fi
;;
cups)
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
CFG_CUPS="$VAL"
@ -3711,6 +3719,14 @@ if [ "$OPT_HELP" = "yes" ]; then
PHN=" "
fi
if [ "$CFG_XCB" = "no" ]; then
XCY=" "
XCN="*"
else
XCY="*"
XCN=" "
fi
cat <<EOF
Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir <dir>]
[-docdir <dir>] [-headerdir <dir>] [-plugindir <dir> ] [-importdir <dir>] [-datadir <dir>]
@ -4061,6 +4077,9 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" -o "$PLATFORM_QPA" = "ye
$SBN -no-separate-debug-info . Do not store debug information in a separate file.
$SBY -separate-debug-info .... Strip debug information into a separate .debug file.
$XKN -no-xcb ............ Do not compile Xcb (X protocol C-language Binding) support.
$XKY -xcb ............... Compile Xcb support.
EOF
fi # X11/QWS
@ -7270,6 +7289,7 @@ fi
[ "$CFG_OPENSSL" = "yes" ] && QT_CONFIG="$QT_CONFIG openssl"
[ "$CFG_OPENSSL" = "linked" ] && QT_CONFIG="$QT_CONFIG openssl-linked"
[ "$CFG_MAC_HARFBUZZ" = "yes" ] && QT_CONFIG="$QT_CONFIG harfbuzz"
[ "$CFG_XCB" = "yes" ] && QT_CONFIG="$QT_CONFIG xcb"
if [ "$PLATFORM_X11" = "yes" ]; then
[ "$CFG_SM" = "yes" ] && QT_CONFIG="$QT_CONFIG x11sm"
@ -7524,10 +7544,8 @@ EOF
canBuildQtConcurrent="no"
;;
symbian-gcce)
canBuildQtConcurrent="no"
;;
symbian-armcc)
canBuildQtConcurrent="no"
;;
esac
@ -8256,7 +8274,7 @@ if [ "$XPLATFORM_SYMBIAN" = "yes" ]; then
# We cannot use Linux's default export rules since they export everything.
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_DLL"
# Disable non-working features.
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CONCURRENT QT_NO_QFUTURE QT_NO_CRASHHANDLER QT_NO_PRINTER QT_NO_SYSTEMTRAYICON"
QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_CRASHHANDLER QT_NO_PRINTER QT_NO_SYSTEMTRAYICON"
fi
if [ -n "$QCONFIG_FLAGS" ]; then
@ -8834,6 +8852,7 @@ if [ "$PLATFORM_MAC" = "yes" ]; then
fi
echo "ICD support ............ $CFG_ICD"
echo "libICU support ......... $CFG_ICU"
echo "Xcb support ............ $CFG_XCB"
echo
[ "$CFG_PTMALLOC" != "no" ] && echo "Use ptmalloc ........... $CFG_PTMALLOC"

Binary file not shown.

View File

@ -49,14 +49,9 @@
//! [0]
//! [3]
#define QT_USE_FAST_CONCATENATION
DEFINES *= QT_USE_QSTRINGBUILDER
//! [3]
//! [4]
#define QT_USE_FAST_CONCATENATION
#define QT_USE_FAST_OPERATOR_PLUS
//! [4]
//! [5]
#include <QStringBuilder>

View File

@ -38,6 +38,10 @@ embedded: check.commands += -qws
# Allow for custom arguments to tests
check.commands += $(TESTARGS)
# If the test is marked as insignificant, discard the exit code
insignificant_test:check.commands = -$${check.commands}
QMAKE_EXTRA_TARGETS *= check
!debug_and_release|build_pass {

View File

@ -57,9 +57,10 @@
# ifdef QT_USE_FAST_OPERATOR_PLUS
# undef QT_USE_FAST_OPERATOR_PLUS
# endif
# ifdef QT_USE_FAST_CONCATENATION
# undef QT_USE_FAST_CONCATENATION
# ifdef QT_USE_QSTRINGBUILDER
# undef QT_USE_QSTRINGBUILDER
# endif
#endif
@ -559,8 +560,7 @@ inline bool operator>=(const QByteArray &a1, const char *a2)
{ return qstrcmp(a1, a2) >= 0; }
inline bool operator>=(const char *a1, const QByteArray &a2)
{ return qstrcmp(a1, a2) >= 0; }
#ifndef QT_USE_FAST_OPERATOR_PLUS
# ifndef QT_USE_FAST_CONCATENATION
#if !defined(QT_USE_QSTRINGBUILDER)
inline const QByteArray operator+(const QByteArray &a1, const QByteArray &a2)
{ return QByteArray(a1) += a2; }
inline const QByteArray operator+(const QByteArray &a1, const char *a2)
@ -571,8 +571,7 @@ inline const QByteArray operator+(const char *a1, const QByteArray &a2)
{ return QByteArray(a1) += a2; }
inline const QByteArray operator+(char a1, const QByteArray &a2)
{ return QByteArray(&a1, 1) += a2; }
# endif // QT_USE_FAST_CONCATENATION
#endif // QT_USE_FAST_OPERATOR_PLUS
#endif // QT_USE_QSTRINGBUILDER
inline QBool QByteArray::contains(const char *c) const
{ return QBool(indexOf(c) != -1); }
inline QByteArray &QByteArray::replace(char before, const char *c)
@ -615,7 +614,7 @@ QT_END_NAMESPACE
QT_END_HEADER
#ifdef QT_USE_FAST_CONCATENATION
#ifdef QT_USE_QSTRINGBUILDER
#include <QtCore/qstring.h>
#endif

View File

@ -777,16 +777,12 @@ const QString::Null QString::null = { };
\snippet doc/src/snippets/qstring/stringbuilder.cpp 5
A more global approach is to include this define:
A more global approach which is the most convenient but
not entirely source compatible, is to this define in your
.pro file:
\snippet doc/src/snippets/qstring/stringbuilder.cpp 3
and use \c{'%'} instead of \c{'+'} for string concatenation
everywhere. The third approach, which is the most convenient but
not entirely source compatible, is to include two defines:
\snippet doc/src/snippets/qstring/stringbuilder.cpp 4
and the \c{'+'} will automatically be performed as the
\c{QStringBuilder} \c{'%'} everywhere.

View File

@ -1016,8 +1016,7 @@ inline int QByteArray::findRev(const QString &s, int from) const
# endif // QT3_SUPPORT
#endif // QT_NO_CAST_TO_ASCII
#ifndef QT_USE_FAST_OPERATOR_PLUS
# ifndef QT_USE_FAST_CONCATENATION
#if !defined(QT_USE_FAST_OPERATOR_PLUS) && !defined(QT_USE_QSTRINGBUILDER)
inline const QString operator+(const QString &s1, const QString &s2)
{ QString t(s1); t += s2; return t; }
inline const QString operator+(const QString &s1, QChar s2)
@ -1038,8 +1037,7 @@ inline QT_ASCII_CAST_WARN const QString operator+(const QByteArray &ba, const QS
inline QT_ASCII_CAST_WARN const QString operator+(const QString &s, const QByteArray &ba)
{ QString t(s); t += QString::fromAscii(ba.constData(), qstrnlen(ba.constData(), ba.size())); return t; }
# endif // QT_NO_CAST_FROM_ASCII
# endif // QT_USE_FAST_CONCATENATION
#endif // QT_USE_FAST_OPERATOR_PLUS
#endif // QT_USE_QSTRINGBUILDER
#ifndef QT_NO_STL
inline std::string QString::toStdString() const
@ -1288,7 +1286,7 @@ QT_END_NAMESPACE
QT_END_HEADER
#ifdef QT_USE_FAST_CONCATENATION
#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
#include <QtCore/qstringbuilder.h>
#endif

View File

@ -410,7 +410,9 @@ operator%(const A &a, const B &b)
return QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>(a, b);
}
#ifdef QT_USE_FAST_OPERATOR_PLUS
// QT_USE_FAST_OPERATOR_PLUS was introduced in 4.7, QT_USE_QSTRINGBUILDER is to be used from 4.8 onwards
// QT_USE_FAST_OPERATOR_PLUS does not remove the normal operator+ for QByteArray
#if defined(QT_USE_FAST_OPERATOR_PLUS) || defined(QT_USE_QSTRINGBUILDER)
template <typename A, typename B>
QStringBuilder<typename QConcatenable<A>::type, typename QConcatenable<B>::type>
operator+(const A &a, const B &b)

View File

@ -532,8 +532,7 @@ QString QColor::name() const
void QColor::setNamedColor(const QString &name)
{
if (!setColorFromString(name))
qWarning("QColor::setNamedColor: Unknown color name '%s'", name.toLatin1().constData());
setColorFromString(name);
}
/*!

View File

@ -986,7 +986,7 @@ public:
static inline Int32x4 v_toInt(Float32x4 x) { return vcvtq_s32_f32(x); }
static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return vcge_f32(a, b); }
static inline Int32x4 v_greaterOrEqual(Float32x4 a, Float32x4 b) { return vreinterpretq_s32_u32(vcgeq_f32(a, b)); }
};
const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data,

View File

@ -3008,8 +3008,16 @@ void QRasterPaintEngine::drawStaticTextItem(QStaticTextItem *textItem)
ensurePen();
ensureState();
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
textItem->fontEngine());
QRasterPaintEngineState *s = state();
QFontEngine *fontEngine = textItem->fontEngine();
const qreal pixelSize = fontEngine->fontDef.pixelSize;
if (pixelSize * pixelSize * qAbs(s->matrix.determinant()) < 64 * 64) {
drawCachedGlyphs(textItem->numGlyphs, textItem->glyphs, textItem->glyphPositions,
fontEngine);
} else {
QPaintEngineEx::drawStaticTextItem(textItem);
}
}
/*!

View File

@ -44,6 +44,8 @@
#include "qstroker_p.h"
#include "qbezier_p.h"
#include <private/qpainterpath_p.h>
#include <private/qfontengine_p.h>
#include <private/qstatictext_p.h>
#include <qvarlengtharray.h>
#include <qdebug.h>
@ -1057,5 +1059,38 @@ Q_GUI_EXPORT QPainterPath qt_painterPathFromVectorPath(const QVectorPath &path)
return p;
}
void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
{
QPainterPath path;
#ifndef Q_WS_MAC
path.setFillRule(Qt::WindingFill);
#endif
if (staticTextItem->numGlyphs == 0)
return;
QFontEngine *fontEngine = staticTextItem->fontEngine();
fontEngine->addGlyphsToPath(staticTextItem->glyphs, staticTextItem->glyphPositions,
staticTextItem->numGlyphs, &path, 0);
if (!path.isEmpty()) {
QPainterState *s = state();
QPainter::RenderHints oldHints = s->renderHints;
bool changedHints = false;
if (bool(oldHints & QPainter::TextAntialiasing)
&& !bool(fontEngine->fontDef.styleStrategy & QFont::NoAntialias)
&& !bool(oldHints & QPainter::Antialiasing)) {
s->renderHints |= QPainter::Antialiasing;
renderHintsChanged();
changedHints = true;
}
fill(qtVectorPathForPath(path), staticTextItem->color);
if (changedHints) {
s->renderHints = oldHints;
renderHintsChanged();
}
}
}
QT_END_NAMESPACE

View File

@ -201,7 +201,7 @@ public:
virtual void updateState(const QPaintEngineState &state);
virtual void drawStaticTextItem(QStaticTextItem *) = 0;
virtual void drawStaticTextItem(QStaticTextItem *);
virtual void setState(QPainterState *s);
inline QPainterState *state() { return static_cast<QPainterState *>(QPaintEngine::state); }

View File

@ -795,7 +795,7 @@ int QFontEngineFT::loadFlags(QGlyphSet *set, GlyphFormat format, int flags,
if (set && set->outline_drawing)
load_flags = FT_LOAD_NO_BITMAP;
if (default_hint_style == HintNone || (flags & HB_ShaperFlag_UseDesignMetrics))
if (default_hint_style == HintNone || (flags & HB_ShaperFlag_UseDesignMetrics) || set->outline_drawing)
load_flags |= FT_LOAD_NO_HINTING;
else
load_flags |= load_target;

View File

@ -720,7 +720,8 @@ Q_IPV6ADDR QHostAddress::toIPv6Address() const
Returns the address as a string.
For example, if the address is the IPv4 address 127.0.0.1, the
returned string is "127.0.0.1".
returned string is "127.0.0.1". For IPv6 the string format will
follow the RFC5952 recommendation.
\sa toIPv4Address()
*/
@ -741,8 +742,32 @@ QString QHostAddress::toString() const
ugle[i] = (quint16(d->a6[2*i]) << 8) | quint16(d->a6[2*i+1]);
}
QString s;
s.sprintf("%X:%X:%X:%X:%X:%X:%X:%X",
ugle[0], ugle[1], ugle[2], ugle[3], ugle[4], ugle[5], ugle[6], ugle[7]);
QString temp;
bool zeroDetected = false;
bool zeroShortened = false;
for (int i = 0; i < 8; i++) {
if ((ugle[i] != 0) || zeroShortened) {
temp.sprintf("%X", ugle[i]);
s.append(temp);
if (zeroDetected)
zeroShortened = true;
} else {
if (!zeroDetected) {
if (i<7 && (ugle[i+1] == 0)) {
s.append(QLatin1Char(':'));
zeroDetected = true;
} else {
temp.sprintf("%X", ugle[i]);
s.append(temp);
if (i<7)
s.append(QLatin1Char(':'));
}
}
}
if (i<7 && ((ugle[i] != 0) || zeroShortened || (i==0 && zeroDetected)))
s.append(QLatin1Char(':'));
}
if (!d->scopeId.isEmpty())
s.append(QLatin1Char('%') + d->scopeId);
return s;

View File

@ -219,7 +219,7 @@ static QNetworkInterfacePrivate *findInterface(int socket, QList<QNetworkInterfa
#ifdef SIOCGIFHWADDR
// Get the HW address
if (qt_safe_ioctl(socket, SIOCGIFHWADDR, &req) >= 0) {
uchar *addr = (uchar *)&req.ifr_addr;
uchar *addr = (uchar *)req.ifr_addr.sa_data;
iface->hardwareAddress = iface->makeHwAddress(6, addr);
}
#endif

View File

@ -1436,19 +1436,30 @@ void QGL2PaintEngineEx::drawStaticTextItem(QStaticTextItem *textItem)
ensureActive();
QFontEngineGlyphCache::Type glyphType = textItem->fontEngine()->glyphFormat >= 0
? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
: d->glyphCacheType;
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
if (d->device->alphaRequested() || state()->matrix.type() > QTransform::TxTranslate
|| (state()->composition_mode != QPainter::CompositionMode_Source
&& state()->composition_mode != QPainter::CompositionMode_SourceOver))
{
glyphType = QFontEngineGlyphCache::Raster_A8;
}
}
QPainterState *s = state();
float det = s->matrix.determinant();
d->drawCachedGlyphs(glyphType, textItem);
// don't try to cache huge fonts or vastly transformed fonts
QFontEngine *fontEngine = textItem->fontEngine();
const qreal pixelSize = fontEngine->fontDef.pixelSize;
if (pixelSize * pixelSize * qAbs(det) < QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE ||
det < 0.25f || det > 4.f) {
QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0
? QFontEngineGlyphCache::Type(textItem->fontEngine()->glyphFormat)
: d->glyphCacheType;
if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) {
if (d->device->alphaRequested() || s->matrix.type() > QTransform::TxTranslate
|| (s->composition_mode != QPainter::CompositionMode_Source
&& s->composition_mode != QPainter::CompositionMode_SourceOver))
{
glyphType = QFontEngineGlyphCache::Raster_A8;
}
}
d->drawCachedGlyphs(glyphType, textItem);
} else {
QPaintEngineEx::drawStaticTextItem(textItem);
}
}
bool QGL2PaintEngineEx::drawTexture(const QRectF &dest, GLuint textureId, const QSize &size, const QRectF &src)

View File

@ -83,21 +83,21 @@ QGLFormat QGLFormat::fromWindowFormat(const QWindowFormat &format)
QWindowFormat QGLFormat::toWindowFormat(const QGLFormat &format)
{
QWindowFormat retFormat;
if (format.alphaBufferSize() >= 0)
retFormat.setAlphaBufferSize(format.alphaBufferSize());
if (format.alpha())
retFormat.setAlphaBufferSize(format.alphaBufferSize() == -1 ? 1 : format.alphaBufferSize());
if (format.blueBufferSize() >= 0)
retFormat.setBlueBufferSize(format.blueBufferSize());
if (format.greenBufferSize() >= 0)
retFormat.setGreenBufferSize(format.greenBufferSize());
if (format.redBufferSize() >= 0)
retFormat.setRedBufferSize(format.redBufferSize());
if (format.depthBufferSize() >= 0)
retFormat.setDepthBufferSize(format.depthBufferSize());
if (format.depth())
retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize());
retFormat.setSwapBehavior(format.doubleBuffer() ? QWindowFormat::DoubleBuffer : QWindowFormat::DefaultSwapBehavior);
if (format.sampleBuffers() && format.samples() > 1)
retFormat.setSamples(format.samples());
if (format.stencil() && format.stencilBufferSize() > 0)
retFormat.setStencilBufferSize(format.stencilBufferSize());
if (format.sampleBuffers())
retFormat.setSamples(format.samples() == -1 ? 4 : format.samples());
if (format.stencil())
retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize());
retFormat.setStereo(format.stereo());
return retFormat;
}
@ -138,6 +138,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
winFormat.setSharedContext(shareContext->d_func()->windowContext);
}
widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
if (widget->testAttribute(Qt::WA_TranslucentBackground))
winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
winFormat.setWindowSurface(false);
widget->windowHandle()->setWindowFormat(winFormat);
widget->winId();//make window

View File

@ -362,17 +362,17 @@ QGLShader::ShaderType QGLShader::shaderType() const
// The precision qualifiers are useful on OpenGL/ES systems,
// but usually not present on desktop systems. Define the
// keywords to empty strings on desktop systems.
#ifndef QT_OPENGL_ES
#if !defined(QT_OPENGL_ES) || defined(QT_OPENGL_FORCE_SHADER_DEFINES)
#define QGL_DEFINE_QUALIFIERS 1
static const char qualifierDefines[] =
"#define lowp\n"
"#define mediump\n"
"#define highp\n";
#endif
#else
// The "highp" qualifier doesn't exist in fragment shaders
// on all ES platforms. When it doesn't exist, use "mediump".
#ifdef QT_OPENGL_ES
#define QGL_REDEFINE_HIGHP 1
static const char redefineHighp[] =
"#ifndef GL_FRAGMENT_PRECISION_HIGH\n"

View File

@ -485,19 +485,30 @@ void QGLWindowSurface::beginPaint(const QRegion &)
d_ptr->did_paint = true;
updateGeometry();
if (!context())
return;
int clearFlags = 0;
if (context()->d_func()->workaround_needsFullClearOnEveryFrame)
#if 0
QGLContext *ctx = reinterpret_cast<QGLContext *>(window()->d_func()->extraData()->glContext);
#endif
const QGLContext *ctx = QGLContext::currentContext();
if (!ctx)
return;
if (ctx->d_func()->workaround_needsFullClearOnEveryFrame)
clearFlags = GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
else if (context()->format().alpha())
else if (ctx->format().alpha())
clearFlags = GL_COLOR_BUFFER_BIT;
if (clearFlags) {
if (d_ptr->fbo)
d_ptr->fbo->bind();
glClearColor(0.0, 0.0, 0.0, 0.0);
glClear(clearFlags);
if (d_ptr->fbo)
d_ptr->fbo->release();
}
}

View File

@ -155,7 +155,9 @@ QString QSjisCodec::convertToUnicode(const char* chars, int len, ConverterState
uchar ch = chars[i];
switch (nbuf) {
case 0:
if (ch < 0x80 || IsKana(ch)) {
if (ch < 0x80) {
result += QValidChar(ch);
} else if (IsKana(ch)) {
// JIS X 0201 Latin or JIS X 0201 Kana
u = conv->jisx0201ToUnicode(ch);
result += QValidChar(u);

View File

@ -5,3 +5,11 @@ HEADERS += \
SOURCES += \
$$PWD/qglxconvenience.cpp
CONFIG += xrender
xrender {
LIBS += -lXrender
} else {
DEFINES += QT_NO_XRENDER
}

View File

@ -43,6 +43,10 @@
#include <QtCore/QVector>
#ifndef QT_NO_XRENDER
#include <X11/extensions/Xrender.h>
#endif
enum {
XFocusOut = FocusOut,
XFocusIn = FocusIn,
@ -76,19 +80,25 @@ QVector<int> qglx_buildSpec(const QWindowFormat &format, int drawableBit)
spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = drawableBit;
spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT;
spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize();
spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize();
spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize();
if (format.hasAlpha()) {
spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize();
spec[i++] = GLX_ALPHA_SIZE; spec[i++] = format.alphaBufferSize();
}
spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.swapBehavior() != QWindowFormat::SingleBuffer ? True : False;
spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False;
spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize();
if (format.depthBufferSize() > 0) {
spec[i++] = GLX_DEPTH_SIZE; spec[i++] = format.depthBufferSize();
}
spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
if (format.stencilBufferSize() > 0) {
spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize();
}
if (format.samples() > 1) {
spec[i++] = GLX_SAMPLE_BUFFERS_ARB;
@ -119,8 +129,17 @@ GLXFBConfig qglx_findConfig(Display *display, int screen , const QWindowFormat &
if (reducedFormat.hasAlpha()) {
int alphaSize;
glXGetFBConfigAttrib(display,configs[i],GLX_ALPHA_SIZE,&alphaSize);
if (alphaSize > 0)
break;
if (alphaSize > 0) {
XVisualInfo *visual = glXGetVisualFromFBConfig(display, chosenConfig);
#if !defined(QT_NO_XRENDER)
XRenderPictFormat *pictFormat = XRenderFindVisualFormat(display, visual->visual);
if (pictFormat->direct.alphaMask > 0)
break;
#else
if (visual->depth == 32)
break;
#endif
}
} else {
break; // Just choose the first in the list if there's no alpha requested
}

View File

@ -50,8 +50,8 @@ QMinimalIntegration::QMinimalIntegration()
QMinimalScreen *mPrimaryScreen = new QMinimalScreen();
mPrimaryScreen->mGeometry = QRect(0, 0, 240, 320);
mPrimaryScreen->mDepth = 16;
mPrimaryScreen->mFormat = QImage::Format_RGB16;
mPrimaryScreen->mDepth = 32;
mPrimaryScreen->mFormat = QImage::Format_ARGB32_Premultiplied;
mScreens.append(mPrimaryScreen);
}

View File

@ -51,7 +51,7 @@ class QMinimalScreen : public QPlatformScreen
{
public:
QMinimalScreen()
: mDepth(16), mFormat(QImage::Format_RGB16) {}
: mDepth(32), mFormat(QImage::Format_ARGB32_Premultiplied) {}
QRect geometry() const { return mGeometry; }
int depth() const { return mDepth; }

View File

@ -6,7 +6,10 @@ contains(QT_CONFIG, wayland) {
SUBDIRS += wayland
}
contains(QT_CONFIG, xcb) {
SUBDIRS += xcb
}
mac {
SUBDIRS += cocoa
}

View File

@ -132,10 +132,12 @@ void QWaylandXCompositeGLXContext::geometryChanged()
Colormap cmap = XCreateColormap(mGlxIntegration->xDisplay(),mGlxIntegration->rootWindow(),visualInfo->visual,AllocNone);
XSetWindowAttributes a;
a.background_pixel = WhitePixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen());
a.border_pixel = BlackPixel(mGlxIntegration->xDisplay(), mGlxIntegration->screen());
a.colormap = cmap;
mXWindow = XCreateWindow(mGlxIntegration->xDisplay(), mGlxIntegration->rootWindow(),0, 0, size.width(), size.height(),
0, visualInfo->depth, InputOutput, visualInfo->visual,
CWColormap, &a);
CWBackPixel|CWBorderPixel|CWColormap, &a);
XCompositeRedirectWindow(mGlxIntegration->xDisplay(), mXWindow, CompositeRedirectManual);
XMapWindow(mGlxIntegration->xDisplay(), mXWindow);

View File

@ -48,7 +48,7 @@
#include <QtCore/QStringList>
#include <QtCore/QFile>
#include <QtCore/QtDebug>
#include <QtWidgets/private/qdnd_p.h>
#include <QtGui/private/qdnd_p.h>
static QWaylandClipboard *clipboard;

View File

@ -51,6 +51,10 @@
#include "gl_integration/qwaylandglintegration.h"
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
#include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
#endif
#include <QtCore/QAbstractEventDispatcher>
#include <QtGui/private/qguiapplication_p.h>
@ -96,6 +100,13 @@ QWaylandGLIntegration * QWaylandDisplay::eglIntegration()
}
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
QWaylandWindowManagerIntegration *QWaylandDisplay::windowManagerIntegration()
{
return mWindowManagerIntegration;
}
#endif
void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell,
uint32_t time, uint32_t edges,
struct wl_surface *surface,
@ -135,6 +146,10 @@ QWaylandDisplay::QWaylandDisplay(void)
mEglIntegration->initialize();
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mWindowManagerIntegration = QWaylandWindowManagerIntegration::createIntegration(this);
#endif
connect(QAbstractEventDispatcher::instance(), SIGNAL(aboutToBlock()), this, SLOT(flushRequests()));
mFd = wl_display_get_fd(mDisplay, sourceUpdate, this);

View File

@ -55,6 +55,8 @@ class QWaylandBuffer;
class QPlatformScreen;
class QWaylandScreen;
class QWaylandGLIntegration;
class QWaylandWindowManagerIntegration;
class QWaylandDisplay : public QObject {
Q_OBJECT
@ -74,6 +76,11 @@ public:
#ifdef QT_WAYLAND_GL_SUPPORT
QWaylandGLIntegration *eglIntegration();
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
QWaylandWindowManagerIntegration *windowManagerIntegration();
#endif
void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y);
void syncCallback(wl_display_sync_func_t func, void *data);
@ -124,6 +131,10 @@ private:
QWaylandGLIntegration *mEglIntegration;
#endif
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
QWaylandWindowManagerIntegration *mWindowManagerIntegration;
#endif
static void shellHandleConfigure(void *data, struct wl_shell *shell,
uint32_t time, uint32_t edges,
struct wl_surface *surface,

View File

@ -47,6 +47,12 @@
#include "qwaylandscreen.h"
#include <QtGui/QWindow>
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
#include "windowmanager_integration/qwaylandwindowmanagerintegration.h"
#endif
#include <QCoreApplication>
#include <QtGui/QWindowSystemInterface>
#include <QDebug>
@ -60,6 +66,10 @@ QWaylandWindow::QWaylandWindow(QWindow *window)
static WId id = 1;
mWindowId = id++;
#ifdef QT_WAYLAND_WINDOWMANAGER_SUPPORT
mDisplay->windowManagerIntegration()->mapClientToProcess(qApp->applicationPid());
#endif
mSurface = mDisplay->createSurface(this);
}
@ -120,7 +130,6 @@ void QWaylandWindow::attach(QWaylandBuffer *buffer)
}
}
void QWaylandWindow::damage(const QRegion &region)
{
//We have to do sync stuff before calling damage, or we might

View File

@ -45,8 +45,10 @@ QT += core-private
QT += widgets-private
include ($$PWD/gl_integration/gl_integration.pri)
include ($$PWD/windowmanager_integration/windowmanager_integration.pri)
include (../fontdatabases/genericunix/genericunix.pri)
target.path += $$[QT_INSTALL_PLUGINS]/platforms
INSTALLS += target

View File

@ -0,0 +1,82 @@
/*
* Copyright © 2010 Kristian Høgsberg
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#ifndef WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
#define WAYLAND_WINDOWMANAGER_CLIENT_PROTOCOL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdint.h>
#include <stddef.h>
#include "wayland-util.h"
struct wl_client;
struct wl_windowmanager;
extern const struct wl_interface wl_windowmanager_interface;
#define WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS 0
static inline struct wl_windowmanager *
wl_windowmanager_create(struct wl_display *display, uint32_t id, uint32_t /*version*/)
{
// ### does not run without latest wayland. must be enabled later
//wl_display_bind(display, id, "wl_windowmanager", version);
return (struct wl_windowmanager *)
wl_proxy_create_for_id(display, &wl_windowmanager_interface, id);
}
static inline void
wl_windowmanager_set_user_data(struct wl_windowmanager *wl_windowmanager, void *user_data)
{
wl_proxy_set_user_data((struct wl_proxy *) wl_windowmanager, user_data);
}
static inline void *
wl_windowmanager_get_user_data(struct wl_windowmanager *wl_windowmanager)
{
return wl_proxy_get_user_data((struct wl_proxy *) wl_windowmanager);
}
static inline void
wl_windowmanager_destroy(struct wl_windowmanager *wl_windowmanager)
{
wl_proxy_destroy((struct wl_proxy *) wl_windowmanager);
}
static inline void
wl_windowmanager_map_client_to_process(struct wl_windowmanager *wl_windowmanager, uint32_t processid)
{
wl_proxy_marshal((struct wl_proxy *) wl_windowmanager,
WL_WINDOWMANAGER_MAP_CLIENT_TO_PROCESS, processid);
}
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,85 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins 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 "qwaylandwindowmanagerintegration.h"
#include "qwaylandwindowmanager-client-protocol.h"
#include <stdint.h>
QWaylandWindowManagerIntegration *QWaylandWindowManagerIntegration::createIntegration(QWaylandDisplay *waylandDisplay)
{
return new QWaylandWindowManagerIntegration(waylandDisplay);
}
QWaylandWindowManagerIntegration::QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay)
: mWaylandDisplay(waylandDisplay)
, mWaylandWindowManager(0)
{
wl_display_add_global_listener(mWaylandDisplay->wl_display(),
QWaylandWindowManagerIntegration::wlHandleListenerGlobal,
this);
}
QWaylandWindowManagerIntegration::~QWaylandWindowManagerIntegration()
{
}
struct wl_windowmanager *QWaylandWindowManagerIntegration::windowManager() const
{
return mWaylandWindowManager;
}
void QWaylandWindowManagerIntegration::wlHandleListenerGlobal(wl_display *display, uint32_t id, const char *interface,
uint32_t version, void *data)
{
if (strcmp(interface, "wl_windowmanager") == 0) {
QWaylandWindowManagerIntegration *integration = static_cast<QWaylandWindowManagerIntegration *>(data);
integration->mWaylandWindowManager = wl_windowmanager_create(display,id, version);
}
}
void QWaylandWindowManagerIntegration::mapClientToProcess(long long processId)
{
if (mWaylandWindowManager)
wl_windowmanager_map_client_to_process(mWaylandWindowManager, (uint32_t) processId);
}

View File

@ -0,0 +1,69 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the plugins 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 QWAYLANDWINDOWMANAGERINTEGRATION_H
#define QWAYLANDWINDOWMANAGERINTEGRATION_H
#include <QObject>
#include "wayland-client.h"
#include "qwaylanddisplay.h"
class QWaylandWindowManagerIntegration
{
public:
explicit QWaylandWindowManagerIntegration(QWaylandDisplay *waylandDisplay);
virtual ~QWaylandWindowManagerIntegration();
static QWaylandWindowManagerIntegration *createIntegration(QWaylandDisplay *waylandDisplay);
struct wl_windowmanager *windowManager() const;
void mapSurfaceToProcess(struct wl_surface *surface, long long processId);
void mapClientToProcess(long long processId);
private:
static void wlHandleListenerGlobal(wl_display *display, uint32_t id,
const char *interface, uint32_t version, void *data);
private:
QWaylandDisplay *mWaylandDisplay;
struct wl_windowmanager *mWaylandWindowManager;
};
#endif // QWAYLANDWINDOWMANAGERINTEGRATION_H

View File

@ -0,0 +1,36 @@
/*
* Copyright © 2010 Kristian Høgsberg
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
* the above copyright notice appear in all copies and that both that copyright
* notice and this permission notice appear in supporting documentation, and
* that the name of the copyright holders not be used in advertising or
* publicity pertaining to distribution of the software without specific,
* written prior permission. The copyright holders make no representations
* about the suitability of this software for any purpose. It is provided "as
* is" without express or implied warranty.
*
* THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
* EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
* OF THIS SOFTWARE.
*/
#include <stdlib.h>
#include <stdint.h>
#include "wayland-util.h"
static const struct wl_message wl_windowmanager_requests[] = {
{ "map_client_to_process", "u", NULL },
};
WL_EXPORT const struct wl_interface wl_windowmanager_interface = {
"wl_windowmanager", 1,
ARRAY_LENGTH(wl_windowmanager_requests), wl_windowmanager_requests,
0, NULL,
};

View File

@ -0,0 +1,16 @@
DEFINES += QT_WAYLAND_WINDOWMANAGER_SUPPORT
contains(DEFINES, QT_WAYLAND_WINDOWMANAGER_SUPPORT) {
HEADERS += \
$$PWD/qwaylandwindowmanager-client-protocol.h \
$$PWD/qwaylandwindowmanagerintegration.h
SOURCES += \
$$PWD/qwaylandwindowmanagerintegration.cpp \
$$PWD/wayland-windowmanager-protocol.c
}

View File

@ -140,8 +140,9 @@ void QXcbWindow::create()
xcb_parent_id = static_cast<QXcbWindow *>(parent())->xcb_window();
#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL)
if (window()->surfaceType() == QWindow::OpenGLSurface
if ((window()->surfaceType() == QWindow::OpenGLSurface
&& QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
|| window()->requestedWindowFormat().hasAlpha())
{
#if defined(XCB_USE_GLX)
XVisualInfo *visualInfo = qglx_findVisualInfo(DISPLAY_FROM_XCB(m_screen),m_screen->screenNumber(), window()->requestedWindowFormat());
@ -159,13 +160,17 @@ void QXcbWindow::create()
visualInfo = XGetVisualInfo(DISPLAY_FROM_XCB(this), VisualIDMask, &visualInfoTemplate, &matchingCount);
#endif //XCB_USE_GLX
if (visualInfo) {
m_depth = visualInfo->depth;
m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), xcb_parent_id, visualInfo->visual, AllocNone);
XSetWindowAttributes a;
a.background_pixel = WhitePixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber());
a.border_pixel = BlackPixel(DISPLAY_FROM_XCB(this), m_screen->screenNumber());
a.colormap = cmap;
m_window = XCreateWindow(DISPLAY_FROM_XCB(this), xcb_parent_id, rect.x(), rect.y(), rect.width(), rect.height(),
0, visualInfo->depth, InputOutput, visualInfo->visual,
CWColormap, &a);
CWBackPixel|CWBorderPixel|CWColormap, &a);
printf("created GL window: %x\n", m_window);
} else {
@ -175,6 +180,8 @@ void QXcbWindow::create()
#endif //defined(XCB_USE_GLX) || defined(XCB_USE_EGL)
{
m_window = xcb_generate_id(xcb_connection());
m_depth = m_screen->screen()->root_depth;
m_format = (m_depth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
Q_XCB_CALL(xcb_create_window(xcb_connection(),
XCB_COPY_FROM_PARENT, // depth -- same as root

View File

@ -44,6 +44,7 @@
#include <QtGui/QPlatformWindow>
#include <QtGui/QWindowFormat>
#include <QtGui/QImage>
#include <xcb/xcb.h>
#include <xcb/sync.h>
@ -76,6 +77,8 @@ public:
QPlatformGLContext *glContext() const;
xcb_window_t xcb_window() const { return m_window; }
uint depth() const { return m_depth; }
QImage::Format format() const { return m_format; }
void handleExposeEvent(const xcb_expose_event_t *event);
void handleClientMessageEvent(const xcb_client_message_event_t *event);
@ -116,6 +119,9 @@ private:
xcb_window_t m_window;
QPlatformGLContext *m_context;
uint m_depth;
QImage::Format m_format;
xcb_sync_int64_t m_syncValue;
xcb_sync_counter_t m_syncCounter;

View File

@ -54,11 +54,12 @@
#include <stdio.h>
#include <qdebug.h>
#include <qpainter.h>
class QXcbShmImage : public QXcbObject
{
public:
QXcbShmImage(QXcbScreen *connection, const QSize &size);
QXcbShmImage(QXcbScreen *connection, const QSize &size, uint depth, QImage::Format format);
~QXcbShmImage() { destroy(); }
QImage *image() { return &m_qimage; }
@ -81,7 +82,7 @@ private:
QRegion m_dirty;
};
QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size)
QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size, uint depth, QImage::Format format)
: QXcbObject(screen->connection())
, m_gc(0)
, m_gc_window(0)
@ -91,7 +92,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size)
size.width(),
size.height(),
XCB_IMAGE_FORMAT_Z_PIXMAP,
screen->depth(),
depth,
0,
~0,
0);
@ -111,7 +112,7 @@ QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size)
if (shmctl(m_shm_info.shmid, IPC_RMID, 0) == -1)
qWarning() << "QXcbWindowSurface: Error while marking the shared memory segment to be destroyed";
m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, screen->format());
m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, format);
}
void QXcbShmImage::destroy()
@ -189,6 +190,16 @@ QPaintDevice *QXcbWindowSurface::paintDevice()
void QXcbWindowSurface::beginPaint(const QRegion &region)
{
m_image->preparePaint(region);
if (m_image->image()->hasAlphaChannel()) {
QPainter p(m_image->image());
p.setCompositionMode(QPainter::CompositionMode_Source);
const QVector<QRect> rects = region.rects();
const QColor blank = Qt::transparent;
for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
p.fillRect(*it, blank);
}
}
}
void QXcbWindowSurface::endPaint(const QRegion &)
@ -229,9 +240,10 @@ void QXcbWindowSurface::resize(const QSize &size)
QWindowSurface::resize(size);
QXcbScreen *screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWindow(window()));
QXcbWindow* win = static_cast<QXcbWindow *>(window()->handle());
delete m_image;
m_image = new QXcbShmImage(screen, size);
m_image = new QXcbShmImage(screen, size, win->depth(), win->format());
Q_XCB_NOOP(connection());
m_syncingResize = true;

View File

@ -150,7 +150,7 @@ bool QXlibIntegration::hasOpenGL() const
{
#if !defined(QT_NO_OPENGL)
#if !defined(QT_OPENGL_ES_2)
QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0));
QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens.at(0));
return glXQueryExtension(screen->display()->nativeDisplay(), 0, 0) != 0;
#else
static bool eglHasbeenInitialized = false;

View File

@ -41,6 +41,8 @@
#include "qxlibscreen.h"
#include <X11/extensions/Xfixes.h>
#include "qxlibcursor.h"
#include "qxlibwindow.h"
#include "qxlibkeyboard.h"
@ -54,8 +56,6 @@
#include <private/qapplication_p.h>
#include <X11/extensions/Xfixes.h>
QT_BEGIN_NAMESPACE
static int (*original_x_errhandler)(Display *dpy, XErrorEvent *);
@ -201,7 +201,7 @@ QXlibScreen::QXlibScreen()
#ifndef DONT_USE_MIT_SHM
Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay->nativeDisplay());
int MIT_SHM_extension_supported = XShmQueryExtension (mDisplay->nativeDisplay());
Q_ASSERT(MIT_SHM_extension_supported == True);
#endif
original_x_errhandler = XSetErrorHandler(qt_x_errhandler);

View File

@ -51,10 +51,6 @@
#include <QDebug>
#ifndef QT_NO_XFIXES
#include <X11/extensions/Xfixes.h>
#endif // QT_NO_XFIXES
static const char * x11_atomnames = {
// window-manager <-> client protocols
"WM_PROTOCOLS\0"

View File

@ -135,6 +135,7 @@ typedef char *XPointer;
#endif
#ifndef QT_NO_XFIXES
#include <X11/extensions/Xfixes.h>
typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *);
typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *);
typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name);

View File

@ -47,14 +47,6 @@
#include "qxlibstatic.h"
#include "qxlibdisplay.h"
#include <QtGui/QWindowSystemInterface>
#include <QSocketNotifier>
#include <QApplication>
#include <QDebug>
#include <QtGui/private/qwindowsurface_p.h>
#include <QtGui/private/qapplication_p.h>
#if !defined(QT_NO_OPENGL)
#if !defined(QT_OPENGL_ES_2)
#include "qglxintegration.h"
@ -66,6 +58,15 @@
#endif //QT_OPENGL_ES_2
#endif //QT_NO_OPENGL
#include <QtGui/QWindowSystemInterface>
#include <QSocketNotifier>
#include <QApplication>
#include <QDebug>
#include <QtGui/private/qwindowsurface_p.h>
#include <QtGui/private/qapplication_p.h>
//#define MYX11_DEBUG
QT_BEGIN_NAMESPACE
@ -80,9 +81,10 @@ QXlibWindow::QXlibWindow(QWidget *window)
int w = window->width();
int h = window->height();
if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL
&& QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL) ) {
#if !defined(QT_NO_OPENGL)
if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL
&& QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)
|| window->platformWindowFormat().alpha()) {
#if !defined(QT_OPENGL_ES_2)
XVisualInfo *visualInfo = qglx_findVisualInfo(mScreen->display()->nativeDisplay(),mScreen->xScreenNumber(),window->platformWindowFormat());
#else
@ -101,18 +103,28 @@ QXlibWindow::QXlibWindow(QWidget *window)
visualInfo = XGetVisualInfo(mScreen->display()->nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount);
#endif //!defined(QT_OPENGL_ES_2)
if (visualInfo) {
Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(),mScreen->rootWindow(),visualInfo->visual,AllocNone);
mDepth = visualInfo->depth;
mFormat = (mDepth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
mVisual = visualInfo->visual;
Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(), mScreen->rootWindow(), visualInfo->visual, AllocNone);
XSetWindowAttributes a;
a.background_pixel = WhitePixel(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber());
a.border_pixel = BlackPixel(mScreen->display()->nativeDisplay(), mScreen->xScreenNumber());
a.colormap = cmap;
x_window = XCreateWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(),x, y, w, h,
0, visualInfo->depth, InputOutput, visualInfo->visual,
CWColormap, &a);
CWBackPixel|CWBorderPixel|CWColormap, &a);
} else {
qFatal("no window!");
}
} else
#endif //!defined(QT_NO_OPENGL)
} else {
{
mDepth = mScreen->depth();
mFormat = (mDepth == 32) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32;
mVisual = mScreen->defaultVisual();
x_window = XCreateSimpleWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(),
x, y, w, h, 0 /*border_width*/,
mScreen->blackPixel(), mScreen->whitePixel());

View File

@ -122,6 +122,10 @@ public:
Window xWindow() const;
GC graphicsContext() const;
inline uint depth() const { return mDepth; }
QImage::Format format() const { return mFormat; }
Visual* visual() const { return mVisual; }
protected:
QVector<Atom> getNetWmState() const;
void setMWMHints(const QXlibMWMHints &mwmhints);
@ -135,6 +139,10 @@ private:
Window x_window;
GC gc;
uint mDepth;
QImage::Format mFormat;
Visual* mVisual;
GC createGC();
QPlatformGLContext *mGLContext;

View File

@ -49,6 +49,8 @@
#include "qxlibscreen.h"
#include "qxlibdisplay.h"
#include "qpainter.h"
# include <sys/ipc.h>
# include <sys/shm.h>
# include <X11/extensions/XShm.h>
@ -80,20 +82,19 @@ void QXlibShmImageInfo::destroy()
void QXlibWindowSurface::resizeShmImage(int width, int height)
{
QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window());
QXlibWindow *win = static_cast<QXlibWindow*>(window()->platformWindow());
#ifdef DONT_USE_MIT_SHM
shm_img = QImage(width, height, QImage::Format_RGB32);
shm_img = QImage(width, height, win->format());
#else
QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window());
if (image_info)
image_info->destroy();
else
image_info = new QXlibShmImageInfo(screen->display()->nativeDisplay());
Visual *visual = screen->defaultVisual();
XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), visual, 24, ZPixmap, 0,
XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), win->visual(), win->depth(), ZPixmap, 0,
&image_info->shminfo, width, height);
@ -109,7 +110,7 @@ void QXlibWindowSurface::resizeShmImage(int width, int height)
Q_ASSERT(shm_attach_status == True);
shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 );
shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, win->format() );
#endif
painted = false;
}
@ -160,11 +161,11 @@ void QXlibWindowSurface::flush(QWidget *widget, const QRegion &region, const QPo
#ifdef DONT_USE_MIT_SHM
// just convert the image every time...
if (!shm_img.isNull()) {
Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber());
QXlibWindow *win = static_cast<QXlibWindow*>(window()->platformWindow());
QImage image = shm_img;
//img.convertToFormat(
XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap,
XImage *xi = XCreateImage(screen->display(), win->visual(), win->depth(), ZPixmap,
0, (char *) image.scanLine(0), image.width(), image.height(),
32, image.bytesPerLine());
@ -214,6 +215,16 @@ void QXlibWindowSurface::beginPaint(const QRegion &region)
{
Q_UNUSED(region);
resizeBuffer(size());
if (shm_img.hasAlphaChannel()) {
QPainter p(&shm_img);
p.setCompositionMode(QPainter::CompositionMode_Source);
const QVector<QRect> rects = region.rects();
const QColor blank = Qt::transparent;
for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) {
p.fillRect(*it, blank);
}
}
}
void QXlibWindowSurface::endPaint(const QRegion &region)

View File

@ -174,7 +174,7 @@ contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE
DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
contains(QT_CONFIG, gui-qt3support):DEFINES *= QT3_SUPPORT
DEFINES *= QT_MOC_COMPAT #we don't need warnings from calling moc code in our generated code
DEFINES *= QT_USE_FAST_OPERATOR_PLUS QT_USE_FAST_CONCATENATION
DEFINES *= QT_USE_QSTRINGBUILDER
TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end

View File

@ -653,7 +653,7 @@ QUiLoader::~QUiLoader()
Loads a form from the given \a device and creates a new widget with the
given \a parentWidget to hold its contents.
\sa createWidget()
\sa createWidget(), errorString()
*/
QWidget *QUiLoader::load(QIODevice *device, QWidget *parentWidget)
{
@ -936,6 +936,19 @@ bool QUiLoader::isTranslationEnabled() const
return d->builder.trEnabled;
}
/*!
Returns a human-readable description of the last error occurred in load().
\since 5.0
\sa load()
*/
QString QUiLoader::errorString() const
{
Q_D(const QUiLoader);
return d->builder.errorString();
}
QT_END_NAMESPACE
#include "quiloader.moc"

View File

@ -90,6 +90,8 @@ public:
void setTranslationEnabled(bool enabled);
bool isTranslationEnabled() const;
QString errorString() const;
private:
QScopedPointer<QUiLoaderPrivate> d_ptr;
Q_DECLARE_PRIVATE(QUiLoader)

View File

@ -96,6 +96,12 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
win->setWindowFlags(data.window_flags);
win->setGeometry(q->geometry());
if (q->testAttribute(Qt::WA_TranslucentBackground)) {
QWindowFormat format = win->requestedWindowFormat();
format.setAlphaBufferSize(8);
win->setWindowFormat(format);
}
if (QWidget *nativeParent = q->nativeParentWidget()) {
if (nativeParent->windowHandle())
win->setParent(nativeParent->windowHandle());
@ -396,6 +402,7 @@ void QWidgetPrivate::show_sys()
surface->resize(geomRect.size());
}
}
if (window)
window->setVisible(true);
}

View File

@ -1740,8 +1740,8 @@ void qt_init(QApplicationPrivate *priv, int,
} else {
// Qt controls everything (default)
if (QApplication::testAttribute(Qt::AA_X11InitThreads))
XInitThreads();
// With the threaded QML renderer, we always need this.
XInitThreads();
// Set application name and class
char *app_class = 0;

View File

@ -6,7 +6,7 @@
#include(../arthurtester.pri)
#TEMPLATE = lib
#CONFIG += static
#QT += xml opengl svg qt3support
#QT += xml opengl svg
#build_all:!build_pass {
# CONFIG -= build_all

View File

@ -49,10 +49,6 @@
#include <qtextlayout.h>
#include <qdebug.h>
#ifdef QT3_SUPPORT
#include <q3painter.h>
#endif
#ifndef QT_NO_OPENGL
#include <qglpixelbuffer.h>
#endif
@ -364,33 +360,6 @@ void PaintCommands::staticInit()
"^gradient_setCoordinateMode\\s+(\\w*)$",
"gradient_setCoordinateMode <coordinate method enum>",
"gradient_setCoordinateMode ObjectBoundingMode");
#ifdef QT3_SUPPORT
DECL_PAINTCOMMANDSECTION("qt3 drawing ops");
DECL_PAINTCOMMAND("qt3_drawArc", command_qt3_drawArc,
"^qt3_drawArc\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$",
"qt3_drawArc <x> <y> <w> <h> <angleStart> <angleArc>\n - angles are expressed in 1/16th of degree",
"qt3_drawArc 10 10 20 20 0 5760");
DECL_PAINTCOMMAND("qt3_drawChord", command_qt3_drawChord,
"^qt3_drawChord\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$",
"qt3_drawChord <x> <y> <w> <h> <angleStart> <angleArc>\n - angles are expressed in 1/16th of degree",
"qt3_drawChord 10 10 20 20 0 5760");
DECL_PAINTCOMMAND("qt3_drawEllipse", command_qt3_drawEllipse,
"^qt3_drawEllipse\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$",
"qt3_drawEllipse <x> <y> <w> <h>",
"qt3_drawEllipse 10 10 20 20");
DECL_PAINTCOMMAND("qt3_drawPie", command_qt3_drawPie,
"^qt3_drawPie\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$",
"qt3_drawPie <x> <y> <w> <h> <angleStart> <angleArc>\n - angles are expressed in 1/16th of degree",
"qt3_drawPie 10 10 20 20 0 5760");
DECL_PAINTCOMMAND("qt3_drawRect", command_qt3_drawRect,
"^qt3_drawRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)$",
"qt3_drawRect <x> <y> <w> <h>",
"qt3_drawRect 10 10 20 20");
DECL_PAINTCOMMAND("qt3_drawRoundRect", command_qt3_drawRoundRect,
"^qt3_drawRoundRect\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s+(-?\\w*)\\s*(-?\\w)?\\s*(-?\\w)?$",
"qt3_drawRoundRect <x> <y> <w> <h> [rx] [ry]",
"qt3_drawRoundRect 10 10 20 20 3 3");
#endif
DECL_PAINTCOMMANDSECTION("drawing ops");
DECL_PAINTCOMMAND("drawPoint", command_drawPoint,
"^drawPoint\\s+(-?[\\w.]*)\\s+(-?[\\w.]*)$",
@ -1271,123 +1240,6 @@ void PaintCommands::command_drawArc(QRegExp re)
m_painter->drawArc(x, y, w, h, angle, sweep);
}
#ifdef QT3_SUPPORT
/***************************************************************************************************/
void PaintCommands::command_qt3_drawRect(QRegExp re)
{
Q_UNUSED(re);
#ifdef QT3_SUPPORT
QStringList caps = re.capturedTexts();
int x = convertToInt(caps.at(1));
int y = convertToInt(caps.at(2));
int w = convertToInt(caps.at(3));
int h = convertToInt(caps.at(4));
if (m_verboseMode)
printf(" -(lance) qt3_drawRect(%d, %d, %d, %d)\n", x, y, w, h);
static_cast<Q3Painter*>(m_painter)->drawRect(x, y, w, h);
#endif
}
/***************************************************************************************************/
void PaintCommands::command_qt3_drawRoundRect(QRegExp re)
{
Q_UNUSED(re);
#ifdef QT3_SUPPORT
QStringList caps = re.capturedTexts();
int x = convertToInt(caps.at(1));
int y = convertToInt(caps.at(2));
int w = convertToInt(caps.at(3));
int h = convertToInt(caps.at(4));
int xrnd = caps.at(5).isEmpty() ? 25 : convertToInt(caps.at(5));
int yrnd = caps.at(6).isEmpty() ? 25 : convertToInt(caps.at(6));
if (m_verboseMode)
printf(" -(lance) qt3_drawRoundRect(%d, %d, %d, %d), %d, %d\n", x, y, w, h, xrnd, yrnd);
static_cast<Q3Painter*>(m_painter)->drawRoundRect(x, y, w, h, xrnd, yrnd);
#endif
}
/***************************************************************************************************/
void PaintCommands::command_qt3_drawEllipse(QRegExp re)
{
Q_UNUSED(re);
#ifdef QT3_SUPPORT
QStringList caps = re.capturedTexts();
int x = convertToInt(caps.at(1));
int y = convertToInt(caps.at(2));
int w = convertToInt(caps.at(3));
int h = convertToInt(caps.at(4));
if (m_verboseMode)
printf(" -(lance) qt3_drawEllipse(%d, %d, %d, %d)\n", x, y, w, h);
static_cast<Q3Painter*>(m_painter)->drawEllipse(x, y, w, h);
#endif
}
/***************************************************************************************************/
void PaintCommands::command_qt3_drawPie(QRegExp re)
{
Q_UNUSED(re);
#ifdef QT3_SUPPORT
QStringList caps = re.capturedTexts();
int x = convertToInt(caps.at(1));
int y = convertToInt(caps.at(2));
int w = convertToInt(caps.at(3));
int h = convertToInt(caps.at(4));
int angle = convertToInt(caps.at(5));
int sweep = convertToInt(caps.at(6));
if (m_verboseMode)
printf(" -(lance) qt3_drawPie(%d, %d, %d, %d, %d, %d)\n", x, y, w, h, angle, sweep);
static_cast<Q3Painter*>(m_painter)->drawPie(x, y, w, h, angle, sweep);
#endif
}
/***************************************************************************************************/
void PaintCommands::command_qt3_drawChord(QRegExp re)
{
Q_UNUSED(re);
#ifdef QT3_SUPPORT
QStringList caps = re.capturedTexts();
int x = convertToInt(caps.at(1));
int y = convertToInt(caps.at(2));
int w = convertToInt(caps.at(3));
int h = convertToInt(caps.at(4));
int angle = convertToInt(caps.at(5));
int sweep = convertToInt(caps.at(6));
if (m_verboseMode)
printf(" -(lance) qt3_drawChord(%d, %d, %d, %d, %d, %d)\n", x, y, w, h, angle, sweep);
static_cast<Q3Painter*>(m_painter)->drawChord(x, y, w, h, angle, sweep);
#endif
}
/***************************************************************************************************/
void PaintCommands::command_qt3_drawArc(QRegExp re)
{
Q_UNUSED(re);
#ifdef QT3_SUPPORT
QStringList caps = re.capturedTexts();
int x = convertToInt(caps.at(1));
int y = convertToInt(caps.at(2));
int w = convertToInt(caps.at(3));
int h = convertToInt(caps.at(4));
int angle = convertToInt(caps.at(5));
int sweep = convertToInt(caps.at(6));
if (m_verboseMode)
printf(" -(lance) qt3_drawArc(%d, %d, %d, %d, %d, %d)\n", x, y, w, h, angle, sweep);
static_cast<Q3Painter*>(m_painter)->drawArc(x, y, w, h, angle, sweep);
#endif
}
#endif //QT3_SUPPORT
/***************************************************************************************************/
void PaintCommands::command_drawText(QRegExp re)
{

View File

@ -185,14 +185,6 @@ private:
void command_gradient_setCoordinateMode(QRegExp re);
// commands: drawing ops
#ifdef QT3_SUPPORT
void command_qt3_drawArc(QRegExp re);
void command_qt3_drawChord(QRegExp re);
void command_qt3_drawEllipse(QRegExp re);
void command_qt3_drawPie(QRegExp re);
void command_qt3_drawRect(QRegExp re);
void command_qt3_drawRoundRect(QRegExp re);
#endif
void command_drawArc(QRegExp re);
void command_drawChord(QRegExp re);
void command_drawConvexPolygon(QRegExp re);

View File

@ -14,16 +14,6 @@ drawRect 120 0 16 16
drawRect 140 0 17 17
drawRect 160 0 18 18
drawRect 180 0 19 19
qt3_drawRect 200 0 10 10
qt3_drawRect 220 0 11 11
qt3_drawRect 240 0 12 12
qt3_drawRect 260 0 13 13
qt3_drawRect 280 0 14 14
qt3_drawRect 300 0 15 15
qt3_drawRect 320 0 16 16
qt3_drawRect 340 0 17 17
qt3_drawRect 360 0 18 18
qt3_drawRect 380 0 19 19
drawEllipse 0 20 10 10
drawEllipse 20 20 11 11
@ -35,16 +25,6 @@ drawEllipse 120 20 16 16
drawEllipse 140 20 17 17
drawEllipse 160 20 18 18
drawEllipse 180 20 19 19
qt3_drawEllipse 200 20 10 10
qt3_drawEllipse 220 20 11 11
qt3_drawEllipse 240 20 12 12
qt3_drawEllipse 260 20 13 13
qt3_drawEllipse 280 20 14 14
qt3_drawEllipse 300 20 15 15
qt3_drawEllipse 320 20 16 16
qt3_drawEllipse 340 20 17 17
qt3_drawEllipse 360 20 18 18
qt3_drawEllipse 380 20 19 19
drawRoundRect 0 40 10 10
drawRoundRect 20 40 11 11
@ -56,16 +36,6 @@ drawRoundRect 120 40 16 16
drawRoundRect 140 40 17 17
drawRoundRect 160 40 18 18
drawRoundRect 180 40 19 19
qt3_drawRoundRect 200 40 10 10
qt3_drawRoundRect 220 40 11 11
qt3_drawRoundRect 240 40 12 12
qt3_drawRoundRect 260 40 13 13
qt3_drawRoundRect 280 40 14 14
qt3_drawRoundRect 300 40 15 15
qt3_drawRoundRect 320 40 16 16
qt3_drawRoundRect 340 40 17 17
qt3_drawRoundRect 360 40 18 18
qt3_drawRoundRect 380 40 19 19
drawPie 0 60 10 10 0 4320
drawPie 20 60 11 11 0 4320
@ -77,16 +47,6 @@ drawPie 120 60 16 16 0 4320
drawPie 140 60 17 17 0 4320
drawPie 160 60 18 18 0 4320
drawPie 180 60 19 19 0 4320
qt3_drawPie 200 60 10 10 0 4320
qt3_drawPie 220 60 11 11 0 4320
qt3_drawPie 240 60 12 12 0 4320
qt3_drawPie 260 60 13 13 0 4320
qt3_drawPie 280 60 14 14 0 4320
qt3_drawPie 300 60 15 15 0 4320
qt3_drawPie 320 60 16 16 0 4320
qt3_drawPie 340 60 17 17 0 4320
qt3_drawPie 360 60 18 18 0 4320
qt3_drawPie 380 60 19 19 0 4320
drawArc 0 80 10 10 0 4320
drawArc 20 80 11 11 0 4320
@ -98,16 +58,6 @@ drawArc 120 80 16 16 0 4320
drawArc 140 80 17 17 0 4320
drawArc 160 80 18 18 0 4320
drawArc 180 80 19 19 0 4320
qt3_drawArc 200 80 10 10 0 4320
qt3_drawArc 220 80 11 11 0 4320
qt3_drawArc 240 80 12 12 0 4320
qt3_drawArc 260 80 13 13 0 4320
qt3_drawArc 280 80 14 14 0 4320
qt3_drawArc 300 80 15 15 0 4320
qt3_drawArc 320 80 16 16 0 4320
qt3_drawArc 340 80 17 17 0 4320
qt3_drawArc 360 80 18 18 0 4320
qt3_drawArc 380 80 19 19 0 4320
drawChord 0 100 10 10 0 4320
drawChord 20 100 11 11 0 4320
@ -119,16 +69,6 @@ drawChord 120 100 16 16 0 4320
drawChord 140 100 17 17 0 4320
drawChord 160 100 18 18 0 4320
drawChord 180 100 19 19 0 4320
qt3_drawChord 200 100 10 10 0 4320
qt3_drawChord 220 100 11 11 0 4320
qt3_drawChord 240 100 12 12 0 4320
qt3_drawChord 260 100 13 13 0 4320
qt3_drawChord 280 100 14 14 0 4320
qt3_drawChord 300 100 15 15 0 4320
qt3_drawChord 320 100 16 16 0 4320
qt3_drawChord 340 100 17 17 0 4320
qt3_drawChord 360 100 18 18 0 4320
qt3_drawChord 380 100 19 19 0 4320
end_block

View File

@ -8,9 +8,8 @@ DEPENDPATH += .
INCLUDEPATH += .
DESTDIR = ../bin
QT += svg xml
QT += svg xml core-private gui-private
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
contains(QT_CONFIG, qt3support):QT += qt3support
# Input
HEADERS += datagenerator.h \

View File

@ -9,9 +9,8 @@ DESTDIR = ../bin
CONFIG += console
QT += svg xml
QT += svg xml core-private gui-private
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
contains(QT_CONFIG, qt3support):QT += qt3support
# Input
HEADERS += htmlgenerator.h

View File

@ -10,7 +10,6 @@ SOURCES += interactivewidget.cpp main.cpp
RESOURCES += icons.qrc
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
contains(QT_CONFIG, qt3support):QT += qt3support
symbian*: {
testData.files = $$QT_BUILD_TREE/tests/arthur/data/qps
@ -18,6 +17,6 @@ symbian*: {
DEPLOYMENT += testData
}
QT += xml svg
QT += xml svg core-private gui-private

View File

@ -137,14 +137,6 @@ static void displayCommands()
" drawText x y \"text\"\n"
" drawTiledPixmap pixmapfile x y width height sx sy\n"
"\n"
"Compat functions for Qt 3:\n"
" qt3_drawArc x y width height angle sweep\n"
" qt3_drawChord x y width height angle sweep\n"
" qt3_drawEllipse x y width height\n"
" qt3_drawPie x y width height angle sweep\n"
" qt3_drawRect x y width height\n"
" qt3_drawRoundRect x y width height xfactor yfactor\n"
"\n"
"Path commands:\n"
" path_addEllipse pathname x y width height\n"
" path_addPolygon pathname [ x1 y1 x2 y2 ... ] winding?\n"

View File

@ -9,9 +9,8 @@ DESTDIR = ../bin
CONFIG += console
QT += xml svg
QT += xml svg core-private gui-private
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
contains(QT_CONFIG, qt3support):QT += qt3support
# Input
HEADERS += performancediff.h

View File

@ -7,9 +7,8 @@ DEPENDPATH += .
INCLUDEPATH += .
DESTDIR = ../bin
QT += xml svg
QT += xml svg core-private gui-private
contains(QT_CONFIG, opengl)|contains(QT_CONFIG, opengles1)|contains(QT_CONFIG, opengles2):QT += opengl
contains(QT_CONFIG, qt3support):QT += qt3support
# Input
HEADERS += shower.h

View File

@ -100,10 +100,6 @@ void foo()
#include "qvector.h"
#include "qqueue.h"
#ifdef QT3_SUPPORT
#include "q3cleanuphandler.h"
#endif
template class QList<int>;
//TESTED_FILES=
@ -133,7 +129,6 @@ private slots:
void cache();
void regexp();
void pair();
void cleanupHandler();
void sharableQList();
void sharableQLinkedList();
void sharableQVector();
@ -2191,14 +2186,7 @@ void tst_Collections::qstring()
QVERIFY(s.toLatin1() == "first");
s = "second";
QVERIFY(s.toLatin1() == "second");
#ifdef QT3_SUPPORT
const char* cache = s.latin1();
QVERIFY(cache == s.latin1());
#endif
s.clear();
#ifdef QT3_SUPPORT
QVERIFY(*s.latin1() == '\0');
#endif
QVERIFY(s.isNull());
QVERIFY(s.toLatin1().size() == 0);
QVERIFY(s.toLatin1().isEmpty());
@ -2208,14 +2196,7 @@ void tst_Collections::qstring()
QVERIFY(s.toUtf8() == "first-utf8");
s = "second-utf8";
QVERIFY(s.toUtf8() == "second-utf8");
#ifdef QT3_SUPPORT
cache = s.utf8();
QVERIFY(cache == s.utf8());
#endif
s.clear();
#ifdef QT3_SUPPORT
QVERIFY(*s.utf8() == '\0');
#endif
QVERIFY(s.isNull());
QVERIFY(s.toUtf8().size() == 0);
QVERIFY(s.toUtf8().isEmpty());
@ -2225,14 +2206,7 @@ void tst_Collections::qstring()
QVERIFY(s.toUtf8() == "first-utf8");
s = "second-utf8";
QVERIFY(s.toUtf8() == "second-utf8");
#ifdef QT3_SUPPORT
cache = s.utf8();
QVERIFY(cache == s.utf8());
#endif
s.clear();
#ifdef QT3_SUPPORT
QVERIFY(*s.utf8() == '\0');
#endif
QVERIFY(s.isNull());
QVERIFY(s.toUtf8().size() == 0);
QVERIFY(s.toUtf8().isEmpty());
@ -2242,14 +2216,7 @@ void tst_Collections::qstring()
QVERIFY(s.toLocal8Bit() == "first-local8Bit");
s = "second-local8Bit";
QVERIFY(s.toLocal8Bit() == "second-local8Bit");
#ifdef QT3_SUPPORT
cache = s.local8Bit();
QVERIFY(cache == s.local8Bit());
#endif
s.clear();
#ifdef QT3_SUPPORT
QVERIFY(*s.local8Bit() == '\0');
#endif
QVERIFY(s.isNull());
QVERIFY(s.toLocal8Bit().size() == 0);
QVERIFY(s.toLocal8Bit().isEmpty());
@ -2258,14 +2225,7 @@ void tst_Collections::qstring()
QVERIFY(s.toAscii() == "first-ascii");
s = "second-ascii";
QVERIFY(s.toAscii() == "second-ascii");
#ifdef QT3_SUPPORT
cache = s.ascii();
QVERIFY(cache == s.ascii());
#endif
s.clear();
#ifdef QT3_SUPPORT
QVERIFY(*s.ascii() == '\0');
#endif
QVERIFY(s.isNull());
QVERIFY(s.toAscii().size() == 0);
QVERIFY(s.toAscii().isEmpty());
@ -2508,24 +2468,6 @@ void tst_Collections::pair()
QVERIFY(!(a > a || b > b || c > c || d > d || e > e));
}
void tst_Collections::cleanupHandler()
{
#ifdef QT3_SUPPORT
LargeStatic * f1 = 0;
LargeStatic * f2 = 0;
{
Q3CleanupHandler<LargeStatic> cleanup;
f1 = new LargeStatic;
f2 = new LargeStatic;
cleanup.add(&f1);
cleanup.add(&f2);
}
QVERIFY(f1 == 0 && f2 == 0);
#else
QSKIP("No Qt3 support", SkipAll);
#endif
}
/*
These test that Java-style mutable iterators don't trash shared
copy (the setSharable() mechanism).

View File

@ -60,7 +60,7 @@ QT_USE_NAMESPACE
#include "3rdparty/memcheck.h"
#endif
class tst_ExceptionSafetyObjects: public QObject
class tst_ExceptionSafety_Objects: public QObject
{
Q_OBJECT
@ -156,7 +156,7 @@ struct DirCreator : public AbstractTester
}
};
void tst_ExceptionSafetyObjects::objects_data()
void tst_ExceptionSafety_Objects::objects_data()
{
QTest::addColumn<AbstractTester *>("objectCreator");
@ -164,12 +164,12 @@ void tst_ExceptionSafetyObjects::objects_data()
NEWROW(QObject);
NEWROW(QBuffer);
NEWROW(QFile);
NEWROW(QFSFileEngine);
NEWROW(QProcess);
NEWROW(QSettings);
NEWROW(QThread);
NEWROW(QThreadPool);
NEWROW(QTranslator);
NEWROW(QFSFileEngine);
#define NEWROW2(T, CREATOR) QTest::newRow(#T) << static_cast<AbstractTester *>(new CREATOR)
NEWROW2(QBitArray, BitArrayCreator);
@ -177,7 +177,6 @@ void tst_ExceptionSafetyObjects::objects_data()
NEWROW2(QCryptographicHash, CryptographicHashCreator);
NEWROW2(QDataStream, DataStreamCreator);
NEWROW2(QDir, DirCreator);
}
// create and destructs an object, and lets each and every allocation
@ -274,9 +273,9 @@ public:
}
};
QtMsgHandler tst_ExceptionSafetyObjects::testMessageHandler;
QtMsgHandler tst_ExceptionSafety_Objects::testMessageHandler;
void tst_ExceptionSafetyObjects::safeMessageHandler(QtMsgType type, const char *msg)
void tst_ExceptionSafety_Objects::safeMessageHandler(QtMsgType type, const char *msg)
{
// this temporarily suspends OOM testing while handling a message
int currentIndex = mallocFailIndex;
@ -301,7 +300,7 @@ void debugUnexpected()
(*defaultUnexpected)();
}
void tst_ExceptionSafetyObjects::initTestCase()
void tst_ExceptionSafety_Objects::initTestCase()
{
// set handlers for bad exception cases, you might want to step in and breakpoint the default handlers too
defaultTerminate = std::set_terminate(&debugTerminate);
@ -345,13 +344,21 @@ void tst_ExceptionSafetyObjects::initTestCase()
QCOMPARE(malloc2Failed, 1);
}
void tst_ExceptionSafetyObjects::cleanupTestCase()
void tst_ExceptionSafety_Objects::cleanupTestCase()
{
qInstallMsgHandler(testMessageHandler);
}
void tst_ExceptionSafetyObjects::objects()
void tst_ExceptionSafety_Objects::objects()
{
QLatin1String tag = QLatin1String(QTest::currentDataTag());
if (tag == QLatin1String("QFile")
|| tag == QLatin1String("QProcess")
|| tag == QLatin1String("QSettings")
|| tag == QLatin1String("QThread")
|| tag == QLatin1String("QThreadPool"))
QSKIP("This type of object is not currently strongly exception safe", SkipSingle);
QFETCH(AbstractTester *, objectCreator);
doOOMTest(*objectCreator, 0);
@ -364,7 +371,8 @@ struct WidgetCreator : public AbstractTester
{
void operator()(QObject *parent)
{
Q_ASSERT(!parent || parent->isWidgetType());
if (parent && !parent->isWidgetType())
qFatal("%s: parent must be either null or a widget type", Q_FUNC_INFO);
QScopedPointer<T> ptr(parent ? new T(static_cast<QWidget *>(parent)) : new T);
}
};
@ -374,7 +382,8 @@ template <> struct WidgetCreator<QSizeGrip> : public AbstractTester
{
void operator()(QObject *parent)
{
Q_ASSERT(!parent || parent->isWidgetType());
if (parent && !parent->isWidgetType())
qFatal("%s: parent must be either null or a widget type", Q_FUNC_INFO);
QScopedPointer<QSizeGrip> ptr(new QSizeGrip(static_cast<QWidget *>(parent)));
}
};
@ -384,11 +393,12 @@ template <> struct WidgetCreator<QDesktopWidget> : public AbstractTester
{
void operator()(QObject *parent)
{
Q_ASSERT(!parent || parent->isWidgetType());
if (parent && !parent->isWidgetType())
qFatal("%s: parent must be either null or a widget type", Q_FUNC_INFO);
QScopedPointer<QDesktopWidget> ptr(new QDesktopWidget());
}
};
void tst_ExceptionSafetyObjects::widgets_data()
void tst_ExceptionSafety_Objects::widgets_data()
{
#ifdef Q_OS_SYMBIAN
// Initialise the S60 rasteriser, which crashes if started while out of memory
@ -405,23 +415,27 @@ void tst_ExceptionSafetyObjects::widgets_data()
NEWROW(QWidget);
NEWROW(QButtonGroup);
NEWROW(QDesktopWidget);
NEWROW(QCheckBox);
NEWROW(QColumnView);
NEWROW(QComboBox);
NEWROW(QCommandLinkButton);
NEWROW(QDateEdit);
NEWROW(QDateTimeEdit);
NEWROW(QDesktopWidget);
NEWROW(QDial);
NEWROW(QDoubleSpinBox);
NEWROW(QFocusFrame);
NEWROW(QFontComboBox);
NEWROW(QFrame);
NEWROW(QGroupBox);
NEWROW(QLCDNumber);
NEWROW(QLabel);
NEWROW(QLCDNumber);
NEWROW(QLineEdit);
NEWROW(QListView);
NEWROW(QListWidget);
NEWROW(QMainWindow);
NEWROW(QMenu);
NEWROW(QMenuBar);
NEWROW(QPlainTextEdit);
NEWROW(QProgressBar);
NEWROW(QPushButton);
@ -435,28 +449,58 @@ void tst_ExceptionSafetyObjects::widgets_data()
NEWROW(QStackedWidget);
NEWROW(QStatusBar);
NEWROW(QTabBar);
NEWROW(QTableView);
NEWROW(QTableWidget);
NEWROW(QTabWidget);
NEWROW(QTextBrowser);
NEWROW(QTextEdit);
NEWROW(QTimeEdit);
NEWROW(QToolBar);
NEWROW(QToolBox);
NEWROW(QToolButton);
NEWROW(QStatusBar);
NEWROW(QToolBar);
NEWROW(QMenuBar);
NEWROW(QMainWindow);
NEWROW(QWorkspace);
NEWROW(QColumnView);
NEWROW(QListView);
NEWROW(QListWidget);
NEWROW(QTableView);
NEWROW(QTableWidget);
NEWROW(QTreeView);
NEWROW(QTreeWidget);
NEWROW(QWorkspace);
}
void tst_ExceptionSafetyObjects::widgets()
void tst_ExceptionSafety_Objects::widgets()
{
QLatin1String tag = QLatin1String(QTest::currentDataTag());
if (tag == QLatin1String("QColumnView")
|| tag == QLatin1String("QComboBox")
|| tag == QLatin1String("QCommandLinkButton")
|| tag == QLatin1String("QDateEdit")
|| tag == QLatin1String("QDateTimeEdit")
|| tag == QLatin1String("QDesktopWidget")
|| tag == QLatin1String("QDoubleSpinBox")
|| tag == QLatin1String("QFontComboBox")
|| tag == QLatin1String("QGroupBox")
|| tag == QLatin1String("QLineEdit")
|| tag == QLatin1String("QListView")
|| tag == QLatin1String("QListWidget")
|| tag == QLatin1String("QMainWindow")
|| tag == QLatin1String("QMenu")
|| tag == QLatin1String("QMenuBar")
|| tag == QLatin1String("QPlainTextEdit")
|| tag == QLatin1String("QProgressBar")
|| tag == QLatin1String("QPushButton")
|| tag == QLatin1String("QScrollArea")
|| tag == QLatin1String("QSpinBox")
|| tag == QLatin1String("QStackedWidget")
|| tag == QLatin1String("QStatusBar")
|| tag == QLatin1String("QTableView")
|| tag == QLatin1String("QTableWidget")
|| tag == QLatin1String("QTabWidget")
|| tag == QLatin1String("QTextBrowser")
|| tag == QLatin1String("QTextEdit")
|| tag == QLatin1String("QTimeEdit")
|| tag == QLatin1String("QToolBar")
|| tag == QLatin1String("QToolBox")
|| tag == QLatin1String("QTreeView")
|| tag == QLatin1String("QTreeWidget")
|| tag == QLatin1String("QWorkspace"))
QSKIP("This type of widget is not currently strongly exception safe", SkipSingle);
QFETCH(AbstractTester *, widgetCreator);
doOOMTest(*widgetCreator, 0, 00000);
@ -547,7 +591,9 @@ struct IntegerMoveable
};
int IntegerMoveable::instanceCount = 0;
QT_BEGIN_NAMESPACE
Q_DECLARE_TYPEINFO(IntegerMoveable, Q_MOVABLE_TYPE);
QT_END_NAMESPACE
template <typename T, template<typename> class Container>
void containerInsertTest(QObject*)
@ -720,12 +766,12 @@ static void containerData()
QTest::newRow("erase moveable") << static_cast<TestFunction>(containerEraseTest<IntegerMoveable, Container>);
}
void tst_ExceptionSafetyObjects::vector_data()
void tst_ExceptionSafety_Objects::vector_data()
{
containerData<QVector>();
}
void tst_ExceptionSafetyObjects::vector()
void tst_ExceptionSafety_Objects::vector()
{
QFETCH(TestFunction, testFunction);
@ -736,30 +782,30 @@ void tst_ExceptionSafetyObjects::vector()
doOOMTest(testFunction, 0);
}
void tst_ExceptionSafetyObjects::list_data()
void tst_ExceptionSafety_Objects::list_data()
{
containerData<QList>();
}
void tst_ExceptionSafetyObjects::list()
void tst_ExceptionSafety_Objects::list()
{
QFETCH(TestFunction, testFunction);
doOOMTest(testFunction, 0);
}
void tst_ExceptionSafetyObjects::linkedList_data()
void tst_ExceptionSafety_Objects::linkedList_data()
{
containerData<QLinkedList>();
}
void tst_ExceptionSafetyObjects::linkedList()
void tst_ExceptionSafety_Objects::linkedList()
{
QFETCH(TestFunction, testFunction);
doOOMTest(testFunction, 0);
}
QTEST_MAIN(tst_ExceptionSafetyObjects)
QTEST_MAIN(tst_ExceptionSafety_Objects)
#include "tst_exceptionsafety_objects.moc"
#endif // QT_NO_EXCEPTIONS

View File

@ -280,7 +280,7 @@ protected:
eventsPtr->canceled << g->gestureType();
break;
default:
Q_ASSERT(false);
qWarning() << "Unknown GestureState enum value:" << static_cast<int>(g->state());
}
}
} else if (event->type() == CustomEvent::EventType) {
@ -823,7 +823,7 @@ public:
emit gestureCanceled(e->type(), g);
break;
default:
Q_ASSERT(false);
qWarning() << "Unknown GestureState enum value:" << static_cast<int>(g->state());
}
}
} else if (event->type() == CustomEvent::EventType) {
@ -1518,17 +1518,20 @@ void tst_Gestures::autoCancelGestures()
{
class MockWidget : public GestureWidget {
public:
MockWidget(const char *name) : GestureWidget(name) { }
MockWidget(const char *name) : GestureWidget(name), badGestureEvents(0) { }
bool event(QEvent *event)
{
if (event->type() == QEvent::Gesture) {
QGestureEvent *ge = static_cast<QGestureEvent*>(event);
Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here...
if (ge->gestures().count() != 1)
++badGestureEvents; // event should contain exactly one gesture
ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext);
}
return GestureWidget::event(event);
}
int badGestureEvents;
};
const Qt::GestureType secondGesture = QGestureRecognizer::registerRecognizer(new CustomGestureRecognizer);
@ -1563,22 +1566,26 @@ void tst_Gestures::autoCancelGestures()
event.serial = CustomGesture::SerialFinishedThreshold;
QApplication::sendEvent(child, &event);
QCOMPARE(parent.events.all.count(), 2);
QCOMPARE(parent.badGestureEvents, 0);
}
void tst_Gestures::autoCancelGestures2()
{
class MockItem : public GestureItem {
public:
MockItem(const char *name) : GestureItem(name) { }
MockItem(const char *name) : GestureItem(name), badGestureEvents(0) { }
bool event(QEvent *event) {
if (event->type() == QEvent::Gesture) {
QGestureEvent *ge = static_cast<QGestureEvent*>(event);
Q_ASSERT(ge->gestures().count() == 1); // can't use QCOMPARE here...
if (ge->gestures().count() != 1)
++badGestureEvents; // event should contain exactly one gesture
ge->gestures().first()->setGestureCancelPolicy(QGesture::CancelAllInContext);
}
return GestureItem::event(event);
}
int badGestureEvents;
};
const Qt::GestureType secondGesture = QGestureRecognizer ::registerRecognizer(new CustomGestureRecognizer);
@ -1614,6 +1621,7 @@ void tst_Gestures::autoCancelGestures2()
event.serial = CustomGesture::SerialFinishedThreshold;
scene.sendEvent(child, &event);
QCOMPARE(parent->events.all.count(), 2);
QCOMPARE(parent->badGestureEvents, 0);
}
void tst_Gestures::graphicsViewParentPropagation()

View File

@ -17,16 +17,6 @@ drawRect 120 0 16 16
drawRect 140 0 17 17
drawRect 160 0 18 18
drawRect 180 0 19 19
# qt3_drawRect 200 0 10 10
# qt3_drawRect 220 0 11 11
# qt3_drawRect 240 0 12 12
# qt3_drawRect 260 0 13 13
# qt3_drawRect 280 0 14 14
# qt3_drawRect 300 0 15 15
# qt3_drawRect 320 0 16 16
# qt3_drawRect 340 0 17 17
# qt3_drawRect 360 0 18 18
# qt3_drawRect 380 0 19 19
drawEllipse 0 20 10 10
drawEllipse 20 20 11 11
@ -38,16 +28,6 @@ drawEllipse 120 20 16 16
drawEllipse 140 20 17 17
drawEllipse 160 20 18 18
drawEllipse 180 20 19 19
# qt3_drawEllipse 200 20 10 10
# qt3_drawEllipse 220 20 11 11
# qt3_drawEllipse 240 20 12 12
# qt3_drawEllipse 260 20 13 13
# qt3_drawEllipse 280 20 14 14
# qt3_drawEllipse 300 20 15 15
# qt3_drawEllipse 320 20 16 16
# qt3_drawEllipse 340 20 17 17
# qt3_drawEllipse 360 20 18 18
# qt3_drawEllipse 380 20 19 19
drawRoundRect 0 40 10 10
drawRoundRect 20 40 11 11
@ -59,16 +39,6 @@ drawRoundRect 120 40 16 16
drawRoundRect 140 40 17 17
drawRoundRect 160 40 18 18
drawRoundRect 180 40 19 19
# qt3_drawRoundRect 200 40 10 10
# qt3_drawRoundRect 220 40 11 11
# qt3_drawRoundRect 240 40 12 12
# qt3_drawRoundRect 260 40 13 13
# qt3_drawRoundRect 280 40 14 14
# qt3_drawRoundRect 300 40 15 15
# qt3_drawRoundRect 320 40 16 16
# qt3_drawRoundRect 340 40 17 17
# qt3_drawRoundRect 360 40 18 18
# qt3_drawRoundRect 380 40 19 19
drawPie 0 60 10 10 0 4320
drawPie 20 60 11 11 0 4320
@ -80,16 +50,6 @@ drawPie 120 60 16 16 0 4320
drawPie 140 60 17 17 0 4320
drawPie 160 60 18 18 0 4320
drawPie 180 60 19 19 0 4320
# qt3_drawPie 200 60 10 10 0 4320
# qt3_drawPie 220 60 11 11 0 4320
# qt3_drawPie 240 60 12 12 0 4320
# qt3_drawPie 260 60 13 13 0 4320
# qt3_drawPie 280 60 14 14 0 4320
# qt3_drawPie 300 60 15 15 0 4320
# qt3_drawPie 320 60 16 16 0 4320
# qt3_drawPie 340 60 17 17 0 4320
# qt3_drawPie 360 60 18 18 0 4320
# qt3_drawPie 380 60 19 19 0 4320
drawArc 0 80 10 10 0 4320
drawArc 20 80 11 11 0 4320
@ -101,16 +61,6 @@ drawArc 120 80 16 16 0 4320
drawArc 140 80 17 17 0 4320
drawArc 160 80 18 18 0 4320
drawArc 180 80 19 19 0 4320
# qt3_drawArc 200 80 10 10 0 4320
# qt3_drawArc 220 80 11 11 0 4320
# qt3_drawArc 240 80 12 12 0 4320
# qt3_drawArc 260 80 13 13 0 4320
# qt3_drawArc 280 80 14 14 0 4320
# qt3_drawArc 300 80 15 15 0 4320
# qt3_drawArc 320 80 16 16 0 4320
# qt3_drawArc 340 80 17 17 0 4320
# qt3_drawArc 360 80 18 18 0 4320
# qt3_drawArc 380 80 19 19 0 4320
drawChord 0 100 10 10 0 4320
drawChord 20 100 11 11 0 4320
@ -122,16 +72,6 @@ drawChord 120 100 16 16 0 4320
drawChord 140 100 17 17 0 4320
drawChord 160 100 18 18 0 4320
drawChord 180 100 19 19 0 4320
# qt3_drawChord 200 100 10 10 0 4320
# qt3_drawChord 220 100 11 11 0 4320
# qt3_drawChord 240 100 12 12 0 4320
# qt3_drawChord 260 100 13 13 0 4320
# qt3_drawChord 280 100 14 14 0 4320
# qt3_drawChord 300 100 15 15 0 4320
# qt3_drawChord 320 100 16 16 0 4320
# qt3_drawChord 340 100 17 17 0 4320
# qt3_drawChord 360 100 18 18 0 4320
# qt3_drawChord 380 100 19 19 0 4320
end_block

View File

@ -348,7 +348,6 @@ QStringList tst_MakeTestSelfTest::find_subdirs(QString const& pro_file, FindSubd
<< "QT_CONFIG+=phonon"
<< "QT_CONFIG+=private_tests"
<< "QT_CONFIG+=pulseaudio"
<< "QT_CONFIG+=qt3support"
<< "QT_CONFIG+=script"
<< "QT_CONFIG+=svg"
<< "QT_CONFIG+=webkit"

View File

@ -52,9 +52,6 @@
#include <QtNetwork/QtNetwork>
#include <QtSql/QtSql>
//#include <QtSvg>
#if defined(QT3_SUPPORT)
#include <Qt3Support>
#endif
#if defined(WITH_DBUS)
#include <QtDBus>
#endif

View File

@ -44,6 +44,7 @@
#include <QtCore/QHash>
#include <QtCore/QList>
#include <QtCore/QTimer>
#include <QtCore/QDebug>
DynamicTreeModel::DynamicTreeModel(QObject *parent)
@ -66,9 +67,11 @@ QModelIndex DynamicTreeModel::index(int row, int column, const QModelIndex &pare
const qint64 grandParent = findParentId(parent.internalId());
if (grandParent >= 0) {
QList<QList<qint64> > parentTable = m_childItems.value(grandParent);
Q_ASSERT(parent.column() < parentTable.size());
if (parent.column() >= parentTable.size())
qFatal("%s: parent.column() must be less than parentTable.size()", Q_FUNC_INFO);
QList<qint64> parentSiblings = parentTable.at(parent.column());
Q_ASSERT(parent.row() < parentSiblings.size());
if (parent.row() >= parentSiblings.size())
qFatal("%s: parent.row() must be less than parentSiblings.size()", Q_FUNC_INFO);
}
if (childIdColumns.size() == 0)
@ -189,7 +192,8 @@ QModelIndex ModelChangeCommand::findIndex(QList<int> rows)
while (i.hasNext())
{
parent = m_model->index(i.next(), col, parent);
Q_ASSERT(parent.isValid());
if (!parent.isValid())
qFatal("%s: parent must be valid", Q_FUNC_INFO);
}
return parent;
}

View File

@ -45,8 +45,6 @@
#include "modeltest.h"
#include <QtTest/QtTest>
#undef Q_ASSERT
#define Q_ASSERT QVERIFY
Q_DECLARE_METATYPE ( QModelIndex )
@ -55,7 +53,8 @@ Q_DECLARE_METATYPE ( QModelIndex )
*/
ModelTest::ModelTest ( QAbstractItemModel *_model, QObject *parent ) : QObject ( parent ), model ( _model ), fetchingMore ( false )
{
Q_ASSERT ( model );
if (!model)
qFatal("%s: model must not be null", Q_FUNC_INFO);
connect ( model, SIGNAL ( columnsAboutToBeInserted ( const QModelIndex &, int, int ) ),
this, SLOT ( runAllTests() ) );
@ -118,15 +117,15 @@ void ModelTest::runAllTests()
*/
void ModelTest::nonDestructiveBasicTest()
{
Q_ASSERT ( model->buddy ( QModelIndex() ) == QModelIndex() );
QVERIFY( model->buddy ( QModelIndex() ) == QModelIndex() );
model->canFetchMore ( QModelIndex() );
Q_ASSERT ( model->columnCount ( QModelIndex() ) >= 0 );
Q_ASSERT ( model->data ( QModelIndex() ) == QVariant() );
QVERIFY( model->columnCount ( QModelIndex() ) >= 0 );
QVERIFY( model->data ( QModelIndex() ) == QVariant() );
fetchingMore = true;
model->fetchMore ( QModelIndex() );
fetchingMore = false;
Qt::ItemFlags flags = model->flags ( QModelIndex() );
Q_ASSERT ( flags == Qt::ItemIsDropEnabled || flags == 0 );
QVERIFY( flags == Qt::ItemIsDropEnabled || flags == 0 );
model->hasChildren ( QModelIndex() );
model->hasIndex ( 0, 0 );
model->headerData ( 0, Qt::Horizontal );
@ -135,8 +134,8 @@ void ModelTest::nonDestructiveBasicTest()
QVariant cache;
model->match ( QModelIndex(), -1, cache );
model->mimeTypes();
Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
Q_ASSERT ( model->rowCount() >= 0 );
QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
QVERIFY( model->rowCount() >= 0 );
QVariant variant;
model->setData ( QModelIndex(), variant, -1 );
model->setHeaderData ( -1, Qt::Horizontal, QVariant() );
@ -158,17 +157,17 @@ void ModelTest::rowCount()
// check top row
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
int rows = model->rowCount ( topIndex );
Q_ASSERT ( rows >= 0 );
QVERIFY( rows >= 0 );
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( topIndex ) == true );
QVERIFY( model->hasChildren ( topIndex ) );
QModelIndex secondLevelIndex = model->index ( 0, 0, topIndex );
if ( secondLevelIndex.isValid() ) { // not the top level
// check a row count where parent is valid
rows = model->rowCount ( secondLevelIndex );
Q_ASSERT ( rows >= 0 );
QVERIFY( rows >= 0 );
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( secondLevelIndex ) == true );
QVERIFY( model->hasChildren ( secondLevelIndex ) );
}
// The models rowCount() is tested more extensively in checkChildren(),
@ -182,12 +181,12 @@ void ModelTest::columnCount()
{
// check top row
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
Q_ASSERT ( model->columnCount ( topIndex ) >= 0 );
QVERIFY( model->columnCount ( topIndex ) >= 0 );
// check a column count where parent is valid
QModelIndex childIndex = model->index ( 0, 0, topIndex );
if ( childIndex.isValid() )
Q_ASSERT ( model->columnCount ( childIndex ) >= 0 );
QVERIFY( model->columnCount ( childIndex ) >= 0 );
// columnCount() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@ -200,19 +199,19 @@ void ModelTest::hasIndex()
{
// qDebug() << "hi";
// Make sure that invalid values returns an invalid index
Q_ASSERT ( model->hasIndex ( -2, -2 ) == false );
Q_ASSERT ( model->hasIndex ( -2, 0 ) == false );
Q_ASSERT ( model->hasIndex ( 0, -2 ) == false );
QVERIFY( !model->hasIndex ( -2, -2 ) );
QVERIFY( !model->hasIndex ( -2, 0 ) );
QVERIFY( !model->hasIndex ( 0, -2 ) );
int rows = model->rowCount();
int columns = model->columnCount();
// check out of bounds
Q_ASSERT ( model->hasIndex ( rows, columns ) == false );
Q_ASSERT ( model->hasIndex ( rows + 1, columns + 1 ) == false );
QVERIFY( !model->hasIndex ( rows, columns ) );
QVERIFY( !model->hasIndex ( rows + 1, columns + 1 ) );
if ( rows > 0 )
Q_ASSERT ( model->hasIndex ( 0, 0 ) == true );
QVERIFY( model->hasIndex ( 0, 0 ) );
// hasIndex() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@ -225,9 +224,9 @@ void ModelTest::index()
{
// qDebug() << "i";
// Make sure that invalid values returns an invalid index
Q_ASSERT ( model->index ( -2, -2 ) == QModelIndex() );
Q_ASSERT ( model->index ( -2, 0 ) == QModelIndex() );
Q_ASSERT ( model->index ( 0, -2 ) == QModelIndex() );
QVERIFY( model->index ( -2, -2 ) == QModelIndex() );
QVERIFY( model->index ( -2, 0 ) == QModelIndex() );
QVERIFY( model->index ( 0, -2 ) == QModelIndex() );
int rows = model->rowCount();
int columns = model->columnCount();
@ -236,13 +235,13 @@ void ModelTest::index()
return;
// Catch off by one errors
Q_ASSERT ( model->index ( rows, columns ) == QModelIndex() );
Q_ASSERT ( model->index ( 0, 0 ).isValid() == true );
QVERIFY( model->index ( rows, columns ) == QModelIndex() );
QVERIFY( model->index ( 0, 0 ).isValid() );
// Make sure that the same index is *always* returned
QModelIndex a = model->index ( 0, 0 );
QModelIndex b = model->index ( 0, 0 );
Q_ASSERT ( a == b );
QVERIFY( a == b );
// index() is tested more extensively in checkChildren(),
// but this catches the big mistakes
@ -256,7 +255,7 @@ void ModelTest::parent()
// qDebug() << "p";
// Make sure the model wont crash and will return an invalid QModelIndex
// when asked for the parent of an invalid index.
Q_ASSERT ( model->parent ( QModelIndex() ) == QModelIndex() );
QVERIFY( model->parent ( QModelIndex() ) == QModelIndex() );
if ( model->rowCount() == 0 )
return;
@ -269,13 +268,13 @@ void ModelTest::parent()
// Common error test #1, make sure that a top level index has a parent
// that is a invalid QModelIndex.
QModelIndex topIndex = model->index ( 0, 0, QModelIndex() );
Q_ASSERT ( model->parent ( topIndex ) == QModelIndex() );
QVERIFY( model->parent ( topIndex ) == QModelIndex() );
// Common error test #2, make sure that a second level index has a parent
// that is the first level index.
if ( model->rowCount ( topIndex ) > 0 ) {
QModelIndex childIndex = model->index ( 0, 0, topIndex );
Q_ASSERT ( model->parent ( childIndex ) == topIndex );
QVERIFY( model->parent ( childIndex ) == topIndex );
}
// Common error test #3, the second column should NOT have the same children
@ -285,7 +284,7 @@ void ModelTest::parent()
if ( model->rowCount ( topIndex1 ) > 0 ) {
QModelIndex childIndex = model->index ( 0, 0, topIndex );
QModelIndex childIndex1 = model->index ( 0, 0, topIndex1 );
Q_ASSERT ( childIndex != childIndex1 );
QVERIFY( childIndex != childIndex1 );
}
// Full test, walk n levels deep through the model making sure that all
@ -325,47 +324,47 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
int columns = model->columnCount ( parent );
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( parent ) );
QVERIFY( model->hasChildren ( parent ) );
// Some further testing against rows(), columns(), and hasChildren()
Q_ASSERT ( rows >= 0 );
Q_ASSERT ( columns >= 0 );
QVERIFY( rows >= 0 );
QVERIFY( columns >= 0 );
if ( rows > 0 )
Q_ASSERT ( model->hasChildren ( parent ) == true );
QVERIFY( model->hasChildren ( parent ) );
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
// << "columns:" << columns << "parent column:" << parent.column();
Q_ASSERT ( model->hasIndex ( rows + 1, 0, parent ) == false );
QVERIFY( !model->hasIndex ( rows + 1, 0, parent ) );
for ( int r = 0; r < rows; ++r ) {
if ( model->canFetchMore ( parent ) ) {
fetchingMore = true;
model->fetchMore ( parent );
fetchingMore = false;
}
Q_ASSERT ( model->hasIndex ( r, columns + 1, parent ) == false );
QVERIFY( !model->hasIndex ( r, columns + 1, parent ) );
for ( int c = 0; c < columns; ++c ) {
Q_ASSERT ( model->hasIndex ( r, c, parent ) == true );
QVERIFY( model->hasIndex ( r, c, parent ) );
QModelIndex index = model->index ( r, c, parent );
// rowCount() and columnCount() said that it existed...
Q_ASSERT ( index.isValid() == true );
QVERIFY( index.isValid() );
// index() should always return the same index when called twice in a row
QModelIndex modifiedIndex = model->index ( r, c, parent );
Q_ASSERT ( index == modifiedIndex );
QVERIFY( index == modifiedIndex );
// Make sure we get the same index if we request it twice in a row
QModelIndex a = model->index ( r, c, parent );
QModelIndex b = model->index ( r, c, parent );
Q_ASSERT ( a == b );
QVERIFY( a == b );
// Some basic checking on the index that is returned
Q_ASSERT ( index.model() == model );
Q_ASSERT ( index.row() == r );
Q_ASSERT ( index.column() == c );
QVERIFY( index.model() == model );
QCOMPARE( index.row(), r );
QCOMPARE( index.column(), c );
// While you can technically return a QVariant usually this is a sign
// of an bug in data() Disable if this really is ok in your model.
// Q_ASSERT ( model->data ( index, Qt::DisplayRole ).isValid() == true );
// of a bug in data(). Disable if this really is ok in your model.
// QVERIFY( model->data ( index, Qt::DisplayRole ).isValid() );
// If the next test fails here is some somewhat useful debug you play with.
@ -380,8 +379,7 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
}
// Check that we can get back our real parent.
// qDebug() << model->parent ( index ) << parent ;
Q_ASSERT ( model->parent ( index ) == parent );
QCOMPARE( model->parent ( index ), parent );
// recursively go down the children
if ( model->hasChildren ( index ) && currentDepth < 10 ) {
@ -391,7 +389,7 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
// make sure that after testing the children that the index doesn't change.
QModelIndex newerIndex = model->index ( r, c, parent );
Q_ASSERT ( index == newerIndex );
QVERIFY( index == newerIndex );
}
}
}
@ -402,68 +400,68 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
void ModelTest::data()
{
// Invalid index should return an invalid qvariant
Q_ASSERT ( !model->data ( QModelIndex() ).isValid() );
QVERIFY( !model->data ( QModelIndex() ).isValid() );
if ( model->rowCount() == 0 )
return;
// A valid index should have a valid QVariant data
Q_ASSERT ( model->index ( 0, 0 ).isValid() );
QVERIFY( model->index ( 0, 0 ).isValid() );
// shouldn't be able to set data on an invalid index
Q_ASSERT ( model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) == false );
QVERIFY( !model->setData ( QModelIndex(), QLatin1String ( "foo" ), Qt::DisplayRole ) );
// General Purpose roles that should return a QString
QVariant variant = model->data ( model->index ( 0, 0 ), Qt::ToolTipRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
QVERIFY( qVariantCanConvert<QString> ( variant ) );
}
variant = model->data ( model->index ( 0, 0 ), Qt::StatusTipRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
QVERIFY( qVariantCanConvert<QString> ( variant ) );
}
variant = model->data ( model->index ( 0, 0 ), Qt::WhatsThisRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QString> ( variant ) );
QVERIFY( qVariantCanConvert<QString> ( variant ) );
}
// General Purpose roles that should return a QSize
variant = model->data ( model->index ( 0, 0 ), Qt::SizeHintRole );
if ( variant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QSize> ( variant ) );
QVERIFY( qVariantCanConvert<QSize> ( variant ) );
}
// General Purpose roles that should return a QFont
QVariant fontVariant = model->data ( model->index ( 0, 0 ), Qt::FontRole );
if ( fontVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QFont> ( fontVariant ) );
QVERIFY( qVariantCanConvert<QFont> ( fontVariant ) );
}
// Check that the alignment is one we know about
QVariant textAlignmentVariant = model->data ( model->index ( 0, 0 ), Qt::TextAlignmentRole );
if ( textAlignmentVariant.isValid() ) {
int alignment = textAlignmentVariant.toInt();
Q_ASSERT ( alignment == ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) );
QCOMPARE( alignment, ( alignment & ( Qt::AlignHorizontal_Mask | Qt::AlignVertical_Mask ) ) );
}
// General Purpose roles that should return a QColor
QVariant colorVariant = model->data ( model->index ( 0, 0 ), Qt::BackgroundColorRole );
if ( colorVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
QVERIFY( qVariantCanConvert<QColor> ( colorVariant ) );
}
colorVariant = model->data ( model->index ( 0, 0 ), Qt::TextColorRole );
if ( colorVariant.isValid() ) {
Q_ASSERT ( qVariantCanConvert<QColor> ( colorVariant ) );
QVERIFY( qVariantCanConvert<QColor> ( colorVariant ) );
}
// Check that the "check state" is one we know about.
QVariant checkStateVariant = model->data ( model->index ( 0, 0 ), Qt::CheckStateRole );
if ( checkStateVariant.isValid() ) {
int state = checkStateVariant.toInt();
Q_ASSERT ( state == Qt::Unchecked ||
state == Qt::PartiallyChecked ||
state == Qt::Checked );
QVERIFY( state == Qt::Unchecked ||
state == Qt::PartiallyChecked ||
state == Qt::Checked );
}
}
@ -472,7 +470,7 @@ void ModelTest::data()
\sa rowsInserted()
*/
void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int end )
void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, int /* end */)
{
// Q_UNUSED(end);
// qDebug() << "rowsAboutToBeInserted" << "start=" << start << "end=" << end << "parent=" << model->data ( parent ).toString()
@ -494,7 +492,7 @@ void ModelTest::rowsAboutToBeInserted ( const QModelIndex &parent, int start, in
void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
{
Changing c = insert.pop();
Q_ASSERT ( c.parent == parent );
QVERIFY( c.parent == parent );
// qDebug() << "rowsInserted" << "start=" << start << "end=" << end << "oldsize=" << c.oldSize
// << "parent=" << model->data ( parent ).toString() << "current rowcount of parent=" << model->rowCount ( parent );
@ -504,8 +502,8 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
// }
// qDebug();
Q_ASSERT ( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
QVERIFY( c.oldSize + ( end - start + 1 ) == model->rowCount ( parent ) );
QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
if (c.next != model->data(model->index(end + 1, 0, c.parent))) {
qDebug() << start << end;
@ -514,7 +512,7 @@ void ModelTest::rowsInserted ( const QModelIndex & parent, int start, int end )
qDebug() << c.next << model->data(model->index(end + 1, 0, c.parent));
}
Q_ASSERT ( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
QVERIFY( c.next == model->data ( model->index ( end + 1, 0, c.parent ) ) );
}
void ModelTest::layoutAboutToBeChanged()
@ -527,7 +525,7 @@ void ModelTest::layoutChanged()
{
for ( int i = 0; i < changing.count(); ++i ) {
QPersistentModelIndex p = changing[i];
Q_ASSERT ( p == model->index ( p.row(), p.column(), p.parent() ) );
QVERIFY( p == model->index ( p.row(), p.column(), p.parent() ) );
}
changing.clear();
}
@ -557,10 +555,10 @@ void ModelTest::rowsRemoved ( const QModelIndex & parent, int start, int end )
{
qDebug() << "rr" << parent << start << end;
Changing c = remove.pop();
Q_ASSERT ( c.parent == parent );
Q_ASSERT ( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
Q_ASSERT ( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
Q_ASSERT ( c.next == model->data ( model->index ( start, 0, c.parent ) ) );
QVERIFY( c.parent == parent );
QVERIFY( c.oldSize - ( end - start + 1 ) == model->rowCount ( parent ) );
QVERIFY( c.last == model->data ( model->index ( start - 1, 0, c.parent ) ) );
QVERIFY( c.next == model->data ( model->index ( start, 0, c.parent ) ) );
}

View File

@ -201,8 +201,10 @@ class ObservingObject : public QObject
Q_OBJECT
public:
ObservingObject(AccessibleProxyModel *proxy, QObject *parent = 0)
: QObject(parent),
m_proxy(proxy)
: QObject(parent)
, m_proxy(proxy)
, storePersistentFailureCount(0)
, checkPersistentFailureCount(0)
{
connect(m_proxy, SIGNAL(layoutAboutToBeChanged()), SLOT(storePersistent()));
connect(m_proxy, SIGNAL(layoutChanged()), SLOT(checkPersistent()));
@ -215,8 +217,14 @@ public slots:
for (int row = 0; row < m_proxy->rowCount(parent); ++row) {
QModelIndex proxyIndex = m_proxy->index(row, 0, parent);
QModelIndex sourceIndex = m_proxy->mapToSource(proxyIndex);
Q_ASSERT(proxyIndex.isValid());
Q_ASSERT(sourceIndex.isValid());
if (!proxyIndex.isValid()) {
qWarning("%s: Invalid proxy index", Q_FUNC_INFO);
++storePersistentFailureCount;
}
if (!sourceIndex.isValid()) {
qWarning("%s: invalid source index", Q_FUNC_INFO);
++storePersistentFailureCount;
}
m_persistentSourceIndexes.append(sourceIndex);
m_persistentProxyIndexes.append(proxyIndex);
if (m_proxy->hasChildren(proxyIndex))
@ -226,12 +234,24 @@ public slots:
void storePersistent()
{
foreach(const QModelIndex &idx, m_persistentProxyIndexes)
Q_ASSERT(idx.isValid()); // This is called from layoutAboutToBeChanged. Persistent indexes should be valid
// This method is called from layoutAboutToBeChanged. Persistent indexes should be valid
foreach(const QModelIndex &idx, m_persistentProxyIndexes)
if (!idx.isValid()) {
qWarning("%s: persistentProxyIndexes contains invalid index", Q_FUNC_INFO);
++storePersistentFailureCount;
}
Q_ASSERT(m_proxy->persistent().isEmpty());
if (!m_proxy->persistent().isEmpty()) {
qWarning("%s: proxy should have no persistent indexes when storePersistent called",
Q_FUNC_INFO);
++storePersistentFailureCount;
}
storePersistent(QModelIndex());
Q_ASSERT(!m_proxy->persistent().isEmpty());
if (m_proxy->persistent().isEmpty()) {
qWarning("%s: proxy should have persistent index after storePersistent called",
Q_FUNC_INFO);
++storePersistentFailureCount;
}
}
void checkPersistent()
@ -243,7 +263,10 @@ public slots:
for (int row = 0; row < m_persistentProxyIndexes.size(); ++row) {
QModelIndex updatedProxy = m_persistentProxyIndexes.at(row);
QModelIndex updatedSource = m_persistentSourceIndexes.at(row);
QCOMPARE(m_proxy->mapToSource(updatedProxy), updatedSource);
if (m_proxy->mapToSource(updatedProxy) != updatedSource) {
qWarning("%s: check failed at row %d", Q_FUNC_INFO, row);
++checkPersistentFailureCount;
}
}
m_persistentSourceIndexes.clear();
m_persistentProxyIndexes.clear();
@ -253,6 +276,9 @@ private:
AccessibleProxyModel *m_proxy;
QList<QPersistentModelIndex> m_persistentSourceIndexes;
QList<QPersistentModelIndex> m_persistentProxyIndexes;
public:
int storePersistentFailureCount;
int checkPersistentFailureCount;
};
void tst_ModelTest::moveSourceItems()
@ -280,6 +306,9 @@ void tst_ModelTest::moveSourceItems()
moveCommand->setDestAncestors(QList<int>() << 1);
moveCommand->setDestRow(0);
moveCommand->doCommand();
QCOMPARE(observer.storePersistentFailureCount, 0);
QCOMPARE(observer.checkPersistentFailureCount, 0);
}
void tst_ModelTest::testResetThroughProxy()
@ -302,6 +331,9 @@ void tst_ModelTest::testResetThroughProxy()
ModelResetCommand *resetCommand = new ModelResetCommand(model, this);
resetCommand->setNumCols(0);
resetCommand->doCommand();
QCOMPARE(observer.storePersistentFailureCount, 0);
QCOMPARE(observer.checkPersistentFailureCount, 0);
}

View File

@ -3,14 +3,12 @@
TEMPLATE=subdirs
SUBDIRS=\
# exceptionsafety_objects \ shouldn't enable it
# baselineexample \ Just an example demonstrating qbaselinetest usage
lancelot \
qaccessibility \
qalgorithms \
qcombobox \
qcssparser \
#qdatastream \ # FIXME: uses qtsvg (QTBUG-19244)
qdatastream \
qdir \
qfocusevent \
qimage \
@ -37,6 +35,8 @@ SUBDIRS=\
windowsmobile \
nativeimagehandleprovider
contains(QT_CONFIG, accessibility):SUBDIRS += qaccessibility
contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter
mac: {
SUBDIRS += macgui \
@ -56,6 +56,8 @@ symbian {
qs60mainapplication
}
!win32-msvc*:!wince*:SUBDIRS += exceptionsafety_objects
# Following tests depends on private API
!contains(QT_CONFIG, private_tests): SUBDIRS -= \
qcombobox \

View File

@ -7,7 +7,7 @@ requires(contains(QT_CONFIG,private_tests))
MOC_DIR=tmp
QT = core network
QT = core-private network-private
symbian {
TARGET.CAPABILITY = NetworkServices

View File

@ -83,8 +83,12 @@ public:
bool open(QIODevice::OpenMode openMode)
{
Q_ASSERT(!openForRead_);
Q_ASSERT(!openForWrite_);
if (openForRead_ || openForWrite_) {
qWarning("%s: file is already open for %s",
Q_FUNC_INFO,
(openForRead_ ? "reading" : "writing"));
return false;
}
openFile_ = resolveFile(openMode & QIODevice::WriteOnly);
if (!openFile_)
@ -132,13 +136,19 @@ public:
qint64 pos() const
{
Q_ASSERT(openForRead_ || openForWrite_);
if (!openForRead_ && !openForWrite_) {
qWarning("%s: file is not open", Q_FUNC_INFO);
return -1;
}
return position_;
}
bool seek(qint64 pos)
{
Q_ASSERT(openForRead_ || openForWrite_);
if (!openForRead_ && !openForWrite_) {
qWarning("%s: file is not open", Q_FUNC_INFO);
return false;
}
if (pos >= 0) {
position_ = pos;
@ -150,7 +160,11 @@ public:
bool flush()
{
Q_ASSERT(openForRead_ || openForWrite_);
if (!openForRead_ && !openForWrite_) {
qWarning("%s: file is not open", Q_FUNC_INFO);
return false;
}
return true;
}
@ -346,10 +360,10 @@ public:
void setFileName(const QString &file)
{
Q_ASSERT(!openForRead_);
Q_ASSERT(!openForWrite_);
fileName_ = file;
if (openForRead_ || openForWrite_)
qWarning("%s: Can't set file name while file is open", Q_FUNC_INFO);
else
fileName_ = file;
}
// typedef QAbstractFileEngineIterator Iterator;
@ -368,9 +382,16 @@ public:
qint64 read(char *data, qint64 maxLen)
{
Q_ASSERT(openForRead_);
if (!openForRead_) {
qWarning("%s: file must be open for reading", Q_FUNC_INFO);
return -1;
}
if (openFile_.isNull()) {
qWarning("%s: file must not be null", Q_FUNC_INFO);
return -1;
}
Q_ASSERT(!openFile_.isNull());
QMutexLocker lock(&openFile_->mutex);
qint64 readSize = qMin(openFile_->content.size() - position_, maxLen);
if (readSize < 0)
@ -384,12 +405,19 @@ public:
qint64 write(const char *data, qint64 length)
{
Q_ASSERT(openForWrite_);
if (!openForWrite_) {
qWarning("%s: file must be open for writing", Q_FUNC_INFO);
return -1;
}
if (openFile_.isNull()) {
qWarning("%s: file must not be null", Q_FUNC_INFO);
return -1;
}
if (length < 0)
return -1;
Q_ASSERT(!openFile_.isNull());
QMutexLocker lock(&openFile_->mutex);
if (openFile_->content.size() == position_)
openFile_->content.append(data, length);
@ -434,7 +462,8 @@ protected:
QSharedPointer<File> resolveFile(bool create) const
{
if (openForRead_ || openForWrite_) {
Q_ASSERT(openFile_);
if (!openFile_)
qWarning("%s: file should not be null", Q_FUNC_INFO);
return openFile_;
}

View File

@ -299,7 +299,7 @@ public:
startTimer(2000);
}
void timerEvent(QTimerEvent *event)
void timerEvent(QTimerEvent * /* event */)
{
// should not crash.
(void)new QScrollArea(this);

View File

@ -90,7 +90,7 @@ public:
QSizeF documentSize() const { return QSizeF(); }
QRectF frameBoundingRect(QTextFrame *) const { return QRectF(); }
QRectF blockBoundingRect(const QTextBlock &) const { return QRectF(); }
void documentChanged(int from, int oldLength, int length) {
void documentChanged(int from, int /* oldLength */, int length) {
++changeEvents;
QTextBlock last = document()->lastBlock();

View File

@ -1,4 +1,5 @@
load(qttest_p4)
requires(contains(QT_CONFIG,accessibility))
SOURCES += tst_qaccessibility.cpp
unix:!mac:LIBS+=-lm

File diff suppressed because it is too large Load Diff

View File

@ -1,212 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt3Support 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 Q3TL_H
#define Q3TL_H
#include <QtCore/qalgorithms.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Qt3SupportLight)
template <typename T, typename LessThan>
Q_OUTOFLINE_TEMPLATE void qHeapSortPushDown(T *heap, int first, int last, LessThan lessThan)
{
int r = first;
while (r <= last / 2) {
if (last == 2 * r) {
// node r has only one child
if (lessThan(heap[2 * r], heap[r]))
qSwap(heap[r], heap[2 * r]);
r = last;
} else {
// node r has two children
if (lessThan(heap[2 * r], heap[r]) && !lessThan(heap[2 * r + 1], heap[2 * r])) {
// swap with left child
qSwap(heap[r], heap[2 * r]);
r *= 2;
} else if (lessThan(heap[2 * r + 1], heap[r])
&& lessThan(heap[2 * r + 1], heap[2 * r])) {
// swap with right child
qSwap(heap[r], heap[2 * r + 1]);
r = 2 * r + 1;
} else {
r = last;
}
}
}
}
template <typename BiIterator, typename T, typename LessThan>
Q_OUTOFLINE_TEMPLATE void qHeapSortHelper(BiIterator begin, BiIterator end, const T & /* dummy */, LessThan lessThan)
{
BiIterator it = begin;
uint n = 0;
while (it != end) {
++n;
++it;
}
if (n == 0)
return;
// Create the heap
BiIterator insert = begin;
T *realheap = new T[n];
T *heap = realheap - 1;
int size = 0;
for(; insert != end; ++insert) {
heap[++size] = *insert;
int i = size;
while (i > 1 && lessThan(heap[i], heap[i / 2])) {
qSwap(heap[i], heap[i / 2]);
i /= 2;
}
}
// Now do the sorting
for (int i = n; i > 0; i--) {
*begin++ = heap[1];
if (i > 1) {
heap[1] = heap[i];
qHeapSortPushDown(heap, 1, i - 1, lessThan);
}
}
delete[] realheap;
}
template <typename BiIterator, typename T>
inline void qHeapSortHelper(BiIterator begin, BiIterator end, const T &dummy)
{
qHeapSortHelper(begin, end, dummy, qLess<T>());
}
template <typename BiIterator, typename LessThan>
inline void qHeapSort(BiIterator begin, BiIterator end, LessThan lessThan)
{
if (begin != end)
qHeapSortHelper(begin, end, *begin, lessThan);
}
template <typename BiIterator>
inline void qHeapSort(BiIterator begin, BiIterator end)
{
if (begin != end)
qHeapSortHelper(begin, end, *begin);
}
template <typename Container>
inline void qHeapSort(Container &c)
{
#ifdef Q_CC_BOR
// Work around Borland 5.5 optimizer bug
c.detach();
#endif
if (!c.empty())
qHeapSortHelper(c.begin(), c.end(), *c.begin());
}
template <typename BiIterator, typename LessThan>
void qBubbleSort(BiIterator begin, BiIterator end, LessThan lessThan)
{
// Goto last element;
BiIterator last = end;
// empty list
if (begin == end)
return;
--last;
// only one element ?
if (last == begin)
return;
// So we have at least two elements in here
while (begin != last) {
bool swapped = false;
BiIterator swapPos = begin;
BiIterator x = end;
BiIterator y = x;
y--;
do {
--x;
--y;
if (lessThan(*x, *y)) {
swapped = true;
qSwap(*x, *y);
swapPos = y;
}
} while (y != begin);
if (!swapped)
return;
begin = swapPos;
++begin;
}
}
template <typename BiIterator, typename T>
void qBubbleSortHelper(BiIterator begin, BiIterator end, T)
{
qBubbleSort(begin, end, qLess<T>());
}
template <typename BiIterator>
void qBubbleSort(BiIterator begin, BiIterator end)
{
if (begin != end)
qBubbleSortHelper(begin, end, *begin);
}
template <typename Container>
inline void qBubbleSort(Container &c)
{
qBubbleSort(c.begin(), c.end());
}
QT_END_NAMESPACE
QT_END_HEADER
#endif // Q3TL_H

View File

@ -47,7 +47,6 @@
#include <sstream>
#include <algorithm>
#include <qalgorithms.h>
#include "q3tl.h"
#include <QStringList>
#include <QString>
#include <QVector>
@ -71,8 +70,6 @@ public slots:
void cleanup();
private slots:
void qBubbleSort();
void qHeapSort();
void test_qLowerBound_data();
void test_qLowerBound();
void test_qUpperBound_data();
@ -100,13 +97,11 @@ private:
};
tst_QAlgorithms::tst_QAlgorithms()
{
}
tst_QAlgorithms::~tst_QAlgorithms()
{
}
void tst_QAlgorithms::init()
@ -241,7 +236,8 @@ QList<ResultSet> testAlgorithm(Algorithm &algorithm, QStringList dataSetTypes,
foreach(QString dataSetType, dataSetTypes) {
QVector<DataType> container = generateData<DataType>(dataSetType, size);
results.append(testRun(container, algorithm, time));
Q_ASSERT(isSorted(container));
if (!isSorted(container))
qWarning("%s: container is not sorted after test", Q_FUNC_INFO);
}
return results;
}
@ -266,149 +262,6 @@ void testAlgorithm(Algorithm algorithm, QStringList &dataSetTypes)
}
}
#endif
static bool userFunction1(char ch1, char ch2)
{
return (ch1 ^ 1) < (ch2 ^ 1);
}
bool userFunction2(const char &ch1, char ch2)
{
return (ch1 ^ 1) < (ch2 ^ 1);
}
static inline bool userFunction3(char ch1, const char &ch2)
{
return (ch1 ^ 1) < (ch2 ^ 1);
}
inline bool userFunction4(const char &ch1, const char &ch2)
{
return (ch1 ^ 1) < (ch2 ^ 1);
}
class UserFunctor1
{
public:
UserFunctor1(int x = 1) : y(x) {}
bool operator()(char ch1, char ch2)
{
return (ch1 ^ y) < (ch2 ^ y);
}
char y;
};
void tst_QAlgorithms::qHeapSort()
{
char array1[] = "3141592";
::qHeapSort((char *)array1, array1 + strlen(array1));
QVERIFY(strcmp(array1, "1123459") == 0);
::qHeapSort((char *)array1, array1 + strlen(array1), qGreater<char>());
QVERIFY(strcmp(array1, "9543211") == 0);
::qHeapSort((char *)array1, array1 + strlen(array1), qLess<char>());
QVERIFY(strcmp(array1, "1123459") == 0);
{
char array2[] = "0123456789@ABCDE";
::qHeapSort((char *)array2, array2 + strlen(array2), userFunction1);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qHeapSort((char *)array2, array2 + strlen(array2), userFunction2);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qHeapSort((char *)array2, array2 + strlen(array2), userFunction3);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qHeapSort((char *)array2, array2 + strlen(array2), userFunction4);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
UserFunctor1 userFunctor1;
char array2[] = "0123456789@ABCDE";
::qHeapSort((char *)array2, array2 + strlen(array2), userFunctor1);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qHeapSort((char *)array2, array2 + strlen(array2), UserFunctor1());
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
::qHeapSort((char *)array2, array2 + strlen(array2), UserFunctor1(1));
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
::qHeapSort((char *)array2, array2 + strlen(array2), UserFunctor1(3));
QVERIFY(strcmp(array2, "3210765498CBA@ED") == 0);
::qHeapSort((char *)array2, array2 + strlen(array2), UserFunctor1(0));
QVERIFY(strcmp(array2, "0123456789@ABCDE") == 0);
}
}
void tst_QAlgorithms::qBubbleSort()
{
char array1[] = "3141592";
::qBubbleSort((char *)array1, array1 + strlen(array1));
QVERIFY(strcmp(array1, "1123459") == 0);
::qBubbleSort((char *)array1, array1 + strlen(array1), qGreater<char>());
QVERIFY(strcmp(array1, "9543211") == 0);
::qBubbleSort((char *)array1, array1 + strlen(array1), qLess<char>());
QVERIFY(strcmp(array1, "1123459") == 0);
{
char array2[] = "0123456789@ABCDE";
::qBubbleSort((char *)array2, array2 + strlen(array2), userFunction1);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qBubbleSort((char *)array2, array2 + strlen(array2), userFunction2);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qBubbleSort((char *)array2, array2 + strlen(array2), userFunction3);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qBubbleSort((char *)array2, array2 + strlen(array2), userFunction4);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
UserFunctor1 userFunctor1;
char array2[] = "0123456789@ABCDE";
::qBubbleSort((char *)array2, array2 + strlen(array2), userFunctor1);
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
}
{
char array2[] = "0123456789@ABCDE";
::qBubbleSort((char *)array2, array2 + strlen(array2), UserFunctor1());
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
::qBubbleSort((char *)array2, array2 + strlen(array2), UserFunctor1(1));
QVERIFY(strcmp(array2, "1032547698A@CBED") == 0);
::qBubbleSort((char *)array2, array2 + strlen(array2), UserFunctor1(3));
QVERIFY(strcmp(array2, "3210765498CBA@ED") == 0);
::qBubbleSort((char *)array2, array2 + strlen(array2), UserFunctor1(0));
QVERIFY(strcmp(array2, "0123456789@ABCDE") == 0);
}
}
void tst_QAlgorithms::swap()
{
@ -557,7 +410,7 @@ void tst_QAlgorithms::sortedList()
QList<int> list;
list << 4 << 3 << 6;
::qHeapSort(list.begin(), list.end());
::qSort(list.begin(), list.end());
QCOMPARE(list.count(), 3);
QCOMPARE(list.at(0), 3);
@ -877,26 +730,6 @@ void tst_QAlgorithms::convenienceAPI()
qDeleteAll(pointerList.begin(), pointerList.end());
}
template <typename DataType>
class HeapSortHelper
{
public:
void operator()(QVector<DataType> list)
{
::qHeapSort(list);
}
};
template <typename DataType>
class BubbleSortHelper
{
public:
void operator()(QVector<DataType> list)
{
::qBubbleSort(list);
}
};
template <typename DataType>
class QuickSortHelper
{
@ -948,22 +781,14 @@ void tst_QAlgorithms::performance()
testAlgorithm<StlSortHelper<TestInt>, TestInt>(StlSortHelper<TestInt>(), dataSetTypes);
cout << endl << "std::stable_sort" << endl;
testAlgorithm<StlStableSortHelper<TestInt>, TestInt>(StlStableSortHelper<TestInt>(), dataSetTypes);
cout << "Heap sort" << endl;
testAlgorithm<HeapSortHelper<TestInt>, TestInt>(HeapSortHelper<TestInt>(), dataSetTypes);
cout << endl << "Bubble sort" << endl;
testAlgorithm<BubbleSortHelper<TestInt>, TestInt>(BubbleSortHelper<TestInt>(), dataSetTypes);
/*
cout << endl << "Sorting lists of ints" << endl;
cout << "Heap sort" << endl;
testAlgorithm<HeapSortHelper<int>, int>(HeapSortHelper<int>(), dataSetTypes);
cout << endl << "Quick sort" << endl;
testAlgorithm<QuickSortHelper<int>, int>(QuickSortHelper<int>(), dataSetTypes);
cout << endl << "std::sort" << endl;
testAlgorithm<StlSortHelper<int>, int>(StlSortHelper<int>(), dataSetTypes);
cout << endl << "std::stable_sort" << endl;
testAlgorithm<StlStableSortHelper<int>, int>(StlStableSortHelper<int>(), dataSetTypes);
cout << endl << "Bubble sort" << endl;
testAlgorithm<BubbleSortHelper<int>, int>(BubbleSortHelper<int>(), dataSetTypes);
*/
}
#endif

View File

@ -49,5 +49,6 @@ int main(int argc, char *argv[])
QApplication app(argc, argv);
QApplication::setAttribute(Qt::AA_NativeWindows); //QTBUG-15774
base *b = new base();
Q_UNUSED(b);
return app.exec();
}

View File

@ -116,8 +116,7 @@ tst_QAtomicInt::~tst_QAtomicInt()
void tst_QAtomicInt::warningFreeHelper()
{
Q_ASSERT(false);
// The code below is bogus, and shouldn't be run. We're looking for warnings, only.
qFatal("This code is bogus, and shouldn't be run. We're looking for compiler warnings only.");
QBasicAtomicInt i = Q_BASIC_ATOMIC_INITIALIZER(0);

View File

@ -98,8 +98,7 @@ struct WFHC
void tst_QAtomicPointer::warningFreeHelper()
{
Q_ASSERT(false);
// The code below is bogus, and shouldn't be run. We're looking for warnings, only.
qFatal("This code is bogus, and shouldn't be run. We're looking for compiler warnings only.");
QBasicAtomicPointer<WFHC> p = Q_BASIC_ATOMIC_INITIALIZER(0);

View File

@ -1,5 +1,5 @@
load(qttest_p4)
requires(contains(QT_CONFIG,private_tests))
QT = core network
QT = core network-private
SOURCES += tst_qauthenticator.cpp
DEFINES += SRCDIR=\\\"$$PWD/\\\"

View File

@ -309,8 +309,7 @@ void tst_QBuffer::seekTest()
// (see Task 184730)
{
char c;
const int offset = 1;
Q_ASSERT(offset > 0); // any positive integer will do
const int offset = 1; // any positive integer will do
const qint64 pos = buf.size() + offset;
QVERIFY(buf.seek(pos));
QCOMPARE(buf.pos(), pos);

View File

@ -548,14 +548,14 @@ void tst_QChar::normalization_data()
QList<QByteArray> l = line.split(';');
Q_ASSERT(l.size() == 5);
QCOMPARE(l.size(), 5);
QStringList columns;
for (int i = 0; i < 5; ++i) {
columns.append(QString());
QList<QByteArray> c = l.at(i).split(' ');
Q_ASSERT(!c.isEmpty());
QVERIFY(!c.isEmpty());
for (int j = 0; j < c.size(); ++j) {
bool ok;

View File

@ -1506,7 +1506,6 @@ void tst_QColor::setallowX11ColorNames()
for (int i = 0; i < x11RgbTblSize; ++i) {
QString colorName = QLatin1String(x11RgbTbl[i].name);
QColor color;
QTest::ignoreMessage(QtWarningMsg, QString("QColor::setNamedColor: Unknown color name '%1'").arg(colorName).toLatin1());
color.setNamedColor(colorName);
QVERIFY(!color.isValid());
}
@ -1528,7 +1527,6 @@ void tst_QColor::setallowX11ColorNames()
for (int i = 0; i < x11RgbTblSize; ++i) {
QString colorName = QLatin1String(x11RgbTbl[i].name);
QColor color;
QTest::ignoreMessage(QtWarningMsg, QString("QColor::setNamedColor: Unknown color name '%1'").arg(colorName).toLatin1());
color.setNamedColor(colorName);
QVERIFY(!color.isValid());
}

View File

@ -1,4 +1,5 @@
CONFIG += qttest_p4
QT += gui-private core-private
SOURCES += tst_qcolumnview.cpp
TARGET = tst_qcolumnview

View File

@ -1,3 +1,4 @@
load(qttest_p4)
QT += gui-private core-private
SOURCES += tst_qcombobox.cpp

View File

@ -1230,21 +1230,17 @@ void tst_QComboBox::insertItem_data()
QTest::addColumn<int>("insertIndex");
QTest::addColumn<QString>("itemLabel");
QTest::addColumn<int>("expectedIndex");
QTest::addColumn<bool>("testQt3Support");
QTest::addColumn<bool>("editable");
QStringList initialItems;
initialItems << "foo" << "bar";
for(int e = 0 ; e<2 ; e++) {
bool editable = (e==0);
QTest::newRow("Insert less then 0") << initialItems << -1 << "inserted" << 0 << false << editable;
QTest::newRow("Insert at 0") << initialItems << 0 << "inserted" << 0 << false << editable;
QTest::newRow("Insert beyond count") << initialItems << 3 << "inserted" << 2 << false << editable;
QTest::newRow("Insert at count") << initialItems << 2 << "inserted" << 2 << false << editable;
QTest::newRow("Insert in the middle") << initialItems << 1 << "inserted" << 1 << false << editable;
#if defined(QT3_SUPPORT)
QTest::newRow("Qt3Support: Insert less then 0") << initialItems << -1 << "inserted" << 2 << true << editable;
#endif
QTest::newRow("Insert less then 0") << initialItems << -1 << "inserted" << 0 << editable;
QTest::newRow("Insert at 0") << initialItems << 0 << "inserted" << 0 << editable;
QTest::newRow("Insert beyond count") << initialItems << 3 << "inserted" << 2 << editable;
QTest::newRow("Insert at count") << initialItems << 2 << "inserted" << 2 << editable;
QTest::newRow("Insert in the middle") << initialItems << 1 << "inserted" << 1 << editable;
}
}
@ -1254,7 +1250,6 @@ void tst_QComboBox::insertItem()
QFETCH(int, insertIndex);
QFETCH(QString, itemLabel);
QFETCH(int, expectedIndex);
QFETCH(bool, testQt3Support);
QFETCH(bool, editable);
testWidget->insertItems(0, initialItems);
@ -1263,16 +1258,7 @@ void tst_QComboBox::insertItem()
testWidget->setEditable(true);
if (editable)
testWidget->setEditText("FOO");
#if defined (QT3_SUPPORT)
if (testQt3Support)
testWidget->insertItem(itemLabel, insertIndex);
else
testWidget->insertItem(insertIndex, itemLabel);
#else
Q_UNUSED(testQt3Support);
testWidget->insertItem(insertIndex, itemLabel);
#endif
QCOMPARE(testWidget->count(), initialItems.count() + 1);
QCOMPARE(testWidget->itemText(expectedIndex), itemLabel);

View File

@ -277,7 +277,9 @@ retry:
case 'L': row = completer->completionCount() - 1; break;
case 'F': row = 0; break;
default:
Q_ASSERT(false);
QFAIL(qPrintable(QString(
"Problem with 'step' value in test data: %1 (only P, N, L and F are allowed)."
).arg(step[i])));
}
completer->setCurrentRow(row);
}
@ -1248,9 +1250,7 @@ public:
void tst_QCompleter::task189564_omitNonSelectableItems()
{
const QString prefix("a");
Q_ASSERT(!prefix.isEmpty());
const int n = 5;
Q_ASSERT(n > 0);
QStringList strings;
for (int i = 0; i < n; ++i)
@ -1278,10 +1278,11 @@ public:
{
setEditable(true);
setInsertPolicy(NoInsert);
Q_ASSERT(completer());
completer()->setCompletionMode(QCompleter::PopupCompletion);
completer()->setCompletionRole(Qt::DisplayRole);
connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix()));
if (completer()) {
completer()->setCompletionMode(QCompleter::PopupCompletion);
completer()->setCompletionRole(Qt::DisplayRole);
connect(lineEdit(), SIGNAL(editingFinished()), SLOT(setCompletionPrefix()));
}
}
private slots:
void setCompletionPrefix() { completer()->setCompletionPrefix(lineEdit()->text()); }
@ -1290,6 +1291,7 @@ private slots:
void tst_QCompleter::task246056_setCompletionPrefix()
{
task246056_ComboBox *comboBox = new task246056_ComboBox;
QVERIFY(comboBox->completer());
comboBox->addItem("");
comboBox->addItem("a1");
comboBox->addItem("a2");

View File

@ -49,7 +49,11 @@ int main(int argc, char** argv)
#ifdef Q_WS_QWS
QApplication app(argc, argv);
QStringList args = app.arguments();
Q_ASSERT(args.count() == 3 || args.count() == 4);
if (args.count() != 3 && args.count() != 4) {
fprintf(stdout,qPrintable(QString("Usage: %1 channel message [data]").arg(args.at(0))));
fflush(stdout);
return 1;
}
QString channelName = args.at(1);
QString msg = args.at(2);
QByteArray data;

View File

@ -1,6 +1,6 @@
load(qttest_p4)
SOURCES += tst_qcssparser.cpp
QT += xml
QT += xml gui-private
requires(contains(QT_CONFIG,private_tests))
!symbian: {

View File

@ -148,7 +148,7 @@ void tst_QCssParser::scanner_data()
}
static char *tokenName(QCss::TokenType t)
static const char *tokenName(QCss::TokenType t)
{
switch (t) {
case QCss::NONE: return "NONE";

File diff suppressed because it is too large Load Diff

Before

Width:  |  Height:  |  Size: 522 KiB

View File

@ -1,23 +1,14 @@
load(qttest_p4)
SOURCES += tst_qdatastream.cpp
!symbian: {
cross_compile: DEFINES += SVGFILE=\\\"tests2.svg\\\"
else: DEFINES += SVGFILE=\\\"gearflowers.svg\\\"
}
# for qpaintdevicemetrics.h
QT += svg
wince*: {
addFiles.files = datastream.q42 tests2.svg
addFiles.files = datastream.q42
addFiles.path = .
DEPLOYMENT += addFiles
DEFINES += SRCDIR=\\\"\\\"
} else:symbian {
# SRCDIR and SVGFILE defined in code in symbian
addFiles.files = datastream.q42 tests2.svg
# SRCDIR defined in code in symbian
addFiles.files = datastream.q42
addFiles.path = .
DEPLOYMENT += addFiles
TARGET.EPOCHEAPSIZE = 1000000 10000000

View File

@ -1,12 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<!-- SVG content generated using Symbology Configuration Management System (SCMS) -->
<!-- Systematic Software Engineering Ltd. - www.systematic.co.uk - do not remove -->
<svg id="SUZP-----------" width="400px" height="400px" viewBox="0 0 400 400">
<g >
<svg viewBox="0 0 400 400" id="_0.SUZ------------" width="400px" height="400px"><path d="M115 285 C115 400 285 400 285 285 C400 285 400 115 285 115 C285 0 115 0 115 115 C0 115 0 285 115 285 z" style="fill:rgb(255,255,128);stroke:rgb(0,0,0);stroke-width:10"></path>
<text x="130px" y="180px" style="font-size:100;font-family:Arial;fill:rgb(0,0,0)">U</text>
</svg>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 757 B

File diff suppressed because it is too large Load Diff

View File

@ -2701,17 +2701,10 @@ void tst_QDateTimeEdit::task98554()
QCOMPARE(testWidget->time(), QTime(0, 0, 10, 0));
}
static QList<int> makeList(int val1, int val2 = -1, int val3 = -1, int val4 = -1, int val5 = -1, int val6 = -1, int val7 = -1)
static QList<int> makeList(int val1, int val2, int val3)
{
QList<int> ret;
Q_ASSERT(val1 >= 0);
ret << val1;
if (val2 < 0) {return ret;} else {ret << val2;}
if (val3 < 0) {return ret;} else {ret << val3;}
if (val4 < 0) {return ret;} else {ret << val4;}
if (val5 < 0) {return ret;} else {ret << val5;}
if (val6 < 0) {return ret;} else {ret << val6;}
if (val7 >= 0) {ret << val2;}
ret << val1 << val2 << val3;
return ret;
}
@ -2753,7 +2746,7 @@ void tst_QDateTimeEdit::setCurrentSection()
QFETCH(QList<int>, setCurrentSections);
QFETCH(QList<int>, expectedCursorPositions);
Q_ASSERT(setCurrentSections.size() == expectedCursorPositions.size());
QCOMPARE(setCurrentSections.size(), expectedCursorPositions.size());
testWidget->setDisplayFormat(format);
testWidget->setDateTime(dateTime);
#ifdef Q_WS_MAC

View File

@ -3,7 +3,7 @@ SOURCES += ../tst_qdbusmarshall.cpp
TARGET = ../tst_qdbusmarshall
QT = core
QT += dbus
QT += core-private dbus-private
LIBS += $$QT_LIBS_DBUS
QMAKE_CXXFLAGS += $$QT_CFLAGS_DBUS

Some files were not shown because too many files have changed in this diff Show More