Merge "Merge remote-tracking branch 'origin/5.15' into dev"
This commit is contained in:
commit
ef442327b8
@ -134,7 +134,7 @@ static QVariant convertCborValue(const QCborValue &value)
|
||||
enum TrimFloatingPoint { Double, Float, Float16 };
|
||||
static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrimming)
|
||||
{
|
||||
if (v.userType() == QVariant::List) {
|
||||
if (v.userType() == QMetaType::QVariantList) {
|
||||
const QVariantList list = v.toList();
|
||||
QCborArray array;
|
||||
for (const QVariant &v : list)
|
||||
@ -152,7 +152,7 @@ static QCborValue convertFromVariant(const QVariant &v, TrimFloatingPoint fpTrim
|
||||
return map;
|
||||
}
|
||||
|
||||
if (v.userType() == QVariant::Double && fpTrimming != Double) {
|
||||
if (v.userType() == QMetaType::Double && fpTrimming != Double) {
|
||||
float f = float(v.toDouble());
|
||||
if (fpTrimming == Float16)
|
||||
return float(qfloat16(f));
|
||||
|
@ -96,8 +96,8 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str
|
||||
QString indented = indent + QLatin1String(" ");
|
||||
|
||||
int type = v.userType();
|
||||
if (type == qMetaTypeId<VariantOrderedMap>() || type == QVariant::Map) {
|
||||
const auto map = (type == QVariant::Map) ?
|
||||
if (type == qMetaTypeId<VariantOrderedMap>() || type == QMetaType::QVariantMap) {
|
||||
const auto map = (type == QMetaType::QVariantMap) ?
|
||||
VariantOrderedMap(v.toMap()) : qvariant_cast<VariantOrderedMap>(v);
|
||||
|
||||
result = QLatin1String("Map {");
|
||||
@ -109,7 +109,7 @@ static QString dumpVariant(const QVariant &v, const QString &indent = QLatin1Str
|
||||
}
|
||||
result.chop(1); // remove comma
|
||||
result += indent + QLatin1String("},");
|
||||
} else if (type == QVariant::List) {
|
||||
} else if (type == QMetaType::QVariantList) {
|
||||
const QVariantList list = v.toList();
|
||||
|
||||
result = QLatin1String("List [");
|
||||
|
@ -56,21 +56,21 @@
|
||||
static void dumpVariant(QTextStream &out, const QVariant &v)
|
||||
{
|
||||
switch (v.userType()) {
|
||||
case QVariant::List: {
|
||||
case QMetaType::QVariantList: {
|
||||
const QVariantList list = v.toList();
|
||||
for (const QVariant &item : list)
|
||||
dumpVariant(out, item);
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::String: {
|
||||
case QMetaType::QString: {
|
||||
const QStringList list = v.toStringList();
|
||||
for (const QString &s : list)
|
||||
out << s << Qt::endl;
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::Map: {
|
||||
case QMetaType::QVariantMap: {
|
||||
const QVariantMap map = v.toMap();
|
||||
for (auto it = map.begin(); it != map.end(); ++it) {
|
||||
out << it.key() << " => ";
|
||||
|
@ -284,18 +284,18 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
|
||||
ba.resize(n);
|
||||
result = ba;
|
||||
} else {
|
||||
int id = QVariant::Invalid;
|
||||
int id = QMetaType::UnknownType;
|
||||
if (type == QLatin1String("datetime"))
|
||||
id = QVariant::DateTime;
|
||||
id = QMetaType::QDateTime;
|
||||
else if (type == QLatin1String("url"))
|
||||
id = QVariant::Url;
|
||||
id = QMetaType::QUrl;
|
||||
else if (type == QLatin1String("uuid"))
|
||||
id = QVariant::Uuid;
|
||||
id = QMetaType::QUuid;
|
||||
else if (type == QLatin1String("regex"))
|
||||
id = QVariant::RegularExpression;
|
||||
id = QMetaType::QRegularExpression;
|
||||
else
|
||||
id = QMetaType::type(type.toLatin1());
|
||||
if (id == QVariant::Invalid) {
|
||||
if (id == QMetaType::UnknownType) {
|
||||
fprintf(stderr, "%lld:%lld: Invalid XML: unknown type '%s'.\n",
|
||||
xml.lineNumber(), xml.columnNumber(), qPrintable(type.toString()));
|
||||
exit(EXIT_FAILURE);
|
||||
@ -327,14 +327,14 @@ static QVariant variantFromXml(QXmlStreamReader &xml, Converter::Options options
|
||||
static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
|
||||
{
|
||||
int type = v.userType();
|
||||
if (type == QVariant::List) {
|
||||
if (type == QMetaType::QVariantList) {
|
||||
QVariantList list = v.toList();
|
||||
xml.writeStartElement("list");
|
||||
for (const QVariant &v : list)
|
||||
variantToXml(xml, v);
|
||||
xml.writeEndElement();
|
||||
} else if (type == QVariant::Map || type == qMetaTypeId<VariantOrderedMap>()) {
|
||||
const VariantOrderedMap map = (type == QVariant::Map) ?
|
||||
} else if (type == QMetaType::QVariantMap || type == qMetaTypeId<VariantOrderedMap>()) {
|
||||
const VariantOrderedMap map = (type == QMetaType::QVariantMap) ?
|
||||
VariantOrderedMap(v.toMap()) :
|
||||
qvariant_cast<VariantOrderedMap>(v);
|
||||
|
||||
@ -433,7 +433,7 @@ static void variantToXml(QXmlStreamWriter &xml, const QVariant &v)
|
||||
// does this convert to string?
|
||||
const char *typeName = v.typeName();
|
||||
QVariant copy = v;
|
||||
if (copy.convert(QVariant::String)) {
|
||||
if (copy.convert(QMetaType::QString)) {
|
||||
xml.writeAttribute(typeString, QString::fromLatin1(typeName));
|
||||
xml.writeCharacters(copy.toString());
|
||||
} else {
|
||||
|
@ -209,7 +209,7 @@ void TrackerClient::httpRequestDone(QNetworkReply *reply)
|
||||
// store it
|
||||
peers.clear();
|
||||
QVariant peerEntry = dict.value("peers");
|
||||
if (peerEntry.type() == QVariant::List) {
|
||||
if (peerEntry.userType() == QMetaType::QVariantList) {
|
||||
QList<QVariant> peerTmp = peerEntry.toList();
|
||||
for (int i = 0; i < peerTmp.size(); ++i) {
|
||||
TorrentPeer tmp;
|
||||
|
@ -425,7 +425,7 @@
|
||||
|
||||
The \c findWindow() function simply searches through the list of
|
||||
existing windows, returning a pointer to the window that matches
|
||||
the given item ID, or 0 if the window doesn't exists.
|
||||
the given item ID, or \nullptr if the window doesn't exists.
|
||||
|
||||
Finally, let's take a quick look at our custom \c ImageItem class:
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
/*!
|
||||
\example widgets/gallery
|
||||
\example gallery
|
||||
\title Widgets Gallery Example
|
||||
\ingroup examples-widgets
|
||||
\brief The Widgets Gallery example shows widgets relevant for designing UIs.
|
||||
|
@ -61,7 +61,7 @@ Window::Window()
|
||||
QItemEditorCreatorBase *colorListCreator =
|
||||
new QStandardItemEditorCreator<ColorListEditor>();
|
||||
|
||||
factory->registerEditor(QVariant::Color, colorListCreator);
|
||||
factory->registerEditor(QMetaType::QColor, colorListCreator);
|
||||
|
||||
QItemEditorFactory::setDefaultFactory(factory);
|
||||
|
||||
|
@ -98,7 +98,7 @@ bool MySortFilterProxyModel::lessThan(const QModelIndex &left,
|
||||
//! [4]
|
||||
|
||||
//! [6]
|
||||
if (leftData.type() == QVariant::DateTime) {
|
||||
if (leftData.userType() == QMetaType::QDateTime) {
|
||||
return leftData.toDateTime() < rightData.toDateTime();
|
||||
} else {
|
||||
static const QRegularExpression emailPattern("[\\w\\.]*@[\\w\\.]*");
|
||||
|
@ -208,7 +208,7 @@ void SettingsTree::updateChildItems(QTreeWidgetItem *parent)
|
||||
}
|
||||
|
||||
QVariant value = settings->value(key);
|
||||
if (value.type() == QVariant::Invalid) {
|
||||
if (value.userType() == QMetaType::UnknownType) {
|
||||
child->setText(1, "Invalid");
|
||||
} else {
|
||||
child->setText(1, value.typeName());
|
||||
|
@ -81,7 +81,7 @@ void VariantDelegate::paint(QPainter *painter,
|
||||
{
|
||||
if (index.column() == 2) {
|
||||
QVariant value = index.model()->data(index, Qt::UserRole);
|
||||
if (!isSupportedType(value.type())) {
|
||||
if (!isSupportedType(value.userType())) {
|
||||
QStyleOptionViewItem myOption = option;
|
||||
myOption.state &= ~QStyle::State_Enabled;
|
||||
QStyledItemDelegate::paint(painter, myOption, index);
|
||||
@ -100,7 +100,7 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
|
||||
return nullptr;
|
||||
|
||||
QVariant originalValue = index.model()->data(index, Qt::UserRole);
|
||||
if (!isSupportedType(originalValue.type()))
|
||||
if (!isSupportedType(originalValue.userType()))
|
||||
return nullptr;
|
||||
|
||||
QLineEdit *lineEdit = new QLineEdit(parent);
|
||||
@ -108,46 +108,46 @@ QWidget *VariantDelegate::createEditor(QWidget *parent,
|
||||
|
||||
QRegularExpression regExp;
|
||||
|
||||
switch (originalValue.type()) {
|
||||
case QVariant::Bool:
|
||||
switch (originalValue.userType()) {
|
||||
case QMetaType::Bool:
|
||||
regExp = boolExp;
|
||||
break;
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
regExp = byteArrayExp;
|
||||
break;
|
||||
case QVariant::Char:
|
||||
case QMetaType::QChar:
|
||||
regExp = charExp;
|
||||
break;
|
||||
case QVariant::Color:
|
||||
case QMetaType::QColor:
|
||||
regExp = colorExp;
|
||||
break;
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
regExp = dateExp;
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
regExp = dateTimeExp;
|
||||
break;
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
regExp = doubleExp;
|
||||
break;
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
regExp = signedIntegerExp;
|
||||
break;
|
||||
case QVariant::Point:
|
||||
case QMetaType::QPoint:
|
||||
regExp = pointExp;
|
||||
break;
|
||||
case QVariant::Rect:
|
||||
case QMetaType::QRect:
|
||||
regExp = rectExp;
|
||||
break;
|
||||
case QVariant::Size:
|
||||
case QMetaType::QSize:
|
||||
regExp = sizeExp;
|
||||
break;
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
regExp = timeExp;
|
||||
break;
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
regExp = unsignedIntegerExp;
|
||||
break;
|
||||
default:
|
||||
@ -189,18 +189,18 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
QVariant value;
|
||||
QRegularExpressionMatch match;
|
||||
|
||||
switch (originalValue.type()) {
|
||||
case QVariant::Char:
|
||||
switch (originalValue.userType()) {
|
||||
case QMetaType::QChar:
|
||||
value = text.at(0);
|
||||
break;
|
||||
case QVariant::Color:
|
||||
case QMetaType::QColor:
|
||||
match = colorExp.match(text);
|
||||
value = QColor(qMin(match.captured(1).toInt(), 255),
|
||||
qMin(match.captured(2).toInt(), 255),
|
||||
qMin(match.captured(3).toInt(), 255),
|
||||
qMin(match.captured(4).toInt(), 255));
|
||||
break;
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
{
|
||||
QDate date = QDate::fromString(text, Qt::ISODate);
|
||||
if (!date.isValid())
|
||||
@ -208,7 +208,7 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
value = date;
|
||||
}
|
||||
break;
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
{
|
||||
QDateTime dateTime = QDateTime::fromString(text, Qt::ISODate);
|
||||
if (!dateTime.isValid())
|
||||
@ -216,23 +216,23 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
value = dateTime;
|
||||
}
|
||||
break;
|
||||
case QVariant::Point:
|
||||
case QMetaType::QPoint:
|
||||
match = pointExp.match(text);
|
||||
value = QPoint(match.captured(1).toInt(), match.captured(2).toInt());
|
||||
break;
|
||||
case QVariant::Rect:
|
||||
case QMetaType::QRect:
|
||||
match = rectExp.match(text);
|
||||
value = QRect(match.captured(1).toInt(), match.captured(2).toInt(),
|
||||
match.captured(3).toInt(), match.captured(4).toInt());
|
||||
break;
|
||||
case QVariant::Size:
|
||||
case QMetaType::QSize:
|
||||
match = sizeExp.match(text);
|
||||
value = QSize(match.captured(1).toInt(), match.captured(2).toInt());
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
value = text.split(',');
|
||||
break;
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
{
|
||||
QTime time = QTime::fromString(text, Qt::ISODate);
|
||||
if (!time.isValid())
|
||||
@ -242,33 +242,33 @@ void VariantDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
break;
|
||||
default:
|
||||
value = text;
|
||||
value.convert(originalValue.type());
|
||||
value.convert(originalValue.userType());
|
||||
}
|
||||
|
||||
model->setData(index, displayText(value), Qt::DisplayRole);
|
||||
model->setData(index, value, Qt::UserRole);
|
||||
}
|
||||
|
||||
bool VariantDelegate::isSupportedType(QVariant::Type type)
|
||||
bool VariantDelegate::isSupportedType(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case QVariant::Bool:
|
||||
case QVariant::ByteArray:
|
||||
case QVariant::Char:
|
||||
case QVariant::Color:
|
||||
case QVariant::Date:
|
||||
case QVariant::DateTime:
|
||||
case QVariant::Double:
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::Point:
|
||||
case QVariant::Rect:
|
||||
case QVariant::Size:
|
||||
case QVariant::String:
|
||||
case QVariant::StringList:
|
||||
case QVariant::Time:
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::QByteArray:
|
||||
case QMetaType::QChar:
|
||||
case QMetaType::QColor:
|
||||
case QMetaType::QDate:
|
||||
case QMetaType::QDateTime:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::QPoint:
|
||||
case QMetaType::QRect:
|
||||
case QMetaType::QSize:
|
||||
case QMetaType::QString:
|
||||
case QMetaType::QStringList:
|
||||
case QMetaType::QTime:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
@ -277,50 +277,50 @@ bool VariantDelegate::isSupportedType(QVariant::Type type)
|
||||
|
||||
QString VariantDelegate::displayText(const QVariant &value)
|
||||
{
|
||||
switch (value.type()) {
|
||||
case QVariant::Bool:
|
||||
case QVariant::ByteArray:
|
||||
case QVariant::Char:
|
||||
case QVariant::Double:
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::String:
|
||||
case QVariant::UInt:
|
||||
case QVariant::ULongLong:
|
||||
switch (value.userType()) {
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::QByteArray:
|
||||
case QMetaType::QChar:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::QString:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::ULongLong:
|
||||
return value.toString();
|
||||
case QVariant::Color:
|
||||
case QMetaType::QColor:
|
||||
{
|
||||
QColor color = qvariant_cast<QColor>(value);
|
||||
return QString("(%1,%2,%3,%4)")
|
||||
.arg(color.red()).arg(color.green())
|
||||
.arg(color.blue()).arg(color.alpha());
|
||||
}
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
return value.toDate().toString(Qt::ISODate);
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return value.toDateTime().toString(Qt::ISODate);
|
||||
case QVariant::Invalid:
|
||||
case QMetaType::UnknownType:
|
||||
return "<Invalid>";
|
||||
case QVariant::Point:
|
||||
case QMetaType::QPoint:
|
||||
{
|
||||
QPoint point = value.toPoint();
|
||||
return QString("(%1,%2)").arg(point.x()).arg(point.y());
|
||||
}
|
||||
case QVariant::Rect:
|
||||
case QMetaType::QRect:
|
||||
{
|
||||
QRect rect = value.toRect();
|
||||
return QString("(%1,%2,%3,%4)")
|
||||
.arg(rect.x()).arg(rect.y())
|
||||
.arg(rect.width()).arg(rect.height());
|
||||
}
|
||||
case QVariant::Size:
|
||||
case QMetaType::QSize:
|
||||
{
|
||||
QSize size = value.toSize();
|
||||
return QString("(%1,%2)").arg(size.width()).arg(size.height());
|
||||
}
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return value.toStringList().join(',');
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
return value.toTime().toString(Qt::ISODate);
|
||||
default:
|
||||
break;
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex &index) const override;
|
||||
|
||||
static bool isSupportedType(QVariant::Type type);
|
||||
static bool isSupportedType(int type);
|
||||
static QString displayText(const QVariant &value);
|
||||
|
||||
private:
|
||||
|
@ -176,7 +176,7 @@ contains(CONFIG, plugin) {
|
||||
list_plugin_extends =
|
||||
for (p, PLUGIN_EXTENDS) {
|
||||
m = $$cmakeModuleName($$p)
|
||||
list_plugin_extends += Qt5::$$m
|
||||
list_plugin_extends += Qt::$$m
|
||||
}
|
||||
CMAKE_PLUGIN_EXTENDS = $$join(list_plugin_extends, ";")
|
||||
}
|
||||
@ -291,6 +291,10 @@ CMAKE_INTERFACE_MODULE_DEPS = $$join(aux_mod_deps, ";")
|
||||
CMAKE_INTERFACE_QT5_MODULE_DEPS = $$join(aux_lib_deps, ";")
|
||||
CMAKE_MODULE_PLUGIN_TYPES = $$join(QT.$${MODULE}.plugin_types, ";")
|
||||
|
||||
# Interface libraries have to have all properties starting with "INTERFACE_".
|
||||
CMAKE_FEATURE_PROPERTY_PREFIX = ""
|
||||
equals(TEMPLATE, aux): CMAKE_FEATURE_PROPERTY_PREFIX = "INTERFACE_"
|
||||
|
||||
mac {
|
||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_LIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}_debug.a
|
||||
|
@ -406,6 +406,15 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
|
||||
add_library(Qt5::$${CMAKE_MODULE_NAME} SHARED IMPORTED)
|
||||
!!ENDIF
|
||||
!!ENDIF
|
||||
|
||||
# Add a versionless target, for compatibility with Qt6.
|
||||
if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::$${CMAKE_MODULE_NAME})
|
||||
add_library(Qt::$${CMAKE_MODULE_NAME} INTERFACE IMPORTED)
|
||||
set_target_properties(Qt::$${CMAKE_MODULE_NAME} PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES \"Qt5::$${CMAKE_MODULE_NAME}\"
|
||||
)
|
||||
endif()
|
||||
|
||||
!!IF !equals(TEMPLATE, aux)
|
||||
!!IF !isEmpty(CMAKE_BUILD_IS_FRAMEWORK)
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY FRAMEWORK 1)
|
||||
@ -420,6 +429,20 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_ENABLED_FEATURES $$join(QT.$${MODULE}.enabled_features, ";"))
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_DISABLED_FEATURES $$join(QT.$${MODULE}.disabled_features, ";"))
|
||||
|
||||
# Qt 6 forward compatible properties.
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
|
||||
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_ENABLED_PUBLIC_FEATURES
|
||||
$$join(QT.$${MODULE}.enabled_features, ";"))
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
|
||||
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_DISABLED_PUBLIC_FEATURES
|
||||
$$join(QT.$${MODULE}.disabled_features, ";"))
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
|
||||
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_ENABLED_PRIVATE_FEATURES
|
||||
$$join(QT.$${MODULE}_private.enabled_features, ";"))
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}
|
||||
PROPERTY $${CMAKE_FEATURE_PROPERTY_PREFIX}QT_DISABLED_PRIVATE_FEATURES
|
||||
$$join(QT.$${MODULE}_private.disabled_features, ";"))
|
||||
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY INTERFACE_QT_PLUGIN_TYPES \"$${CMAKE_MODULE_PLUGIN_TYPES}\")
|
||||
|
||||
set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE)
|
||||
@ -443,6 +466,14 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
|
||||
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME}Private PROPERTY
|
||||
INTERFACE_LINK_LIBRARIES Qt5::$${CMAKE_MODULE_NAME} ${_Qt5$${CMAKE_MODULE_NAME}_PRIVATEDEPS}
|
||||
)
|
||||
|
||||
# Add a versionless target, for compatibility with Qt6.
|
||||
if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::$${CMAKE_MODULE_NAME}Private)
|
||||
add_library(Qt::$${CMAKE_MODULE_NAME}Private INTERFACE IMPORTED)
|
||||
set_target_properties(Qt::$${CMAKE_MODULE_NAME}Private PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES \"Qt5::$${CMAKE_MODULE_NAME}Private\"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
!!IF !equals(TEMPLATE, aux)
|
||||
|
@ -75,19 +75,30 @@ endif()
|
||||
set(_user_specified_genex
|
||||
\"$<IN_LIST:Qt5::$$CMAKE_PLUGIN_NAME,${_manual_plugins_genex};${_plugin_type_genex}>\"
|
||||
)
|
||||
set(_user_specified_genex_versionless
|
||||
\"$<IN_LIST:Qt::$$CMAKE_PLUGIN_NAME,${_manual_plugins_genex};${_plugin_type_genex}>\"
|
||||
)
|
||||
string(CONCAT _plugin_genex
|
||||
\"$<$<OR:\"
|
||||
# Add this plugin if it\'s in the list of manual plugins or plugins for the type
|
||||
# Add this plugin if it\'s in the list of manually specified plugins or in the list of
|
||||
# explicitly included plugin types.
|
||||
\"${_user_specified_genex},\"
|
||||
# Add this plugin if the list of plugins for the type is empty, the PLUGIN_EXTENDS
|
||||
# is either empty or equal to the module name, and the user hasn\'t blacklisted it
|
||||
\"${_user_specified_genex_versionless},\"
|
||||
# Add this plugin if all of the following are true:
|
||||
# 1) the list of explicitly included plugin types is empty
|
||||
# 2) the QT_PLUGIN_EXTENDS property for the plugin is empty or equal to the current
|
||||
# module name
|
||||
# 3) the user hasn\'t explicitly excluded the plugin.
|
||||
\"$<AND:\"
|
||||
\"$<STREQUAL:${_plugin_type_genex},>,\"
|
||||
\"$<OR:\"
|
||||
\"$<STREQUAL:$<TARGET_PROPERTY:Qt5::$${CMAKE_PLUGIN_NAME},QT_PLUGIN_EXTENDS>,Qt5::$${CMAKE_MODULE_NAME}>,\"
|
||||
# FIXME: The value of CMAKE_MODULE_NAME seems to be wrong (e.g for Svg plugin
|
||||
# it should be Qt::Svg instead of Qt::Gui).
|
||||
\"$<STREQUAL:$<TARGET_PROPERTY:Qt5::$${CMAKE_PLUGIN_NAME},QT_PLUGIN_EXTENDS>,Qt::$${CMAKE_MODULE_NAME}>,\"
|
||||
\"$<STREQUAL:$<TARGET_PROPERTY:Qt5::$${CMAKE_PLUGIN_NAME},QT_PLUGIN_EXTENDS>,>\"
|
||||
\">,\"
|
||||
\"$<NOT:$<IN_LIST:Qt5::$${CMAKE_PLUGIN_NAME},${_no_plugins_genex}>>\"
|
||||
\"$<NOT:$<IN_LIST:Qt5::$${CMAKE_PLUGIN_NAME},${_no_plugins_genex}>>,\"
|
||||
\"$<NOT:$<IN_LIST:Qt::$${CMAKE_PLUGIN_NAME},${_no_plugins_genex}>>\"
|
||||
\">\"
|
||||
\">:Qt5::$$CMAKE_PLUGIN_NAME>\"
|
||||
)
|
||||
@ -100,3 +111,4 @@ set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} APPEND PROPERTY INTERFACE_LINK_LI
|
||||
!!ENDIF
|
||||
set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_TYPE \"$$CMAKE_PLUGIN_TYPE\")
|
||||
set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_EXTENDS \"$$CMAKE_PLUGIN_EXTENDS\")
|
||||
set_property(TARGET Qt5::$${CMAKE_PLUGIN_NAME} PROPERTY QT_PLUGIN_CLASS_NAME \"$$CMAKE_PLUGIN_NAME\")
|
||||
|
@ -1851,7 +1851,6 @@ QString MakefileGenerator::resolveDependency(const QDir &outDir, const QString &
|
||||
}
|
||||
|
||||
void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCompiler,
|
||||
const QString &dep_cd_cmd,
|
||||
const QString &tmp_dep_cmd,
|
||||
const QString &inpf,
|
||||
const QString &tmp_out,
|
||||
@ -1864,7 +1863,10 @@ void MakefileGenerator::callExtraCompilerDependCommand(const ProString &extraCom
|
||||
QString dep_cmd = replaceExtraCompilerVariables(tmp_dep_cmd, inpf, tmp_out, LocalShell);
|
||||
if (checkCommandAvailability && !canExecute(dep_cmd))
|
||||
return;
|
||||
dep_cmd = dep_cd_cmd + fixEnvVariables(dep_cmd);
|
||||
dep_cmd = QLatin1String("cd ")
|
||||
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
|
||||
+ QLatin1String(" && ")
|
||||
+ fixEnvVariables(dep_cmd);
|
||||
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
|
||||
QByteArray depData;
|
||||
while (int read_in = feof(proc) ? 0 : (int)fread(buff, 1, 255, proc))
|
||||
@ -1916,12 +1918,6 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
FileFixifyFromOutdir);
|
||||
const QString tmp_cmd = project->values(ProKey(*it + ".commands")).join(' ');
|
||||
const QString tmp_dep_cmd = project->values(ProKey(*it + ".depend_command")).join(' ');
|
||||
QString dep_cd_cmd;
|
||||
if (!tmp_dep_cmd.isEmpty()) {
|
||||
dep_cd_cmd = QLatin1String("cd ")
|
||||
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
|
||||
+ QLatin1String(" && ");
|
||||
}
|
||||
const bool dep_lines = (config.indexOf("dep_lines") != -1);
|
||||
const ProStringList &vars = project->values(ProKey(*it + ".variables"));
|
||||
if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
|
||||
@ -2035,7 +2031,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
deps += findDependencies(inpf);
|
||||
inputs += Option::fixPathToTargetOS(inpf, false);
|
||||
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
|
||||
callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
|
||||
callExtraCompilerDependCommand(*it, tmp_dep_cmd, inpf,
|
||||
tmp_out, dep_lines, &deps, existingDepsOnly);
|
||||
}
|
||||
}
|
||||
@ -2084,7 +2080,7 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t)
|
||||
for (ProStringList::ConstIterator it3 = vars.constBegin(); it3 != vars.constEnd(); ++it3)
|
||||
cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")");
|
||||
if(!tmp_dep_cmd.isEmpty() && doDepends()) {
|
||||
callExtraCompilerDependCommand(*it, dep_cd_cmd, tmp_dep_cmd, inpf,
|
||||
callExtraCompilerDependCommand(*it, tmp_dep_cmd, inpf,
|
||||
tmp_out, dep_lines, &deps, existingDepsOnly);
|
||||
//use the depend system to find includes of these included files
|
||||
QStringList inc_deps;
|
||||
|
@ -84,7 +84,7 @@ protected:
|
||||
void writeExtraVariables(QTextStream &t);
|
||||
void writeExtraTargets(QTextStream &t);
|
||||
QString resolveDependency(const QDir &outDir, const QString &file);
|
||||
void callExtraCompilerDependCommand(const ProString &extraCompiler, const QString &dep_cd_cmd,
|
||||
void callExtraCompilerDependCommand(const ProString &extraCompiler,
|
||||
const QString &tmp_dep_cmd, const QString &inpf,
|
||||
const QString &tmp_out, bool dep_lines, QStringList *deps,
|
||||
bool existingDepsOnly,
|
||||
|
@ -2351,10 +2351,7 @@ bool VCFilter::addExtraCompiler(const VCFilterFile &info)
|
||||
if (!tmp_dep.isEmpty())
|
||||
deps = tmp_dep;
|
||||
if (!tmp_dep_cmd.isEmpty()) {
|
||||
const QString dep_cd_cmd = QLatin1String("cd ")
|
||||
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
|
||||
+ QLatin1String(" && ");
|
||||
Project->callExtraCompilerDependCommand(extraCompilerName, dep_cd_cmd, tmp_dep_cmd,
|
||||
Project->callExtraCompilerDependCommand(extraCompilerName, tmp_dep_cmd,
|
||||
inFile, out,
|
||||
true, // dep_lines
|
||||
&deps,
|
||||
|
@ -1481,36 +1481,20 @@ void VcprojGenerator::initResourceFiles()
|
||||
// Bad hack, please look away -------------------------------------
|
||||
QString rcc_dep_cmd = project->values("rcc.depend_command").join(' ');
|
||||
if(!rcc_dep_cmd.isEmpty()) {
|
||||
ProStringList qrc_files = project->values("RESOURCES");
|
||||
const QStringList qrc_files = project->values("RESOURCES").toQStringList();
|
||||
QStringList deps;
|
||||
if(!qrc_files.isEmpty()) {
|
||||
for (int i = 0; i < qrc_files.count(); ++i) {
|
||||
char buff[256];
|
||||
QString dep_cmd = replaceExtraCompilerVariables(
|
||||
rcc_dep_cmd, qrc_files.at(i).toQString(), QString(), LocalShell);
|
||||
|
||||
dep_cmd = Option::fixPathToLocalOS(dep_cmd, true, false);
|
||||
if(canExecute(dep_cmd)) {
|
||||
dep_cmd.prepend(QLatin1String("cd ")
|
||||
+ IoUtils::shellQuote(Option::fixPathToLocalOS(Option::output_dir, false))
|
||||
+ QLatin1String(" && "));
|
||||
if (FILE *proc = QT_POPEN(dep_cmd.toLatin1().constData(), QT_POPEN_READ)) {
|
||||
QString indeps;
|
||||
while(!feof(proc)) {
|
||||
int read_in = (int)fread(buff, 1, 255, proc);
|
||||
if(!read_in)
|
||||
break;
|
||||
indeps += QByteArray(buff, read_in);
|
||||
}
|
||||
QT_PCLOSE(proc);
|
||||
if(!indeps.isEmpty())
|
||||
deps += fileFixify(indeps.replace('\n', ' ').simplified().split(' '),
|
||||
FileFixifyFromOutdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
vcProject.ResourceFiles.addFiles(deps);
|
||||
for (const QString &qrc_file : qrc_files) {
|
||||
callExtraCompilerDependCommand("rcc",
|
||||
rcc_dep_cmd,
|
||||
qrc_file,
|
||||
QString(),
|
||||
true, // dep_lines
|
||||
&deps,
|
||||
false, // existingDepsOnly
|
||||
true // checkCommandavailability
|
||||
);
|
||||
}
|
||||
vcProject.ResourceFiles.addFiles(deps);
|
||||
}
|
||||
// You may look again --------------------------------------------
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION)
|
||||
set(QT_DEFAULT_MAJOR_VERSION 5)
|
||||
endif()
|
||||
|
||||
if (NOT TARGET Qt5::qmake)
|
||||
add_executable(Qt5::qmake IMPORTED)
|
||||
@ -177,3 +180,24 @@ if (ANDROID_PLATFORM)
|
||||
endif()
|
||||
|
||||
_qt5_Core_check_file_exists(${_Qt5CTestMacros})
|
||||
|
||||
# Create versionless tool targets.
|
||||
foreach(__qt_tool qmake moc rcc)
|
||||
if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::${__qt_tool}
|
||||
AND TARGET Qt5::${__qt_tool})
|
||||
add_executable(Qt::${__qt_tool} IMPORTED)
|
||||
get_target_property(__qt_imported_location Qt5::${__qt_tool} IMPORTED_LOCATION)
|
||||
set_target_properties(Qt::${__qt_tool}
|
||||
PROPERTIES IMPORTED_LOCATION \"${__qt_imported_location}\")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
!!IF !isEmpty(CMAKE_WINDOWS_BUILD)
|
||||
# Add a versionless target for WinMain.
|
||||
if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::WinMain)
|
||||
add_library(Qt::WinMain INTERFACE IMPORTED)
|
||||
set_target_properties(Qt::WinMain PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES \"Qt5::WinMain\"
|
||||
)
|
||||
endif()
|
||||
!!ENDIF
|
||||
|
@ -157,6 +157,16 @@ function(qt5_generate_moc infile outfile )
|
||||
qt5_create_moc_command(${abs_infile} ${_outfile} "${moc_flags}" "" "${moc_target}" "")
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_generate_moc)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_generate_moc(${ARGV})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_generate_moc(${ARGV})
|
||||
endif()
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
# qt5_wrap_cpp(outfiles inputfile ... )
|
||||
|
||||
@ -184,6 +194,17 @@ function(qt5_wrap_cpp outfiles )
|
||||
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# This will override the CMake upstream command, because that one is for Qt 3.
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_wrap_cpp outfiles)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_wrap_cpp("${outfiles}" ${ARGN})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_wrap_cpp("${outfiles}" ${ARGN})
|
||||
endif()
|
||||
set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
# _qt5_parse_qrc_file(infile _out_depends _rc_depends)
|
||||
@ -255,6 +276,16 @@ function(qt5_add_binary_resources target )
|
||||
add_custom_target(${target} ALL DEPENDS ${rcc_destination})
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_add_binary_resources)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_add_binary_resources(${ARGV})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_add_binary_resources(${ARGV})
|
||||
endif()
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
# qt5_add_resources(outfiles inputfile ... )
|
||||
|
||||
@ -293,6 +324,18 @@ function(qt5_add_resources outfiles )
|
||||
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_add_resources outfiles)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_add_resources("${outfiles}" ${ARGN})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_add_resources("${outfiles}" ${ARGN})
|
||||
endif()
|
||||
set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
# qt5_add_big_resources(outfiles inputfile ... )
|
||||
|
||||
function(qt5_add_big_resources outfiles )
|
||||
@ -341,6 +384,18 @@ function(qt5_add_big_resources outfiles )
|
||||
set(${outfiles} ${${outfiles}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_add_big_resources outfiles)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_add_big_resources(${outfiles} ${ARGN})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_add_big_resources(${outfiles} ${ARGN})
|
||||
endif()
|
||||
set("${outfiles}" "${${outfiles}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..")
|
||||
|
||||
macro(qt5_use_modules _target _link_type)
|
||||
@ -413,10 +468,19 @@ function(qt5_import_plugins TARGET_NAME)
|
||||
elseif(_doing STREQUAL "EXCLUDE_BY_TYPE")
|
||||
string(REGEX REPLACE "[-/]" "_" _plugin_type "${_arg}")
|
||||
set_property(TARGET ${TARGET_NAME} PROPERTY "QT_PLUGINS_${_plugin_type}" -)
|
||||
set(_doing "")
|
||||
else()
|
||||
message(FATAL_ERROR "Unexpected extra argument: \"${_arg}\"")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_import_plugins)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_import_plugins(${ARGV})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_import_plugins(${ARGV})
|
||||
endif()
|
||||
endfunction()
|
||||
endif()
|
||||
|
@ -92,7 +92,7 @@ QT_BEGIN_NAMESPACE
|
||||
void QPropertyAnimationPrivate::updateMetaProperty()
|
||||
{
|
||||
if (!target || propertyName.isEmpty()) {
|
||||
propertyType = QVariant::Invalid;
|
||||
propertyType = QMetaType::UnknownType;
|
||||
propertyIndex = -1;
|
||||
return;
|
||||
}
|
||||
@ -102,11 +102,11 @@ void QPropertyAnimationPrivate::updateMetaProperty()
|
||||
propertyType = targetValue->property(propertyName).userType();
|
||||
propertyIndex = targetValue->metaObject()->indexOfProperty(propertyName);
|
||||
|
||||
if (propertyType != QVariant::Invalid)
|
||||
if (propertyType != QMetaType::UnknownType)
|
||||
convertValues(propertyType);
|
||||
if (propertyIndex == -1) {
|
||||
//there is no Q_PROPERTY on the object
|
||||
propertyType = QVariant::Invalid;
|
||||
propertyType = QMetaType::UnknownType;
|
||||
if (!targetValue->dynamicPropertyNames().contains(propertyName))
|
||||
qWarning("QPropertyAnimation: you're trying to animate a non-existing property %s of your QObject", propertyName.constData());
|
||||
} else if (!targetValue->metaObject()->property(propertyIndex).isWritable()) {
|
||||
|
@ -61,6 +61,7 @@ Q_PROPERTY(type name
|
||||
[USER bool]
|
||||
[CONSTANT]
|
||||
[FINAL])
|
||||
[REQUIRED]
|
||||
//! [0]
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ QApplication::sendEvent(mainWindow, &event);
|
||||
|
||||
//! [1]
|
||||
QPushButton *quitButton = new QPushButton("Quit");
|
||||
connect(quitButton, SIGNAL(clicked()), &app, SLOT(quit()), Qt::QueuedConnection);
|
||||
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection);
|
||||
//! [1]
|
||||
|
||||
|
||||
@ -79,12 +79,12 @@ Q_COREAPP_STARTUP_FUNCTION(preRoutineMyDebugTool)
|
||||
|
||||
|
||||
//! [4]
|
||||
static int *global_ptr = 0;
|
||||
static int *global_ptr = nullptr;
|
||||
|
||||
static void cleanup_ptr()
|
||||
{
|
||||
delete [] global_ptr;
|
||||
global_ptr = 0;
|
||||
global_ptr = nullptr;
|
||||
}
|
||||
|
||||
void init_ptr()
|
||||
@ -125,9 +125,9 @@ private:
|
||||
|
||||
//! [6]
|
||||
static inline QString tr(const char *sourceText,
|
||||
const char *comment = 0);
|
||||
const char *comment = nullptr);
|
||||
static inline QString trUtf8(const char *sourceText,
|
||||
const char *comment = 0);
|
||||
const char *comment = nullptr);
|
||||
//! [6]
|
||||
|
||||
|
||||
|
@ -56,7 +56,7 @@ QState *s1 = new QState();
|
||||
s1->assignProperty(&button, "text", "Click me");
|
||||
|
||||
QFinalState *s2 = new QFinalState();
|
||||
s1->addTransition(&button, SIGNAL(clicked()), s2);
|
||||
s1->addTransition(&button, &QPushButton::clicked, s2);
|
||||
|
||||
machine.addState(s1);
|
||||
machine.addState(s2);
|
||||
|
@ -52,7 +52,7 @@
|
||||
// Instantiate the objects and connect to the finished signal.
|
||||
MyClass myObject;
|
||||
QFutureWatcher<int> watcher;
|
||||
connect(&watcher, SIGNAL(finished()), &myObject, SLOT(handleFinished()));
|
||||
connect(&watcher, QFutureWatcher<int>::finished, &myObject, &MyClass::handleFinished);
|
||||
|
||||
// Start the computation.
|
||||
QFuture<int> future = QtConcurrent::run(...);
|
||||
|
@ -56,10 +56,10 @@ progressBar->setRange(0, 100);
|
||||
// Construct a 1-second timeline with a frame range of 0 - 100
|
||||
QTimeLine *timeLine = new QTimeLine(1000, this);
|
||||
timeLine->setFrameRange(0, 100);
|
||||
connect(timeLine, SIGNAL(frameChanged(int)), progressBar, SLOT(setValue(int)));
|
||||
connect(timeLine, &QTimeLine::frameChanged, progressBar, &QProgressBar::setValue);
|
||||
|
||||
// Clicking the push button will start the progress bar animation
|
||||
pushButton = new QPushButton(tr("Start animation"), this);
|
||||
connect(pushButton, SIGNAL(clicked()), timeLine, SLOT(start()));
|
||||
connect(pushButton, &QPushButton::clicked, timeLine, &QTimeLine::start);
|
||||
...
|
||||
//! [0]
|
||||
|
@ -48,11 +48,10 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
#include "buttonwidget.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
//! [0]
|
||||
ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@ -62,15 +61,16 @@ ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent)
|
||||
QGridLayout *gridLayout = new QGridLayout;
|
||||
for (int i = 0; i < texts.size(); ++i) {
|
||||
QPushButton *button = new QPushButton(texts[i]);
|
||||
connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
|
||||
connect(button, &QPushButton::clicked,
|
||||
signalMapper, &QSignalMapper::map);
|
||||
//! [0] //! [1]
|
||||
signalMapper->setMapping(button, texts[i]);
|
||||
gridLayout->addWidget(button, i / 3, i % 3);
|
||||
}
|
||||
|
||||
connect(signalMapper, SIGNAL(mapped(QString)),
|
||||
connect(signalMapper, QOverload<const QString &>::of(&QSignalMapper::mapped),
|
||||
//! [1] //! [2]
|
||||
this, SIGNAL(clicked(QString)));
|
||||
this, &ButtonWidget::clicked);
|
||||
|
||||
setLayout(gridLayout);
|
||||
}
|
||||
@ -84,7 +84,7 @@ ButtonWidget::ButtonWidget(const QStringList &texts, QWidget *parent)
|
||||
for (int i = 0; i < texts.size(); ++i) {
|
||||
QString text = texts[i];
|
||||
QPushButton *button = new QPushButton(text);
|
||||
connect(button, &QPushButton::clicked, [=] { clicked(text); });
|
||||
connect(button, &QPushButton::clicked, [this, text] { clicked(text); });
|
||||
gridLayout->addWidget(button, i / 3, i % 3);
|
||||
}
|
||||
setLayout(gridLayout);
|
||||
|
@ -51,7 +51,7 @@
|
||||
#ifndef BUTTONWIDGET_H
|
||||
#define BUTTONWIDGET_H
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <QWidget>
|
||||
|
||||
class QSignalMapper;
|
||||
class QString;
|
||||
@ -63,7 +63,7 @@ class ButtonWidget : public QWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ButtonWidget(const QStringList &texts, QWidget *parent = 0);
|
||||
ButtonWidget(const QStringList &texts, QWidget *parent = nullptr);
|
||||
|
||||
signals:
|
||||
void clicked(const QString &text);
|
||||
|
@ -68,10 +68,10 @@ MainWindow::MainWindow()
|
||||
|
||||
readSettings();
|
||||
|
||||
connect(textEdit->document(), SIGNAL(contentsChanged()),
|
||||
this, SLOT(documentWasModified()));
|
||||
connect(textEdit->document(), &QTextEdit::contentsChanged,
|
||||
this, &QAction::documentWasModified);
|
||||
|
||||
setCurrentFile("");
|
||||
setCurrentFile(QString());
|
||||
setUnifiedTitleAndToolBarOnMac(true);
|
||||
}
|
||||
//! [2]
|
||||
@ -95,7 +95,7 @@ void MainWindow::newFile()
|
||||
{
|
||||
if (maybeSave()) {
|
||||
textEdit->clear();
|
||||
setCurrentFile("");
|
||||
setCurrentFile(QString());
|
||||
}
|
||||
}
|
||||
//! [6]
|
||||
@ -162,31 +162,31 @@ void MainWindow::createActions()
|
||||
newAct = new QAction(QIcon(":/images/new.png"), tr("&New"), this);
|
||||
newAct->setShortcuts(QKeySequence::New);
|
||||
newAct->setStatusTip(tr("Create a new file"));
|
||||
connect(newAct, SIGNAL(triggered()), this, SLOT(newFile()));
|
||||
connect(newAct, &QAction::triggered, this, &MainWindow::newFile);
|
||||
|
||||
//! [19]
|
||||
openAct = new QAction(QIcon(":/images/open.png"), tr("&Open..."), this);
|
||||
openAct->setShortcuts(QKeySequence::Open);
|
||||
openAct->setStatusTip(tr("Open an existing file"));
|
||||
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
|
||||
connect(openAct, &QAction::triggered, this, &MainWindow::open);
|
||||
//! [18] //! [19]
|
||||
|
||||
saveAct = new QAction(QIcon(":/images/save.png"), tr("&Save"), this);
|
||||
saveAct->setShortcuts(QKeySequence::Save);
|
||||
saveAct->setStatusTip(tr("Save the document to disk"));
|
||||
connect(saveAct, SIGNAL(triggered()), this, SLOT(save()));
|
||||
connect(saveAct, &QAction::triggered, this, &MainWindow::save);
|
||||
|
||||
saveAsAct = new QAction(tr("Save &As..."), this);
|
||||
saveAsAct->setShortcuts(QKeySequence::SaveAs);
|
||||
saveAsAct->setStatusTip(tr("Save the document under a new name"));
|
||||
connect(saveAsAct, SIGNAL(triggered()), this, SLOT(saveAs()));
|
||||
connect(saveAsAct, &QAction::triggered, this, &MainWindow::saveAs);
|
||||
|
||||
//! [20]
|
||||
exitAct = new QAction(tr("E&xit"), this);
|
||||
exitAct->setShortcuts(QKeySequence::Quit);
|
||||
//! [20]
|
||||
exitAct->setStatusTip(tr("Exit the application"));
|
||||
connect(exitAct, SIGNAL(triggered()), this, SLOT(close()));
|
||||
connect(exitAct, &QAction::triggered, this, &MainWindow::close);
|
||||
|
||||
//! [21]
|
||||
cutAct = new QAction(QIcon(":/images/cut.png"), tr("Cu&t"), this);
|
||||
@ -194,38 +194,38 @@ void MainWindow::createActions()
|
||||
cutAct->setShortcuts(QKeySequence::Cut);
|
||||
cutAct->setStatusTip(tr("Cut the current selection's contents to the "
|
||||
"clipboard"));
|
||||
connect(cutAct, SIGNAL(triggered()), textEdit, SLOT(cut()));
|
||||
connect(cutAct, &QAction::triggered, textEdit, &QTextEdit::cut);
|
||||
|
||||
copyAct = new QAction(QIcon(":/images/copy.png"), tr("&Copy"), this);
|
||||
copyAct->setShortcuts(QKeySequence::Copy);
|
||||
copyAct->setStatusTip(tr("Copy the current selection's contents to the "
|
||||
"clipboard"));
|
||||
connect(copyAct, SIGNAL(triggered()), textEdit, SLOT(copy()));
|
||||
connect(copyAct, &QAction::triggered, textEdit, &QTextEdit::copy);
|
||||
|
||||
pasteAct = new QAction(QIcon(":/images/paste.png"), tr("&Paste"), this);
|
||||
pasteAct->setShortcuts(QKeySequence::Paste);
|
||||
pasteAct->setStatusTip(tr("Paste the clipboard's contents into the current "
|
||||
"selection"));
|
||||
connect(pasteAct, SIGNAL(triggered()), textEdit, SLOT(paste()));
|
||||
connect(pasteAct, &QAction::triggered, textEdit, &QTextEdit::paste);
|
||||
|
||||
aboutAct = new QAction(tr("&About"), this);
|
||||
aboutAct->setStatusTip(tr("Show the application's About box"));
|
||||
connect(aboutAct, SIGNAL(triggered()), this, SLOT(about()));
|
||||
connect(aboutAct, &QAction::triggered, this, &MainWindow::about);
|
||||
|
||||
//! [22]
|
||||
aboutQtAct = new QAction(tr("About &Qt"), this);
|
||||
aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
|
||||
connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||
connect(aboutQtAct, &QAction::triggered, qApp, &QApplication::aboutQt);
|
||||
//! [22]
|
||||
|
||||
//! [23]
|
||||
cutAct->setEnabled(false);
|
||||
//! [23] //! [24]
|
||||
copyAct->setEnabled(false);
|
||||
connect(textEdit, SIGNAL(copyAvailable(bool)),
|
||||
cutAct, SLOT(setEnabled(bool)));
|
||||
connect(textEdit, SIGNAL(copyAvailable(bool)),
|
||||
copyAct, SLOT(setEnabled(bool)));
|
||||
connect(textEdit, &QTextEdit::copyAvailable,
|
||||
cutAct, &QAction::setEnabled);
|
||||
connect(textEdit, &QTextEdit::copyAvailable,
|
||||
copyAct, &QAction::setEnabled);
|
||||
}
|
||||
//! [24]
|
||||
|
||||
|
@ -48,13 +48,14 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
int main(int argv, char **args)
|
||||
{
|
||||
QApplication app(argv, args);
|
||||
|
||||
QLabel *label = new QLabel;
|
||||
QPushButton *button = new QPushButton;
|
||||
|
||||
//![0]
|
||||
QStateMachine machine;
|
||||
@ -70,14 +71,14 @@ int main(int argv, char **args)
|
||||
//![4]
|
||||
|
||||
//![5]
|
||||
QObject::connect(s3, SIGNAL(entered()), button, SLOT(showMaximized()));
|
||||
QObject::connect(s3, SIGNAL(exited()), button, SLOT(showMinimized()));
|
||||
QObject::connect(s3, &QState::entered, button, &QPushButton:showMaximized);
|
||||
QObject::connect(s3, &QState::exited, button, &QPushButton::showMinimized);
|
||||
//![5]
|
||||
|
||||
//![1]
|
||||
s1->addTransition(button, SIGNAL(clicked()), s2);
|
||||
s2->addTransition(button, SIGNAL(clicked()), s3);
|
||||
s3->addTransition(button, SIGNAL(clicked()), s1);
|
||||
s1->addTransition(button, &QPushButton::clicked, s2);
|
||||
s2->addTransition(button, &QPushButton::clicked, s3);
|
||||
s3->addTransition(button, &QPushButton::clicked, s1);
|
||||
//![1]
|
||||
|
||||
//![2]
|
||||
|
@ -48,11 +48,11 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtGui>
|
||||
#include <QtWidgets>
|
||||
|
||||
int main(int argv, char **args)
|
||||
{
|
||||
QApplication app(argv, args);
|
||||
QApplication app(argv, args);
|
||||
|
||||
QStateMachine machine;
|
||||
|
||||
@ -66,16 +66,17 @@ int main(int argv, char **args)
|
||||
//![0]
|
||||
|
||||
//![2]
|
||||
s12->addTransition(quitButton, SIGNAL(clicked()), s12);
|
||||
s12->addTransition(quitButton, &QPushButton::clicked, s12);
|
||||
//![2]
|
||||
|
||||
//![1]
|
||||
QFinalState *s2 = new QFinalState();
|
||||
s1->addTransition(quitButton, SIGNAL(clicked()), s2);
|
||||
s1->addTransition(quitButton, &QPushButton::clicked, s2);
|
||||
machine.addState(s2);
|
||||
machine.setInitialState(s1);
|
||||
|
||||
QObject::connect(&machine, SIGNAL(finished()), QApplication::instance(), SLOT(quit()));
|
||||
QObject::connect(&machine, &QStateMachine::finished,
|
||||
QCoreApplication::instance(), &QCoreApplication::quit);
|
||||
//![1]
|
||||
|
||||
QButton *interruptButton = new QPushButton("Interrupt Button");
|
||||
@ -90,11 +91,11 @@ int main(int argv, char **args)
|
||||
mbox->addButton(QMessageBox::Ok);
|
||||
mbox->setText("Interrupted!");
|
||||
mbox->setIcon(QMessageBox::Information);
|
||||
QObject::connect(s3, SIGNAL(entered()), mbox, SLOT(exec()));
|
||||
QObject::connect(s3, &QState::entered, mbox, &QMessageBox::exec);
|
||||
s3->addTransition(s1h);
|
||||
machine.addState(s3);
|
||||
|
||||
s1->addTransition(interruptButton, SIGNAL(clicked()), s3);
|
||||
s1->addTransition(interruptButton, &QPushButton::clicked, s3);
|
||||
//![3]
|
||||
|
||||
return app.exec();
|
||||
|
@ -62,7 +62,7 @@ int main(int argv, char **args)
|
||||
//![0]
|
||||
|
||||
//![1]
|
||||
s1->addTransition(s1, SIGNAL(finished()), s2);
|
||||
s1->addTransition(s1, &QState::finished, s2);
|
||||
//![1]
|
||||
|
||||
return app.exec();
|
||||
|
@ -98,7 +98,7 @@ int main(int argv, char **args)
|
||||
s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
|
||||
s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100));
|
||||
|
||||
s1->addTransition(button, SIGNAL(clicked()), s2);
|
||||
s1->addTransition(button, &QPushButton::clicked, s2);
|
||||
//![3]
|
||||
|
||||
}
|
||||
@ -111,7 +111,7 @@ int main(int argv, char **args)
|
||||
s1->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
|
||||
s2->assignProperty(button, "geometry", QRectF(0, 0, 100, 100));
|
||||
|
||||
QSignalTransition *transition = s1->addTransition(button, SIGNAL(clicked()), s2);
|
||||
QSignalTransition *transition = s1->addTransition(button, &QPushButton::clicked, s2);
|
||||
transition->addAnimation(new QPropertyAnimation(button, "geometry"));
|
||||
//![4]
|
||||
|
||||
@ -130,9 +130,9 @@ int main(int argv, char **args)
|
||||
|
||||
QState *s2 = new QState();
|
||||
s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
|
||||
connect(s2, SIGNAL(entered()), messageBox, SLOT(exec()));
|
||||
connect(s2, &QState::entered, messageBox, SLOT(exec()));
|
||||
|
||||
s1->addTransition(button, SIGNAL(clicked()), s2);
|
||||
s1->addTransition(button, &QPushButton::clicked, s2);
|
||||
//![5]
|
||||
}
|
||||
|
||||
@ -151,10 +151,10 @@ int main(int argv, char **args)
|
||||
s2->assignProperty(button, "geometry", QRectF(0, 0, 50, 50));
|
||||
|
||||
QState *s3 = new QState();
|
||||
connect(s3, SIGNAL(entered()), messageBox, SLOT(exec()));
|
||||
connect(s3, &QState::entered, messageBox, SLOT(exec()));
|
||||
|
||||
s1->addTransition(button, SIGNAL(clicked()), s2);
|
||||
s2->addTransition(s2, SIGNAL(propertiesAssigned()), s3);
|
||||
s1->addTransition(button, &QPushButton::clicked, s2);
|
||||
s2->addTransition(s2, &QState::propertiesAssigned, s3);
|
||||
//![6]
|
||||
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ AnalogClock::AnalogClock(QWidget *parent)
|
||||
//! [3] //! [4]
|
||||
QTimer *timer = new QTimer(this);
|
||||
//! [4] //! [5]
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(update()));
|
||||
connect(timer, &QTimer::timeout, this, QOverload<>::of(&AnalogClock::update));
|
||||
//! [5] //! [6]
|
||||
timer->start(1000);
|
||||
//! [6]
|
||||
|
@ -61,13 +61,13 @@ Foo::Foo()
|
||||
//! [0]
|
||||
QTimer *timer = new QTimer(this);
|
||||
//! [0] //! [1]
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(updateCaption()));
|
||||
connect(timer, &QTimer::timeout, this, &Foo::updateCaption);
|
||||
//! [1] //! [2]
|
||||
timer->start(1000);
|
||||
//! [2]
|
||||
|
||||
//! [3]
|
||||
QTimer::singleShot(200, this, SLOT(updateCaption()));
|
||||
QTimer::singleShot(200, this, &Foo::updateCaption);
|
||||
//! [3]
|
||||
|
||||
{
|
||||
@ -75,7 +75,7 @@ Foo::Foo()
|
||||
//! [4]
|
||||
QTimer *timer = new QTimer(this);
|
||||
//! [4] //! [5]
|
||||
connect(timer, SIGNAL(timeout()), this, SLOT(processOneThing()));
|
||||
connect(timer, &QTimer::timeout, this, &Foo::processOneThing);
|
||||
//! [5] //! [6]
|
||||
timer->start();
|
||||
//! [6]
|
||||
|
@ -356,11 +356,11 @@
|
||||
state2->assignProperty(button, "geometry", QRect(250, 250, 100, 30));
|
||||
|
||||
QSignalTransition *transition1 = state1->addTransition(button,
|
||||
SIGNAL(clicked()), state2);
|
||||
&QPushButton::clicked, state2);
|
||||
transition1->addAnimation(new QPropertyAnimation(button, "geometry"));
|
||||
|
||||
QSignalTransition *transition2 = state2->addTransition(button,
|
||||
SIGNAL(clicked()), state1);
|
||||
&QPushButton::clicked, state1);
|
||||
transition2->addAnimation(new QPropertyAnimation(button, "geometry"));
|
||||
|
||||
machine->start();
|
||||
|
@ -144,6 +144,12 @@
|
||||
optimizations in some cases, but is not enforced by moc. Care must be taken
|
||||
never to override a \c FINAL property.
|
||||
|
||||
\li The presence of the \c REQUIRED attribute indicates that the property
|
||||
should be set by a user of the class. This is not enforced by moc, and is
|
||||
mostly useful for classes exposed to QML. In QML, classes with REQUIRED
|
||||
properties cannot be instantiated unless all REQUIRED properties have
|
||||
been set.
|
||||
|
||||
\endlist
|
||||
|
||||
The \c READ, \c WRITE, and \c RESET functions can be inherited.
|
||||
|
@ -323,12 +323,12 @@
|
||||
QState *s1 = new QState(&machine);
|
||||
|
||||
QPushButton button;
|
||||
QSignalTransition *trans = new QSignalTransition(&button, SIGNAL(clicked()));
|
||||
QSignalTransition *trans = new QSignalTransition(&button, &QPushButton::clicked);
|
||||
s1->addTransition(trans);
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("The button was clicked; carry on.");
|
||||
QObject::connect(trans, SIGNAL(triggered()), &msgBox, SLOT(exec()));
|
||||
QObject::connect(trans, QSignalTransition::triggered, &msgBox, &QMessageBox::exec);
|
||||
|
||||
machine.setInitialState(s1);
|
||||
\endcode
|
||||
|
@ -702,7 +702,7 @@ Q_STATIC_ASSERT((std::is_same<qsizetype, qptrdiff>::value));
|
||||
64-bit integer literals in a platform-independent way. The
|
||||
Q_CHECK_PTR() macro prints a warning containing the source code's
|
||||
file name and line number, saying that the program ran out of
|
||||
memory, if the pointer is 0. The qPrintable() and qUtf8Printable()
|
||||
memory, if the pointer is \nullptr. The qPrintable() and qUtf8Printable()
|
||||
macros represent an easy way of printing text.
|
||||
|
||||
The QT_POINTER_SIZE macro expands to the size of a pointer in bytes.
|
||||
@ -3279,7 +3279,7 @@ QByteArray QSysInfo::bootUniqueId()
|
||||
\macro void Q_CHECK_PTR(void *pointer)
|
||||
\relates <QtGlobal>
|
||||
|
||||
If \a pointer is 0, prints a message containing the source
|
||||
If \a pointer is \nullptr, prints a message containing the source
|
||||
code's file name and line number, saying that the program ran out
|
||||
of memory and aborts program execution. It throws \c std::bad_alloc instead
|
||||
if exceptions are enabled.
|
||||
|
@ -1749,6 +1749,9 @@ namespace Qt {
|
||||
PassThrough
|
||||
};
|
||||
|
||||
// QTBUG-48701
|
||||
enum ReturnByValue_t { ReturnByValue }; // ### Qt 7: Remove me
|
||||
|
||||
#ifndef Q_QDOC
|
||||
// NOTE: Generally, do not add Q_ENUM_NS if a corresponding Q_FLAG_NS exists.
|
||||
Q_ENUM_NS(ScrollBarPolicy)
|
||||
|
@ -3319,3 +3319,15 @@
|
||||
\value RoundPreferFloor Round up for .75 and above.
|
||||
\value PassThrough Don't round.
|
||||
*/
|
||||
|
||||
/*!
|
||||
\enum Qt::ReturnByValue_t
|
||||
\since 5.15
|
||||
|
||||
This is a dummy type, designed to help users transition from certain deprecated APIs to their replacement APIs.
|
||||
|
||||
\sa QCursor::bitmap()
|
||||
\sa QCursor::mask()
|
||||
\sa QLabel::picture()
|
||||
\sa QLabel::pixmap()
|
||||
*/
|
||||
|
@ -227,7 +227,7 @@ QBuffer::~QBuffer()
|
||||
|
||||
\snippet buffer/buffer.cpp 4
|
||||
|
||||
If \a byteArray is 0, the buffer creates its own internal
|
||||
If \a byteArray is \nullptr, the buffer creates its own internal
|
||||
QByteArray to work on. This byte array is initially empty.
|
||||
|
||||
\sa buffer(), setData(), open()
|
||||
|
@ -1829,7 +1829,7 @@ QByteArray QIODevicePrivate::peek(qint64 maxSize)
|
||||
/*! \fn bool QIODevice::getChar(char *c)
|
||||
|
||||
Reads one character from the device and stores it in \a c. If \a c
|
||||
is 0, the character is discarded. Returns \c true on success;
|
||||
is \nullptr, the character is discarded. Returns \c true on success;
|
||||
otherwise returns \c false.
|
||||
|
||||
\sa read(), putChar(), ungetChar()
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -396,12 +396,12 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
{
|
||||
QString result;
|
||||
|
||||
switch (v.type()) {
|
||||
case QVariant::Invalid:
|
||||
switch (v.userType()) {
|
||||
case QMetaType::UnknownType:
|
||||
result = QLatin1String("@Invalid()");
|
||||
break;
|
||||
|
||||
case QVariant::ByteArray: {
|
||||
case QMetaType::QByteArray: {
|
||||
QByteArray a = v.toByteArray();
|
||||
result = QLatin1String("@ByteArray(")
|
||||
+ QLatin1String(a.constData(), a.size())
|
||||
@ -409,17 +409,16 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
break;
|
||||
}
|
||||
|
||||
case QVariant::String:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
case QVariant::Int:
|
||||
case QVariant::UInt:
|
||||
case QVariant::Bool:
|
||||
case QVariant::Double:
|
||||
#if QT_CONFIG(shortcut)
|
||||
case QVariant::KeySequence:
|
||||
case QMetaType::QKeySequence:
|
||||
#endif
|
||||
{
|
||||
case QMetaType::QString:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::ULongLong:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::Double: {
|
||||
result = v.toString();
|
||||
if (result.contains(QChar::Null))
|
||||
result = QLatin1String("@String(") + result + QLatin1Char(')');
|
||||
@ -428,17 +427,17 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
break;
|
||||
}
|
||||
#ifndef QT_NO_GEOM_VARIANT
|
||||
case QVariant::Rect: {
|
||||
case QMetaType::QRect: {
|
||||
QRect r = qvariant_cast<QRect>(v);
|
||||
result = QString::asprintf("@Rect(%d %d %d %d)", r.x(), r.y(), r.width(), r.height());
|
||||
break;
|
||||
}
|
||||
case QVariant::Size: {
|
||||
case QMetaType::QSize: {
|
||||
QSize s = qvariant_cast<QSize>(v);
|
||||
result = QString::asprintf("@Size(%d %d)", s.width(), s.height());
|
||||
break;
|
||||
}
|
||||
case QVariant::Point: {
|
||||
case QMetaType::QPoint: {
|
||||
QPoint p = qvariant_cast<QPoint>(v);
|
||||
result = QString::asprintf("@Point(%d %d)", p.x(), p.y());
|
||||
break;
|
||||
@ -449,7 +448,7 @@ QString QSettingsPrivate::variantToString(const QVariant &v)
|
||||
#ifndef QT_NO_DATASTREAM
|
||||
QDataStream::Version version;
|
||||
const char *typeSpec;
|
||||
if (v.type() == QVariant::DateTime) {
|
||||
if (v.userType() == QMetaType::QDateTime) {
|
||||
version = QDataStream::Qt_5_6;
|
||||
typeSpec = "@DateTime(";
|
||||
} else {
|
||||
@ -1891,8 +1890,8 @@ bool QConfFileSettingsPrivate::writeIniFile(QIODevice &device, const ParsedSetti
|
||||
QVariant(QString("foo")).toList() returns an empty
|
||||
list, not a list containing "foo".
|
||||
*/
|
||||
if (value.type() == QVariant::StringList
|
||||
|| (value.type() == QVariant::List && value.toList().size() != 1)) {
|
||||
if (value.userType() == QMetaType::QStringList
|
||||
|| (value.userType() == QMetaType::QVariantList && value.toList().size() != 1)) {
|
||||
iniEscapedStringList(variantListToStringList(value.toList()), block, iniCodec);
|
||||
} else {
|
||||
iniEscapedString(variantToString(value), block, iniCodec);
|
||||
|
@ -552,32 +552,32 @@ const QHash<int,QByteArray> &QAbstractItemModelPrivate::defaultRoleNames()
|
||||
bool QAbstractItemModelPrivate::isVariantLessThan(const QVariant &left, const QVariant &right,
|
||||
Qt::CaseSensitivity cs, bool isLocaleAware)
|
||||
{
|
||||
if (left.userType() == QVariant::Invalid)
|
||||
if (left.userType() == QMetaType::UnknownType)
|
||||
return false;
|
||||
if (right.userType() == QVariant::Invalid)
|
||||
if (right.userType() == QMetaType::UnknownType)
|
||||
return true;
|
||||
switch (left.userType()) {
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
return left.toInt() < right.toInt();
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
return left.toUInt() < right.toUInt();
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
return left.toLongLong() < right.toLongLong();
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
return left.toULongLong() < right.toULongLong();
|
||||
case QMetaType::Float:
|
||||
return left.toFloat() < right.toFloat();
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return left.toDouble() < right.toDouble();
|
||||
case QVariant::Char:
|
||||
case QMetaType::QChar:
|
||||
return left.toChar() < right.toChar();
|
||||
case QVariant::Date:
|
||||
case QMetaType::QDate:
|
||||
return left.toDate() < right.toDate();
|
||||
case QVariant::Time:
|
||||
case QMetaType::QTime:
|
||||
return left.toTime() < right.toTime();
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return left.toDateTime() < right.toDateTime();
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
default:
|
||||
if (isLocaleAware)
|
||||
return left.toString().localeAwareCompare(right.toString()) < 0;
|
||||
@ -591,19 +591,19 @@ static uint typeOfVariant(const QVariant &value)
|
||||
{
|
||||
//return 0 for integer, 1 for floating point and 2 for other
|
||||
switch (value.userType()) {
|
||||
case QVariant::Bool:
|
||||
case QVariant::Int:
|
||||
case QVariant::UInt:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::ULongLong:
|
||||
case QVariant::Char:
|
||||
case QMetaType::Bool:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::ULongLong:
|
||||
case QMetaType::QChar:
|
||||
case QMetaType::Short:
|
||||
case QMetaType::UShort:
|
||||
case QMetaType::UChar:
|
||||
case QMetaType::ULong:
|
||||
case QMetaType::Long:
|
||||
return 0;
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
case QMetaType::Float:
|
||||
return 1;
|
||||
default:
|
||||
@ -2374,7 +2374,7 @@ QModelIndexList QAbstractItemModel::match(const QModelIndex &start, int role,
|
||||
} else { // QString or regular expression based matching
|
||||
if (matchType == Qt::MatchRegularExpression) {
|
||||
if (rx.pattern().isEmpty()) {
|
||||
if (value.type() == QVariant::RegularExpression) {
|
||||
if (value.userType() == QMetaType::QRegularExpression) {
|
||||
rx = value.toRegularExpression();
|
||||
} else {
|
||||
rx.setPattern(value.toString());
|
||||
|
@ -160,7 +160,7 @@ QAbstractEventDispatcher::~QAbstractEventDispatcher()
|
||||
|
||||
/*!
|
||||
Returns a pointer to the event dispatcher object for the specified
|
||||
\a thread. If \a thread is zero, the current thread is used. If no
|
||||
\a thread. If \a thread is \nullptr, the current thread is used. If no
|
||||
event dispatcher exists for the specified thread, this function
|
||||
returns \nullptr.
|
||||
|
||||
|
@ -603,7 +603,7 @@ static bool methodMatch(const QMetaObject *m, int handle,
|
||||
* \internal
|
||||
* helper function for indexOf{Method,Slot,Signal}, returns the relative index of the method within
|
||||
* the baseObject
|
||||
* \a MethodType might be MethodSignal or MethodSlot, or 0 to match everything.
|
||||
* \a MethodType might be MethodSignal or MethodSlot, or \nullptr to match everything.
|
||||
*/
|
||||
template<int MethodType>
|
||||
static inline int indexOfMethodRelative(const QMetaObject **baseObject,
|
||||
@ -737,7 +737,7 @@ int QMetaObject::indexOfSignal(const char *signal) const
|
||||
\internal
|
||||
Same as QMetaObject::indexOfSignal, but the result is the local offset to the base object.
|
||||
|
||||
\a baseObject will be adjusted to the enclosing QMetaObject, or 0 if the signal is not found
|
||||
\a baseObject will be adjusted to the enclosing QMetaObject, or \nullptr if the signal is not found
|
||||
*/
|
||||
int QMetaObjectPrivate::indexOfSignalRelative(const QMetaObject **baseObject,
|
||||
const QByteArray &name, int argc,
|
||||
@ -2988,7 +2988,7 @@ int QMetaProperty::userType() const
|
||||
if (type == QMetaType::UnknownType) {
|
||||
type = registerPropertyType();
|
||||
if (type == QMetaType::UnknownType)
|
||||
return QVariant::Int; // Match behavior of QMetaType::type()
|
||||
return QMetaType::Int; // Match behavior of QMetaType::type()
|
||||
}
|
||||
return type;
|
||||
}
|
||||
@ -3106,7 +3106,7 @@ QVariant QMetaProperty::read(const QObject *object) const
|
||||
if (!object || !mobj)
|
||||
return QVariant();
|
||||
|
||||
uint t = QVariant::Int;
|
||||
uint t = QMetaType::Int;
|
||||
if (isEnumType()) {
|
||||
/*
|
||||
try to create a QVariant that can be converted to this enum
|
||||
@ -3183,9 +3183,9 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
|
||||
return false;
|
||||
|
||||
QVariant v = value;
|
||||
uint t = QVariant::Invalid;
|
||||
uint t = QMetaType::UnknownType;
|
||||
if (isEnumType()) {
|
||||
if (v.type() == QVariant::String) {
|
||||
if (v.userType() == QMetaType::QString) {
|
||||
bool ok;
|
||||
if (isFlagType())
|
||||
v = QVariant(menum.keysToValue(value.toByteArray(), &ok));
|
||||
@ -3193,13 +3193,13 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const
|
||||
v = QVariant(menum.keyToValue(value.toByteArray(), &ok));
|
||||
if (!ok)
|
||||
return false;
|
||||
} else if (v.type() != QVariant::Int && v.type() != QVariant::UInt) {
|
||||
} else if (v.userType() != QMetaType::Int && v.userType() != QMetaType::UInt) {
|
||||
int enumMetaTypeId = QMetaType::type(qualifiedName(menum));
|
||||
if ((enumMetaTypeId == QMetaType::UnknownType) || (v.userType() != enumMetaTypeId) || !v.constData())
|
||||
return false;
|
||||
v = QVariant(*reinterpret_cast<const int *>(v.constData()));
|
||||
}
|
||||
v.convert(QVariant::Int);
|
||||
v.convert(QMetaType::Int);
|
||||
} else {
|
||||
int handle = priv(mobj->d.data)->propertyData + 3*idx;
|
||||
const char *typeName = nullptr;
|
||||
@ -3578,6 +3578,21 @@ bool QMetaProperty::isFinal() const
|
||||
return flags & Final;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
Returns \c true if the property is required; otherwise returns \c false.
|
||||
|
||||
A property is final if the \c{Q_PROPERTY()}'s \c REQUIRED attribute
|
||||
is set.
|
||||
*/
|
||||
bool QMetaProperty::isRequired() const
|
||||
{
|
||||
if (!mobj)
|
||||
return false;
|
||||
int flags = mobj->d.data[handle + 2];
|
||||
return flags & Required;
|
||||
}
|
||||
|
||||
/*!
|
||||
\obsolete
|
||||
|
||||
|
@ -263,6 +263,7 @@ public:
|
||||
bool isUser(const QObject *obj = nullptr) const;
|
||||
bool isConstant() const;
|
||||
bool isFinal() const;
|
||||
bool isRequired() const;
|
||||
|
||||
bool isFlagType() const;
|
||||
bool isEnumType() const;
|
||||
|
@ -85,7 +85,8 @@ enum PropertyFlags {
|
||||
User = 0x00100000,
|
||||
ResolveUser = 0x00200000,
|
||||
Notify = 0x00400000,
|
||||
Revisioned = 0x00800000
|
||||
Revisioned = 0x00800000,
|
||||
Required = 0x01000000,
|
||||
};
|
||||
|
||||
enum MethodFlags {
|
||||
|
@ -254,6 +254,7 @@ struct DefinedTypesFilter {
|
||||
\value QPolygon QPolygon
|
||||
\value QPolygonF QPolygonF
|
||||
\value QColor QColor
|
||||
\value QColorSpace QColorSpace
|
||||
\value QSizeF QSizeF
|
||||
\value QRectF QRectF
|
||||
\value QLine QLine
|
||||
@ -458,7 +459,7 @@ struct DefinedTypesFilter {
|
||||
\deprecated
|
||||
|
||||
Constructs a value of the given type which is a copy of \a copy.
|
||||
The default value for \a copy is 0.
|
||||
The default value for \a copy is \nullptr.
|
||||
|
||||
Deprecated, use the static function QMetaType::create(int type,
|
||||
const void *copy) instead.
|
||||
|
@ -182,6 +182,7 @@ inline Q_DECL_CONSTEXPR int qMetaTypeId();
|
||||
F(QVector4D, 84, QVector4D) \
|
||||
F(QQuaternion, 85, QQuaternion) \
|
||||
F(QPolygonF, 86, QPolygonF) \
|
||||
F(QColorSpace, 87, QColorSpace) \
|
||||
|
||||
|
||||
#define QT_FOR_EACH_STATIC_WIDGETS_CLASS(F)\
|
||||
@ -440,7 +441,7 @@ public:
|
||||
FirstCoreType = Bool,
|
||||
LastCoreType = QCborMap,
|
||||
FirstGuiType = QFont,
|
||||
LastGuiType = QPolygonF,
|
||||
LastGuiType = QColorSpace,
|
||||
FirstWidgetsType = QSizePolicy,
|
||||
LastWidgetsType = QSizePolicy,
|
||||
HighestInternalId = LastWidgetsType,
|
||||
@ -475,12 +476,12 @@ public:
|
||||
QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73,
|
||||
QCursor = 74, QKeySequence = 75, QPen = 76, QTextLength = 77, QTextFormat = 78,
|
||||
QMatrix = 79, QTransform = 80, QMatrix4x4 = 81, QVector2D = 82,
|
||||
QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86,
|
||||
QVector3D = 83, QVector4D = 84, QQuaternion = 85, QPolygonF = 86, QColorSpace = 87,
|
||||
|
||||
// Widget types
|
||||
QSizePolicy = 121,
|
||||
LastCoreType = QCborMap,
|
||||
LastGuiType = QPolygonF,
|
||||
LastGuiType = QColorSpace,
|
||||
User = 1024
|
||||
};
|
||||
#endif
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
void setData(const QString &format, const QVariant &data);
|
||||
QVariant getData(const QString &format) const;
|
||||
|
||||
QVariant retrieveTypedData(const QString &format, QVariant::Type type) const;
|
||||
QVariant retrieveTypedData(const QString &format, QMetaType::Type type) const;
|
||||
|
||||
QVector<QMimeDataStruct> dataList;
|
||||
};
|
||||
@ -108,23 +108,23 @@ QVariant QMimeDataPrivate::getData(const QString &format) const
|
||||
return data;
|
||||
}
|
||||
|
||||
QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Type type) const
|
||||
QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QMetaType::Type type) const
|
||||
{
|
||||
Q_Q(const QMimeData);
|
||||
|
||||
QVariant data = q->retrieveData(format, type);
|
||||
QVariant data = q->retrieveData(format, QVariant::Type(type));
|
||||
|
||||
// Text data requested: fallback to URL data if available
|
||||
if (format == QLatin1String("text/plain") && !data.isValid()) {
|
||||
data = retrieveTypedData(textUriListLiteral(), QVariant::List);
|
||||
if (data.type() == QVariant::Url) {
|
||||
data = retrieveTypedData(textUriListLiteral(), QMetaType::QVariantList);
|
||||
if (data.userType() == QMetaType::QUrl) {
|
||||
data = QVariant(data.toUrl().toDisplayString());
|
||||
} else if (data.type() == QVariant::List) {
|
||||
} else if (data.userType() == QMetaType::QVariantList) {
|
||||
QString text;
|
||||
int numUrls = 0;
|
||||
const QList<QVariant> list = data.toList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).type() == QVariant::Url) {
|
||||
if (list.at(i).userType() == QMetaType::QUrl) {
|
||||
text += list.at(i).toUrl().toDisplayString() + QLatin1Char('\n');
|
||||
++numUrls;
|
||||
}
|
||||
@ -135,26 +135,26 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
}
|
||||
}
|
||||
|
||||
if (data.type() == type || !data.isValid())
|
||||
if (data.userType() == type || !data.isValid())
|
||||
return data;
|
||||
|
||||
// provide more conversion possiblities than just what QVariant provides
|
||||
|
||||
// URLs can be lists as well...
|
||||
if ((type == QVariant::Url && data.type() == QVariant::List)
|
||||
|| (type == QVariant::List && data.type() == QVariant::Url))
|
||||
if ((type == QMetaType::QUrl && data.userType() == QMetaType::QVariantList)
|
||||
|| (type == QMetaType::QVariantList && data.userType() == QMetaType::QUrl))
|
||||
return data;
|
||||
|
||||
// images and pixmaps are interchangeable
|
||||
if ((type == QVariant::Pixmap && data.type() == QVariant::Image)
|
||||
|| (type == QVariant::Image && data.type() == QVariant::Pixmap))
|
||||
if ((type == QMetaType::QPixmap && data.userType() == QMetaType::QImage)
|
||||
|| (type == QMetaType::QImage && data.userType() == QMetaType::QPixmap))
|
||||
return data;
|
||||
|
||||
if (data.type() == QVariant::ByteArray) {
|
||||
if (data.userType() == QMetaType::QByteArray) {
|
||||
// see if we can convert to the requested type
|
||||
switch(type) {
|
||||
#if QT_CONFIG(textcodec)
|
||||
case QVariant::String: {
|
||||
case QMetaType::QString: {
|
||||
const QByteArray ba = data.toByteArray();
|
||||
QTextCodec *codec = QTextCodec::codecForName("utf-8");
|
||||
if (format == QLatin1String("text/html"))
|
||||
@ -162,17 +162,17 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
return codec->toUnicode(ba);
|
||||
}
|
||||
#endif // textcodec
|
||||
case QVariant::Color: {
|
||||
case QMetaType::QColor: {
|
||||
QVariant newData = data;
|
||||
newData.convert(QVariant::Color);
|
||||
newData.convert(QMetaType::QColor);
|
||||
return newData;
|
||||
}
|
||||
case QVariant::List: {
|
||||
case QMetaType::QVariantList: {
|
||||
if (format != QLatin1String("text/uri-list"))
|
||||
break;
|
||||
Q_FALLTHROUGH();
|
||||
}
|
||||
case QVariant::Url: {
|
||||
case QMetaType::QUrl: {
|
||||
QByteArray ba = data.toByteArray();
|
||||
// Qt 3.x will send text/uri-list with a trailing
|
||||
// null-terminator (that is *not* sent for any other
|
||||
@ -193,23 +193,23 @@ QVariant QMimeDataPrivate::retrieveTypedData(const QString &format, QVariant::Ty
|
||||
break;
|
||||
}
|
||||
|
||||
} else if (type == QVariant::ByteArray) {
|
||||
} else if (type == QMetaType::QByteArray) {
|
||||
|
||||
// try to convert to bytearray
|
||||
switch(data.type()) {
|
||||
case QVariant::ByteArray:
|
||||
case QVariant::Color:
|
||||
switch (data.userType()) {
|
||||
case QMetaType::QByteArray:
|
||||
case QMetaType::QColor:
|
||||
return data.toByteArray();
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return data.toString().toUtf8();
|
||||
case QVariant::Url:
|
||||
case QMetaType::QUrl:
|
||||
return data.toUrl().toEncoded();
|
||||
case QVariant::List: {
|
||||
case QMetaType::QVariantList: {
|
||||
// has to be list of URLs
|
||||
QByteArray result;
|
||||
QList<QVariant> list = data.toList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).type() == QVariant::Url) {
|
||||
if (list.at(i).userType() == QMetaType::QUrl) {
|
||||
result += list.at(i).toUrl().toEncoded();
|
||||
result += "\r\n";
|
||||
}
|
||||
@ -340,14 +340,14 @@ QMimeData::~QMimeData()
|
||||
QList<QUrl> QMimeData::urls() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant data = d->retrieveTypedData(textUriListLiteral(), QVariant::List);
|
||||
QVariant data = d->retrieveTypedData(textUriListLiteral(), QMetaType::QVariantList);
|
||||
QList<QUrl> urls;
|
||||
if (data.type() == QVariant::Url)
|
||||
if (data.userType() == QMetaType::QUrl)
|
||||
urls.append(data.toUrl());
|
||||
else if (data.type() == QVariant::List) {
|
||||
else if (data.userType() == QMetaType::QVariantList) {
|
||||
QList<QVariant> list = data.toList();
|
||||
for (int i = 0; i < list.size(); ++i) {
|
||||
if (list.at(i).type() == QVariant::Url)
|
||||
if (list.at(i).userType() == QMetaType::QUrl)
|
||||
urls.append(list.at(i).toUrl());
|
||||
}
|
||||
}
|
||||
@ -400,11 +400,11 @@ bool QMimeData::hasUrls() const
|
||||
QString QMimeData::text() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant utf8Text = d->retrieveTypedData(textPlainUtf8Literal(), QVariant::String);
|
||||
QVariant utf8Text = d->retrieveTypedData(textPlainUtf8Literal(), QMetaType::QString);
|
||||
if (!utf8Text.isNull())
|
||||
return utf8Text.toString();
|
||||
|
||||
QVariant data = d->retrieveTypedData(textPlainLiteral(), QVariant::String);
|
||||
QVariant data = d->retrieveTypedData(textPlainLiteral(), QMetaType::QString);
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
@ -440,7 +440,7 @@ bool QMimeData::hasText() const
|
||||
QString QMimeData::html() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant data = d->retrieveTypedData(textHtmlLiteral(), QVariant::String);
|
||||
QVariant data = d->retrieveTypedData(textHtmlLiteral(), QMetaType::QString);
|
||||
return data.toString();
|
||||
}
|
||||
|
||||
@ -482,7 +482,7 @@ bool QMimeData::hasHtml() const
|
||||
QVariant QMimeData::imageData() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
return d->retrieveTypedData(applicationXQtImageLiteral(), QVariant::Image);
|
||||
return d->retrieveTypedData(applicationXQtImageLiteral(), QMetaType::QImage);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -529,7 +529,7 @@ bool QMimeData::hasImage() const
|
||||
QVariant QMimeData::colorData() const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
return d->retrieveTypedData(applicationXColorLiteral(), QVariant::Color);
|
||||
return d->retrieveTypedData(applicationXColorLiteral(), QMetaType::QColor);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -564,7 +564,7 @@ bool QMimeData::hasColor() const
|
||||
QByteArray QMimeData::data(const QString &mimeType) const
|
||||
{
|
||||
Q_D(const QMimeData);
|
||||
QVariant data = d->retrieveTypedData(mimeType, QVariant::ByteArray);
|
||||
QVariant data = d->retrieveTypedData(mimeType, QMetaType::QByteArray);
|
||||
return data.toByteArray();
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -362,7 +362,7 @@ class QVariantConstructor
|
||||
FilteredConstructor(const QVariantConstructor &tc)
|
||||
{
|
||||
// ignore types that lives outside of the current library
|
||||
tc.m_x->type = QVariant::Invalid;
|
||||
tc.m_x->type = QMetaType::UnknownType;
|
||||
}
|
||||
};
|
||||
public:
|
||||
@ -430,7 +430,7 @@ public:
|
||||
{}
|
||||
~QVariantDestructor()
|
||||
{
|
||||
m_d->type = QVariant::Invalid;
|
||||
m_d->type = QMetaType::UnknownType;
|
||||
m_d->is_null = true;
|
||||
m_d->is_shared = false;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 Intel Corporation.
|
||||
** Copyright (C) 2020 Intel Corporation.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -637,9 +637,9 @@ static void appendVariant(QCborContainerPrivate *d, const QVariant &variant)
|
||||
// Handle strings and byte arrays directly, to avoid creating a temporary
|
||||
// dummy container to hold their data.
|
||||
int type = variant.userType();
|
||||
if (type == QVariant::String) {
|
||||
if (type == QMetaType::QString) {
|
||||
d->append(variant.toString());
|
||||
} else if (type == QVariant::ByteArray) {
|
||||
} else if (type == QMetaType::QByteArray) {
|
||||
QByteArray ba = variant.toByteArray();
|
||||
d->appendByteData(ba.constData(), ba.size(), QCborValue::ByteArray);
|
||||
} else {
|
||||
@ -698,48 +698,48 @@ static void appendVariant(QCborContainerPrivate *d, const QVariant &variant)
|
||||
QCborValue QCborValue::fromVariant(const QVariant &variant)
|
||||
{
|
||||
switch (variant.userType()) {
|
||||
case QVariant::Invalid:
|
||||
case QMetaType::UnknownType:
|
||||
return {};
|
||||
case QMetaType::Nullptr:
|
||||
return nullptr;
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return variant.toBool();
|
||||
case QMetaType::Short:
|
||||
case QMetaType::UShort:
|
||||
case QVariant::Int:
|
||||
case QVariant::LongLong:
|
||||
case QVariant::UInt:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::LongLong:
|
||||
case QMetaType::UInt:
|
||||
return variant.toLongLong();
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
if (variant.toULongLong() <= static_cast<uint64_t>(std::numeric_limits<qint64>::max()))
|
||||
return variant.toLongLong();
|
||||
Q_FALLTHROUGH();
|
||||
case QMetaType::Float:
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return variant.toDouble();
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return variant.toString();
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return QCborArray::fromStringList(variant.toStringList());
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
return variant.toByteArray();
|
||||
case QVariant::DateTime:
|
||||
case QMetaType::QDateTime:
|
||||
return QCborValue(variant.toDateTime());
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
case QVariant::Url:
|
||||
case QMetaType::QUrl:
|
||||
return QCborValue(variant.toUrl());
|
||||
#endif
|
||||
case QVariant::Uuid:
|
||||
case QMetaType::QUuid:
|
||||
return QCborValue(variant.toUuid());
|
||||
case QVariant::List:
|
||||
case QMetaType::QVariantList:
|
||||
return QCborArray::fromVariantList(variant.toList());
|
||||
case QVariant::Map:
|
||||
case QMetaType::QVariantMap:
|
||||
return QCborMap::fromVariantMap(variant.toMap());
|
||||
case QVariant::Hash:
|
||||
case QMetaType::QVariantHash:
|
||||
return QCborMap::fromVariantHash(variant.toHash());
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#if QT_CONFIG(regularexpression)
|
||||
case QVariant::RegularExpression:
|
||||
case QMetaType::QRegularExpression:
|
||||
return QCborValue(variant.toRegularExpression());
|
||||
#endif
|
||||
case QMetaType::QJsonValue:
|
||||
|
@ -405,17 +405,17 @@ QJsonDocument QJsonDocument::fromVariant(const QVariant &variant)
|
||||
{
|
||||
QJsonDocument doc;
|
||||
|
||||
switch (variant.type()) {
|
||||
case QVariant::Map:
|
||||
switch (variant.userType()) {
|
||||
case QMetaType::QVariantMap:
|
||||
doc.setObject(QJsonObject::fromVariantMap(variant.toMap()));
|
||||
break;
|
||||
case QVariant::Hash:
|
||||
case QMetaType::QVariantHash:
|
||||
doc.setObject(QJsonObject::fromVariantHash(variant.toHash()));
|
||||
break;
|
||||
case QVariant::List:
|
||||
case QMetaType::QVariantList:
|
||||
doc.setArray(QJsonArray::fromVariantList(variant.toList()));
|
||||
break;
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
doc.d = qt_make_unique<QJsonDocumentPrivate>();
|
||||
doc.d->value = QCborArray::fromStringList(variant.toStringList());
|
||||
break;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore module of the Qt Toolkit.
|
||||
@ -449,35 +449,35 @@ QJsonValue QJsonValue::fromVariant(const QVariant &variant)
|
||||
switch (variant.userType()) {
|
||||
case QMetaType::Nullptr:
|
||||
return QJsonValue(Null);
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return QJsonValue(variant.toBool());
|
||||
case QMetaType::Short:
|
||||
case QMetaType::UShort:
|
||||
case QVariant::Int:
|
||||
case QVariant::UInt:
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::Int:
|
||||
case QMetaType::UInt:
|
||||
case QMetaType::LongLong:
|
||||
return QJsonValue(variant.toLongLong());
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
if (variant.toULongLong() <= static_cast<uint64_t>(std::numeric_limits<qint64>::max()))
|
||||
return QJsonValue(variant.toLongLong());
|
||||
Q_FALLTHROUGH();
|
||||
case QMetaType::Float:
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return QJsonValue(variant.toDouble());
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return QJsonValue(variant.toString());
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return QJsonValue(QJsonArray::fromStringList(variant.toStringList()));
|
||||
case QVariant::List:
|
||||
case QMetaType::QVariantList:
|
||||
return QJsonValue(QJsonArray::fromVariantList(variant.toList()));
|
||||
case QVariant::Map:
|
||||
case QMetaType::QVariantMap:
|
||||
return QJsonValue(QJsonObject::fromVariantMap(variant.toMap()));
|
||||
case QVariant::Hash:
|
||||
case QMetaType::QVariantHash:
|
||||
return QJsonValue(QJsonObject::fromVariantHash(variant.toHash()));
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
case QVariant::Url:
|
||||
case QMetaType::QUrl:
|
||||
return QJsonValue(variant.toUrl().toString(QUrl::FullyEncoded));
|
||||
case QVariant::Uuid:
|
||||
case QMetaType::QUuid:
|
||||
return variant.toUuid().toString(QUuid::WithoutBraces);
|
||||
case QMetaType::QJsonValue:
|
||||
return variant.toJsonValue();
|
||||
|
@ -1681,7 +1681,7 @@ QString QTextStream::readLine(qint64 maxlen)
|
||||
\since 5.5
|
||||
|
||||
Reads one line of text from the stream into \a line.
|
||||
If \a line is 0, the read line is not stored.
|
||||
If \a line is \nullptr, the read line is not stored.
|
||||
|
||||
The maximum allowed line length is set to \a maxlen. If
|
||||
the stream contains lines longer than this, then the lines will be
|
||||
|
@ -2430,7 +2430,7 @@ QTime QLocale::toTime(const QString &string, const QString &format, QCalendar ca
|
||||
{
|
||||
QTime time;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QTime, QDateTimeParser::FromString, cal);
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, nullptr, &time);
|
||||
@ -2469,7 +2469,7 @@ QDate QLocale::toDate(const QString &string, const QString &format, QCalendar ca
|
||||
{
|
||||
QDate date;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDate, QDateTimeParser::FromString, cal);
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, &date, nullptr);
|
||||
@ -2510,7 +2510,7 @@ QDateTime QLocale::toDateTime(const QString &string, const QString &format, QCal
|
||||
QTime time;
|
||||
QDate date;
|
||||
|
||||
QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
||||
dt.setDefaultLocale(*this);
|
||||
if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
|
||||
return QDateTime(date, time);
|
||||
|
@ -234,16 +234,16 @@ QVariant QSystemLocale::query(QueryType type, QVariant in) const
|
||||
case CurrencySymbol:
|
||||
return lc_monetary.currencySymbol(QLocale::CurrencySymbolFormat(in.toUInt()));
|
||||
case CurrencyToString: {
|
||||
switch (in.type()) {
|
||||
case QVariant::Int:
|
||||
switch (in.userType()) {
|
||||
case QMetaType::Int:
|
||||
return lc_monetary.toCurrencyString(in.toInt());
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
return lc_monetary.toCurrencyString(in.toUInt());
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return lc_monetary.toCurrencyString(in.toDouble());
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
return lc_monetary.toCurrencyString(in.toLongLong());
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
return lc_monetary.toCurrencyString(in.toULongLong());
|
||||
default:
|
||||
break;
|
||||
|
@ -43,9 +43,9 @@
|
||||
#if QT_CONFIG(regularexpression)
|
||||
# include <qregularexpression.h>
|
||||
#endif
|
||||
#include <private/qduplicatetracker_p.h>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
/*! \typedef QStringListIterator
|
||||
@ -885,15 +885,13 @@ int QtPrivate::QStringList_removeDuplicates(QStringList *that)
|
||||
{
|
||||
int n = that->size();
|
||||
int j = 0;
|
||||
QSet<QString> seen;
|
||||
|
||||
QDuplicateTracker<QString> seen;
|
||||
seen.reserve(n);
|
||||
int setSize = 0;
|
||||
for (int i = 0; i < n; ++i) {
|
||||
const QString &s = that->at(i);
|
||||
seen.insert(s);
|
||||
if (setSize == seen.size()) // unchanged size => was already seen
|
||||
if (seen.hasSeen(s))
|
||||
continue;
|
||||
++setSize;
|
||||
if (j != i)
|
||||
that->swapItemsAt(i, j);
|
||||
++j;
|
||||
|
@ -487,7 +487,7 @@ QRecursiveMutex::~QRecursiveMutex()
|
||||
\fn QMutexLocker::QMutexLocker(QMutex *mutex)
|
||||
|
||||
Constructs a QMutexLocker and locks \a mutex. The mutex will be
|
||||
unlocked when the QMutexLocker is destroyed. If \a mutex is zero,
|
||||
unlocked when the QMutexLocker is destroyed. If \a mutex is \nullptr,
|
||||
QMutexLocker does nothing.
|
||||
|
||||
\sa QMutex::lock()
|
||||
|
@ -614,7 +614,7 @@ void QThread::run()
|
||||
priority.
|
||||
|
||||
The \a priority argument can be any value in the \c
|
||||
QThread::Priority enum except for \c InheritPriorty.
|
||||
QThread::Priority enum except for \c InheritPriority.
|
||||
|
||||
The effect of the \a priority parameter is dependent on the
|
||||
operating system's scheduling policy. In particular, the \a priority
|
||||
@ -626,6 +626,10 @@ void QThread::run()
|
||||
*/
|
||||
void QThread::setPriority(Priority priority)
|
||||
{
|
||||
if (priority == QThread::InheritPriority) {
|
||||
qWarning("QThread::setPriority: Argument cannot be InheritPriority");
|
||||
return;
|
||||
}
|
||||
Q_D(QThread);
|
||||
QMutexLocker locker(&d->mutex);
|
||||
if (!d->running) {
|
||||
|
@ -715,9 +715,7 @@ void QThreadPrivate::setPriority(QThread::Priority threadPriority)
|
||||
prio = THREAD_PRIORITY_TIME_CRITICAL;
|
||||
break;
|
||||
|
||||
case QThread::InheritPriority:
|
||||
default:
|
||||
qWarning("QThread::setPriority: Argument cannot be InheritPriority");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1791,7 +1791,7 @@ QDate QDate::fromString(const QString &string, const QString &format, QCalendar
|
||||
{
|
||||
QDate date;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Date, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDate, QDateTimeParser::FromString, cal);
|
||||
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, &date, nullptr);
|
||||
@ -2537,7 +2537,7 @@ QTime QTime::fromString(const QString &string, const QString &format)
|
||||
{
|
||||
QTime time;
|
||||
#if QT_CONFIG(datetimeparser)
|
||||
QDateTimeParser dt(QVariant::Time, QDateTimeParser::FromString, QCalendar());
|
||||
QDateTimeParser dt(QMetaType::QTime, QDateTimeParser::FromString, QCalendar());
|
||||
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
||||
if (dt.parseFormat(format))
|
||||
dt.fromString(string, nullptr, &time);
|
||||
@ -5482,7 +5482,7 @@ QDateTime QDateTime::fromString(const QString &string, const QString &format, QC
|
||||
QTime time;
|
||||
QDate date;
|
||||
|
||||
QDateTimeParser dt(QVariant::DateTime, QDateTimeParser::FromString, cal);
|
||||
QDateTimeParser dt(QMetaType::QDateTime, QDateTimeParser::FromString, cal);
|
||||
// dt.setDefaultLocale(QLocale::c()); ### Qt 6
|
||||
if (dt.parseFormat(format) && dt.fromString(string, &date, &time))
|
||||
return QDateTime(date, time);
|
||||
|
@ -425,7 +425,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
switch (sect) {
|
||||
case 'H':
|
||||
case 'h':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const Section hour = (sect == 'h') ? Hour12Section : Hour24Section;
|
||||
const SectionNode sn = { hour, i - add, countRepeat(newFormat, i, 2), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
@ -436,7 +436,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'm':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const SectionNode sn = { MinuteSection, i - add, countRepeat(newFormat, i, 2), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -446,7 +446,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 's':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const SectionNode sn = { SecondSection, i - add, countRepeat(newFormat, i, 2), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -457,7 +457,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
break;
|
||||
|
||||
case 'z':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const SectionNode sn = { MSecSection, i - add, countRepeat(newFormat, i, 3) < 3 ? 1 : 3, 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -468,7 +468,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
break;
|
||||
case 'A':
|
||||
case 'a':
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
const bool cap = (sect == 'A');
|
||||
const SectionNode sn = { AmPmSection, i - add, (cap ? 1 : 0), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
@ -482,7 +482,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'y':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const int repeat = countRepeat(newFormat, i, 4);
|
||||
if (repeat >= 2) {
|
||||
const SectionNode sn = { repeat == 4 ? YearSection : YearSection2Digits,
|
||||
@ -496,7 +496,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'M':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const SectionNode sn = { MonthSection, i - add, countRepeat(newFormat, i, 4), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
newSeparators.append(unquote(newFormat.midRef(index, i - index)));
|
||||
@ -506,7 +506,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 'd':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const int repeat = countRepeat(newFormat, i, 4);
|
||||
const Section sectionType = (repeat == 4 ? DayOfWeekSectionLong
|
||||
: (repeat == 3 ? DayOfWeekSectionShort : DaySection));
|
||||
@ -519,7 +519,7 @@ bool QDateTimeParser::parseFormat(const QString &newFormat)
|
||||
}
|
||||
break;
|
||||
case 't':
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
const SectionNode sn = { TimeZoneSection, i - add, countRepeat(newFormat, i, 4), 0 };
|
||||
newSectionNodes.append(sn);
|
||||
appendSeparator(&newSeparators, newFormat, index, i - index, lastQuote);
|
||||
@ -1252,7 +1252,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
||||
return StateNode();
|
||||
}
|
||||
|
||||
if (parserType != QVariant::Time) {
|
||||
if (parserType != QMetaType::QTime) {
|
||||
if (year % 100 != year2digits && (isSet & YearSection2Digits)) {
|
||||
if (!(isSet & YearSection)) {
|
||||
year = (year / 100) * 100;
|
||||
@ -1322,7 +1322,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
||||
}
|
||||
}
|
||||
|
||||
if (parserType != QVariant::Date) {
|
||||
if (parserType != QMetaType::QDate) {
|
||||
if (isSet & Hour12Section) {
|
||||
const bool hasHour = isSet & Hour24Section;
|
||||
if (ampm == -1) {
|
||||
@ -1360,7 +1360,7 @@ QDateTimeParser::scanString(const QDateTime &defaultValue,
|
||||
|
||||
// If hour wasn't specified, check the default we're using exists on the
|
||||
// given date (which might be a spring-forward, skipping an hour).
|
||||
if (parserType == QVariant::DateTime && !(isSet & HourSectionMask) && !when.isValid()) {
|
||||
if (parserType == QMetaType::QDateTime && !(isSet & HourSectionMask) && !when.isValid()) {
|
||||
qint64 msecs = when.toMSecsSinceEpoch();
|
||||
// Fortunately, that gets a useful answer, even though when is invalid ...
|
||||
const QDateTime replace =
|
||||
|
@ -82,7 +82,7 @@ public:
|
||||
FromString,
|
||||
DateTimeEdit
|
||||
};
|
||||
QDateTimeParser(QVariant::Type t, Context ctx, const QCalendar &cal = QCalendar())
|
||||
QDateTimeParser(QMetaType::Type t, Context ctx, const QCalendar &cal = QCalendar())
|
||||
: currentSectionIndex(-1), cachedDay(-1), parserType(t),
|
||||
fixday(false), spec(Qt::LocalTime), context(ctx), calendar(cal)
|
||||
{
|
||||
@ -295,7 +295,7 @@ protected: // for the benefit of QDateTimeEditPrivate
|
||||
QStringList separators;
|
||||
QString displayFormat;
|
||||
QLocale defaultLocale;
|
||||
QVariant::Type parserType;
|
||||
QMetaType::Type parserType;
|
||||
bool fixday;
|
||||
Qt::TimeSpec spec; // spec if used by QDateTimeEdit
|
||||
Context context;
|
||||
|
94
src/corelib/tools/qduplicatetracker_p.h
Normal file
94
src/corelib/tools/qduplicatetracker_p.h
Normal file
@ -0,0 +1,94 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2020 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com, author Marc Mutz <marc.mutz@kdab.com>
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtCore 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 QDUPLICATETRACKER_P_H
|
||||
#define QDUPLICATETRACKER_P_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <qglobal.h>
|
||||
|
||||
#if QT_HAS_INCLUDE(<memory_resource>) && __cplusplus > 201402L
|
||||
# include <unordered_set>
|
||||
# include <memory_resource>
|
||||
#else
|
||||
# include <qset.h>
|
||||
#endif
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
template <typename T, size_t Prealloc = 32>
|
||||
class QDuplicateTracker {
|
||||
#ifdef __cpp_lib_memory_resource
|
||||
char buffer[Prealloc * sizeof(T)];
|
||||
std::pmr::monotonic_buffer_resource res{buffer, sizeof buffer};
|
||||
std::pmr::unordered_set<T> set{&res};
|
||||
#else
|
||||
QSet<T> set;
|
||||
int setSize = 0;
|
||||
#endif
|
||||
Q_DISABLE_COPY_MOVE(QDuplicateTracker);
|
||||
public:
|
||||
QDuplicateTracker() = default;
|
||||
void reserve(int n) { set.reserve(n); }
|
||||
Q_REQUIRED_RESULT bool hasSeen(const T &s)
|
||||
{
|
||||
bool inserted;
|
||||
#ifdef __cpp_lib_memory_resource
|
||||
inserted = set.insert(s).second;
|
||||
#else
|
||||
set.insert(s);
|
||||
const int n = set.size();
|
||||
inserted = qExchange(setSize, n) != n;
|
||||
#endif
|
||||
return !inserted;
|
||||
}
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif /* QDUPLICATETRACKER_P_H */
|
@ -2128,4 +2128,11 @@ void QMapDataBase::freeData(QMapDataBase *d)
|
||||
once in the returned list.
|
||||
*/
|
||||
|
||||
/*! \fn template <class Key, class T> QMultiMap<Key, T> &QMultiMap<Key, T>::unite(const QMultiMap<Key, T> &other)
|
||||
|
||||
Inserts all the items in the \a other map into this map. If a
|
||||
key is common to both maps, the resulting map will contain the
|
||||
key multiple times.
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -12,6 +12,7 @@ HEADERS += \
|
||||
tools/qcontainerfwd.h \
|
||||
tools/qcontainertools_impl.h \
|
||||
tools/qcryptographichash.h \
|
||||
tools/qduplicatetracker_p.h \
|
||||
tools/qflatmap_p.h \
|
||||
tools/qfreelist_p.h \
|
||||
tools/qhash.h \
|
||||
|
@ -31,3 +31,14 @@ endif()
|
||||
|
||||
set(Qt5DBus_QDBUSCPP2XML_EXECUTABLE Qt5::qdbuscpp2xml)
|
||||
set(Qt5DBus_QDBUSXML2CPP_EXECUTABLE Qt5::qdbusxml2cpp)
|
||||
|
||||
# Create versionless tool targets.
|
||||
foreach(__qt_tool qdbuscpp2xml qdbusxml2cpp)
|
||||
if(NOT \"${QT_NO_CREATE_VERSIONLESS_TARGETS}\" AND NOT TARGET Qt::${__qt_tool}
|
||||
AND TARGET Qt5::${__qt_tool})
|
||||
add_executable(Qt::${__qt_tool} IMPORTED)
|
||||
get_target_property(__qt_imported_location Qt5::${__qt_tool} IMPORTED_LOCATION)
|
||||
set_target_properties(Qt::${__qt_tool}
|
||||
PROPERTIES IMPORTED_LOCATION \"${__qt_imported_location}\")
|
||||
endif()
|
||||
endforeach()
|
||||
|
@ -70,6 +70,17 @@ function(qt5_add_dbus_interface _sources _interface _basename)
|
||||
set(${_sources} ${${_sources}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_add_dbus_interface sources)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_add_dbus_interface("${sources}" ${ARGN})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_add_dbus_interface("${sources}" ${ARGN})
|
||||
endif()
|
||||
set("${sources}" "${${sources}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
function(qt5_add_dbus_interfaces _sources)
|
||||
foreach(_current_FILE ${ARGN})
|
||||
@ -83,6 +94,17 @@ function(qt5_add_dbus_interfaces _sources)
|
||||
set(${_sources} ${${_sources}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_add_dbus_interfaces sources)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_add_dbus_interfaces("${sources}" ${ARGN})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_add_dbus_interfaces("${sources}" ${ARGN})
|
||||
endif()
|
||||
set("${sources}" "${${sources}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
function(qt5_generate_dbus_interface _header) # _customName OPTIONS -some -options )
|
||||
set(options)
|
||||
@ -116,6 +138,16 @@ function(qt5_generate_dbus_interface _header) # _customName OPTIONS -some -optio
|
||||
)
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_generate_dbus_interface)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_generate_dbus_interface(${ARGV})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_generate_dbus_interface(${ARGV})
|
||||
endif()
|
||||
endfunction()
|
||||
endif()
|
||||
|
||||
|
||||
function(qt5_add_dbus_adaptor _sources _xml_file _include _parentClass) # _optionalBasename _optionalClassName)
|
||||
get_filename_component(_infile ${_xml_file} ABSOLUTE)
|
||||
@ -152,3 +184,14 @@ function(qt5_add_dbus_adaptor _sources _xml_file _include _parentClass) # _optio
|
||||
list(APPEND ${_sources} "${_impl}" "${_header}" "${_moc}")
|
||||
set(${_sources} ${${_sources}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if(NOT QT_NO_CREATE_VERSIONLESS_FUNCTIONS)
|
||||
function(qt_add_dbus_adaptor sources)
|
||||
if(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
|
||||
qt5_add_dbus_adaptor("${sources}" ${ARGN})
|
||||
elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
|
||||
qt6_add_dbus_adaptor("${sources}" ${ARGN})
|
||||
endif()
|
||||
set("${sources}" "${${sources}}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
endif()
|
||||
|
@ -157,7 +157,7 @@ bool QDBusAbstractInterfacePrivate::property(const QMetaProperty &mp, void *retu
|
||||
const int type = mp.userType();
|
||||
// is this metatype registered?
|
||||
const char *expectedSignature = "";
|
||||
if (int(mp.type()) != QMetaType::QVariant) {
|
||||
if (int(mp.userType()) != QMetaType::QVariant) {
|
||||
expectedSignature = QDBusMetaType::typeToSignature(type);
|
||||
if (expectedSignature == nullptr) {
|
||||
qWarning("QDBusAbstractInterface: type %s must be registered with Qt D-Bus before it can be "
|
||||
|
@ -330,7 +330,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QMap<Key, T> &m
|
||||
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantMap &map)
|
||||
{
|
||||
arg.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>());
|
||||
arg.beginMap(QMetaType::QString, qMetaTypeId<QDBusVariant>());
|
||||
QVariantMap::ConstIterator it = map.constBegin();
|
||||
QVariantMap::ConstIterator end = map.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
@ -379,7 +379,7 @@ inline const QDBusArgument &operator>>(const QDBusArgument &arg, QHash<Key, T> &
|
||||
|
||||
inline QDBusArgument &operator<<(QDBusArgument &arg, const QVariantHash &map)
|
||||
{
|
||||
arg.beginMap(QVariant::String, qMetaTypeId<QDBusVariant>());
|
||||
arg.beginMap(QMetaType::QString, qMetaTypeId<QDBusVariant>());
|
||||
QVariantHash::ConstIterator it = map.constBegin();
|
||||
QVariantHash::ConstIterator end = map.constEnd();
|
||||
for ( ; it != end; ++it) {
|
||||
|
@ -1822,7 +1822,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
|
||||
hook.service = QDBusUtil::dbusService();
|
||||
hook.path.clear(); // no matching
|
||||
hook.obj = this;
|
||||
hook.params << QMetaType::Void << QVariant::String; // both functions take a QString as parameter and return void
|
||||
hook.params << QMetaType::Void << QMetaType::QString; // both functions take a QString as parameter and return void
|
||||
|
||||
hook.midx = staticMetaObject.indexOfSlot("registerServiceNoLock(QString)");
|
||||
Q_ASSERT(hook.midx != -1);
|
||||
@ -1836,7 +1836,7 @@ void QDBusConnectionPrivate::setConnection(DBusConnection *dbc, const QDBusError
|
||||
// we don't use connectSignal here because the rules are added by connectSignal on a per-need basis
|
||||
hook.params.clear();
|
||||
hook.params.reserve(4);
|
||||
hook.params << QMetaType::Void << QVariant::String << QVariant::String << QVariant::String;
|
||||
hook.params << QMetaType::Void << QMetaType::QString << QMetaType::QString << QMetaType::QString;
|
||||
hook.midx = staticMetaObject.indexOfSlot("serviceOwnerChangedNoLock(QString,QString,QString)");
|
||||
Q_ASSERT(hook.midx != -1);
|
||||
signalHooks.insert(QLatin1String("NameOwnerChanged:" DBUS_INTERFACE_DBUS), hook);
|
||||
|
@ -55,7 +55,7 @@ static void copyArgument(void *to, int id, const QVariant &arg)
|
||||
{
|
||||
if (id == arg.userType()) {
|
||||
switch (id) {
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
*reinterpret_cast<bool *>(to) = arg.toBool();
|
||||
return;
|
||||
|
||||
@ -71,35 +71,35 @@ static void copyArgument(void *to, int id, const QVariant &arg)
|
||||
*reinterpret_cast<ushort *>(to) = qvariant_cast<ushort>(arg);
|
||||
return;
|
||||
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
*reinterpret_cast<int *>(to) = arg.toInt();
|
||||
return;
|
||||
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
*reinterpret_cast<uint *>(to) = arg.toUInt();
|
||||
return;
|
||||
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
*reinterpret_cast<qlonglong *>(to) = arg.toLongLong();
|
||||
return;
|
||||
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
*reinterpret_cast<qulonglong *>(to) = arg.toULongLong();
|
||||
return;
|
||||
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
*reinterpret_cast<double *>(to) = arg.toDouble();
|
||||
return;
|
||||
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
*reinterpret_cast<QString *>(to) = arg.toString();
|
||||
return;
|
||||
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
*reinterpret_cast<QByteArray *>(to) = arg.toByteArray();
|
||||
return;
|
||||
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
*reinterpret_cast<QStringList *>(to) = arg.toStringList();
|
||||
return;
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ inline bool QDBusMarshaller::append(const QDBusVariant &arg)
|
||||
|
||||
const QVariant &value = arg.variant();
|
||||
int id = value.userType();
|
||||
if (id == QVariant::Invalid) {
|
||||
if (id == QMetaType::UnknownType) {
|
||||
qWarning("QDBusMarshaller: cannot add a null QDBusVariant");
|
||||
error(QLatin1String("Variant containing QVariant::Invalid passed in arguments"));
|
||||
return false;
|
||||
@ -384,7 +384,7 @@ void QDBusMarshaller::error(const QString &msg)
|
||||
bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
|
||||
{
|
||||
int id = arg.userType();
|
||||
if (id == QVariant::Invalid) {
|
||||
if (id == QMetaType::UnknownType) {
|
||||
qWarning("QDBusMarshaller: cannot add an invalid QVariant");
|
||||
error(QLatin1String("Variant containing QVariant::Invalid passed in arguments"));
|
||||
return false;
|
||||
@ -485,12 +485,12 @@ bool QDBusMarshaller::appendVariantInternal(const QVariant &arg)
|
||||
case DBUS_TYPE_ARRAY:
|
||||
// could be many things
|
||||
// find out what kind of array it is
|
||||
switch (arg.type()) {
|
||||
case QVariant::StringList:
|
||||
switch (arg.userType()) {
|
||||
case QMetaType::QStringList:
|
||||
append( arg.toStringList() );
|
||||
return true;
|
||||
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
append( arg.toByteArray() );
|
||||
return true;
|
||||
|
||||
|
@ -276,7 +276,7 @@ QDBusMessage QDBusMessagePrivate::makeLocal(const QDBusConnectionPrivate &conn,
|
||||
for ( ; it != end; ++it) {
|
||||
int id = it->userType();
|
||||
const char *signature = QDBusMetaType::typeToSignature(id);
|
||||
if ((id != QVariant::StringList && id != QVariant::ByteArray &&
|
||||
if ((id != QMetaType::QStringList && id != QMetaType::QByteArray &&
|
||||
qstrlen(signature) != 1) || id == qMetaTypeId<QDBusVariant>()) {
|
||||
// yes, we are
|
||||
// we must marshall and demarshall again so as to create QDBusArgument
|
||||
|
@ -158,10 +158,10 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
|
||||
const char *direction, int id)
|
||||
{
|
||||
Type result;
|
||||
result.id = QVariant::Invalid;
|
||||
result.id = QMetaType::UnknownType;
|
||||
|
||||
int type = QDBusMetaType::signatureToType(signature);
|
||||
if (type == QVariant::Invalid && !qt_dbus_metaobject_skip_annotations) {
|
||||
if (type == QMetaType::UnknownType && !qt_dbus_metaobject_skip_annotations) {
|
||||
// it's not a type normally handled by our meta type system
|
||||
// it must contain an annotation
|
||||
QString annotationName = QString::fromLatin1("org.qtproject.QtDBus.QtTypeName");
|
||||
@ -189,7 +189,7 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
|
||||
type = QMetaType::type(typeName);
|
||||
}
|
||||
|
||||
if (type == QVariant::Invalid || signature != QDBusMetaType::typeToSignature(type)) {
|
||||
if (type == QMetaType::UnknownType || signature != QDBusMetaType::typeToSignature(type)) {
|
||||
// type is still unknown or doesn't match back to the signature that it
|
||||
// was expected to, so synthesize a fake type
|
||||
typeName = "QDBusRawType<0x" + signature.toHex() + ">*";
|
||||
@ -197,16 +197,16 @@ QDBusMetaObjectGenerator::findType(const QByteArray &signature,
|
||||
}
|
||||
|
||||
result.name = typeName;
|
||||
} else if (type == QVariant::Invalid) {
|
||||
} else if (type == QMetaType::UnknownType) {
|
||||
// this case is used only by the qdbus command-line tool
|
||||
// invalid, let's create an impossible type that contains the signature
|
||||
|
||||
if (signature == "av") {
|
||||
result.name = "QVariantList";
|
||||
type = QVariant::List;
|
||||
type = QMetaType::QVariantList;
|
||||
} else if (signature == "a{sv}") {
|
||||
result.name = "QVariantMap";
|
||||
type = QVariant::Map;
|
||||
type = QMetaType::QVariantMap;
|
||||
} else if (signature == "a{ss}") {
|
||||
result.name = "QMap<QString,QString>";
|
||||
type = qMetaTypeId<QMap<QString, QString> >();
|
||||
@ -246,7 +246,7 @@ void QDBusMetaObjectGenerator::parseMethods()
|
||||
const QDBusIntrospection::Argument &arg = m.inputArgs.at(i);
|
||||
|
||||
Type type = findType(arg.type.toLatin1(), m.annotations, "In", i);
|
||||
if (type.id == QVariant::Invalid) {
|
||||
if (type.id == QMetaType::UnknownType) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -265,7 +265,7 @@ void QDBusMetaObjectGenerator::parseMethods()
|
||||
const QDBusIntrospection::Argument &arg = m.outputArgs.at(i);
|
||||
|
||||
Type type = findType(arg.type.toLatin1(), m.annotations, "Out", i);
|
||||
if (type.id == QVariant::Invalid) {
|
||||
if (type.id == QMetaType::UnknownType) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -322,7 +322,7 @@ void QDBusMetaObjectGenerator::parseSignals()
|
||||
const QDBusIntrospection::Argument &arg = s.outputArgs.at(i);
|
||||
|
||||
Type type = findType(arg.type.toLatin1(), s.annotations, "Out", i);
|
||||
if (type.id == QVariant::Invalid) {
|
||||
if (type.id == QMetaType::UnknownType) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
@ -358,7 +358,7 @@ void QDBusMetaObjectGenerator::parseProperties()
|
||||
const QDBusIntrospection::Property &p = *prop_it;
|
||||
Property mp;
|
||||
Type type = findType(p.type.toLatin1(), p.annotations);
|
||||
if (type.id == QVariant::Invalid)
|
||||
if (type.id == QMetaType::UnknownType)
|
||||
continue;
|
||||
|
||||
QByteArray name = p.name.toLatin1();
|
||||
|
@ -325,7 +325,7 @@ int QDBusMetaType::signatureToType(const char *signature)
|
||||
switch (signature[0])
|
||||
{
|
||||
case DBUS_TYPE_BOOLEAN:
|
||||
return QVariant::Bool;
|
||||
return QMetaType::Bool;
|
||||
|
||||
case DBUS_TYPE_BYTE:
|
||||
return QMetaType::UChar;
|
||||
@ -337,22 +337,22 @@ int QDBusMetaType::signatureToType(const char *signature)
|
||||
return QMetaType::UShort;
|
||||
|
||||
case DBUS_TYPE_INT32:
|
||||
return QVariant::Int;
|
||||
return QMetaType::Int;
|
||||
|
||||
case DBUS_TYPE_UINT32:
|
||||
return QVariant::UInt;
|
||||
return QMetaType::UInt;
|
||||
|
||||
case DBUS_TYPE_INT64:
|
||||
return QVariant::LongLong;
|
||||
return QMetaType::LongLong;
|
||||
|
||||
case DBUS_TYPE_UINT64:
|
||||
return QVariant::ULongLong;
|
||||
return QMetaType::ULongLong;
|
||||
|
||||
case DBUS_TYPE_DOUBLE:
|
||||
return QVariant::Double;
|
||||
return QMetaType::Double;
|
||||
|
||||
case DBUS_TYPE_STRING:
|
||||
return QVariant::String;
|
||||
return QMetaType::QString;
|
||||
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
return QDBusMetaTypeId::objectpath();
|
||||
@ -369,13 +369,13 @@ int QDBusMetaType::signatureToType(const char *signature)
|
||||
case DBUS_TYPE_ARRAY: // special case
|
||||
switch (signature[1]) {
|
||||
case DBUS_TYPE_BYTE:
|
||||
return QVariant::ByteArray;
|
||||
return QMetaType::QByteArray;
|
||||
|
||||
case DBUS_TYPE_STRING:
|
||||
return QVariant::StringList;
|
||||
return QMetaType::QStringList;
|
||||
|
||||
case DBUS_TYPE_VARIANT:
|
||||
return QVariant::List;
|
||||
return QMetaType::QVariantList;
|
||||
|
||||
case DBUS_TYPE_OBJECT_PATH:
|
||||
return qMetaTypeId<QList<QDBusObjectPath> >();
|
||||
@ -409,7 +409,7 @@ const char *QDBusMetaType::typeToSignature(int type)
|
||||
case QMetaType::UChar:
|
||||
return DBUS_TYPE_BYTE_AS_STRING;
|
||||
|
||||
case QVariant::Bool:
|
||||
case QMetaType::Bool:
|
||||
return DBUS_TYPE_BOOLEAN_AS_STRING;
|
||||
|
||||
case QMetaType::Short:
|
||||
@ -418,29 +418,29 @@ const char *QDBusMetaType::typeToSignature(int type)
|
||||
case QMetaType::UShort:
|
||||
return DBUS_TYPE_UINT16_AS_STRING;
|
||||
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
return DBUS_TYPE_INT32_AS_STRING;
|
||||
|
||||
case QVariant::UInt:
|
||||
case QMetaType::UInt:
|
||||
return DBUS_TYPE_UINT32_AS_STRING;
|
||||
|
||||
case QVariant::LongLong:
|
||||
case QMetaType::LongLong:
|
||||
return DBUS_TYPE_INT64_AS_STRING;
|
||||
|
||||
case QVariant::ULongLong:
|
||||
case QMetaType::ULongLong:
|
||||
return DBUS_TYPE_UINT64_AS_STRING;
|
||||
|
||||
case QVariant::Double:
|
||||
case QMetaType::Double:
|
||||
return DBUS_TYPE_DOUBLE_AS_STRING;
|
||||
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
return DBUS_TYPE_STRING_AS_STRING;
|
||||
|
||||
case QVariant::StringList:
|
||||
case QMetaType::QStringList:
|
||||
return DBUS_TYPE_ARRAY_AS_STRING
|
||||
DBUS_TYPE_STRING_AS_STRING; // as
|
||||
|
||||
case QVariant::ByteArray:
|
||||
case QMetaType::QByteArray:
|
||||
return DBUS_TYPE_ARRAY_AS_STRING
|
||||
DBUS_TYPE_BYTE_AS_STRING; // ay
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
{
|
||||
int argType = arg.userType();
|
||||
|
||||
if (argType == QVariant::StringList) {
|
||||
if (argType == QMetaType::QStringList) {
|
||||
out += QLatin1Char('{');
|
||||
const QStringList list = arg.toStringList();
|
||||
for (const QString &item : list)
|
||||
@ -90,7 +90,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
if (!list.isEmpty())
|
||||
out.chop(2);
|
||||
out += QLatin1Char('}');
|
||||
} else if (argType == QVariant::ByteArray) {
|
||||
} else if (argType == QMetaType::QByteArray) {
|
||||
out += QLatin1Char('{');
|
||||
QByteArray list = arg.toByteArray();
|
||||
for (int i = 0; i < list.count(); ++i) {
|
||||
@ -100,7 +100,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
if (!list.isEmpty())
|
||||
out.chop(2);
|
||||
out += QLatin1Char('}');
|
||||
} else if (argType == QVariant::List) {
|
||||
} else if (argType == QMetaType::QVariantList) {
|
||||
out += QLatin1Char('{');
|
||||
const QList<QVariant> list = arg.toList();
|
||||
for (const QVariant &item : list) {
|
||||
@ -148,7 +148,7 @@ static bool variantToString(const QVariant &arg, QString &out)
|
||||
if (!variantToString(v, out))
|
||||
return false;
|
||||
out += QLatin1Char(']');
|
||||
} else if (arg.canConvert(QVariant::String)) {
|
||||
} else if (arg.canConvert(QMetaType::QString)) {
|
||||
out += QLatin1Char('\"') + arg.toString() + QLatin1Char('\"');
|
||||
} else {
|
||||
out += QLatin1Char('[');
|
||||
|
@ -113,7 +113,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
QLatin1String(signature),
|
||||
accessAsString(mp.isReadable(), mp.isWritable()));
|
||||
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) {
|
||||
const char *typeName = QMetaType::typeName(typeId);
|
||||
retval += QLatin1String(">\n <annotation name=\"org.qtproject.QtDBus.QtTypeName\" value=\"%3\"/>\n </property>\n")
|
||||
.arg(typeNameToXml(typeName));
|
||||
@ -161,7 +161,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
.arg(typeNameToXml(typeName));
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(typeName) == QVariant::Invalid)
|
||||
if (QDBusMetaType::signatureToType(typeName) == QMetaType::UnknownType)
|
||||
xml += QLatin1String(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.Out0\" value=\"%1\"/>\n")
|
||||
.arg(typeNameToXml(QMetaType::typeName(typeId)));
|
||||
} else {
|
||||
@ -208,7 +208,7 @@ static QString generateInterfaceXml(const QMetaObject *mo, int flags, int method
|
||||
qUtf16Printable(name), signature, isOutput ? "out" : "in");
|
||||
|
||||
// do we need to describe this argument?
|
||||
if (QDBusMetaType::signatureToType(signature) == QVariant::Invalid) {
|
||||
if (QDBusMetaType::signatureToType(signature) == QMetaType::UnknownType) {
|
||||
const char *typeName = QMetaType::typeName(types.at(j));
|
||||
xml += QString::fromLatin1(" <annotation name=\"org.qtproject.QtDBus.QtTypeName.%1%2\" value=\"%3\"/>\n")
|
||||
.arg(isOutput ? QLatin1String("Out") : QLatin1String("In"))
|
||||
|
@ -2029,7 +2029,7 @@ QAccessibleTextInterface::~QAccessibleTextInterface()
|
||||
\fn void QAccessibleTextInterface::selection(int selectionIndex, int *startOffset, int *endOffset) const
|
||||
|
||||
Returns a selection. The size of the selection is returned in \a startOffset and \a endOffset.
|
||||
If there is no selection both \a startOffset and \a endOffset are 0.
|
||||
If there is no selection both \a startOffset and \a endOffset are \nullptr.
|
||||
|
||||
The accessibility APIs support multiple selections. For most widgets though, only one selection
|
||||
is supported with \a selectionIndex equal to 0.
|
||||
|
@ -91,7 +91,7 @@ int main(int argc, char *argv[])
|
||||
//! [3]
|
||||
QSize MyWidget::sizeHint() const
|
||||
{
|
||||
return QSize(80, 25).expandedTo(QApplication::globalStrut());
|
||||
return QSize(80, 25);
|
||||
}
|
||||
//! [3]
|
||||
|
||||
|
@ -62,7 +62,7 @@
|
||||
\include module-use.qdocinc using qt module
|
||||
\quotefile overview/using-qt-gui.cmake
|
||||
|
||||
See also the \l[QtDoc]{Build with CMake} overview.
|
||||
See also the \l{Build with CMake} overview.
|
||||
|
||||
\section2 Building with qmake
|
||||
|
||||
|
@ -218,7 +218,7 @@ QBitmap::~QBitmap()
|
||||
*/
|
||||
QBitmap::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Bitmap, this);
|
||||
return QVariant(QMetaType::QBitmap, this);
|
||||
}
|
||||
|
||||
static QBitmap makeBitmap(QImage &&image, Qt::ImageConversionFlags flags)
|
||||
|
@ -782,7 +782,7 @@ QIcon &QIcon::operator=(const QIcon &other)
|
||||
*/
|
||||
QIcon::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Icon, this);
|
||||
return QVariant(QMetaType::QIcon, this);
|
||||
}
|
||||
|
||||
/*! \fn int QIcon::serialNumber() const
|
||||
|
@ -1067,7 +1067,7 @@ int QImage::devType() const
|
||||
*/
|
||||
QImage::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Image, this);
|
||||
return QVariant(QMetaType::QImage, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -3649,8 +3649,8 @@ QImage QImage::fromData(const uchar *data, int size, const char *format)
|
||||
/*!
|
||||
Saves the image to the file with the given \a fileName, using the
|
||||
given image file \a format and \a quality factor. If \a format is
|
||||
0, QImage will attempt to guess the format by looking at \a fileName's
|
||||
suffix.
|
||||
\nullptr, QImage will attempt to guess the format by looking at
|
||||
\a fileName's suffix.
|
||||
|
||||
The \a quality factor must be in the range 0 to 100 or -1. Specify
|
||||
0 to obtain small compressed files, 100 for large uncompressed
|
||||
|
@ -402,7 +402,7 @@ QPixmap &QPixmap::operator=(const QPixmap &pixmap)
|
||||
*/
|
||||
QPixmap::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Pixmap, this);
|
||||
return QVariant(QMetaType::QPixmap, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -813,8 +813,8 @@ bool QPixmap::loadFromData(const uchar *buf, uint len, const char *format, Qt::I
|
||||
0 to obtain small compressed files, 100 for large uncompressed
|
||||
files, and -1 to use the default settings.
|
||||
|
||||
If \a format is 0, an image format will be chosen from \a fileName's
|
||||
suffix.
|
||||
If \a format is \nullptr, an image format will be chosen from
|
||||
\a fileName's suffix.
|
||||
|
||||
\sa {QPixmap#Reading and Writing Image Files}{Reading and Writing
|
||||
Image Files}
|
||||
|
@ -926,7 +926,7 @@ void QStandardItem::setData(const QVariant &value, int role)
|
||||
for (it = d->values.begin(); it != d->values.end(); ++it) {
|
||||
if ((*it).role == role) {
|
||||
if (value.isValid()) {
|
||||
if ((*it).value.type() == value.type() && (*it).value == value)
|
||||
if ((*it).value.userType() == value.userType() && (*it).value == value)
|
||||
return;
|
||||
(*it).value = value;
|
||||
} else {
|
||||
|
@ -325,7 +325,7 @@ QDataStream &operator<<(QDataStream &s, const QCursor &c)
|
||||
if (isPixmap)
|
||||
s << c.pixmap();
|
||||
else
|
||||
s << *c.bitmap() << *c.mask();
|
||||
s << c.bitmap(Qt::ReturnByValue) << c.mask(Qt::ReturnByValue);
|
||||
s << c.hotSpot();
|
||||
}
|
||||
return s;
|
||||
@ -565,7 +565,12 @@ void QCursor::setShape(Qt::CursorShape shape)
|
||||
}
|
||||
}
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
/*!
|
||||
\deprecated
|
||||
|
||||
New code should use the other overload which returns QBitmap by-value.
|
||||
|
||||
Returns the cursor bitmap, or \nullptr if it is one of the
|
||||
standard cursors.
|
||||
*/
|
||||
@ -577,6 +582,10 @@ const QBitmap *QCursor::bitmap() const
|
||||
}
|
||||
|
||||
/*!
|
||||
\deprecated
|
||||
|
||||
New code should use the other overload which returns QBitmap by-value.
|
||||
|
||||
Returns the cursor bitmap mask, or \nullptr if it is one of the
|
||||
standard cursors.
|
||||
*/
|
||||
@ -587,6 +596,71 @@ const QBitmap *QCursor::mask() const
|
||||
QCursorData::initialize();
|
||||
return d->bmm;
|
||||
}
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the cursor bitmap, or a null bitmap if it is one of the
|
||||
standard cursors.
|
||||
|
||||
Previously, Qt provided a version of \c bitmap() which returned the bitmap
|
||||
by-pointer. That version is now deprecated. To maintain compatibility
|
||||
with old code, you can explicitly differentiate between the by-pointer
|
||||
function and the by-value function:
|
||||
|
||||
\code
|
||||
const QBitmap *bmpPtr = cursor->bitmap();
|
||||
QBitmap bmpVal = cursor->bitmap(Qt::ReturnByValue);
|
||||
\endcode
|
||||
|
||||
If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE
|
||||
macro, then you can omit \c Qt::ReturnByValue as shown below:
|
||||
|
||||
\code
|
||||
QBitmap bmpVal = cursor->bitmap();
|
||||
\endcode
|
||||
*/
|
||||
QBitmap QCursor::bitmap(Qt::ReturnByValue_t) const
|
||||
{
|
||||
if (!QCursorData::initialized)
|
||||
QCursorData::initialize();
|
||||
if (d->bm)
|
||||
return *(d->bm);
|
||||
return QBitmap();
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.15
|
||||
|
||||
Returns the cursor bitmap mask, or a null bitmap if it is one of the
|
||||
standard cursors.
|
||||
|
||||
Previously, Qt provided a version of \c mask() which returned the bitmap
|
||||
by-pointer. That version is now deprecated. To maintain compatibility
|
||||
with old code, you can explicitly differentiate between the by-pointer
|
||||
function and the by-value function:
|
||||
|
||||
\code
|
||||
const QBitmap *bmpPtr = cursor->mask();
|
||||
QBitmap bmpVal = cursor->mask(Qt::ReturnByValue);
|
||||
\endcode
|
||||
|
||||
If you disable the deprecated version using the QT_DISABLE_DEPRECATED_BEFORE
|
||||
macro, then you can omit \c Qt::ReturnByValue as shown below:
|
||||
|
||||
\code
|
||||
QBitmap bmpVal = cursor->mask();
|
||||
\endcode
|
||||
*/
|
||||
QBitmap QCursor::mask(Qt::ReturnByValue_t) const
|
||||
{
|
||||
if (!QCursorData::initialized)
|
||||
QCursorData::initialize();
|
||||
if (d->bmm)
|
||||
return *(d->bmm);
|
||||
return QBitmap();
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the cursor pixmap. This is only valid if the cursor is a
|
||||
@ -657,7 +731,7 @@ QCursor &QCursor::operator=(const QCursor &c)
|
||||
*/
|
||||
QCursor::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Cursor, this);
|
||||
return QVariant(QMetaType::QCursor, this);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_DEBUG_STREAM
|
||||
|
@ -97,8 +97,19 @@ public:
|
||||
Qt::CursorShape shape() const;
|
||||
void setShape(Qt::CursorShape newShape);
|
||||
|
||||
const QBitmap *bitmap() const;
|
||||
const QBitmap *mask() const;
|
||||
#if QT_DEPRECATED_SINCE(5, 15)
|
||||
QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value")
|
||||
const QBitmap *bitmap() const; // ### Qt 7: Remove function
|
||||
|
||||
QT_DEPRECATED_VERSION_X(5, 15, "Use the other overload which returns QBitmap by-value")
|
||||
const QBitmap *mask() const; // ### Qt 7: Remove function
|
||||
|
||||
QBitmap bitmap(Qt::ReturnByValue_t) const;
|
||||
QBitmap mask(Qt::ReturnByValue_t) const;
|
||||
#else
|
||||
QBitmap bitmap(Qt::ReturnByValue_t = Qt::ReturnByValue) const; // ### Qt 7: Remove arg
|
||||
QBitmap mask(Qt::ReturnByValue_t = Qt::ReturnByValue) const; // ### Qt 7: Remove arg
|
||||
#endif // QT_DEPRECATED_SINCE(5, 15)
|
||||
QPixmap pixmap() const;
|
||||
QPoint hotSpot() const;
|
||||
|
||||
|
@ -946,7 +946,7 @@ QWheelEvent::~QWheelEvent()
|
||||
\li or scrolling has ended and the distance did not change anymore (Qt::ScrollEnd).
|
||||
\endlist
|
||||
|
||||
\see pixelDelta()
|
||||
\sa pixelDelta()
|
||||
*/
|
||||
|
||||
/*!
|
||||
@ -3355,7 +3355,7 @@ QWhatsThisClickedEvent::~QWhatsThisClickedEvent()
|
||||
|
||||
\a action is the action that is changed, added, or removed. If \a
|
||||
type is ActionAdded, the action is to be inserted before the
|
||||
action \a before. If \a before is 0, the action is appended.
|
||||
action \a before. If \a before is \nullptr, the action is appended.
|
||||
*/
|
||||
QActionEvent::QActionEvent(int type, QGuiAction *action, QGuiAction *before)
|
||||
: QEvent(static_cast<QEvent::Type>(type)), act(action), bef(before)
|
||||
|
@ -592,6 +592,21 @@ static QWindowGeometrySpecification windowGeometrySpecification = Q_WINDOW_GEOME
|
||||
\list
|
||||
\li \c {altgr}, detect the key \c {AltGr} found on some keyboards as
|
||||
Qt::GroupSwitchModifier (since Qt 5.12).
|
||||
\li \c {darkmode=[1|2]} controls how Qt responds to the activation
|
||||
of the \e{Dark Mode for applications} introduced in Windows 10
|
||||
1903 (since Qt 5.15).
|
||||
|
||||
A value of 1 causes Qt to switch the window borders to black
|
||||
when \e{Dark Mode for applications} is activated and no High
|
||||
Contrast Theme is in use. This is intended for applications
|
||||
that implement their own theming.
|
||||
|
||||
A value of 2 will in addition cause the Windows Vista style to
|
||||
be deactivated and switch to the Windows style using a
|
||||
simplified palette in dark mode. This is currently
|
||||
experimental pending the introduction of new style that
|
||||
properly adapts to dark mode.
|
||||
|
||||
\li \c {dialogs=[xp|none]}, \c xp uses XP-style native dialogs and
|
||||
\c none disables them.
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Copyright (C) 2020 The Qt Company Ltd.
|
||||
** Contact: https://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the QtGui module of the Qt Toolkit.
|
||||
@ -41,6 +41,7 @@
|
||||
#include "qbitmap.h"
|
||||
#include "qbrush.h"
|
||||
#include "qcolor.h"
|
||||
#include "qcolorspace.h"
|
||||
#include "qcursor.h"
|
||||
#include "qfont.h"
|
||||
#include "qimage.h"
|
||||
@ -180,25 +181,25 @@ static bool convert(const QVariant::Private *d, int t,
|
||||
void *result, bool *ok)
|
||||
{
|
||||
switch (t) {
|
||||
case QVariant::ByteArray:
|
||||
if (d->type == QVariant::Color) {
|
||||
case QMetaType::QByteArray:
|
||||
if (d->type == QMetaType::QColor) {
|
||||
const QColor *c = v_cast<QColor>(d);
|
||||
*static_cast<QByteArray *>(result) = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb).toLatin1();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case QVariant::String: {
|
||||
case QMetaType::QString: {
|
||||
QString *str = static_cast<QString *>(result);
|
||||
switch (d->type) {
|
||||
#if QT_CONFIG(shortcut)
|
||||
case QVariant::KeySequence:
|
||||
case QMetaType::QKeySequence:
|
||||
*str = (*v_cast<QKeySequence>(d)).toString(QKeySequence::NativeText);
|
||||
return true;
|
||||
#endif
|
||||
case QVariant::Font:
|
||||
case QMetaType::QFont:
|
||||
*str = v_cast<QFont>(d)->toString();
|
||||
return true;
|
||||
case QVariant::Color: {
|
||||
case QMetaType::QColor: {
|
||||
const QColor *c = v_cast<QColor>(d);
|
||||
*str = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb);
|
||||
return true;
|
||||
@ -208,85 +209,85 @@ static bool convert(const QVariant::Private *d, int t,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case QVariant::Pixmap:
|
||||
if (d->type == QVariant::Image) {
|
||||
case QMetaType::QPixmap:
|
||||
if (d->type == QMetaType::QImage) {
|
||||
*static_cast<QPixmap *>(result) = QPixmap::fromImage(*v_cast<QImage>(d));
|
||||
return true;
|
||||
} else if (d->type == QVariant::Bitmap) {
|
||||
} else if (d->type == QMetaType::QBitmap) {
|
||||
*static_cast<QPixmap *>(result) = *v_cast<QBitmap>(d);
|
||||
return true;
|
||||
} else if (d->type == QVariant::Brush) {
|
||||
} else if (d->type == QMetaType::QBrush) {
|
||||
if (v_cast<QBrush>(d)->style() == Qt::TexturePattern) {
|
||||
*static_cast<QPixmap *>(result) = v_cast<QBrush>(d)->texture();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QVariant::Image:
|
||||
if (d->type == QVariant::Pixmap) {
|
||||
case QMetaType::QImage:
|
||||
if (d->type == QMetaType::QPixmap) {
|
||||
*static_cast<QImage *>(result) = v_cast<QPixmap>(d)->toImage();
|
||||
return true;
|
||||
} else if (d->type == QVariant::Bitmap) {
|
||||
} else if (d->type == QMetaType::QBitmap) {
|
||||
*static_cast<QImage *>(result) = v_cast<QBitmap>(d)->toImage();
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case QVariant::Bitmap:
|
||||
if (d->type == QVariant::Pixmap) {
|
||||
case QMetaType::QBitmap:
|
||||
if (d->type == QMetaType::QPixmap) {
|
||||
*static_cast<QBitmap *>(result) = *v_cast<QPixmap>(d);
|
||||
return true;
|
||||
} else if (d->type == QVariant::Image) {
|
||||
} else if (d->type == QMetaType::QImage) {
|
||||
*static_cast<QBitmap *>(result) = QBitmap::fromImage(*v_cast<QImage>(d));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#if QT_CONFIG(shortcut)
|
||||
case QVariant::Int:
|
||||
if (d->type == QVariant::KeySequence) {
|
||||
case QMetaType::Int:
|
||||
if (d->type == QMetaType::QKeySequence) {
|
||||
const QKeySequence &seq = *v_cast<QKeySequence>(d);
|
||||
*static_cast<int *>(result) = seq.isEmpty() ? 0 : seq[0];
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
case QVariant::Font:
|
||||
if (d->type == QVariant::String) {
|
||||
case QMetaType::QFont:
|
||||
if (d->type == QMetaType::QString) {
|
||||
QFont *f = static_cast<QFont *>(result);
|
||||
f->fromString(*v_cast<QString>(d));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case QVariant::Color:
|
||||
if (d->type == QVariant::String) {
|
||||
case QMetaType::QColor:
|
||||
if (d->type == QMetaType::QString) {
|
||||
static_cast<QColor *>(result)->setNamedColor(*v_cast<QString>(d));
|
||||
return static_cast<QColor *>(result)->isValid();
|
||||
} else if (d->type == QVariant::ByteArray) {
|
||||
} else if (d->type == QMetaType::QByteArray) {
|
||||
static_cast<QColor *>(result)->setNamedColor(QLatin1String(*v_cast<QByteArray>(d)));
|
||||
return true;
|
||||
} else if (d->type == QVariant::Brush) {
|
||||
} else if (d->type == QMetaType::QBrush) {
|
||||
if (v_cast<QBrush>(d)->style() == Qt::SolidPattern) {
|
||||
*static_cast<QColor *>(result) = v_cast<QBrush>(d)->color();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QVariant::Brush:
|
||||
if (d->type == QVariant::Color) {
|
||||
case QMetaType::QBrush:
|
||||
if (d->type == QMetaType::QColor) {
|
||||
*static_cast<QBrush *>(result) = QBrush(*v_cast<QColor>(d));
|
||||
return true;
|
||||
} else if (d->type == QVariant::Pixmap) {
|
||||
} else if (d->type == QMetaType::QPixmap) {
|
||||
*static_cast<QBrush *>(result) = QBrush(*v_cast<QPixmap>(d));
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#if QT_CONFIG(shortcut)
|
||||
case QVariant::KeySequence: {
|
||||
case QMetaType::QKeySequence: {
|
||||
QKeySequence *seq = static_cast<QKeySequence *>(result);
|
||||
switch (d->type) {
|
||||
case QVariant::String:
|
||||
case QMetaType::QString:
|
||||
*seq = QKeySequence(*v_cast<QString>(d));
|
||||
return true;
|
||||
case QVariant::Int:
|
||||
case QMetaType::Int:
|
||||
*seq = QKeySequence(d->data.i);
|
||||
return true;
|
||||
default:
|
||||
@ -296,7 +297,7 @@ static bool convert(const QVariant::Private *d, int t,
|
||||
}
|
||||
#endif
|
||||
#ifndef QT_NO_ICON
|
||||
case QVariant::Icon: {
|
||||
case QMetaType::QIcon: {
|
||||
if (ok)
|
||||
*ok = false;
|
||||
return false;
|
||||
|
@ -112,22 +112,23 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type
|
||||
{
|
||||
QVariant data = retrieveData_sys(mimeType, type);
|
||||
if (mimeType == QLatin1String("application/x-qt-image")) {
|
||||
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty())) {
|
||||
if (data.isNull() || (data.userType() == QMetaType::QByteArray && data.toByteArray().isEmpty())) {
|
||||
// try to find an image
|
||||
QStringList imageFormats = imageReadMimeFormats();
|
||||
for (int i = 0; i < imageFormats.size(); ++i) {
|
||||
data = retrieveData_sys(imageFormats.at(i), type);
|
||||
if (data.isNull() || (data.type() == QVariant::ByteArray && data.toByteArray().isEmpty()))
|
||||
if (data.isNull() || (data.userType() == QMetaType::QByteArray && data.toByteArray().isEmpty()))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
}
|
||||
int typeId = type;
|
||||
// we wanted some image type, but all we got was a byte array. Convert it to an image.
|
||||
if (data.type() == QVariant::ByteArray
|
||||
&& (type == QVariant::Image || type == QVariant::Pixmap || type == QVariant::Bitmap))
|
||||
if (data.userType() == QMetaType::QByteArray
|
||||
&& (typeId == QMetaType::QImage || typeId == QMetaType::QPixmap || typeId == QMetaType::QBitmap))
|
||||
data = QImage::fromData(data.toByteArray());
|
||||
|
||||
} else if (mimeType == QLatin1String("application/x-color") && data.type() == QVariant::ByteArray) {
|
||||
} else if (mimeType == QLatin1String("application/x-color") && data.userType() == QMetaType::QByteArray) {
|
||||
QColor c;
|
||||
QByteArray ba = data.toByteArray();
|
||||
if (ba.size() == 8) {
|
||||
@ -140,7 +141,7 @@ QVariant QInternalMimeData::retrieveData(const QString &mimeType, QVariant::Type
|
||||
} else {
|
||||
qWarning("Qt: Invalid color format");
|
||||
}
|
||||
} else if (data.type() != type && data.type() == QVariant::ByteArray) {
|
||||
} else if (data.userType() != int(type) && data.userType() == QMetaType::QByteArray) {
|
||||
// try to use mime data's internal conversion stuf.
|
||||
QInternalMimeData *that = const_cast<QInternalMimeData *>(this);
|
||||
that->setData(mimeType, data.toByteArray());
|
||||
|
@ -1402,7 +1402,7 @@ QKeySequence::SequenceMatch QKeySequence::matches(const QKeySequence &seq) const
|
||||
*/
|
||||
QKeySequence::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::KeySequence, this);
|
||||
return QVariant(QMetaType::QKeySequence, this);
|
||||
}
|
||||
|
||||
/*! \fn QKeySequence::operator int () const
|
||||
|
@ -942,7 +942,7 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
|
||||
The latter may happen if the surface is not exposed, or the graphics
|
||||
hardware is not available due to e.g. the application being suspended.
|
||||
|
||||
If \a surface is 0 this is equivalent to calling doneCurrent().
|
||||
If \a surface is \nullptr this is equivalent to calling doneCurrent().
|
||||
|
||||
Avoid calling this function from a different thread than the one the
|
||||
QOpenGLContext instance lives in. If you wish to use QOpenGLContext from a
|
||||
|
@ -725,7 +725,7 @@ QPalette &QPalette::operator=(const QPalette &p)
|
||||
*/
|
||||
QPalette::operator QVariant() const
|
||||
{
|
||||
return QVariant(QVariant::Palette, this);
|
||||
return QVariant(QMetaType::QPalette, this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user