Merge "Merge remote-tracking branch 'origin/wip/qt6' into dev"
This commit is contained in:
commit
d243232974
@ -6,4 +6,4 @@ DEFINES += QT_NO_JAVA_STYLE_ITERATORS
|
|||||||
QT_SOURCE_TREE = $$PWD
|
QT_SOURCE_TREE = $$PWD
|
||||||
QT_BUILD_TREE = $$shadowed($$PWD)
|
QT_BUILD_TREE = $$shadowed($$PWD)
|
||||||
|
|
||||||
MODULE_VERSION = 5.15.0
|
MODULE_VERSION = 6.0.0
|
||||||
|
@ -87,7 +87,8 @@
|
|||||||
#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
|
#define QT_REQUIRE_CONFIG(feature) Q_STATIC_ASSERT_X(QT_FEATURE_##feature == 1, "Required feature " #feature " for file " __FILE__ " not available.")
|
||||||
|
|
||||||
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)
|
||||||
# define QT_NO_UNSHARABLE_CONTAINERS
|
// ### Qt6: FIXME and get rid of unsharable containers
|
||||||
|
//# define QT_NO_UNSHARABLE_CONTAINERS
|
||||||
# define QT6_VIRTUAL virtual
|
# define QT6_VIRTUAL virtual
|
||||||
# define QT6_NOT_VIRTUAL
|
# define QT6_NOT_VIRTUAL
|
||||||
#else
|
#else
|
||||||
|
@ -1307,7 +1307,7 @@ static QStringList backtraceFramesForLogMessage(int frameCount)
|
|||||||
QString function = m.captured(2);
|
QString function = m.captured(2);
|
||||||
|
|
||||||
// skip the trace from QtCore that are because of the qDebug itself
|
// skip the trace from QtCore that are because of the qDebug itself
|
||||||
if (!numberPrinted && library.contains(QLatin1String("Qt5Core"))
|
if (!numberPrinted && library.contains(QLatin1String("Qt6Core"))
|
||||||
&& (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
|
&& (function.isEmpty() || function.contains(QLatin1String("Message"), Qt::CaseInsensitive)
|
||||||
|| function.contains(QLatin1String("QDebug")))) {
|
|| function.contains(QLatin1String("QDebug")))) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -342,7 +342,6 @@ void QFileSelectorPrivate::updateSelectors()
|
|||||||
QStringList QFileSelectorPrivate::platformSelectors()
|
QStringList QFileSelectorPrivate::platformSelectors()
|
||||||
{
|
{
|
||||||
// similar, but not identical to QSysInfo::osType
|
// similar, but not identical to QSysInfo::osType
|
||||||
// ### Qt6: remove macOS fallbacks to "mac" and the future compatibility
|
|
||||||
QStringList ret;
|
QStringList ret;
|
||||||
#if defined(Q_OS_WIN)
|
#if defined(Q_OS_WIN)
|
||||||
ret << QStringLiteral("windows");
|
ret << QStringLiteral("windows");
|
||||||
@ -355,16 +354,10 @@ QStringList QFileSelectorPrivate::platformSelectors()
|
|||||||
# if !defined(Q_OS_ANDROID) && !defined(Q_OS_QNX)
|
# if !defined(Q_OS_ANDROID) && !defined(Q_OS_QNX)
|
||||||
// we don't want "linux" for Android or two instances of "qnx" for QNX
|
// we don't want "linux" for Android or two instances of "qnx" for QNX
|
||||||
ret << QSysInfo::kernelType();
|
ret << QSysInfo::kernelType();
|
||||||
# ifdef Q_OS_MAC
|
|
||||||
ret << QStringLiteral("mac"); // compatibility, since kernelType() is "darwin"
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
QString productName = QSysInfo::productType();
|
QString productName = QSysInfo::productType();
|
||||||
if (productName != QLatin1String("unknown"))
|
if (productName != QLatin1String("unknown"))
|
||||||
ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
|
ret << productName; // "opensuse", "fedora", "osx", "ios", "android"
|
||||||
# if defined(Q_OS_MACOS)
|
|
||||||
ret << QStringLiteral("macos"); // future compatibility
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ static Qt::HANDLE createChangeNotification(const QString &path, uint flags)
|
|||||||
nativePath.append(QLatin1Char('\\'));
|
nativePath.append(QLatin1Char('\\'));
|
||||||
const HANDLE result = FindFirstChangeNotification(reinterpret_cast<const wchar_t *>(nativePath.utf16()),
|
const HANDLE result = FindFirstChangeNotification(reinterpret_cast<const wchar_t *>(nativePath.utf16()),
|
||||||
FALSE, flags);
|
FALSE, flags);
|
||||||
DEBUG() << __FUNCTION__ << nativePath << Qt::hex <<showbase << flags << "returns" << result;
|
DEBUG() << __FUNCTION__ << nativePath << Qt::hex << Qt::showbase << flags << "returns" << result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3270,7 +3270,11 @@ void QAbstractItemModel::endResetModel()
|
|||||||
{
|
{
|
||||||
Q_D(QAbstractItemModel);
|
Q_D(QAbstractItemModel);
|
||||||
d->invalidatePersistentIndexes();
|
d->invalidatePersistentIndexes();
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
resetInternalData();
|
||||||
|
#else
|
||||||
QMetaObject::invokeMethod(this, "resetInternalData");
|
QMetaObject::invokeMethod(this, "resetInternalData");
|
||||||
|
#endif
|
||||||
emit modelReset(QPrivateSignal());
|
emit modelReset(QPrivateSignal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,11 @@ Q_SIGNALS:
|
|||||||
void sourceModelChanged(QPrivateSignal);
|
void sourceModelChanged(QPrivateSignal);
|
||||||
|
|
||||||
protected Q_SLOTS:
|
protected Q_SLOTS:
|
||||||
void resetInternalData();
|
void resetInternalData()
|
||||||
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
override
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
|
QAbstractProxyModel(QAbstractProxyModelPrivate &, QObject *parent);
|
||||||
|
@ -156,10 +156,10 @@ private:
|
|||||||
extern QString qAppFileName();
|
extern QString qAppFileName();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if QT_VERSION >= 0x060000
|
#if QT_VERSION >= 0x070000
|
||||||
# error "Bump QCoreApplicatoinPrivate::app_compile_version to 0x060000"
|
# error "Bump QCoreApplicatoinPrivate::app_compile_version to 0x070000"
|
||||||
#endif
|
#endif
|
||||||
int QCoreApplicationPrivate::app_compile_version = 0x050000; //we don't know exactly, but it's at least 5.0.0
|
int QCoreApplicationPrivate::app_compile_version = 0x060000; //we don't know exactly, but it's at least 6.0.0
|
||||||
|
|
||||||
bool QCoreApplicationPrivate::setuidAllowed = false;
|
bool QCoreApplicationPrivate::setuidAllowed = false;
|
||||||
|
|
||||||
|
@ -772,7 +772,7 @@ QString decodeMSG(const MSG& msg)
|
|||||||
auto rect = reinterpret_cast<const RECT *>(lParam);
|
auto rect = reinterpret_cast<const RECT *>(lParam);
|
||||||
QTextStream(¶meters) << "DPI: " << HIWORD(wParam) << ','
|
QTextStream(¶meters) << "DPI: " << HIWORD(wParam) << ','
|
||||||
<< LOWORD(wParam) << ' ' << (rect->right - rect->left) << 'x'
|
<< LOWORD(wParam) << ' ' << (rect->right - rect->left) << 'x'
|
||||||
<< (rect->bottom - rect->top) << forcesign << rect->left << rect->top;
|
<< (rect->bottom - rect->top) << Qt::forcesign << rect->left << rect->top;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WM_IME_NOTIFY:
|
case WM_IME_NOTIFY:
|
||||||
|
@ -500,7 +500,7 @@ public:
|
|||||||
typedef void (*Deleter)(void *);
|
typedef void (*Deleter)(void *);
|
||||||
typedef void *(*Creator)(const void *);
|
typedef void *(*Creator)(const void *);
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
#if 1 || QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt6: fix this
|
||||||
typedef void (*Destructor)(void *);
|
typedef void (*Destructor)(void *);
|
||||||
typedef void *(*Constructor)(void *, const void *); // TODO Qt6: remove me
|
typedef void *(*Constructor)(void *, const void *); // TODO Qt6: remove me
|
||||||
#endif
|
#endif
|
||||||
|
@ -233,10 +233,6 @@ QObjectPrivate::~QObjectPrivate()
|
|||||||
|
|
||||||
if (metaObject) metaObject->objectDestroyed(q_ptr);
|
if (metaObject) metaObject->objectDestroyed(q_ptr);
|
||||||
|
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
if (extraData)
|
|
||||||
qDeleteAll(extraData->userData);
|
|
||||||
#endif
|
|
||||||
delete extraData;
|
delete extraData;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4260,58 +4256,6 @@ void QObject::dumpObjectInfo() const
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
static QBasicAtomicInteger<uint> user_data_registration = Q_BASIC_ATOMIC_INITIALIZER(0);
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
uint QObject::registerUserData()
|
|
||||||
{
|
|
||||||
return user_data_registration.fetchAndAddRelaxed(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QObjectUserData::QObjectUserData()
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
QObjectUserData::~QObjectUserData()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
void QObject::setUserData(uint id, QObjectUserData* data)
|
|
||||||
{
|
|
||||||
Q_D(QObject);
|
|
||||||
if (!d->extraData)
|
|
||||||
d->extraData = new QObjectPrivate::ExtraData;
|
|
||||||
|
|
||||||
if (d->extraData->userData.size() <= (int) id)
|
|
||||||
d->extraData->userData.resize((int) id + 1);
|
|
||||||
d->extraData->userData[id] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\internal
|
|
||||||
*/
|
|
||||||
QObjectUserData* QObject::userData(uint id) const
|
|
||||||
{
|
|
||||||
Q_D(const QObject);
|
|
||||||
if (!d->extraData)
|
|
||||||
return 0;
|
|
||||||
if ((int)id < d->extraData->userData.size())
|
|
||||||
return d->extraData->userData.at(id);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QT_NO_USERDATA
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_DEBUG_STREAM
|
#ifndef QT_NO_DEBUG_STREAM
|
||||||
QDebug operator<<(QDebug dbg, const QObject *o)
|
QDebug operator<<(QDebug dbg, const QObject *o)
|
||||||
|
@ -78,12 +78,6 @@ class QRegExp;
|
|||||||
#if QT_CONFIG(regularexpression)
|
#if QT_CONFIG(regularexpression)
|
||||||
class QRegularExpression;
|
class QRegularExpression;
|
||||||
#endif
|
#endif
|
||||||
#if !QT_DEPRECATED_SINCE(5, 14) || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
||||||
# define QT_NO_USERDATA
|
|
||||||
#endif
|
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
class QObjectUserData;
|
|
||||||
#endif
|
|
||||||
struct QDynamicMetaObjectData;
|
struct QDynamicMetaObjectData;
|
||||||
|
|
||||||
typedef QList<QObject*> QObjectList;
|
typedef QList<QObject*> QObjectList;
|
||||||
@ -408,15 +402,6 @@ public:
|
|||||||
QList<QByteArray> dynamicPropertyNames() const;
|
QList<QByteArray> dynamicPropertyNames() const;
|
||||||
#endif // QT_NO_PROPERTIES
|
#endif // QT_NO_PROPERTIES
|
||||||
|
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
QT_DEPRECATED_VERSION_5_14
|
|
||||||
static uint registerUserData();
|
|
||||||
QT_DEPRECATED_VERSION_X_5_14("Use setProperty()")
|
|
||||||
void setUserData(uint id, QObjectUserData* data);
|
|
||||||
QT_DEPRECATED_VERSION_X_5_14("Use property()")
|
|
||||||
QObjectUserData* userData(uint id) const;
|
|
||||||
#endif // QT_NO_USERDATA
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void destroyed(QObject * = nullptr);
|
void destroyed(QObject * = nullptr);
|
||||||
void objectNameChanged(const QString &objectName, QPrivateSignal);
|
void objectNameChanged(const QString &objectName, QPrivateSignal);
|
||||||
@ -485,15 +470,6 @@ inline QMetaObject::Connection QObject::connect(const QObject *asender, const ch
|
|||||||
inline const QMetaObject *qt_getQtMetaObject() noexcept
|
inline const QMetaObject *qt_getQtMetaObject() noexcept
|
||||||
{ return &QObject::staticQtMetaObject; }
|
{ return &QObject::staticQtMetaObject; }
|
||||||
|
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
class Q_CORE_EXPORT QObjectUserData {
|
|
||||||
Q_DISABLE_COPY(QObjectUserData)
|
|
||||||
public:
|
|
||||||
QObjectUserData() = default;
|
|
||||||
virtual ~QObjectUserData();
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 0)
|
#if QT_DEPRECATED_SINCE(5, 0)
|
||||||
template<typename T>
|
template<typename T>
|
||||||
inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString())
|
inline QT_DEPRECATED T qFindChild(const QObject *o, const QString &name = QString())
|
||||||
|
@ -113,9 +113,6 @@ public:
|
|||||||
struct ExtraData
|
struct ExtraData
|
||||||
{
|
{
|
||||||
ExtraData() {}
|
ExtraData() {}
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
QVector<QObjectUserData *> userData;
|
|
||||||
#endif
|
|
||||||
QList<QByteArray> propertyNames;
|
QList<QByteArray> propertyNames;
|
||||||
QVector<QVariant> propertyValues;
|
QVector<QVariant> propertyValues;
|
||||||
QVector<int> runningTimers;
|
QVector<int> runningTimers;
|
||||||
|
@ -63,6 +63,7 @@ QT_REQUIRE_CONFIG(mimetype);
|
|||||||
#include <QtCore/qmutex.h>
|
#include <QtCore/qmutex.h>
|
||||||
#include <QtCore/qvector.h>
|
#include <QtCore/qvector.h>
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -692,7 +692,7 @@ static bool qt_get_metadata(QLibraryPrivate *priv, QString *errMsg)
|
|||||||
};
|
};
|
||||||
#else
|
#else
|
||||||
auto getMetaData = [](QFunctionPointer fptr) {
|
auto getMetaData = [](QFunctionPointer fptr) {
|
||||||
auto f = reinterpret_cast<QPair<const char *, size_t> (*)()>(fptr);
|
auto f = reinterpret_cast<QPluginMetaData (*)()>(fptr);
|
||||||
return f();
|
return f();
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
@ -702,7 +702,7 @@ static bool qt_get_metadata(QLibraryPrivate *priv, QString *errMsg)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto metaData = getMetaData(pfn);
|
auto metaData = getMetaData(pfn);
|
||||||
QJsonDocument doc = qJsonFromRawLibraryMetaData(metaData.first, metaData.second, errMsg);
|
QJsonDocument doc = qJsonFromRawLibraryMetaData(reinterpret_cast<const char *>(metaData.data), metaData.size, errMsg);
|
||||||
if (doc.isNull())
|
if (doc.isNull())
|
||||||
return false;
|
return false;
|
||||||
priv->metaData = doc.object();
|
priv->metaData = doc.object();
|
||||||
|
@ -1369,11 +1369,6 @@ void QEasingCurve::addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qre
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn QList<QPointF> QEasingCurve::cubicBezierSpline() const
|
|
||||||
\obsolete Use toCubicSpline() instead.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\since 5.0
|
\since 5.0
|
||||||
|
|
||||||
|
@ -46,10 +46,6 @@ QT_REQUIRE_CONFIG(easingcurve);
|
|||||||
|
|
||||||
#include <QtCore/qobjectdefs.h>
|
#include <QtCore/qobjectdefs.h>
|
||||||
#include <QtCore/qvector.h>
|
#include <QtCore/qvector.h>
|
||||||
#if QT_DEPRECATED_SINCE(5, 0)
|
|
||||||
# include <QtCore/qlist.h>
|
|
||||||
# include <QtCore/qpoint.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
@ -105,9 +101,6 @@ public:
|
|||||||
void addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint);
|
void addCubicBezierSegment(const QPointF & c1, const QPointF & c2, const QPointF & endPoint);
|
||||||
void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b);
|
void addTCBSegment(const QPointF &nextPoint, qreal t, qreal c, qreal b);
|
||||||
QVector<QPointF> toCubicSpline() const;
|
QVector<QPointF> toCubicSpline() const;
|
||||||
#if QT_DEPRECATED_SINCE(5, 0)
|
|
||||||
QT_DEPRECATED QList<QPointF> cubicBezierSpline() const { return toCubicSpline().toList(); }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Type type() const;
|
Type type() const;
|
||||||
void setType(Type type);
|
void setType(Type type);
|
||||||
|
@ -246,12 +246,6 @@ public:
|
|||||||
{ QSet<T> result = *this; result -= other; return result; }
|
{ QSet<T> result = *this; result -= other; return result; }
|
||||||
|
|
||||||
QList<T> values() const;
|
QList<T> values() const;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
|
||||||
Q_DECL_DEPRECATED_X("Use values() instead.")
|
|
||||||
QList<T> toList() const { return values(); }
|
|
||||||
Q_DECL_DEPRECATED_X("Use QSet<T>(list.begin(), list.end()) instead.")
|
|
||||||
static QSet<T> fromList(const QList<T> &list);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Hash q_hash;
|
Hash q_hash;
|
||||||
@ -383,30 +377,6 @@ Q_OUTOFLINE_TEMPLATE QList<T> QSet<T>::values() const
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
|
||||||
template <typename T>
|
|
||||||
Q_OUTOFLINE_TEMPLATE QSet<T> QList<T>::toSet() const
|
|
||||||
{
|
|
||||||
QSet<T> result;
|
|
||||||
result.reserve(size());
|
|
||||||
for (int i = 0; i < size(); ++i)
|
|
||||||
result.insert(at(i));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
QSet<T> QSet<T>::fromList(const QList<T> &list)
|
|
||||||
{
|
|
||||||
return list.toSet();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
QList<T> QList<T>::fromSet(const QSet<T> &set)
|
|
||||||
{
|
|
||||||
return set.toList();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Q_DECLARE_SEQUENTIAL_ITERATOR(Set)
|
Q_DECLARE_SEQUENTIAL_ITERATOR(Set)
|
||||||
|
|
||||||
#if !defined(QT_NO_JAVA_STYLE_ITERATORS)
|
#if !defined(QT_NO_JAVA_STYLE_ITERATORS)
|
||||||
|
@ -80,82 +80,3 @@ int main()
|
|||||||
painter.end(); // painting done
|
painter.end(); // painting done
|
||||||
//! [1]
|
//! [1]
|
||||||
}
|
}
|
||||||
|
|
||||||
QPicture myPicture;
|
|
||||||
{
|
|
||||||
// FORMATS
|
|
||||||
//! [2]
|
|
||||||
const QStringList list = QPicture::inputFormatList();
|
|
||||||
for (const QString &string : list)
|
|
||||||
myProcessing(string);
|
|
||||||
//! [2]
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// OUTPUT
|
|
||||||
//! [3]
|
|
||||||
const QStringList list = QPicture::outputFormatList();
|
|
||||||
for (const QString &string : list)
|
|
||||||
myProcessing(string);
|
|
||||||
//! [3]
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
// PIC READ
|
|
||||||
//! [4]
|
|
||||||
QPictureIO iio;
|
|
||||||
QPixmap pixmap;
|
|
||||||
iio.setFileName("vegeburger.pic");
|
|
||||||
if (iio.read()) { // OK
|
|
||||||
QPicture picture = iio.picture();
|
|
||||||
QPainter painter(&pixmap);
|
|
||||||
painter.drawPicture(0, 0, picture);
|
|
||||||
}
|
|
||||||
//! [4]
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
QPixmap pixmap;
|
|
||||||
// PIC WRITE
|
|
||||||
//! [5]
|
|
||||||
QPictureIO iio;
|
|
||||||
QPicture picture;
|
|
||||||
QPainter painter(&picture);
|
|
||||||
painter.drawPixmap(0, 0, pixmap);
|
|
||||||
iio.setPicture(picture);
|
|
||||||
iio.setFileName("vegeburger.pic");
|
|
||||||
iio.setFormat("PIC");
|
|
||||||
if (iio.write())
|
|
||||||
return true; // returned true if written successfully
|
|
||||||
//! [5]
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// SVG READ
|
|
||||||
//! [6]
|
|
||||||
void readSVG(QPictureIO *picture)
|
|
||||||
{
|
|
||||||
// read the picture using the picture->ioDevice()
|
|
||||||
}
|
|
||||||
//! [6]
|
|
||||||
|
|
||||||
// SVG WRITE
|
|
||||||
//! [7]
|
|
||||||
void writeSVG(QPictureIO *picture)
|
|
||||||
{
|
|
||||||
// write the picture using the picture->ioDevice()
|
|
||||||
}
|
|
||||||
//! [7]
|
|
||||||
|
|
||||||
// USE SVG
|
|
||||||
void foo() {
|
|
||||||
|
|
||||||
//! [8]
|
|
||||||
// add the SVG picture handler
|
|
||||||
// ...
|
|
||||||
//! [8]
|
|
||||||
QPictureIO::defineIOHandler("SVG", 0, 0, readSVG, writeSVG);
|
|
||||||
// ...
|
|
||||||
|
|
||||||
}
|
|
||||||
|
@ -14,7 +14,6 @@ HEADERS += \
|
|||||||
image/qpaintengine_pic_p.h \
|
image/qpaintengine_pic_p.h \
|
||||||
image/qpicture.h \
|
image/qpicture.h \
|
||||||
image/qpicture_p.h \
|
image/qpicture_p.h \
|
||||||
image/qpictureformatplugin.h \
|
|
||||||
image/qpixmap.h \
|
image/qpixmap.h \
|
||||||
image/qpixmap_raster_p.h \
|
image/qpixmap_raster_p.h \
|
||||||
image/qpixmap_blitter_p.h \
|
image/qpixmap_blitter_p.h \
|
||||||
@ -38,7 +37,6 @@ SOURCES += \
|
|||||||
image/qimagewriter.cpp \
|
image/qimagewriter.cpp \
|
||||||
image/qpaintengine_pic.cpp \
|
image/qpaintengine_pic.cpp \
|
||||||
image/qpicture.cpp \
|
image/qpicture.cpp \
|
||||||
image/qpictureformatplugin.cpp \
|
|
||||||
image/qpixmap.cpp \
|
image/qpixmap.cpp \
|
||||||
image/qpixmapcache.cpp \
|
image/qpixmapcache.cpp \
|
||||||
image/qplatformpixmap.cpp \
|
image/qplatformpixmap.cpp \
|
||||||
@ -59,9 +57,6 @@ win32:!winrt: SOURCES += image/qpixmap_win.cpp
|
|||||||
|
|
||||||
darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm
|
darwin: OBJECTIVE_SOURCES += image/qimage_darwin.mm
|
||||||
|
|
||||||
NO_PCH_SOURCES += image/qimage_compat.cpp
|
|
||||||
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
|
|
||||||
|
|
||||||
# Built-in image format support
|
# Built-in image format support
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
image/qbmphandler_p.h \
|
image/qbmphandler_p.h \
|
||||||
|
@ -179,7 +179,6 @@ public:
|
|||||||
|
|
||||||
Format format() const;
|
Format format() const;
|
||||||
|
|
||||||
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QIMAGE_COMPAT_CPP)
|
|
||||||
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
|
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const &
|
||||||
{ return convertToFormat_helper(f, flags); }
|
{ return convertToFormat_helper(f, flags); }
|
||||||
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
|
Q_REQUIRED_RESULT Q_ALWAYS_INLINE QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) &&
|
||||||
@ -189,9 +188,6 @@ public:
|
|||||||
else
|
else
|
||||||
return convertToFormat_helper(f, flags);
|
return convertToFormat_helper(f, flags);
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
Q_REQUIRED_RESULT QImage convertToFormat(Format f, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
|
|
||||||
#endif
|
|
||||||
Q_REQUIRED_RESULT QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
|
Q_REQUIRED_RESULT QImage convertToFormat(Format f, const QVector<QRgb> &colorTable, Qt::ImageConversionFlags flags = Qt::AutoColor) const;
|
||||||
bool reinterpretAsFormat(Format f);
|
bool reinterpretAsFormat(Format f);
|
||||||
|
|
||||||
@ -284,7 +280,6 @@ public:
|
|||||||
static QMatrix trueMatrix(const QMatrix &, int w, int h);
|
static QMatrix trueMatrix(const QMatrix &, int w, int h);
|
||||||
QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const;
|
||||||
static QTransform trueMatrix(const QTransform &, int w, int h);
|
static QTransform trueMatrix(const QTransform &, int w, int h);
|
||||||
#if defined(Q_COMPILER_REF_QUALIFIERS) && !defined(QT_COMPILING_QIMAGE_COMPAT_CPP)
|
|
||||||
QImage mirrored(bool horizontally = false, bool vertically = true) const &
|
QImage mirrored(bool horizontally = false, bool vertically = true) const &
|
||||||
{ return mirrored_helper(horizontally, vertically); }
|
{ return mirrored_helper(horizontally, vertically); }
|
||||||
QImage &&mirrored(bool horizontally = false, bool vertically = true) &&
|
QImage &&mirrored(bool horizontally = false, bool vertically = true) &&
|
||||||
@ -293,10 +288,6 @@ public:
|
|||||||
{ return rgbSwapped_helper(); }
|
{ return rgbSwapped_helper(); }
|
||||||
QImage &&rgbSwapped() &&
|
QImage &&rgbSwapped() &&
|
||||||
{ rgbSwapped_inplace(); return std::move(*this); }
|
{ rgbSwapped_inplace(); return std::move(*this); }
|
||||||
#else
|
|
||||||
QImage mirrored(bool horizontally = false, bool vertically = true) const;
|
|
||||||
QImage rgbSwapped() const;
|
|
||||||
#endif
|
|
||||||
void invertPixels(InvertMode = InvertRgb);
|
void invertPixels(InvertMode = InvertRgb);
|
||||||
|
|
||||||
QColorSpace colorSpace() const;
|
QColorSpace colorSpace() const;
|
||||||
|
@ -1,66 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the QtGui module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 3 requirements
|
|
||||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 2.0 or (at your option) the GNU General
|
|
||||||
** Public license version 3 or any later version approved by the KDE Free
|
|
||||||
** Qt Foundation. The licenses are as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
||||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifdef QIMAGE_H
|
|
||||||
# error "This file cannot be used with precompiled headers"
|
|
||||||
#endif
|
|
||||||
#define QT_COMPILING_QIMAGE_COMPAT_CPP
|
|
||||||
|
|
||||||
#include "qimage.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
// These implementations must be the same as the inline versions in qimage.h
|
|
||||||
|
|
||||||
QImage QImage::convertToFormat(Format f, Qt::ImageConversionFlags flags) const
|
|
||||||
{
|
|
||||||
return convertToFormat_helper(f, flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage QImage::mirrored(bool horizontally, bool vertically) const
|
|
||||||
{
|
|
||||||
return mirrored_helper(horizontally, vertically);
|
|
||||||
}
|
|
||||||
|
|
||||||
QImage QImage::rgbSwapped() const
|
|
||||||
{
|
|
||||||
return rgbSwapped_helper();
|
|
||||||
}
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
@ -140,7 +140,7 @@ QImageData::calculateImageParameters(qsizetype width, qsizetype height, qsizetyp
|
|||||||
qsizetype dummy;
|
qsizetype dummy;
|
||||||
if (mul_overflow(height, qsizetype(sizeof(uchar *)), &dummy))
|
if (mul_overflow(height, qsizetype(sizeof(uchar *)), &dummy))
|
||||||
return invalid; // why is this here?
|
return invalid; // why is this here?
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
#if 1 || QT_VERSION < QT_VERSION_CHECK(6,0,0) // ### can only fix this if QImage dimensions are not int anymore
|
||||||
// Disallow images where width * depth calculations might overflow
|
// Disallow images where width * depth calculations might overflow
|
||||||
if (width > (INT_MAX - 31) / depth)
|
if (width > (INT_MAX - 31) / depth)
|
||||||
return invalid;
|
return invalid;
|
||||||
|
@ -264,14 +264,14 @@ void QPicture::setData(const char* data, uint size)
|
|||||||
\sa save()
|
\sa save()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QPicture::load(const QString &fileName, const char *format)
|
bool QPicture::load(const QString &fileName)
|
||||||
{
|
{
|
||||||
QFile f(fileName);
|
QFile f(fileName);
|
||||||
if (!f.open(QIODevice::ReadOnly)) {
|
if (!f.open(QIODevice::ReadOnly)) {
|
||||||
operator=(QPicture());
|
operator=(QPicture());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return load(&f, format);
|
return load(&f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -280,21 +280,8 @@ bool QPicture::load(const QString &fileName, const char *format)
|
|||||||
\a dev is the device to use for loading.
|
\a dev is the device to use for loading.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QPicture::load(QIODevice *dev, const char *format)
|
bool QPicture::load(QIODevice *dev)
|
||||||
{
|
{
|
||||||
if(format) {
|
|
||||||
#ifndef QT_NO_PICTUREIO
|
|
||||||
QPictureIO io(dev, format);
|
|
||||||
if (io.read()) {
|
|
||||||
operator=(io.picture());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
qWarning("QPicture::load: No such picture format: %s", format);
|
|
||||||
operator=(QPicture());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
detach();
|
detach();
|
||||||
QByteArray a = dev->readAll();
|
QByteArray a = dev->readAll();
|
||||||
|
|
||||||
@ -312,7 +299,7 @@ bool QPicture::load(QIODevice *dev, const char *format)
|
|||||||
\sa load()
|
\sa load()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QPicture::save(const QString &fileName, const char *format)
|
bool QPicture::save(const QString &fileName)
|
||||||
{
|
{
|
||||||
if (paintingActive()) {
|
if (paintingActive()) {
|
||||||
qWarning("QPicture::save: still being painted on. "
|
qWarning("QPicture::save: still being painted on. "
|
||||||
@ -320,27 +307,10 @@ bool QPicture::save(const QString &fileName, const char *format)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(format) {
|
|
||||||
#ifndef QT_NO_PICTUREIO
|
|
||||||
QPictureIO io(fileName, format);
|
|
||||||
bool result = io.write();
|
|
||||||
if (result) {
|
|
||||||
operator=(io.picture());
|
|
||||||
} else if (format)
|
|
||||||
#else
|
|
||||||
bool result = false;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
qWarning("QPicture::save: No such picture format: %s", format);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
QFile f(fileName);
|
QFile f(fileName);
|
||||||
if (!f.open(QIODevice::WriteOnly))
|
if (!f.open(QIODevice::WriteOnly))
|
||||||
return false;
|
return false;
|
||||||
return save(&f, format);
|
return save(&f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -349,7 +319,7 @@ bool QPicture::save(const QString &fileName, const char *format)
|
|||||||
\a dev is the device to use for saving.
|
\a dev is the device to use for saving.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool QPicture::save(QIODevice *dev, const char *format)
|
bool QPicture::save(QIODevice *dev)
|
||||||
{
|
{
|
||||||
if (paintingActive()) {
|
if (paintingActive()) {
|
||||||
qWarning("QPicture::save: still being painted on. "
|
qWarning("QPicture::save: still being painted on. "
|
||||||
@ -357,22 +327,6 @@ bool QPicture::save(QIODevice *dev, const char *format)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(format) {
|
|
||||||
#ifndef QT_NO_PICTUREIO
|
|
||||||
QPictureIO io(dev, format);
|
|
||||||
bool result = io.write();
|
|
||||||
if (result) {
|
|
||||||
operator=(io.picture());
|
|
||||||
} else if (format)
|
|
||||||
#else
|
|
||||||
bool result = false;
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
qWarning("QPicture::save: No such picture format: %s", format);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
dev->write(d_func()->pictb.buffer(), d_func()->pictb.buffer().size());
|
dev->write(d_func()->pictb.buffer(), d_func()->pictb.buffer().size());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -1189,780 +1143,6 @@ QDataStream &operator>>(QDataStream &s, QPicture &r)
|
|||||||
}
|
}
|
||||||
#endif // QT_NO_DATASTREAM
|
#endif // QT_NO_DATASTREAM
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_PICTUREIO
|
|
||||||
|
|
||||||
QT_BEGIN_INCLUDE_NAMESPACE
|
|
||||||
#include "qregexp.h"
|
|
||||||
#include "qpictureformatplugin.h"
|
|
||||||
QT_END_INCLUDE_NAMESPACE
|
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 10)
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Returns a string that specifies the picture format of the file \a
|
|
||||||
fileName, or \nullptr if the file cannot be read or if the format
|
|
||||||
is not recognized.
|
|
||||||
|
|
||||||
\sa load(), save()
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char* QPicture::pictureFormat(const QString &fileName)
|
|
||||||
{
|
|
||||||
const QByteArray format = QPictureIO::pictureFormat(fileName);
|
|
||||||
// This function returns a const char * from a QByteArray.
|
|
||||||
// Double check that the QByteArray is not detached, otherwise
|
|
||||||
// we would return a dangling pointer.
|
|
||||||
Q_ASSERT(!format.isDetached());
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Returns a list of picture formats that are supported for picture
|
|
||||||
input.
|
|
||||||
|
|
||||||
\sa outputFormats(), inputFormatList(), QPictureIO
|
|
||||||
*/
|
|
||||||
QList<QByteArray> QPicture::inputFormats()
|
|
||||||
{
|
|
||||||
return QPictureIO::inputFormats();
|
|
||||||
}
|
|
||||||
|
|
||||||
static QStringList qToStringList(const QList<QByteArray> &arr)
|
|
||||||
{
|
|
||||||
QStringList list;
|
|
||||||
const int count = arr.count();
|
|
||||||
list.reserve(count);
|
|
||||||
for (int i = 0; i < count; ++i)
|
|
||||||
list.append(QString::fromLatin1(arr.at(i)));
|
|
||||||
return list;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Returns a list of picture formats that are supported for picture
|
|
||||||
input.
|
|
||||||
|
|
||||||
Note that if you want to iterate over the list, you should iterate
|
|
||||||
over a copy, e.g.
|
|
||||||
\snippet picture/picture.cpp 2
|
|
||||||
|
|
||||||
\sa outputFormatList(), inputFormats(), QPictureIO
|
|
||||||
*/
|
|
||||||
QStringList QPicture::inputFormatList()
|
|
||||||
{
|
|
||||||
return qToStringList(QPictureIO::inputFormats());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Returns a list of picture formats that are supported for picture
|
|
||||||
output.
|
|
||||||
|
|
||||||
Note that if you want to iterate over the list, you should iterate
|
|
||||||
over a copy, e.g.
|
|
||||||
\snippet picture/picture.cpp 3
|
|
||||||
|
|
||||||
\sa inputFormatList(), outputFormats(), QPictureIO
|
|
||||||
*/
|
|
||||||
QStringList QPicture::outputFormatList()
|
|
||||||
{
|
|
||||||
return qToStringList(QPictureIO::outputFormats());
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
Returns a list of picture formats that are supported for picture
|
|
||||||
output.
|
|
||||||
|
|
||||||
\sa inputFormats(), outputFormatList(), QPictureIO
|
|
||||||
*/
|
|
||||||
QList<QByteArray> QPicture::outputFormats()
|
|
||||||
{
|
|
||||||
return QPictureIO::outputFormats();
|
|
||||||
}
|
|
||||||
#endif // QT_DEPRECATED_SINCE(5, 10)
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
QPictureIO member functions
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
\class QPictureIO
|
|
||||||
|
|
||||||
\brief The QPictureIO class contains parameters for loading and
|
|
||||||
saving pictures.
|
|
||||||
|
|
||||||
\ingroup painting
|
|
||||||
\ingroup io
|
|
||||||
\inmodule QtGui
|
|
||||||
|
|
||||||
QPictureIO contains a QIODevice object that is used for picture data
|
|
||||||
I/O. The programmer can install new picture file formats in addition
|
|
||||||
to those that Qt provides.
|
|
||||||
|
|
||||||
You don't normally need to use this class; QPicture::load(),
|
|
||||||
QPicture::save().
|
|
||||||
|
|
||||||
\sa QPicture, QPixmap, QFile
|
|
||||||
*/
|
|
||||||
|
|
||||||
struct QPictureIOData
|
|
||||||
{
|
|
||||||
QPicture pi; // picture
|
|
||||||
int iostat; // IO status
|
|
||||||
QByteArray frmt; // picture format
|
|
||||||
QIODevice *iodev; // IO device
|
|
||||||
QString fname; // file name
|
|
||||||
QString descr; // picture description
|
|
||||||
const char *parameters;
|
|
||||||
int quality;
|
|
||||||
float gamma;
|
|
||||||
};
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Constructs a QPictureIO object with all parameters set to zero.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QPictureIO::QPictureIO()
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Constructs a QPictureIO object with the I/O device \a ioDevice and a
|
|
||||||
\a format tag.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QPictureIO::QPictureIO(QIODevice *ioDevice, const char *format)
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
d->iodev = ioDevice;
|
|
||||||
d->frmt = format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Constructs a QPictureIO object with the file name \a fileName and a
|
|
||||||
\a format tag.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QPictureIO::QPictureIO(const QString &fileName, const char* format)
|
|
||||||
{
|
|
||||||
init();
|
|
||||||
d->frmt = format;
|
|
||||||
d->fname = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Contains initialization common to all QPictureIO constructors.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void QPictureIO::init()
|
|
||||||
{
|
|
||||||
d = new QPictureIOData();
|
|
||||||
d->parameters = 0;
|
|
||||||
d->quality = -1; // default quality of the current format
|
|
||||||
d->gamma=0.0f;
|
|
||||||
d->iostat = 0;
|
|
||||||
d->iodev = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Destroys the object and all related data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QPictureIO::~QPictureIO()
|
|
||||||
{
|
|
||||||
if (d->parameters)
|
|
||||||
delete [] d->parameters;
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
QPictureIO picture handler functions
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
class QPictureHandler
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QPictureHandler(const char *f, const char *h, const QByteArray& fl,
|
|
||||||
picture_io_handler r, picture_io_handler w);
|
|
||||||
QByteArray format; // picture format
|
|
||||||
QRegExp header; // picture header pattern
|
|
||||||
enum TMode { Untranslated=0, TranslateIn, TranslateInOut } text_mode;
|
|
||||||
picture_io_handler read_picture; // picture read function
|
|
||||||
picture_io_handler write_picture; // picture write function
|
|
||||||
bool obsolete; // support not "published"
|
|
||||||
};
|
|
||||||
|
|
||||||
QPictureHandler::QPictureHandler(const char *f, const char *h, const QByteArray& fl,
|
|
||||||
picture_io_handler r, picture_io_handler w)
|
|
||||||
: format(f), header(QString::fromLatin1(h))
|
|
||||||
{
|
|
||||||
text_mode = Untranslated;
|
|
||||||
if (fl.contains('t'))
|
|
||||||
text_mode = TranslateIn;
|
|
||||||
else if (fl.contains('T'))
|
|
||||||
text_mode = TranslateInOut;
|
|
||||||
obsolete = fl.contains('O');
|
|
||||||
read_picture = r;
|
|
||||||
write_picture = w;
|
|
||||||
}
|
|
||||||
|
|
||||||
typedef QList<QPictureHandler *> QPHList;
|
|
||||||
Q_GLOBAL_STATIC(QPHList, pictureHandlers)
|
|
||||||
|
|
||||||
void qt_init_picture_plugins()
|
|
||||||
{
|
|
||||||
typedef QMultiMap<int, QString> PluginKeyMap;
|
|
||||||
typedef PluginKeyMap::const_iterator PluginKeyMapConstIterator;
|
|
||||||
|
|
||||||
static QBasicMutex mutex;
|
|
||||||
const auto locker = qt_scoped_lock(mutex);
|
|
||||||
static QFactoryLoader loader(QPictureFormatInterface_iid,
|
|
||||||
QStringLiteral("/pictureformats"));
|
|
||||||
|
|
||||||
const PluginKeyMap keyMap = loader.keyMap();
|
|
||||||
const PluginKeyMapConstIterator cend = keyMap.constEnd();
|
|
||||||
for (PluginKeyMapConstIterator it = keyMap.constBegin(); it != cend; ++it) {
|
|
||||||
if (QPictureFormatPlugin *format = qobject_cast<QPictureFormatPlugin*>(loader.instance(it.key())))
|
|
||||||
format->installIOHandler(it.value());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void cleanup()
|
|
||||||
{
|
|
||||||
// make sure that picture handlers are delete before plugin manager
|
|
||||||
if (QPHList *list = pictureHandlers()) {
|
|
||||||
qDeleteAll(*list);
|
|
||||||
list->clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void qt_init_picture_handlers() // initialize picture handlers
|
|
||||||
{
|
|
||||||
static QBasicAtomicInt done = Q_BASIC_ATOMIC_INITIALIZER(0);
|
|
||||||
if (done.testAndSetRelaxed(0, 1)) {
|
|
||||||
qAddPostRoutine(cleanup);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static QPictureHandler *get_picture_handler(const char *format)
|
|
||||||
{ // get pointer to handler
|
|
||||||
qt_init_picture_handlers();
|
|
||||||
qt_init_picture_plugins();
|
|
||||||
if (QPHList *list = pictureHandlers()) {
|
|
||||||
for (int i = 0; i < list->size(); ++i) {
|
|
||||||
if (list->at(i)->format == format)
|
|
||||||
return list->at(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0; // no such handler
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Defines a picture I/O handler for the picture format called \a
|
|
||||||
format, which is recognized using the regular
|
|
||||||
expression defined in \a header, read using \a readPicture and
|
|
||||||
written using \a writePicture.
|
|
||||||
|
|
||||||
\a flags is a string of single-character flags for this format.
|
|
||||||
The only flag defined currently is T (upper case), so the only
|
|
||||||
legal value for \a flags are "T" and the empty string. The "T"
|
|
||||||
flag means that the picture file is a text file, and Qt should treat
|
|
||||||
all newline conventions as equivalent. (XPM files and some PPM
|
|
||||||
files are text files for example.)
|
|
||||||
|
|
||||||
\a format is used to select a handler to write a QPicture; \a header
|
|
||||||
is used to select a handler to read an picture file.
|
|
||||||
|
|
||||||
If \a readPicture is \nullptr, the QPictureIO will not be able
|
|
||||||
to read pictures in \a format. If \a writePicture is \nullptr,
|
|
||||||
the QPictureIO will not be able to write pictures in \a format. If
|
|
||||||
both are null, the QPictureIO object is valid but useless.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
\snippet picture/picture.cpp 6
|
|
||||||
\codeline
|
|
||||||
\snippet picture/picture.cpp 7
|
|
||||||
\codeline
|
|
||||||
\snippet picture/picture.cpp 8
|
|
||||||
|
|
||||||
Before the regular expression test, all the 0 bytes in the file header are
|
|
||||||
converted to 1 bytes. This is done because when Qt was ASCII-based, QRegExp
|
|
||||||
could not handle 0 bytes in strings.
|
|
||||||
|
|
||||||
The regexp is only applied on the first 14 bytes of the file.
|
|
||||||
|
|
||||||
(Note that if one handlerIO supports writing a format and another
|
|
||||||
supports reading it, Qt supports both reading and writing. If two
|
|
||||||
handlers support the same operation, Qt chooses one arbitrarily.)
|
|
||||||
*/
|
|
||||||
|
|
||||||
void QPictureIO::defineIOHandler(const char *format,
|
|
||||||
const char *header,
|
|
||||||
const char *flags,
|
|
||||||
picture_io_handler readPicture,
|
|
||||||
picture_io_handler writePicture)
|
|
||||||
{
|
|
||||||
qt_init_picture_handlers();
|
|
||||||
if (QPHList *list = pictureHandlers()) {
|
|
||||||
QPictureHandler *p;
|
|
||||||
p = new QPictureHandler(format, header, QByteArray(flags), readPicture, writePicture);
|
|
||||||
list->prepend(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
|
||||||
QPictureIO normal member functions
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the picture currently set.
|
|
||||||
|
|
||||||
\sa setPicture()
|
|
||||||
*/
|
|
||||||
const QPicture &QPictureIO::picture() const { return d->pi; }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the picture's IO status. A non-zero value indicates an
|
|
||||||
error, whereas 0 means that the IO operation was successful.
|
|
||||||
|
|
||||||
\sa setStatus()
|
|
||||||
*/
|
|
||||||
int QPictureIO::status() const { return d->iostat; }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the picture format string or \nullptr if no format has been
|
|
||||||
explicitly set.
|
|
||||||
*/
|
|
||||||
const char *QPictureIO::format() const { return d->frmt; }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the IO device currently set.
|
|
||||||
|
|
||||||
\sa setIODevice()
|
|
||||||
*/
|
|
||||||
QIODevice *QPictureIO::ioDevice() const { return d->iodev; }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the file name currently set.
|
|
||||||
|
|
||||||
\sa setFileName()
|
|
||||||
*/
|
|
||||||
QString QPictureIO::fileName() const { return d->fname; }
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the picture description string.
|
|
||||||
|
|
||||||
\sa setDescription()
|
|
||||||
*/
|
|
||||||
QString QPictureIO::description() const { return d->descr; }
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the picture to \a picture.
|
|
||||||
|
|
||||||
\sa picture()
|
|
||||||
*/
|
|
||||||
void QPictureIO::setPicture(const QPicture &picture)
|
|
||||||
{
|
|
||||||
d->pi = picture;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the picture IO status to \a status. A non-zero value indicates
|
|
||||||
an error, whereas 0 means that the IO operation was successful.
|
|
||||||
|
|
||||||
\sa status()
|
|
||||||
*/
|
|
||||||
void QPictureIO::setStatus(int status)
|
|
||||||
{
|
|
||||||
d->iostat = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the picture format to \a format for the picture to be read or
|
|
||||||
written.
|
|
||||||
|
|
||||||
It is necessary to specify a format before writing an picture, but
|
|
||||||
it is not necessary to specify a format before reading an picture.
|
|
||||||
|
|
||||||
If no format has been set, Qt guesses the picture format before
|
|
||||||
reading it. If a format is set the picture will only be read if it
|
|
||||||
has that format.
|
|
||||||
|
|
||||||
\sa read(), write(), format()
|
|
||||||
*/
|
|
||||||
void QPictureIO::setFormat(const char *format)
|
|
||||||
{
|
|
||||||
d->frmt = format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the IO device to be used for reading or writing an picture.
|
|
||||||
|
|
||||||
Setting the IO device allows pictures to be read/written to any
|
|
||||||
block-oriented QIODevice.
|
|
||||||
|
|
||||||
If \a ioDevice is not null, this IO device will override file name
|
|
||||||
settings.
|
|
||||||
|
|
||||||
\sa setFileName()
|
|
||||||
*/
|
|
||||||
void QPictureIO::setIODevice(QIODevice *ioDevice)
|
|
||||||
{
|
|
||||||
d->iodev = ioDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the name of the file to read or write an picture from to \a
|
|
||||||
fileName.
|
|
||||||
|
|
||||||
\sa setIODevice()
|
|
||||||
*/
|
|
||||||
void QPictureIO::setFileName(const QString &fileName)
|
|
||||||
{
|
|
||||||
d->fname = fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the quality of the written picture, related to the
|
|
||||||
compression ratio.
|
|
||||||
|
|
||||||
\sa setQuality(), QPicture::save()
|
|
||||||
*/
|
|
||||||
int QPictureIO::quality() const
|
|
||||||
{
|
|
||||||
return d->quality;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the quality of the written picture to \a q, related to the
|
|
||||||
compression ratio.
|
|
||||||
|
|
||||||
\a q must be in the range -1..100. Specify 0 to obtain small
|
|
||||||
compressed files, 100 for large uncompressed files. (-1 signifies
|
|
||||||
the default compression.)
|
|
||||||
|
|
||||||
\sa quality(), QPicture::save()
|
|
||||||
*/
|
|
||||||
|
|
||||||
void QPictureIO::setQuality(int q)
|
|
||||||
{
|
|
||||||
d->quality = q;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the picture's parameters string.
|
|
||||||
|
|
||||||
\sa setParameters()
|
|
||||||
*/
|
|
||||||
|
|
||||||
const char *QPictureIO::parameters() const
|
|
||||||
{
|
|
||||||
return d->parameters;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the picture's parameter string to \a parameters. This is for
|
|
||||||
picture handlers that require special parameters.
|
|
||||||
|
|
||||||
Although the current picture formats supported by Qt ignore the
|
|
||||||
parameters string, it may be used in future extensions or by
|
|
||||||
contributions (for example, JPEG).
|
|
||||||
|
|
||||||
\sa parameters()
|
|
||||||
*/
|
|
||||||
|
|
||||||
void QPictureIO::setParameters(const char *parameters)
|
|
||||||
{
|
|
||||||
if (d->parameters)
|
|
||||||
delete [] d->parameters;
|
|
||||||
d->parameters = qstrdup(parameters);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the gamma value at which the picture will be viewed to \a
|
|
||||||
gamma. If the picture format stores a gamma value for which the
|
|
||||||
picture is intended to be used, then this setting will be used to
|
|
||||||
modify the picture. Setting to 0.0 will disable gamma correction
|
|
||||||
(i.e. any specification in the file will be ignored).
|
|
||||||
|
|
||||||
The default value is 0.0.
|
|
||||||
|
|
||||||
\sa gamma()
|
|
||||||
*/
|
|
||||||
void QPictureIO::setGamma(float gamma)
|
|
||||||
{
|
|
||||||
d->gamma=gamma;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns the gamma value at which the picture will be viewed.
|
|
||||||
|
|
||||||
\sa setGamma()
|
|
||||||
*/
|
|
||||||
float QPictureIO::gamma() const
|
|
||||||
{
|
|
||||||
return d->gamma;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Sets the picture description string for picture handlers that support
|
|
||||||
picture descriptions to \a description.
|
|
||||||
|
|
||||||
Currently, no picture format supported by Qt uses the description
|
|
||||||
string.
|
|
||||||
*/
|
|
||||||
|
|
||||||
void QPictureIO::setDescription(const QString &description)
|
|
||||||
{
|
|
||||||
d->descr = description;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a string that specifies the picture format of the file \a
|
|
||||||
fileName, or null if the file cannot be read or if the format is
|
|
||||||
not recognized.
|
|
||||||
*/
|
|
||||||
|
|
||||||
QByteArray QPictureIO::pictureFormat(const QString &fileName)
|
|
||||||
{
|
|
||||||
QFile file(fileName);
|
|
||||||
QByteArray format;
|
|
||||||
if (!file.open(QIODevice::ReadOnly))
|
|
||||||
return format;
|
|
||||||
format = pictureFormat(&file);
|
|
||||||
file.close();
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\overload
|
|
||||||
|
|
||||||
Returns a string that specifies the picture format of the picture read
|
|
||||||
from IO device \a d, or 0 if the device cannot be read or if the
|
|
||||||
format is not recognized.
|
|
||||||
|
|
||||||
Make sure that \a d is at the right position in the device (for
|
|
||||||
example, at the beginning of the file).
|
|
||||||
|
|
||||||
\sa QIODevice::pos()
|
|
||||||
*/
|
|
||||||
|
|
||||||
QByteArray QPictureIO::pictureFormat(QIODevice *d)
|
|
||||||
{
|
|
||||||
// if you change this change the documentation for defineIOHandler()
|
|
||||||
const int buflen = 14;
|
|
||||||
|
|
||||||
char buf[buflen];
|
|
||||||
char buf2[buflen];
|
|
||||||
qt_init_picture_handlers();
|
|
||||||
qt_init_picture_plugins();
|
|
||||||
int pos = d->pos(); // save position
|
|
||||||
int rdlen = d->read(buf, buflen); // read a few bytes
|
|
||||||
|
|
||||||
QByteArray format;
|
|
||||||
if (rdlen != buflen)
|
|
||||||
return format;
|
|
||||||
|
|
||||||
memcpy(buf2, buf, buflen);
|
|
||||||
|
|
||||||
for (int n = 0; n < rdlen; n++)
|
|
||||||
if (buf[n] == '\0')
|
|
||||||
buf[n] = '\001';
|
|
||||||
if (rdlen > 0) {
|
|
||||||
buf[rdlen - 1] = '\0';
|
|
||||||
QString bufStr = QString::fromLatin1(buf);
|
|
||||||
if (QPHList *list = pictureHandlers()) {
|
|
||||||
for (int i = 0; i < list->size(); ++i) {
|
|
||||||
if (list->at(i)->header.indexIn(bufStr) != -1) { // try match with headers
|
|
||||||
format = list->at(i)->format;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
d->seek(pos); // restore position
|
|
||||||
return format;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a sorted list of picture formats that are supported for
|
|
||||||
picture input.
|
|
||||||
*/
|
|
||||||
QList<QByteArray> QPictureIO::inputFormats()
|
|
||||||
{
|
|
||||||
QList<QByteArray> result;
|
|
||||||
|
|
||||||
qt_init_picture_handlers();
|
|
||||||
qt_init_picture_plugins();
|
|
||||||
|
|
||||||
if (QPHList *list = pictureHandlers()) {
|
|
||||||
for (int i = 0; i < list->size(); ++i) {
|
|
||||||
QPictureHandler *p = list->at(i);
|
|
||||||
if (p->read_picture && !p->obsolete && !result.contains(p->format))
|
|
||||||
result.append(p->format);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::sort(result.begin(), result.end());
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Returns a sorted list of picture formats that are supported for
|
|
||||||
picture output.
|
|
||||||
*/
|
|
||||||
QList<QByteArray> QPictureIO::outputFormats()
|
|
||||||
{
|
|
||||||
qt_init_picture_handlers();
|
|
||||||
qt_init_picture_plugins();
|
|
||||||
|
|
||||||
QList<QByteArray> result;
|
|
||||||
if (QPHList *list = pictureHandlers()) {
|
|
||||||
for (int i = 0; i < list->size(); ++i) {
|
|
||||||
QPictureHandler *p = list->at(i);
|
|
||||||
if (p->write_picture && !p->obsolete && !result.contains(p->format))
|
|
||||||
result.append(p->format);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Reads an picture into memory and returns \c true if the picture was
|
|
||||||
successfully read; otherwise returns \c false.
|
|
||||||
|
|
||||||
Before reading an picture you must set an IO device or a file name.
|
|
||||||
If both an IO device and a file name have been set, the IO device
|
|
||||||
will be used.
|
|
||||||
|
|
||||||
Setting the picture file format string is optional.
|
|
||||||
|
|
||||||
Note that this function does \e not set the \l{format()}{format} used to read the picture. If you need that
|
|
||||||
information, use the pictureFormat() static functions.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
\snippet picture/picture.cpp 4
|
|
||||||
|
|
||||||
\sa setIODevice(), setFileName(), setFormat(), write(), QPixmap::load()
|
|
||||||
*/
|
|
||||||
bool QPictureIO::read()
|
|
||||||
{
|
|
||||||
QFile file;
|
|
||||||
QByteArray picture_format;
|
|
||||||
QPictureHandler *h;
|
|
||||||
|
|
||||||
if (d->iodev) { // read from io device
|
|
||||||
// ok, already open
|
|
||||||
} else if (!d->fname.isEmpty()) { // read from file
|
|
||||||
file.setFileName(d->fname);
|
|
||||||
if (!file.open(QIODevice::ReadOnly))
|
|
||||||
return false; // cannot open file
|
|
||||||
d->iodev = &file;
|
|
||||||
} else { // no file name or io device
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (d->frmt.isEmpty()) {
|
|
||||||
// Try to guess format
|
|
||||||
picture_format = pictureFormat(d->iodev); // get picture format
|
|
||||||
if (picture_format.isEmpty()) {
|
|
||||||
if (file.isOpen()) { // unknown format
|
|
||||||
file.close();
|
|
||||||
d->iodev = 0;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
picture_format = d->frmt;
|
|
||||||
}
|
|
||||||
|
|
||||||
h = get_picture_handler(picture_format);
|
|
||||||
if (file.isOpen()) {
|
|
||||||
#if !defined(Q_OS_UNIX)
|
|
||||||
if (h && h->text_mode) { // reopen in translated mode
|
|
||||||
file.close();
|
|
||||||
file.open(QIODevice::ReadOnly | QIODevice::Text);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
file.seek(0); // position to start
|
|
||||||
}
|
|
||||||
d->iostat = 1; // assume error
|
|
||||||
|
|
||||||
if (h && h->read_picture)
|
|
||||||
(*h->read_picture)(this);
|
|
||||||
|
|
||||||
if (file.isOpen()) { // picture was read using file
|
|
||||||
file.close();
|
|
||||||
d->iodev = 0;
|
|
||||||
}
|
|
||||||
return d->iostat == 0; // picture successfully read?
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Writes an picture to an IO device and returns \c true if the picture was
|
|
||||||
successfully written; otherwise returns \c false.
|
|
||||||
|
|
||||||
Before writing an picture you must set an IO device or a file name.
|
|
||||||
If both an IO device and a file name have been set, the IO device
|
|
||||||
will be used.
|
|
||||||
|
|
||||||
The picture will be written using the specified picture format.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
\snippet picture/picture.cpp 5
|
|
||||||
|
|
||||||
\sa setIODevice(), setFileName(), setFormat(), read(), QPixmap::save()
|
|
||||||
*/
|
|
||||||
bool QPictureIO::write()
|
|
||||||
{
|
|
||||||
if (d->frmt.isEmpty())
|
|
||||||
return false;
|
|
||||||
QPictureHandler *h = get_picture_handler(d->frmt);
|
|
||||||
if (!h || !h->write_picture) {
|
|
||||||
qWarning("QPictureIO::write: No such picture format handler: %s",
|
|
||||||
format());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
QFile file;
|
|
||||||
if (!d->iodev && !d->fname.isEmpty()) {
|
|
||||||
file.setFileName(d->fname);
|
|
||||||
bool translate = h->text_mode==QPictureHandler::TranslateInOut;
|
|
||||||
QIODevice::OpenMode fmode = translate ? QIODevice::WriteOnly | QIODevice::Text : QIODevice::OpenMode(QIODevice::WriteOnly);
|
|
||||||
if (!file.open(fmode)) // couldn't create file
|
|
||||||
return false;
|
|
||||||
d->iodev = &file;
|
|
||||||
}
|
|
||||||
d->iostat = 1;
|
|
||||||
(*h->write_picture)(this);
|
|
||||||
if (file.isOpen()) { // picture was written using file
|
|
||||||
file.close();
|
|
||||||
d->iodev = 0;
|
|
||||||
}
|
|
||||||
return d->iostat == 0; // picture successfully written?
|
|
||||||
}
|
|
||||||
#endif //QT_NO_PICTUREIO
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QT_NO_PICTURE
|
#endif // QT_NO_PICTURE
|
||||||
|
@ -48,7 +48,6 @@
|
|||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_PICTURE
|
#ifndef QT_NO_PICTURE
|
||||||
|
|
||||||
class QPicturePrivate;
|
class QPicturePrivate;
|
||||||
@ -69,10 +68,10 @@ public:
|
|||||||
|
|
||||||
bool play(QPainter *p);
|
bool play(QPainter *p);
|
||||||
|
|
||||||
bool load(QIODevice *dev, const char *format = nullptr);
|
bool load(QIODevice *dev);
|
||||||
bool load(const QString &fileName, const char *format = nullptr);
|
bool load(const QString &fileName);
|
||||||
bool save(QIODevice *dev, const char *format = nullptr);
|
bool save(QIODevice *dev);
|
||||||
bool save(const QString &fileName, const char *format = nullptr);
|
bool save(const QString &fileName);
|
||||||
|
|
||||||
QRect boundingRect() const;
|
QRect boundingRect() const;
|
||||||
void setBoundingRect(const QRect &r);
|
void setBoundingRect(const QRect &r);
|
||||||
@ -88,14 +87,6 @@ public:
|
|||||||
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QPicture &p);
|
friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &in, const QPicture &p);
|
||||||
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QPicture &p);
|
friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &in, QPicture &p);
|
||||||
|
|
||||||
#if QT_DEPRECATED_SINCE(5, 10)
|
|
||||||
static QT_DEPRECATED const char* pictureFormat(const QString &fileName);
|
|
||||||
static QT_DEPRECATED QList<QByteArray> inputFormats();
|
|
||||||
static QT_DEPRECATED QList<QByteArray> outputFormats();
|
|
||||||
static QT_DEPRECATED QStringList inputFormatList();
|
|
||||||
static QT_DEPRECATED QStringList outputFormatList();
|
|
||||||
#endif // QT_DEPRECATED_SINCE(5, 10)
|
|
||||||
|
|
||||||
QPaintEngine *paintEngine() const override;
|
QPaintEngine *paintEngine() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -118,67 +109,6 @@ public:
|
|||||||
|
|
||||||
Q_DECLARE_SHARED(QPicture)
|
Q_DECLARE_SHARED(QPicture)
|
||||||
|
|
||||||
|
|
||||||
#ifndef QT_NO_PICTUREIO
|
|
||||||
class QIODevice;
|
|
||||||
class QPictureIO;
|
|
||||||
typedef void (*picture_io_handler)(QPictureIO *); // picture IO handler
|
|
||||||
|
|
||||||
struct QPictureIOData;
|
|
||||||
|
|
||||||
class Q_GUI_EXPORT QPictureIO
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
QPictureIO();
|
|
||||||
QPictureIO(QIODevice *ioDevice, const char *format);
|
|
||||||
QPictureIO(const QString &fileName, const char *format);
|
|
||||||
~QPictureIO();
|
|
||||||
|
|
||||||
const QPicture &picture() const;
|
|
||||||
int status() const;
|
|
||||||
const char *format() const;
|
|
||||||
QIODevice *ioDevice() const;
|
|
||||||
QString fileName() const;
|
|
||||||
int quality() const;
|
|
||||||
QString description() const;
|
|
||||||
const char *parameters() const;
|
|
||||||
float gamma() const;
|
|
||||||
|
|
||||||
void setPicture(const QPicture &);
|
|
||||||
void setStatus(int);
|
|
||||||
void setFormat(const char *);
|
|
||||||
void setIODevice(QIODevice *);
|
|
||||||
void setFileName(const QString &);
|
|
||||||
void setQuality(int);
|
|
||||||
void setDescription(const QString &);
|
|
||||||
void setParameters(const char *);
|
|
||||||
void setGamma(float);
|
|
||||||
|
|
||||||
bool read();
|
|
||||||
bool write();
|
|
||||||
|
|
||||||
static QByteArray pictureFormat(const QString &fileName);
|
|
||||||
static QByteArray pictureFormat(QIODevice *);
|
|
||||||
static QList<QByteArray> inputFormats();
|
|
||||||
static QList<QByteArray> outputFormats();
|
|
||||||
|
|
||||||
static void defineIOHandler(const char *format,
|
|
||||||
const char *header,
|
|
||||||
const char *flags,
|
|
||||||
picture_io_handler read_picture,
|
|
||||||
picture_io_handler write_picture);
|
|
||||||
|
|
||||||
private:
|
|
||||||
Q_DISABLE_COPY(QPictureIO)
|
|
||||||
|
|
||||||
void init();
|
|
||||||
|
|
||||||
QPictureIOData *d;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //QT_NO_PICTUREIO
|
|
||||||
|
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
QPicture stream functions
|
QPicture stream functions
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
@ -1,135 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the QtGui module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 3 requirements
|
|
||||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 2.0 or (at your option) the GNU General
|
|
||||||
** Public license version 3 or any later version approved by the KDE Free
|
|
||||||
** Qt Foundation. The licenses are as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
||||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "qpictureformatplugin.h"
|
|
||||||
#if !defined(QT_NO_PICTURE)
|
|
||||||
#include "qpicture.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\obsolete
|
|
||||||
|
|
||||||
\class QPictureFormatPlugin
|
|
||||||
\brief The QPictureFormatPlugin class provides an abstract base
|
|
||||||
for custom picture format plugins.
|
|
||||||
|
|
||||||
\ingroup plugins
|
|
||||||
\inmodule QtGui
|
|
||||||
|
|
||||||
The picture format plugin is a simple plugin interface that makes
|
|
||||||
it easy to create custom picture formats that can be used
|
|
||||||
transparently by applications.
|
|
||||||
|
|
||||||
Writing an picture format plugin is achieved by subclassing this
|
|
||||||
base class, reimplementing the pure virtual functions
|
|
||||||
loadPicture(), savePicture(), and installIOHandler(), and
|
|
||||||
exporting the class with the Q_PLUGIN_METADATA() macro.
|
|
||||||
|
|
||||||
The json file containing the metadata should contain one entry
|
|
||||||
with the list of picture formats supported by the plugin:
|
|
||||||
|
|
||||||
\code
|
|
||||||
{ "Keys": [ "mypictureformat" ] }
|
|
||||||
\endcode
|
|
||||||
|
|
||||||
\sa {How to Create Qt Plugins}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*!
|
|
||||||
\fn bool QPictureFormatPlugin::installIOHandler(const QString &format)
|
|
||||||
|
|
||||||
Installs a QPictureIO picture I/O handler for the picture format \a
|
|
||||||
format. Returns \c true on success.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Constructs an picture format plugin with the given \a parent.
|
|
||||||
This is invoked automatically by the moc generated code that exports the plugin.
|
|
||||||
*/
|
|
||||||
QPictureFormatPlugin::QPictureFormatPlugin(QObject *parent)
|
|
||||||
: QObject(parent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Destroys the picture format plugin.
|
|
||||||
|
|
||||||
You never have to call this explicitly. Qt destroys a plugin
|
|
||||||
automatically when it is no longer used.
|
|
||||||
*/
|
|
||||||
QPictureFormatPlugin::~QPictureFormatPlugin()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Loads the picture stored in the file called \a fileName, with the
|
|
||||||
given \a format, into *\a picture. Returns \c true on success;
|
|
||||||
otherwise returns \c false.
|
|
||||||
|
|
||||||
\sa savePicture()
|
|
||||||
*/
|
|
||||||
bool QPictureFormatPlugin::loadPicture(const QString &format, const QString &fileName, QPicture *picture)
|
|
||||||
{
|
|
||||||
Q_UNUSED(format)
|
|
||||||
Q_UNUSED(fileName)
|
|
||||||
Q_UNUSED(picture)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
Saves the given \a picture into the file called \a fileName,
|
|
||||||
using the specified \a format. Returns \c true on success; otherwise
|
|
||||||
returns \c false.
|
|
||||||
|
|
||||||
\sa loadPicture()
|
|
||||||
*/
|
|
||||||
bool QPictureFormatPlugin::savePicture(const QString &format, const QString &fileName, const QPicture &picture)
|
|
||||||
{
|
|
||||||
Q_UNUSED(format)
|
|
||||||
Q_UNUSED(fileName)
|
|
||||||
Q_UNUSED(picture)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // QT_NO_PICTURE
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
@ -1,76 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of the QtGui module of the Qt Toolkit.
|
|
||||||
**
|
|
||||||
** $QT_BEGIN_LICENSE:LGPL$
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU Lesser General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.LGPL3 included in the
|
|
||||||
** packaging of this file. Please review the following information to
|
|
||||||
** ensure the GNU Lesser General Public License version 3 requirements
|
|
||||||
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 2.0 or (at your option) the GNU General
|
|
||||||
** Public license version 3 or any later version approved by the KDE Free
|
|
||||||
** Qt Foundation. The licenses are as published by the Free Software
|
|
||||||
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
|
|
||||||
** https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
** $QT_END_LICENSE$
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef QPICTUREFORMATPLUGIN_H
|
|
||||||
#define QPICTUREFORMATPLUGIN_H
|
|
||||||
|
|
||||||
#include <QtGui/qtguiglobal.h>
|
|
||||||
#include <QtCore/qplugin.h>
|
|
||||||
#include <QtCore/qfactoryinterface.h>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
|
|
||||||
|
|
||||||
#if !defined(QT_NO_PICTURE)
|
|
||||||
|
|
||||||
class QPicture;
|
|
||||||
class QImage;
|
|
||||||
class QString;
|
|
||||||
class QStringList;
|
|
||||||
|
|
||||||
#define QPictureFormatInterface_iid "org.qt-project.Qt.QPictureFormatInterface"
|
|
||||||
|
|
||||||
class Q_GUI_EXPORT QPictureFormatPlugin : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
public:
|
|
||||||
explicit QPictureFormatPlugin(QObject *parent = nullptr);
|
|
||||||
~QPictureFormatPlugin();
|
|
||||||
|
|
||||||
virtual bool loadPicture(const QString &format, const QString &filename, QPicture *pic);
|
|
||||||
virtual bool savePicture(const QString &format, const QString &filename, const QPicture &pic);
|
|
||||||
virtual bool installIOHandler(const QString &format) = 0;
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // QT_NO_PICTURE
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
#endif // QPICTUREFORMATPLUGIN_H
|
|
@ -344,8 +344,11 @@ public:
|
|||||||
|
|
||||||
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
||||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
// Qt 6: add override keyword
|
bool clearItemData(const QModelIndex &index)
|
||||||
bool clearItemData(const QModelIndex &index);
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
override
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
|
||||||
QVariant headerData(int section, Qt::Orientation orientation,
|
QVariant headerData(int section, Qt::Orientation orientation,
|
||||||
int role = Qt::DisplayRole) const override;
|
int role = Qt::DisplayRole) const override;
|
||||||
|
@ -2664,10 +2664,6 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QPoin
|
|||||||
{ }
|
{ }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
typedef QHash<const QNativeGestureEvent*, const QTouchDevice*> NativeGestureEventDataHash;
|
|
||||||
// ### Qt6: move this to a member in QNativeGestureEvent
|
|
||||||
Q_GLOBAL_STATIC(NativeGestureEventDataHash, g_nativeGestureEventDataHash)
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Constructs a native gesture event of type \a type originating from \a device.
|
Constructs a native gesture event of type \a type originating from \a device.
|
||||||
|
|
||||||
@ -2682,27 +2678,20 @@ QNativeGestureEvent::QNativeGestureEvent(Qt::NativeGestureType type, const QTouc
|
|||||||
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
|
const QPointF &screenPos, qreal realValue, ulong sequenceId, quint64 intValue)
|
||||||
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
|
: QInputEvent(QEvent::NativeGesture), mGestureType(type),
|
||||||
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
|
mLocalPos(localPos), mWindowPos(windowPos), mScreenPos(screenPos), mRealValue(realValue),
|
||||||
mSequenceId(sequenceId), mIntValue(intValue)
|
mSequenceId(sequenceId), mIntValue(intValue), mDevice(device)
|
||||||
{
|
{
|
||||||
g_nativeGestureEventDataHash->insert(this, device);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QNativeGestureEvent::~QNativeGestureEvent()
|
QNativeGestureEvent::~QNativeGestureEvent()
|
||||||
{
|
= default;
|
||||||
g_nativeGestureEventDataHash->remove(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
\fn const QTouchDevice *QNativeGestureEvent::device() const
|
||||||
\since 5.10
|
\since 5.10
|
||||||
|
|
||||||
Returns the device.
|
Returns the device.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const QTouchDevice *QNativeGestureEvent::device() const
|
|
||||||
{
|
|
||||||
return g_nativeGestureEventDataHash->value(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
\fn QNativeGestureEvent::gestureType() const
|
\fn QNativeGestureEvent::gestureType() const
|
||||||
\since 5.2
|
\since 5.2
|
||||||
|
@ -350,7 +350,7 @@ public:
|
|||||||
const QPointF &windowPos() const { return mWindowPos; }
|
const QPointF &windowPos() const { return mWindowPos; }
|
||||||
const QPointF &screenPos() const { return mScreenPos; }
|
const QPointF &screenPos() const { return mScreenPos; }
|
||||||
|
|
||||||
const QTouchDevice *device() const;
|
const QTouchDevice *device() const { return mDevice; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Qt::NativeGestureType mGestureType;
|
Qt::NativeGestureType mGestureType;
|
||||||
@ -360,6 +360,7 @@ protected:
|
|||||||
qreal mRealValue;
|
qreal mRealValue;
|
||||||
ulong mSequenceId;
|
ulong mSequenceId;
|
||||||
quint64 mIntValue;
|
quint64 mIntValue;
|
||||||
|
const QTouchDevice *mDevice;
|
||||||
};
|
};
|
||||||
#endif // QT_NO_GESTURES
|
#endif // QT_NO_GESTURES
|
||||||
|
|
||||||
|
@ -1182,14 +1182,18 @@ Q_LOGGING_CATEGORY(lcQpaPluginLoading, "qt.qpa.plugin");
|
|||||||
|
|
||||||
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
|
static void init_platform(const QString &pluginNamesWithArguments, const QString &platformPluginPath, const QString &platformThemeName, int &argc, char **argv)
|
||||||
{
|
{
|
||||||
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'));
|
QStringList plugins = pluginNamesWithArguments.split(QLatin1Char(';'), QString::SkipEmptyParts);
|
||||||
QStringList platformArguments;
|
QStringList platformArguments;
|
||||||
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
|
QStringList availablePlugins = QPlatformIntegrationFactory::keys(platformPluginPath);
|
||||||
for (const auto &pluginArgument : plugins) {
|
for (const auto &pluginArgument : plugins) {
|
||||||
// Split into platform name and arguments
|
// Split into platform name and arguments
|
||||||
QStringList arguments = pluginArgument.split(QLatin1Char(':'));
|
QStringList arguments = pluginArgument.split(QLatin1Char(':'), QString::SkipEmptyParts);
|
||||||
|
if (arguments.isEmpty())
|
||||||
|
continue;
|
||||||
const QString name = arguments.takeFirst().toLower();
|
const QString name = arguments.takeFirst().toLower();
|
||||||
QString argumentsKey = name;
|
QString argumentsKey = name;
|
||||||
|
if (name.isEmpty())
|
||||||
|
continue;
|
||||||
argumentsKey[0] = argumentsKey.at(0).toUpper();
|
argumentsKey[0] = argumentsKey.at(0).toUpper();
|
||||||
arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));
|
arguments.append(QLibraryInfo::platformPluginArguments(argumentsKey));
|
||||||
|
|
||||||
|
@ -275,7 +275,7 @@ void QSslSocketBackendPrivate::startClientEncryption()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sync custom certificates
|
// Sync custom certificates
|
||||||
const QSet<QSslCertificate> caCertificates = configuration.caCertificates.toSet();
|
const QSet<QSslCertificate> caCertificates(configuration.caCertificates.constBegin(), configuration.caCertificates.constEnd());
|
||||||
const QSet<QSslCertificate> newCertificates = caCertificates - previousCaCertificates;
|
const QSet<QSslCertificate> newCertificates = caCertificates - previousCaCertificates;
|
||||||
const QSet<QSslCertificate> oldCertificates = previousCaCertificates - caCertificates;
|
const QSet<QSslCertificate> oldCertificates = previousCaCertificates - caCertificates;
|
||||||
g->syncCaCertificates(newCertificates, oldCertificates);
|
g->syncCaCertificates(newCertificates, oldCertificates);
|
||||||
@ -398,7 +398,7 @@ void QSslSocketBackendPrivate::continueHandshake()
|
|||||||
hr = control2->get_IgnorableServerCertificateErrors(&ignoreList);
|
hr = control2->get_IgnorableServerCertificateErrors(&ignoreList);
|
||||||
Q_ASSERT_SUCCEEDED(hr);
|
Q_ASSERT_SUCCEEDED(hr);
|
||||||
|
|
||||||
QSet<QSslError> ignoreErrors = ignoreErrorsList.toSet();
|
QSet<QSslError> ignoreErrors(ignoreErrorsList.constBegin(), ignoreErrorsList.constEnd());
|
||||||
for (int i = ChainValidationResult_Untrusted; i < ChainValidationResult_OtherErrors + 1; ++i) {
|
for (int i = ChainValidationResult_Untrusted; i < ChainValidationResult_OtherErrors + 1; ++i) {
|
||||||
// Populate the native ignore list - break to add, continue to skip
|
// Populate the native ignore list - break to add, continue to skip
|
||||||
switch (i) {
|
switch (i) {
|
||||||
@ -601,7 +601,7 @@ HRESULT QSslSocketBackendPrivate::onSslUpgrade(IAsyncAction *action, AsyncStatus
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sslErrors = errors.toList();
|
sslErrors = QList<QSslError>(errors.constBegin(), errors.constEnd());
|
||||||
|
|
||||||
// Peer validation
|
// Peer validation
|
||||||
if (!configuration.peerCertificate.isNull()) {
|
if (!configuration.peerCertificate.isNull()) {
|
||||||
|
@ -387,7 +387,7 @@ QPlatformScreen *QKmsDevice::createScreenForConnector(drmModeResPtr resources,
|
|||||||
drmFormat = DRM_FORMAT_XRGB8888;
|
drmFormat = DRM_FORMAT_XRGB8888;
|
||||||
drmFormatExplicit = false;
|
drmFormatExplicit = false;
|
||||||
}
|
}
|
||||||
qCDebug(qLcKmsDebug) << "Format is" << hex << drmFormat << dec << "requested_by_user =" << drmFormatExplicit
|
qCDebug(qLcKmsDebug) << "Format is" << Qt::hex << drmFormat << Qt::dec << "requested_by_user =" << drmFormatExplicit
|
||||||
<< "for output" << connectorName;
|
<< "for output" << connectorName;
|
||||||
|
|
||||||
const QString cloneSource = userConnectorConfig.value(QStringLiteral("clones")).toString();
|
const QString cloneSource = userConnectorConfig.value(QStringLiteral("clones")).toString();
|
||||||
|
@ -269,7 +269,7 @@ QDebug operator<<(QDebug d, const GUID &guid)
|
|||||||
|
|
||||||
static void formatBriefRectangle(QDebug &d, const QRect &r)
|
static void formatBriefRectangle(QDebug &d, const QRect &r)
|
||||||
{
|
{
|
||||||
d << r.width() << 'x' << r.height() << forcesign << r.x() << r.y() << noforcesign;
|
d << r.width() << 'x' << r.height() << Qt::forcesign << r.x() << r.y() << Qt::noforcesign;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void formatBriefMargins(QDebug &d, const QMargins &m)
|
static void formatBriefMargins(QDebug &d, const QMargins &m)
|
||||||
@ -913,7 +913,7 @@ QMargins QWindowsGeometryHint::frameOnPrimaryScreen(DWORD style, DWORD exStyle)
|
|||||||
const QMargins result(qAbs(rect.left), qAbs(rect.top),
|
const QMargins result(qAbs(rect.left), qAbs(rect.top),
|
||||||
qAbs(rect.right), qAbs(rect.bottom));
|
qAbs(rect.right), qAbs(rect.bottom));
|
||||||
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style="
|
qCDebug(lcQpaWindows).nospace() << __FUNCTION__ << " style="
|
||||||
<< showbase << hex << style << " exStyle=" << exStyle << dec << noshowbase
|
<< Qt::showbase << Qt::hex << style << " exStyle=" << exStyle << Qt::dec << Qt::noshowbase
|
||||||
<< ' ' << rect << ' ' << result;
|
<< ' ' << rect << ' ' << result;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -190,10 +190,20 @@ static QSet<QByteArray> activeConditions()
|
|||||||
if (!distributionName.isEmpty()) {
|
if (!distributionName.isEmpty()) {
|
||||||
if (result.find(distributionName) == result.end())
|
if (result.find(distributionName) == result.end())
|
||||||
result.insert(distributionName);
|
result.insert(distributionName);
|
||||||
|
// backwards compatibility with Qt 5
|
||||||
|
if (distributionName == "macos") {
|
||||||
|
if (result.find(distributionName) == result.end())
|
||||||
|
result.insert("osx");
|
||||||
|
}
|
||||||
if (!distributionRelease.isEmpty()) {
|
if (!distributionRelease.isEmpty()) {
|
||||||
QByteArray versioned = distributionName + "-" + distributionRelease;
|
QByteArray versioned = distributionName + "-" + distributionRelease;
|
||||||
if (result.find(versioned) == result.end())
|
if (result.find(versioned) == result.end())
|
||||||
result.insert(versioned);
|
result.insert(versioned);
|
||||||
|
if (distributionName == "macos") {
|
||||||
|
QByteArray versioned = "osx-" + distributionRelease;
|
||||||
|
if (result.find(versioned) == result.end())
|
||||||
|
result.insert(versioned);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ static QString createGuid(const QUuid &uuid)
|
|||||||
|
|
||||||
QTextStream stream(&guid);
|
QTextStream stream(&guid);
|
||||||
|
|
||||||
hex(stream);
|
Qt::hex(stream);
|
||||||
|
|
||||||
stream << "("
|
stream << "("
|
||||||
<< "0x" << uuid.data1 << ", "
|
<< "0x" << uuid.data1 << ", "
|
||||||
|
@ -80,10 +80,6 @@ int runUic(int argc, char *argv[])
|
|||||||
noImplicitIncludesOption.setDescription(QStringLiteral("Disable generation of #include-directives."));
|
noImplicitIncludesOption.setDescription(QStringLiteral("Disable generation of #include-directives."));
|
||||||
parser.addOption(noImplicitIncludesOption);
|
parser.addOption(noImplicitIncludesOption);
|
||||||
|
|
||||||
QCommandLineOption noStringLiteralOption(QStringList() << QStringLiteral("s") << QStringLiteral("no-stringliteral"));
|
|
||||||
noStringLiteralOption.setDescription(QStringLiteral("Deprecated. The use of this option won't take any effect."));
|
|
||||||
parser.addOption(noStringLiteralOption);
|
|
||||||
|
|
||||||
QCommandLineOption postfixOption(QStringLiteral("postfix"));
|
QCommandLineOption postfixOption(QStringLiteral("postfix"));
|
||||||
postfixOption.setDescription(QStringLiteral("Postfix to add to all generated classnames."));
|
postfixOption.setDescription(QStringLiteral("Postfix to add to all generated classnames."));
|
||||||
postfixOption.setValueName(QStringLiteral("postfix"));
|
postfixOption.setValueName(QStringLiteral("postfix"));
|
||||||
@ -129,9 +125,6 @@ int runUic(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
language::setLanguage(language);
|
language::setLanguage(language);
|
||||||
|
|
||||||
if (parser.isSet(noStringLiteralOption))
|
|
||||||
fprintf(stderr, "The -s, --no-stringliteral option is deprecated and it won't take any effect.\n");
|
|
||||||
|
|
||||||
QString inputFile;
|
QString inputFile;
|
||||||
if (!parser.positionalArguments().isEmpty())
|
if (!parser.positionalArguments().isEmpty())
|
||||||
inputFile = parser.positionalArguments().at(0);
|
inputFile = parser.positionalArguments().at(0);
|
||||||
|
@ -644,9 +644,6 @@ QT_CLASS_LIB(QImageReader, QtGui, qimagereader.h)
|
|||||||
QT_CLASS_LIB(QImageWriter, QtGui, qimagewriter.h)
|
QT_CLASS_LIB(QImageWriter, QtGui, qimagewriter.h)
|
||||||
QT_CLASS_LIB(QMovie, QtGui, qmovie.h)
|
QT_CLASS_LIB(QMovie, QtGui, qmovie.h)
|
||||||
QT_CLASS_LIB(QPicture, QtGui, qpicture.h)
|
QT_CLASS_LIB(QPicture, QtGui, qpicture.h)
|
||||||
QT_CLASS_LIB(QPictureIO, QtGui, qpicture.h)
|
|
||||||
QT_CLASS_LIB(QPictureFormatInterface, QtGui, qpictureformatplugin.h)
|
|
||||||
QT_CLASS_LIB(QPictureFormatPlugin, QtGui, qpictureformatplugin.h)
|
|
||||||
QT_CLASS_LIB(QPixmap, QtGui, qpixmap.h)
|
QT_CLASS_LIB(QPixmap, QtGui, qpixmap.h)
|
||||||
QT_CLASS_LIB(QPixmapCache, QtGui, qpixmapcache.h)
|
QT_CLASS_LIB(QPixmapCache, QtGui, qpixmapcache.h)
|
||||||
QT_CLASS_LIB(QAbstractItemDelegate, QtWidgets, qabstractitemdelegate.h)
|
QT_CLASS_LIB(QAbstractItemDelegate, QtWidgets, qabstractitemdelegate.h)
|
||||||
|
@ -115,7 +115,7 @@ static DWORD createSymbolicLink(const QString &symLinkName, const QString &targe
|
|||||||
reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) {
|
reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) {
|
||||||
result = GetLastError();
|
result = GetLastError();
|
||||||
QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", "
|
QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", "
|
||||||
<< nativeTarget << ", 0x" << hex << flags << dec << ") failed with error " << result
|
<< nativeTarget << ", 0x" << Qt::hex << flags << Qt::dec << ") failed with error " << result
|
||||||
<< ": " << qt_error_string(int(result));
|
<< ": " << qt_error_string(int(result));
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
@ -1,65 +1,51 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>extras/test</file>
|
<file>extras/test</file>
|
||||||
<file>extras/test2</file>
|
<file>extras/test2</file>
|
||||||
<file>extras/+custom1/test</file>
|
<file>extras/+custom1/test</file>
|
||||||
<file>extras/+custom1/test3</file>
|
<file>extras/+custom1/test3</file>
|
||||||
<file>extras/+custom2/test</file>
|
<file>extras/+custom2/test</file>
|
||||||
<file>extras/+custom3/test</file>
|
<file>extras/+custom3/test</file>
|
||||||
<file>extras/+custom3/+custom2/test</file>
|
<file>extras/+custom3/+custom2/test</file>
|
||||||
<file>extras/+custom3/+custom4/test</file>
|
<file>extras/+custom3/+custom4/test</file>
|
||||||
<file>extras/+custom3/+custom5/test</file>
|
<file>extras/+custom3/+custom5/test</file>
|
||||||
<file>extras/+custom5/+custom3/test</file>
|
<file>extras/+custom5/+custom3/test</file>
|
||||||
|
<file>platforms/test</file>
|
||||||
<!-- platforms/test: deepest possible selection -->
|
<file>platforms/+unix/+android/test</file>
|
||||||
<file>platforms/test</file>
|
<file>platforms/+unix/+darwin/test</file>
|
||||||
<file>platforms/+unix/+android/test</file>
|
<file>platforms/+unix/+haiku/test</file>
|
||||||
<file>platforms/+unix/+darwin/+mac/+ios/test</file>
|
<file>platforms/+unix/+linux/test</file>
|
||||||
<file>platforms/+unix/+darwin/+mac/+osx/+macos/test</file>
|
<file>platforms/+unix/+qnx/test</file>
|
||||||
<file>platforms/+unix/+darwin/+mac/+osx/test</file>
|
<file>platforms/+unix/test</file>
|
||||||
<file>platforms/+unix/+darwin/+mac/test</file>
|
<file>platforms/+windows/+wince/test</file>
|
||||||
<file>platforms/+unix/+darwin/test</file>
|
<file>platforms/+windows/+winnt/test</file>
|
||||||
<file>platforms/+unix/+haiku/test</file>
|
<file>platforms/+windows/+winrt/test</file>
|
||||||
<file>platforms/+unix/+linux/test</file>
|
<file>platforms/+windows/test</file>
|
||||||
<file>platforms/+unix/+qnx/test</file>
|
<file>platforms/+android/test</file>
|
||||||
<file>platforms/+unix/test</file>
|
<file>platforms/+ios/test</file>
|
||||||
<file>platforms/+windows/+wince/test</file>
|
<file>platforms/+macos/test</file>
|
||||||
<file>platforms/+windows/+winnt/test</file>
|
<file>platforms/+darwin/test</file>
|
||||||
<file>platforms/+windows/+winrt/test</file>
|
<file>platforms/+haiku/test</file>
|
||||||
<file>platforms/+windows/test</file>
|
<file>platforms/+linux/test</file>
|
||||||
<file>platforms/+android/test</file>
|
<file>platforms/+qnx/test</file>
|
||||||
<file>platforms/+ios/test</file>
|
<file>platforms/+wince/test</file>
|
||||||
<file>platforms/+macos/test</file>
|
<file>platforms/+winrt/test</file>
|
||||||
<file>platforms/+osx/test</file>
|
<file>platforms/test2</file>
|
||||||
<file>platforms/+darwin/test</file>
|
<file>platforms/+android/test2</file>
|
||||||
<file>platforms/+mac/test</file>
|
<file>platforms/+ios/test2</file>
|
||||||
<file>platforms/+haiku/test</file>
|
<file>platforms/+macos/test2</file>
|
||||||
<file>platforms/+linux/test</file>
|
<file>platforms/+haiku/test2</file>
|
||||||
<file>platforms/+qnx/test</file>
|
<file>platforms/+linux/test2</file>
|
||||||
<file>platforms/+wince/test</file>
|
<file>platforms/+qnx/test2</file>
|
||||||
<file>platforms/+winrt/test</file>
|
<file>platforms/+wince/test2</file>
|
||||||
|
<file>platforms/+winnt/test2</file>
|
||||||
<!-- platforms/test2: shallow selection for the deepest selector -->
|
<file>platforms/+winrt/test2</file>
|
||||||
<file>platforms/test2</file>
|
<file>platforms/test3</file>
|
||||||
<file>platforms/+android/test2</file>
|
<file>platforms/+windows/test3</file>
|
||||||
<file>platforms/+ios/test2</file>
|
<file>platforms/+unix/test3</file>
|
||||||
<file>platforms/+macos/test2</file>
|
<file>platforms/test4</file>
|
||||||
<file>platforms/+haiku/test2</file>
|
<file>platforms/test5</file>
|
||||||
<file>platforms/+linux/test2</file>
|
<file>platforms/+unix/+darwin/+macos/test</file>
|
||||||
<file>platforms/+qnx/test2</file>
|
<file>platforms/+unix/+darwin/+ios/test</file>
|
||||||
<file>platforms/+wince/test2</file>
|
</qresource>
|
||||||
<file>platforms/+winnt/test2</file>
|
|
||||||
<file>platforms/+winrt/test2</file>
|
|
||||||
|
|
||||||
<!-- platforms/test3: selection for the family only -->
|
|
||||||
<file>platforms/test3</file>
|
|
||||||
<file>platforms/+windows/test3</file>
|
|
||||||
<file>platforms/+unix/test3</file>
|
|
||||||
|
|
||||||
<!-- platforms/test4 and 5: special cases for macOS -->
|
|
||||||
<file>platforms/test4</file>
|
|
||||||
<file>platforms/+osx/test4</file>
|
|
||||||
<file>platforms/test5</file>
|
|
||||||
<file>platforms/+mac/test5</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -126,14 +126,6 @@ void tst_QFileSelector::basicTest_data()
|
|||||||
QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList()
|
QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList()
|
||||||
<< expectedPlatform3File;
|
<< expectedPlatform3File;
|
||||||
|
|
||||||
#ifdef Q_OS_MACOS
|
|
||||||
// special case for compatibility code
|
|
||||||
QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList()
|
|
||||||
<< ":/platforms/+osx/test4";
|
|
||||||
QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList()
|
|
||||||
<< ":/platforms/+mac/test5";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
QString resourceTestPath(":/extras/test");
|
QString resourceTestPath(":/extras/test");
|
||||||
QString custom1("custom1");
|
QString custom1("custom1");
|
||||||
QTest::newRow("custom1-noselector") << resourceTestPath << QStringList()
|
QTest::newRow("custom1-noselector") << resourceTestPath << QStringList()
|
||||||
|
@ -81,9 +81,6 @@ private slots:
|
|||||||
void senderTest();
|
void senderTest();
|
||||||
void declareInterface();
|
void declareInterface();
|
||||||
void qpointerResetBeforeDestroyedSignal();
|
void qpointerResetBeforeDestroyedSignal();
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
void testUserData();
|
|
||||||
#endif
|
|
||||||
void childDeletesItsSibling();
|
void childDeletesItsSibling();
|
||||||
void dynamicProperties();
|
void dynamicProperties();
|
||||||
void floatProperty();
|
void floatProperty();
|
||||||
@ -2341,51 +2338,6 @@ void tst_QObject::declareInterface()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef QT_NO_USERDATA
|
|
||||||
class CustomData : public QObjectUserData
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
int id;
|
|
||||||
};
|
|
||||||
|
|
||||||
void tst_QObject::testUserData()
|
|
||||||
{
|
|
||||||
const int USER_DATA_COUNT = 100;
|
|
||||||
int user_data_ids[USER_DATA_COUNT];
|
|
||||||
|
|
||||||
// Register a few
|
|
||||||
for (int i=0; i<USER_DATA_COUNT; ++i) {
|
|
||||||
user_data_ids[i] = QObject::registerUserData();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Randomize the table a bit
|
|
||||||
for (int i=0; i<100; ++i) {
|
|
||||||
int p1 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
|
|
||||||
int p2 = QRandomGenerator::global()->bounded(USER_DATA_COUNT);
|
|
||||||
|
|
||||||
int tmp = user_data_ids[p1];
|
|
||||||
user_data_ids[p1] = user_data_ids[p2];
|
|
||||||
user_data_ids[p2] = tmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
// insert the user data into an object
|
|
||||||
QObject my_test_object;
|
|
||||||
for (int i=0; i<USER_DATA_COUNT; ++i) {
|
|
||||||
CustomData *data = new CustomData;
|
|
||||||
data->id = user_data_ids[i];
|
|
||||||
my_test_object.setUserData(data->id, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
// verify that all ids and positions are matching
|
|
||||||
for (int i=0; i<USER_DATA_COUNT; ++i) {
|
|
||||||
int id = user_data_ids[i];
|
|
||||||
CustomData *data = static_cast<CustomData *>(my_test_object.userData(id));
|
|
||||||
QVERIFY(data != nullptr);
|
|
||||||
QCOMPARE(data->id, id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif // QT_NO_USERDATA
|
|
||||||
|
|
||||||
class DestroyedListener : public QObject
|
class DestroyedListener : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include <qscreen.h>
|
#include <qscreen.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
|
#ifndef QT_NO_PICTURE
|
||||||
|
|
||||||
class tst_QPicture : public QObject
|
class tst_QPicture : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -45,7 +47,6 @@ public:
|
|||||||
tst_QPicture();
|
tst_QPicture();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void getSetCheck();
|
|
||||||
void devType();
|
void devType();
|
||||||
void paintingActive();
|
void paintingActive();
|
||||||
void boundingRect();
|
void boundingRect();
|
||||||
@ -56,31 +57,6 @@ private slots:
|
|||||||
void boundaryValues();
|
void boundaryValues();
|
||||||
};
|
};
|
||||||
|
|
||||||
// Testing get/set functions
|
|
||||||
void tst_QPicture::getSetCheck()
|
|
||||||
{
|
|
||||||
QPictureIO obj1;
|
|
||||||
// const QPicture & QPictureIO::picture()
|
|
||||||
// void QPictureIO::setPicture(const QPicture &)
|
|
||||||
// const char * QPictureIO::format()
|
|
||||||
// void QPictureIO::setFormat(const char *)
|
|
||||||
const char var2[] = "PNG";
|
|
||||||
obj1.setFormat(var2);
|
|
||||||
QCOMPARE(var2, obj1.format());
|
|
||||||
obj1.setFormat((char *)0);
|
|
||||||
// The format is stored internally in a QString, so return is always a valid char *
|
|
||||||
QVERIFY(QString(obj1.format()).isEmpty());
|
|
||||||
|
|
||||||
// const char * QPictureIO::parameters()
|
|
||||||
// void QPictureIO::setParameters(const char *)
|
|
||||||
const char var3[] = "Bogus data";
|
|
||||||
obj1.setParameters(var3);
|
|
||||||
QCOMPARE(var3, obj1.parameters());
|
|
||||||
obj1.setParameters((char *)0);
|
|
||||||
// The format is stored internally in a QString, so return is always a valid char *
|
|
||||||
QVERIFY(QString(obj1.parameters()).isEmpty());
|
|
||||||
}
|
|
||||||
|
|
||||||
tst_QPicture::tst_QPicture()
|
tst_QPicture::tst_QPicture()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -316,6 +292,7 @@ void tst_QPicture::boundaryValues()
|
|||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QTEST_MAIN(tst_QPicture)
|
QTEST_MAIN(tst_QPicture)
|
||||||
#include "tst_qpicture.moc"
|
#include "tst_qpicture.moc"
|
||||||
|
|
||||||
|
#endif // QT_NO_PICTURE
|
||||||
|
@ -54,7 +54,7 @@ QVector<double> mixedvector_fill_and_return_helper()
|
|||||||
std::vector<double> v(N);
|
std::vector<double> v(N);
|
||||||
for (int i = 0; i != N; ++i)
|
for (int i = 0; i != N; ++i)
|
||||||
v[i] = i;
|
v[i] = i;
|
||||||
return QVector<double>::fromStdVector(v);
|
return QVector<double>(v.begin(), v.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ void qfile_vs_qnetworkaccessmanager::qnamFileRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
qint64 elapsed = t.elapsed();
|
qint64 elapsed = t.elapsed();
|
||||||
qDebug() << endl << "Finished!";
|
qDebug() << Qt::endl << "Finished!";
|
||||||
qDebug() << "Bytes:" << size;
|
qDebug() << "Bytes:" << size;
|
||||||
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
|
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
|
||||||
}
|
}
|
||||||
@ -138,7 +138,7 @@ void qfile_vs_qnetworkaccessmanager::qnamImmediateFileRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
qint64 elapsed = t.elapsed();
|
qint64 elapsed = t.elapsed();
|
||||||
qDebug() << endl << "Finished!";
|
qDebug() << Qt::endl << "Finished!";
|
||||||
qDebug() << "Bytes:" << size;
|
qDebug() << "Bytes:" << size;
|
||||||
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
|
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
|
||||||
}
|
}
|
||||||
@ -167,7 +167,7 @@ void qfile_vs_qnetworkaccessmanager::qfileFileRead()
|
|||||||
}
|
}
|
||||||
|
|
||||||
qint64 elapsed = t.elapsed();
|
qint64 elapsed = t.elapsed();
|
||||||
qDebug() << endl << "Finished!";
|
qDebug() << Qt::endl << "Finished!";
|
||||||
qDebug() << "Bytes:" << size;
|
qDebug() << "Bytes:" << size;
|
||||||
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
|
qDebug() << "Speed:" << (qreal(size*iterations) / 1024.0) / (qreal(elapsed) / 1000.0) << "KB/sec";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user