Merge remote-tracking branch 'origin/dev' into wip/cmake
Conflicts: src/corelib/Qt5CoreConfigExtras.cmake.in src/corelib/Qt5CoreMacros.cmake src/dbus/Qt5DBusConfigExtras.cmake.in src/widgets/Qt5WidgetsConfigExtras.cmake.in Change-Id: Ib782f3b177c38b2cce83beebe15be9c0baa578f7
This commit is contained in:
commit
a1dbdcbd6e
@ -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 {
|
||||
|
@ -6,5 +6,3 @@ CONFIG += no_docs_target
|
||||
|
||||
SUBDIRS += analogclock
|
||||
SUBDIRS += rasterwindow
|
||||
qtHaveModule(gui):qtConfig(opengl): \
|
||||
SUBDIRS += openglwindow
|
||||
|
@ -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;
|
||||
|
@ -2,6 +2,7 @@ TEMPLATE = subdirs
|
||||
|
||||
SUBDIRS = hellowindow \
|
||||
paintedwindow \
|
||||
openglwindow \
|
||||
qopenglwindow
|
||||
|
||||
qtHaveModule(widgets) {
|
||||
|
@ -1,3 +1,4 @@
|
||||
QT += opengl
|
||||
INCLUDEPATH += $$PWD
|
||||
SOURCES += $$PWD/openglwindow.cpp
|
||||
HEADERS += $$PWD/openglwindow.h
|
@ -3,5 +3,5 @@ include(openglwindow.pri)
|
||||
SOURCES += \
|
||||
main.cpp
|
||||
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/gui/openglwindow
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/opengl/openglwindow
|
||||
INSTALLS += target
|
@ -1,3 +1,5 @@
|
||||
QT += opengl
|
||||
|
||||
HEADERS += paintedwindow.h
|
||||
SOURCES += paintedwindow.cpp main.cpp
|
||||
|
||||
|
@ -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:
|
||||
|
||||
|
@ -67,7 +67,7 @@ Window::Window(QWidget *parent)
|
||||
|
||||
connect(m_ui.easingCurvePicker, &QListWidget::currentRowChanged,
|
||||
this, &Window::curveChanged);
|
||||
connect(m_ui.buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
|
||||
connect(m_ui.buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
|
||||
this, &Window::pathChanged);
|
||||
connect(m_ui.periodSpinBox, QOverload<double>::of(&QDoubleSpinBox::valueChanged),
|
||||
this, &Window::periodChanged);
|
||||
@ -180,9 +180,10 @@ void Window::curveChanged(int row)
|
||||
m_ui.overshootSpinBox->setEnabled(curveType >= QEasingCurve::InBack && curveType <= QEasingCurve::OutInBack);
|
||||
}
|
||||
|
||||
void Window::pathChanged(int index)
|
||||
void Window::pathChanged(QAbstractButton *button)
|
||||
{
|
||||
m_anim->setPathType((Animation::PathType)index);
|
||||
const int index = m_ui.buttonGroup->id(button);
|
||||
m_anim->setPathType(Animation::PathType(index));
|
||||
}
|
||||
|
||||
void Window::periodChanged(double value)
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
Window(QWidget *parent = nullptr);
|
||||
private slots:
|
||||
void curveChanged(int row);
|
||||
void pathChanged(int index);
|
||||
void pathChanged(QAbstractButton *button);
|
||||
void periodChanged(double);
|
||||
void amplitudeChanged(double);
|
||||
void overshootChanged(double);
|
||||
|
@ -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.
|
||||
|
@ -220,11 +220,11 @@ void View::setupMatrix()
|
||||
{
|
||||
qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50));
|
||||
|
||||
QMatrix matrix;
|
||||
QTransform matrix;
|
||||
matrix.scale(scale, scale);
|
||||
matrix.rotate(rotateSlider->value());
|
||||
|
||||
graphicsView->setMatrix(matrix);
|
||||
graphicsView->setTransform(matrix);
|
||||
setResetButtonEnabled();
|
||||
}
|
||||
|
||||
|
@ -113,13 +113,14 @@ void MainWindow::backgroundButtonGroupClicked(QAbstractButton *button)
|
||||
//! [1]
|
||||
|
||||
//! [2]
|
||||
void MainWindow::buttonGroupClicked(int id)
|
||||
void MainWindow::buttonGroupClicked(QAbstractButton *button)
|
||||
{
|
||||
const QList<QAbstractButton *> buttons = buttonGroup->buttons();
|
||||
for (QAbstractButton *button : buttons) {
|
||||
if (buttonGroup->button(id) != button)
|
||||
for (QAbstractButton *myButton : buttons) {
|
||||
if (myButton != button)
|
||||
button->setChecked(false);
|
||||
}
|
||||
const int id = buttonGroup->id(button);
|
||||
if (id == InsertTextButton) {
|
||||
scene->setMode(DiagramScene::InsertText);
|
||||
} else {
|
||||
@ -154,7 +155,7 @@ void MainWindow::deleteItem()
|
||||
//! [3]
|
||||
|
||||
//! [4]
|
||||
void MainWindow::pointerGroupClicked(int)
|
||||
void MainWindow::pointerGroupClicked()
|
||||
{
|
||||
scene->setMode(DiagramScene::Mode(pointerTypeGroup->checkedId()));
|
||||
}
|
||||
@ -231,8 +232,8 @@ void MainWindow::fontSizeChanged(const QString &)
|
||||
void MainWindow::sceneScaleChanged(const QString &scale)
|
||||
{
|
||||
double newScale = scale.left(scale.indexOf(tr("%"))).toDouble() / 100.0;
|
||||
QMatrix oldMatrix = view->matrix();
|
||||
view->resetMatrix();
|
||||
QTransform oldMatrix = view->transform();
|
||||
view->resetTransform();
|
||||
view->translate(oldMatrix.dx(), oldMatrix.dy());
|
||||
view->scale(newScale, newScale);
|
||||
}
|
||||
@ -334,7 +335,7 @@ void MainWindow::createToolBox()
|
||||
{
|
||||
buttonGroup = new QButtonGroup(this);
|
||||
buttonGroup->setExclusive(false);
|
||||
connect(buttonGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
|
||||
connect(buttonGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
|
||||
this, &MainWindow::buttonGroupClicked);
|
||||
QGridLayout *layout = new QGridLayout;
|
||||
layout->addWidget(createCellWidget(tr("Conditional"), DiagramItem::Conditional), 0, 0);
|
||||
@ -528,7 +529,7 @@ void MainWindow::createToolbars()
|
||||
pointerTypeGroup = new QButtonGroup(this);
|
||||
pointerTypeGroup->addButton(pointerButton, int(DiagramScene::MoveItem));
|
||||
pointerTypeGroup->addButton(linePointerButton, int(DiagramScene::InsertLine));
|
||||
connect(pointerTypeGroup, QOverload<int>::of(&QButtonGroup::buttonClicked),
|
||||
connect(pointerTypeGroup, QOverload<QAbstractButton *>::of(&QButtonGroup::buttonClicked),
|
||||
this, &MainWindow::pointerGroupClicked);
|
||||
|
||||
sceneScaleCombo = new QComboBox;
|
||||
|
@ -82,9 +82,9 @@ public:
|
||||
|
||||
private slots:
|
||||
void backgroundButtonGroupClicked(QAbstractButton *button);
|
||||
void buttonGroupClicked(int id);
|
||||
void buttonGroupClicked(QAbstractButton *button);
|
||||
void deleteItem();
|
||||
void pointerGroupClicked(int id);
|
||||
void pointerGroupClicked();
|
||||
void bringToFront();
|
||||
void sendToBack();
|
||||
void itemInserted(DiagramItem *item);
|
||||
|
@ -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\\.]*");
|
||||
|
@ -223,7 +223,7 @@ void XFormView::setRotation(qreal r)
|
||||
m_rotation = r;
|
||||
|
||||
QPointF center(pts->points().at(0));
|
||||
QMatrix m;
|
||||
QTransform m;
|
||||
m.translate(center.x(), center.y());
|
||||
m.rotate(m_rotation - old_rot);
|
||||
m.translate(-center.x(), -center.y());
|
||||
@ -236,7 +236,7 @@ void XFormView::timerEvent(QTimerEvent *e)
|
||||
{
|
||||
if (e->timerId() == timer.timerId()) {
|
||||
QPointF center(pts->points().at(0));
|
||||
QMatrix m;
|
||||
QTransform m;
|
||||
m.translate(center.x(), center.y());
|
||||
m.rotate(0.2);
|
||||
m.translate(-center.x(), -center.y());
|
||||
|
@ -374,7 +374,7 @@ void PathDeformRenderer::setText(const QString &text)
|
||||
}
|
||||
|
||||
for (int i=0; i<m_paths.size(); ++i)
|
||||
m_paths[i] = m_paths[i] * QMatrix(1, 0, 0, 1, -m_pathBounds.x(), -m_pathBounds.y());
|
||||
m_paths[i] = m_paths[i] * QTransform(1, 0, 0, 1, -m_pathBounds.x(), -m_pathBounds.y());
|
||||
|
||||
update();
|
||||
}
|
||||
|
@ -511,10 +511,10 @@ void PathStrokeRenderer::initializePoints()
|
||||
m_points.clear();
|
||||
m_vectors.clear();
|
||||
|
||||
QMatrix m;
|
||||
QTransform m;
|
||||
qreal rot = 360.0 / count;
|
||||
QPointF center(width() / 2, height() / 2);
|
||||
QMatrix vm;
|
||||
QTransform vm;
|
||||
vm.shear(2, -1);
|
||||
vm.scale(3, 3);
|
||||
|
||||
|
@ -62,8 +62,8 @@
|
||||
#include <QRegularExpression>
|
||||
#include <QOffscreenSurface>
|
||||
#include <QOpenGLContext>
|
||||
#include <QOpenGLPaintDevice>
|
||||
#if QT_CONFIG(opengl)
|
||||
#include <QtOpenGL/QOpenGLPaintDevice>
|
||||
#include <QtOpenGL/QOpenGLWindow>
|
||||
#endif
|
||||
|
||||
|
@ -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:
|
||||
|
@ -60,7 +60,7 @@
|
||||
#include <QWidget>
|
||||
|
||||
|
||||
// Making use of the class from the opengl example in gui.
|
||||
// Making use of the class from the openglwindow example
|
||||
class Window : public OpenGLWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -6,4 +6,4 @@ QT += widgets
|
||||
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/windowcontainer
|
||||
INSTALLS += target
|
||||
|
||||
include(../../gui/openglwindow/openglwindow.pri)
|
||||
include(../../opengl/openglwindow/openglwindow.pri)
|
||||
|
@ -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, ";")
|
||||
}
|
||||
@ -212,21 +212,17 @@ contains(CONFIG, plugin) {
|
||||
CMAKE_PLUGIN_TYPE_ESCAPED = $$replace(PLUGIN_TYPE, [-/], _)
|
||||
|
||||
win32 {
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl
|
||||
isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.dll
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.dll
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl
|
||||
} else:mingw {
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.a
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.a
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}.prl
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/lib$${CMAKE_QT_STEM}d.prl
|
||||
} else { # MSVC static
|
||||
CMAKE_PLUGIN_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.lib
|
||||
CMAKE_PLUGIN_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.lib
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}.prl
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $$PLUGIN_TYPE/$${CMAKE_QT_STEM}d.prl
|
||||
}
|
||||
} else {
|
||||
mac {
|
||||
@ -291,6 +287,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
|
||||
@ -316,36 +316,25 @@ mac {
|
||||
CMAKE_LIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.dll
|
||||
CMAKE_LIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.dll
|
||||
|
||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_STATIC_WINDOWS_BUILD = "true"
|
||||
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
|
||||
}
|
||||
|
||||
mingw {
|
||||
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = libqtmain$${QT_LIBINFIX}d.a
|
||||
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = libqtmain$${QT_LIBINFIX}.a
|
||||
|
||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_STATIC_WINDOWS_BUILD = "true"
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
|
||||
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.prl
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.prl
|
||||
} else {
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
|
||||
}
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = lib$${CMAKE_QT_STEM}d.a
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = lib$${CMAKE_QT_STEM}.a
|
||||
} else {
|
||||
CMAKE_WINMAIN_FILE_LOCATION_DEBUG = qtmain$${QT_LIBINFIX}d.lib
|
||||
CMAKE_WINMAIN_FILE_LOCATION_RELEASE = qtmain$${QT_LIBINFIX}.lib
|
||||
|
||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||
CMAKE_STATIC_WINDOWS_BUILD = "true"
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
|
||||
|
||||
CMAKE_PRL_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.prl
|
||||
CMAKE_PRL_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.prl
|
||||
} else {
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
|
||||
}
|
||||
CMAKE_IMPLIB_FILE_LOCATION_DEBUG = $${CMAKE_QT_STEM}d.lib
|
||||
CMAKE_IMPLIB_FILE_LOCATION_RELEASE = $${CMAKE_QT_STEM}.lib
|
||||
}
|
||||
} else {
|
||||
!isEmpty(CMAKE_STATIC_TYPE) {
|
||||
|
@ -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\")
|
||||
|
@ -64,11 +64,13 @@ debug {
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
|
||||
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
|
||||
DEFINES += $$DEFINES_DEBUG
|
||||
} else {
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
|
||||
QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
|
||||
QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
|
||||
DEFINES += $$DEFINES_RELEASE
|
||||
}
|
||||
|
||||
stack_protector_strong {
|
||||
|
@ -26,10 +26,4 @@ CONFIG = \
|
||||
unset(today)
|
||||
}
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
DEFINES += $$DEFINES_DEBUG
|
||||
} else {
|
||||
DEFINES += $$DEFINES_RELEASE
|
||||
}
|
||||
|
||||
load(toolchain)
|
||||
|
@ -23,7 +23,6 @@ qtConfig(c11): CONFIG += c11
|
||||
qtConfig(stack-protector-strong): CONFIG += stack_protector_strong
|
||||
contains(TEMPLATE, .*lib) {
|
||||
# module and plugins
|
||||
if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols
|
||||
unix:qtConfig(reduce_relocations): CONFIG += bsymbolic_functions
|
||||
qtConfig(separate_debug_info): CONFIG += separate_debug_info
|
||||
|
||||
@ -58,6 +57,9 @@ contains(TEMPLATE, .*lib) {
|
||||
QMAKE_PRL_INSTALL_REPLACE += qtlibdir_replace
|
||||
}
|
||||
}
|
||||
contains(TEMPLATE, .*lib)|darwin {
|
||||
if(!host_build|!cross_compile):qtConfig(reduce_exports): CONFIG += hide_symbols
|
||||
}
|
||||
|
||||
# The remainder of this file must not apply to host tools/libraries,
|
||||
# as the host compiler's version and capabilities are not checked.
|
||||
|
@ -36,6 +36,7 @@ EMCC_COMMON_LFLAGS += \
|
||||
-s USE_WEBGL2=1 \
|
||||
-s NO_EXIT_RUNTIME=0 \
|
||||
-s ERROR_ON_UNDEFINED_SYMBOLS=1 \
|
||||
-s EXTRA_EXPORTED_RUNTIME_METHODS=[\"UTF16ToString\",\"stringToUTF16\"] \
|
||||
--bind
|
||||
|
||||
# The -s arguments can also be used with release builds,
|
||||
|
@ -1168,7 +1168,7 @@
|
||||
\section1 DEFINES_DEBUG
|
||||
|
||||
Specifies preprocessor defines for the debug configuration. The values of
|
||||
this variable get added to \l{DEFINES} before the project is loaded. This
|
||||
this variable get added to \l{DEFINES} after the project is loaded. This
|
||||
variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
||||
to be modified.
|
||||
|
||||
@ -1178,10 +1178,13 @@
|
||||
\section1 DEFINES_RELEASE
|
||||
|
||||
Specifies preprocessor defines for the release configuration. The values of
|
||||
this variable get added to \l{DEFINES} before the project is loaded. This
|
||||
this variable get added to \l{DEFINES} after the project is loaded. This
|
||||
variable is typically set in \l{#QMAKESPEC}{qmake.conf} and rarely needs
|
||||
to be modified.
|
||||
|
||||
\note For MSVC mkspecs, this variable contains the value \c NDEBUG by
|
||||
default.
|
||||
|
||||
This variable was introduced in Qt 5.13.2.
|
||||
|
||||
\target DEF_FILE
|
||||
|
@ -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 --------------------------------------------
|
||||
|
||||
|
@ -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.
|
||||
|
@ -534,8 +534,25 @@ static QString getRelocatablePrefix()
|
||||
#if defined(QT_STATIC)
|
||||
prefixPath = prefixFromAppDirHelper();
|
||||
#elif defined(Q_OS_DARWIN) && QT_CONFIG(framework)
|
||||
CFBundleRef qtCoreBundle = CFBundleGetBundleWithIdentifier(
|
||||
CFSTR("org.qt-project.QtCore"));
|
||||
auto qtCoreBundle = CFBundleGetBundleWithIdentifier(CFSTR("org.qt-project.QtCore"));
|
||||
if (!qtCoreBundle) {
|
||||
// When running Qt apps over Samba shares, CoreFoundation will fail to find
|
||||
// the Resources directory inside the bundle, This directory is a symlink,
|
||||
// and CF relies on readdir() and dtent.dt_type to detect symlinks, which
|
||||
// does not work reliably for Samba shares. We work around it by manually
|
||||
// looking for the QtCore bundle.
|
||||
auto allBundles = CFBundleGetAllBundles();
|
||||
auto bundleCount = CFArrayGetCount(allBundles);
|
||||
for (int i = 0; i < bundleCount; ++i) {
|
||||
auto bundle = CFBundleRef(CFArrayGetValueAtIndex(allBundles, i));
|
||||
auto url = QCFType<CFURLRef>(CFBundleCopyBundleURL(bundle));
|
||||
auto path = QCFType<CFStringRef>(CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle));
|
||||
if (CFStringHasSuffix(path, CFSTR("/QtCore.framework"))) {
|
||||
qtCoreBundle = bundle;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
Q_ASSERT(qtCoreBundle);
|
||||
|
||||
QCFType<CFURLRef> qtCorePath = CFBundleCopyBundleURL(qtCoreBundle);
|
||||
|
@ -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)
|
||||
|
@ -1023,7 +1023,7 @@
|
||||
|
||||
\value WA_MacNoClickThrough This value is obsolete and has no effect.
|
||||
|
||||
\value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip
|
||||
\value WA_MacOpaqueSizeGrip Indicates that the native size grip
|
||||
should be opaque instead of transparent (the default). This attribute
|
||||
is only applicable to \macos and is set by the widget's author.
|
||||
|
||||
@ -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()
|
||||
|
@ -810,16 +810,6 @@ void QProcessPrivate::Channel::clear()
|
||||
\a newState argument is the state QProcess changed to.
|
||||
*/
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
/*!
|
||||
\fn void QProcess::finished(int exitCode)
|
||||
\obsolete
|
||||
\overload
|
||||
|
||||
Use finished(int exitCode, QProcess::ExitStatus status) instead.
|
||||
*/
|
||||
#endif
|
||||
|
||||
/*!
|
||||
\fn void QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus)
|
||||
|
||||
@ -1175,12 +1165,6 @@ bool QProcessPrivate::_q_processDied()
|
||||
//emit q->standardOutputClosed();
|
||||
//emit q->standardErrorClosed();
|
||||
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
emit q->finished(exitCode);
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
emit q->finished(exitCode, exitStatus);
|
||||
}
|
||||
#if defined QPROCESS_DEBUG
|
||||
|
@ -273,11 +273,7 @@ public Q_SLOTS:
|
||||
|
||||
Q_SIGNALS:
|
||||
void started(QPrivateSignal);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_DEPRECATED_X("Use QProcess::finished(int, QProcess::ExitStatus) instead")
|
||||
void finished(int exitCode); // ### Qt 6: merge the two signals with a default value
|
||||
#endif
|
||||
void finished(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void finished(int exitCode, QProcess::ExitStatus exitStatus = NormalExit);
|
||||
#if QT_DEPRECATED_SINCE(5, 6)
|
||||
QT_DEPRECATED_X("Use QProcess::errorOccurred(QProcess::ProcessError) instead")
|
||||
void error(QProcess::ProcessError error);
|
||||
|
@ -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
|
||||
|
@ -50,6 +50,7 @@
|
||||
#endif
|
||||
#include <qstack.h>
|
||||
#include <qbuffer.h>
|
||||
#include <qscopeguard.h>
|
||||
#ifndef QT_BOOTSTRAPPED
|
||||
#include <qcoreapplication.h>
|
||||
#else
|
||||
@ -68,6 +69,8 @@ public: \
|
||||
{ return QString::fromLatin1(sourceText); } \
|
||||
private:
|
||||
#endif
|
||||
#include <private/qmemory_p.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#include "qxmlstream_p.h"
|
||||
@ -847,7 +850,7 @@ void QXmlStreamReaderPrivate::init()
|
||||
#endif
|
||||
attributeStack.clear();
|
||||
attributeStack.reserve(16);
|
||||
entityParser = nullptr;
|
||||
entityParser.reset();
|
||||
hasCheckedStartDocument = false;
|
||||
normalizeLiterals = false;
|
||||
hasSeenTag = false;
|
||||
@ -880,7 +883,7 @@ void QXmlStreamReaderPrivate::parseEntity(const QString &value)
|
||||
|
||||
|
||||
if (!entityParser)
|
||||
entityParser = new QXmlStreamReaderPrivate(q);
|
||||
entityParser = qt_make_unique<QXmlStreamReaderPrivate>(q);
|
||||
else
|
||||
entityParser->init();
|
||||
entityParser->inParseEntity = true;
|
||||
@ -910,7 +913,6 @@ QXmlStreamReaderPrivate::~QXmlStreamReaderPrivate()
|
||||
#endif
|
||||
free(sym_stack);
|
||||
free(state_stack);
|
||||
delete entityParser;
|
||||
}
|
||||
|
||||
|
||||
@ -1582,6 +1584,7 @@ QStringRef QXmlStreamReaderPrivate::namespaceForPrefix(const QStringRef &prefix)
|
||||
*/
|
||||
void QXmlStreamReaderPrivate::resolveTag()
|
||||
{
|
||||
const auto attributeStackCleaner = qScopeGuard([this](){ attributeStack.clear(); });
|
||||
int n = attributeStack.size();
|
||||
|
||||
if (namespaceProcessing) {
|
||||
@ -1649,7 +1652,10 @@ void QXmlStreamReaderPrivate::resolveTag()
|
||||
if (attributes[j].name() == attribute.name()
|
||||
&& attributes[j].namespaceUri() == attribute.namespaceUri()
|
||||
&& (namespaceProcessing || attributes[j].qualifiedName() == attribute.qualifiedName()))
|
||||
{
|
||||
raiseWellFormedError(QXmlStream::tr("Attribute '%1' redefined.").arg(attribute.qualifiedName()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1680,8 +1686,6 @@ void QXmlStreamReaderPrivate::resolveTag()
|
||||
attribute.m_isDefault = true;
|
||||
attributes.append(attribute);
|
||||
}
|
||||
|
||||
attributeStack.clear();
|
||||
}
|
||||
|
||||
void QXmlStreamReaderPrivate::resolvePublicNamespaces()
|
||||
|
@ -981,7 +981,7 @@ public:
|
||||
|
||||
QString resolveUndeclaredEntity(const QString &name);
|
||||
void parseEntity(const QString &value);
|
||||
QXmlStreamReaderPrivate *entityParser;
|
||||
std::unique_ptr<QXmlStreamReaderPrivate> entityParser;
|
||||
|
||||
bool scanAfterLangleBang();
|
||||
bool scanPublicOrSystem();
|
||||
|
@ -734,23 +734,23 @@ static void updateSystemPrivate()
|
||||
globalLocaleData.m_script_id = res.toInt();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::DecimalPoint, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_decimal = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::GroupSeparator, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_group = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::ZeroDigit, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_zero = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::NegativeSign, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_minus = res.toString().at(0).unicode();
|
||||
|
||||
res = sys_locale->query(QSystemLocale::PositiveSign, QVariant());
|
||||
if (!res.isNull())
|
||||
if (!res.isNull() && !res.toString().isEmpty())
|
||||
globalLocaleData.m_plus = res.toString().at(0).unicode();
|
||||
}
|
||||
#endif // !QT_NO_SYSTEMLOCALE
|
||||
@ -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);
|
||||
@ -4463,6 +4463,8 @@ QStringList QLocale::uiLanguages() const
|
||||
for (const auto entry : qAsConst(uiLanguages))
|
||||
locales.append(QLocale(entry));
|
||||
}
|
||||
if (locales.isEmpty())
|
||||
locales.append(systemLocale()->fallbackUiLocale());
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
@ -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;
|
||||
|
@ -48,7 +48,7 @@ SOURCES += \
|
||||
NO_PCH_SOURCES += text/qstring_compat.cpp
|
||||
false: SOURCES += $$NO_PCH_SOURCES # Hack for QtCreator
|
||||
|
||||
!nacl:macos: {
|
||||
!nacl:darwin: {
|
||||
SOURCES += text/qlocale_mac.mm
|
||||
}
|
||||
else:unix {
|
||||
|
@ -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 \
|
||||
|
@ -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 "
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user