Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: I5bdfe94f7eec1ba328c4a4b54d12dbc0da7fc3ac
This commit is contained in:
commit
d3814e51bb
@ -4826,9 +4826,11 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
/*!
|
||||
\macro qMove(x)
|
||||
\relates <QtGlobal>
|
||||
\obsolete
|
||||
|
||||
It expands to "std::move" if your compiler supports that C++11 function, or to nothing
|
||||
otherwise.
|
||||
Use \c std::move instead.
|
||||
|
||||
It expands to "std::move".
|
||||
|
||||
qMove takes an rvalue reference to its parameter \a x, and converts it to an xvalue.
|
||||
*/
|
||||
@ -4929,6 +4931,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
/*!
|
||||
\macro Q_DECL_OVERRIDE
|
||||
\since 5.0
|
||||
\obsolete
|
||||
\relates <QtGlobal>
|
||||
|
||||
This macro can be used to declare an overriding virtual
|
||||
@ -4936,8 +4939,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
an error if the overriding virtual function does not in fact
|
||||
override anything.
|
||||
|
||||
It expands to "override" if your compiler supports that C++11
|
||||
contextual keyword, or to nothing otherwise.
|
||||
It expands to "override".
|
||||
|
||||
The macro goes at the end of the function, usually after the
|
||||
\c{const}, if any:
|
||||
@ -4949,6 +4951,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
/*!
|
||||
\macro Q_DECL_FINAL
|
||||
\since 5.0
|
||||
\obsolete
|
||||
\relates <QtGlobal>
|
||||
|
||||
This macro can be used to declare an overriding virtual or a class
|
||||
@ -4956,10 +4959,7 @@ bool QInternal::activateCallbacks(Callback cb, void **parameters)
|
||||
no longer override this virtual function, or inherit from this
|
||||
class, respectively.
|
||||
|
||||
It expands to "final" if your compiler supports that C++11
|
||||
contextual keyword, or something non-standard if your compiler
|
||||
supports something close enough to the C++11 semantics, or to
|
||||
nothing otherwise.
|
||||
It expands to "final".
|
||||
|
||||
The macro goes at the end of the function, usually after the
|
||||
\c{const}, if any:
|
||||
|
@ -62,7 +62,7 @@ class Q_GUI_EXPORT QGuiAction : public QObject
|
||||
Q_DECLARE_PRIVATE(QGuiAction)
|
||||
|
||||
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed)
|
||||
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled)
|
||||
Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled)
|
||||
Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed)
|
||||
Q_PROPERTY(QIcon icon READ icon WRITE setIcon NOTIFY changed)
|
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY changed)
|
||||
|
@ -243,7 +243,7 @@ void QTextDocumentPrivate::clear()
|
||||
curs->adjusted_anchor = 0;
|
||||
}
|
||||
|
||||
QList<QTextCursorPrivate *>oldCursors = cursors;
|
||||
QSet<QTextCursorPrivate *> oldCursors = cursors;
|
||||
QT_TRY{
|
||||
cursors.clear();
|
||||
|
||||
|
@ -277,8 +277,8 @@ private:
|
||||
public:
|
||||
void documentChange(int from, int length);
|
||||
|
||||
inline void addCursor(QTextCursorPrivate *c) { cursors.append(c); }
|
||||
inline void removeCursor(QTextCursorPrivate *c) { cursors.removeAll(c); }
|
||||
inline void addCursor(QTextCursorPrivate *c) { cursors.insert(c); }
|
||||
inline void removeCursor(QTextCursorPrivate *c) { cursors.remove(c); }
|
||||
|
||||
QTextFrame *frameAt(int pos) const;
|
||||
QTextFrame *rootFrame() const;
|
||||
@ -330,7 +330,7 @@ private:
|
||||
BlockMap blocks;
|
||||
int initialBlockCharFormatIndex;
|
||||
|
||||
QList<QTextCursorPrivate *> cursors;
|
||||
QSet<QTextCursorPrivate *> cursors;
|
||||
QMap<int, QTextObject *> objects;
|
||||
QMap<QUrl, QVariant> resources;
|
||||
QMap<QUrl, QVariant> cachedResources;
|
||||
|
@ -40,7 +40,7 @@
|
||||
#ifndef QTESTSUPPORT_WIDGETS_H
|
||||
#define QTESTSUPPORT_WIDGETS_H
|
||||
|
||||
#include "qtwidgetsglobal.h"
|
||||
#include <QtWidgets/qtwidgetsglobal.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
@ -177,11 +177,11 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice
|
||||
Q_PROPERTY(QSize sizeHint READ sizeHint)
|
||||
Q_PROPERTY(QSize minimumSizeHint READ minimumSizeHint)
|
||||
Q_PROPERTY(bool acceptDrops READ acceptDrops WRITE setAcceptDrops)
|
||||
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle NOTIFY windowTitleChanged DESIGNABLE isWindow)
|
||||
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged DESIGNABLE isWindow)
|
||||
Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText NOTIFY windowIconTextChanged DESIGNABLE isWindow) // deprecated
|
||||
Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity DESIGNABLE isWindow)
|
||||
Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified DESIGNABLE isWindow)
|
||||
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle NOTIFY windowTitleChanged)
|
||||
Q_PROPERTY(QIcon windowIcon READ windowIcon WRITE setWindowIcon NOTIFY windowIconChanged)
|
||||
Q_PROPERTY(QString windowIconText READ windowIconText WRITE setWindowIconText NOTIFY windowIconTextChanged) // deprecated
|
||||
Q_PROPERTY(double windowOpacity READ windowOpacity WRITE setWindowOpacity)
|
||||
Q_PROPERTY(bool windowModified READ isWindowModified WRITE setWindowModified)
|
||||
#ifndef QT_NO_TOOLTIP
|
||||
Q_PROPERTY(QString toolTip READ toolTip WRITE setToolTip)
|
||||
Q_PROPERTY(int toolTipDuration READ toolTipDuration WRITE setToolTipDuration)
|
||||
@ -203,7 +203,7 @@ class Q_WIDGETS_EXPORT QWidget : public QObject, public QPaintDevice
|
||||
Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet)
|
||||
#endif
|
||||
Q_PROPERTY(QLocale locale READ locale WRITE setLocale RESET unsetLocale)
|
||||
Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath DESIGNABLE isWindow)
|
||||
Q_PROPERTY(QString windowFilePath READ windowFilePath WRITE setWindowFilePath)
|
||||
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
|
||||
|
||||
public:
|
||||
|
@ -66,7 +66,7 @@ class Q_WIDGETS_EXPORT QAbstractButton : public QWidget
|
||||
Q_PROPERTY(QKeySequence shortcut READ shortcut WRITE setShortcut)
|
||||
#endif
|
||||
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
|
||||
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled USER true)
|
||||
Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled USER true)
|
||||
Q_PROPERTY(bool autoRepeat READ autoRepeat WRITE setAutoRepeat)
|
||||
Q_PROPERTY(bool autoExclusive READ autoExclusive WRITE setAutoExclusive)
|
||||
Q_PROPERTY(int autoRepeatDelay READ autoRepeatDelay WRITE setAutoRepeatDelay)
|
||||
|
@ -91,30 +91,11 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
QComboBoxPrivate::QComboBoxPrivate()
|
||||
: QWidgetPrivate(),
|
||||
model(0),
|
||||
lineEdit(0),
|
||||
container(0),
|
||||
insertPolicy(QComboBox::InsertAtBottom),
|
||||
sizeAdjustPolicy(QComboBox::AdjustToContentsOnFirstShow),
|
||||
minimumContentsLength(0),
|
||||
shownOnce(false),
|
||||
autoCompletion(true),
|
||||
duplicatesEnabled(false),
|
||||
frame(true),
|
||||
maxVisibleItems(10),
|
||||
maxCount(INT_MAX),
|
||||
modelColumn(0),
|
||||
inserting(false),
|
||||
arrowState(QStyle::State_None),
|
||||
hoverControl(QStyle::SC_None),
|
||||
autoCompletionCaseSensitivity(Qt::CaseInsensitive),
|
||||
indexBeforeChange(-1)
|
||||
#ifdef Q_OS_MAC
|
||||
, m_platformMenu(0)
|
||||
#endif
|
||||
#if QT_CONFIG(completer)
|
||||
, completer(0)
|
||||
#endif
|
||||
inserting(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -447,12 +428,8 @@ void QComboBoxPrivateContainer::paintEvent(QPaintEvent *e)
|
||||
QFrame::paintEvent(e);
|
||||
}
|
||||
|
||||
void QComboBoxPrivateContainer::leaveEvent(QEvent *)
|
||||
{
|
||||
}
|
||||
|
||||
QComboBoxPrivateContainer::QComboBoxPrivateContainer(QAbstractItemView *itemView, QComboBox *parent)
|
||||
: QFrame(parent, Qt::Popup), combo(parent), view(0), top(0), bottom(0), maybeIgnoreMouseButtonRelease(false)
|
||||
: QFrame(parent, Qt::Popup), combo(parent)
|
||||
{
|
||||
// we need the combobox and itemview
|
||||
Q_ASSERT(parent);
|
||||
@ -557,7 +534,7 @@ void QComboBoxPrivateContainer::updateScrollers()
|
||||
*/
|
||||
void QComboBoxPrivateContainer::viewDestroyed()
|
||||
{
|
||||
view = 0;
|
||||
view = nullptr;
|
||||
setItemView(new QComboBoxListView());
|
||||
}
|
||||
|
||||
@ -591,7 +568,7 @@ void QComboBoxPrivateContainer::setItemView(QAbstractItemView *itemView)
|
||||
|
||||
if (isAncestorOf(view))
|
||||
delete view;
|
||||
view = 0;
|
||||
view = nullptr;
|
||||
}
|
||||
|
||||
// setup the item view
|
||||
@ -1568,7 +1545,7 @@ void QComboBox::setAutoCompletion(bool enable)
|
||||
d->lineEdit->setCompleter(d->completer);
|
||||
d->completer->setWidget(this);
|
||||
} else {
|
||||
d->lineEdit->setCompleter(0);
|
||||
d->lineEdit->setCompleter(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1757,7 +1734,7 @@ QSize QComboBox::iconSize() const
|
||||
if (d->iconSize.isValid())
|
||||
return d->iconSize;
|
||||
|
||||
int iconWidth = style()->pixelMetric(QStyle::PM_SmallIconSize, 0, this);
|
||||
int iconWidth = style()->pixelMetric(QStyle::PM_SmallIconSize, nullptr, this);
|
||||
return QSize(iconWidth, iconWidth);
|
||||
}
|
||||
|
||||
@ -1827,7 +1804,7 @@ QString QComboBox::placeholderText() const
|
||||
bool QComboBox::isEditable() const
|
||||
{
|
||||
Q_D(const QComboBox);
|
||||
return d->lineEdit != 0;
|
||||
return d->lineEdit != nullptr;
|
||||
}
|
||||
|
||||
/*! \internal
|
||||
@ -1883,7 +1860,7 @@ void QComboBox::setEditable(bool editable)
|
||||
setAttribute(Qt::WA_InputMethodEnabled, false);
|
||||
d->lineEdit->hide();
|
||||
d->lineEdit->deleteLater();
|
||||
d->lineEdit = 0;
|
||||
d->lineEdit = nullptr;
|
||||
}
|
||||
|
||||
d->updateDelegate();
|
||||
@ -1932,6 +1909,8 @@ void QComboBox::setLineEdit(QLineEdit *edit)
|
||||
d->lineEdit->setFocusProxy(this);
|
||||
d->lineEdit->setAttribute(Qt::WA_MacShowFocusRect, false);
|
||||
#if QT_DEPRECATED_SINCE(5, 13)
|
||||
QT_WARNING_PUSH
|
||||
QT_WARNING_DISABLE_DEPRECATED
|
||||
#if QT_CONFIG(completer)
|
||||
setAutoCompletion(d->autoCompletion);
|
||||
|
||||
@ -1948,6 +1927,7 @@ void QComboBox::setLineEdit(QLineEdit *edit)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
QT_WARNING_POP
|
||||
#endif
|
||||
|
||||
setAttribute(Qt::WA_InputMethodEnabled);
|
||||
@ -1996,7 +1976,7 @@ void QComboBox::setValidator(const QValidator *v)
|
||||
const QValidator *QComboBox::validator() const
|
||||
{
|
||||
Q_D(const QComboBox);
|
||||
return d->lineEdit ? d->lineEdit->validator() : 0;
|
||||
return d->lineEdit ? d->lineEdit->validator() : nullptr;
|
||||
}
|
||||
#endif // QT_NO_VALIDATOR
|
||||
|
||||
@ -2040,7 +2020,7 @@ void QComboBox::setCompleter(QCompleter *c)
|
||||
QCompleter *QComboBox::completer() const
|
||||
{
|
||||
Q_D(const QComboBox);
|
||||
return d->lineEdit ? d->lineEdit->completer() : 0;
|
||||
return d->lineEdit ? d->lineEdit->completer() : nullptr;
|
||||
}
|
||||
|
||||
#endif // QT_CONFIG(completer)
|
||||
@ -2927,7 +2907,7 @@ void QComboBox::hidePopup()
|
||||
QSignalBlocker containerBlocker(d->container);
|
||||
// Flash selected/triggered item (if any).
|
||||
if (style()->styleHint(QStyle::SH_Menu_FlashTriggeredItem)) {
|
||||
QItemSelectionModel *selectionModel = view() ? view()->selectionModel() : 0;
|
||||
QItemSelectionModel *selectionModel = view() ? view()->selectionModel() : nullptr;
|
||||
if (selectionModel && selectionModel->hasSelection()) {
|
||||
QEventLoop eventLoop;
|
||||
const QItemSelection selection = selectionModel->selection();
|
||||
|
@ -79,7 +79,6 @@ QT_REQUIRE_CONFIG(combobox);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAction;
|
||||
class QPlatformMenu;
|
||||
|
||||
class QComboBoxListView : public QListView
|
||||
@ -131,9 +130,6 @@ private:
|
||||
QComboBox *combo;
|
||||
};
|
||||
|
||||
|
||||
class QStandardItemModel;
|
||||
|
||||
class Q_AUTOTEST_EXPORT QComboBoxPrivateScroller : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -212,7 +208,7 @@ Q_SIGNALS:
|
||||
private:
|
||||
QAbstractSlider::SliderAction sliderAction;
|
||||
QBasicTimer timer;
|
||||
bool fast;
|
||||
bool fast = false;
|
||||
};
|
||||
|
||||
class Q_WIDGETS_EXPORT QComboBoxPrivateContainer : public QFrame
|
||||
@ -246,7 +242,6 @@ protected:
|
||||
void showEvent(QShowEvent *e) override;
|
||||
void hideEvent(QHideEvent *e) override;
|
||||
void timerEvent(QTimerEvent *timerEvent) override;
|
||||
void leaveEvent(QEvent *e) override;
|
||||
void resizeEvent(QResizeEvent *e) override;
|
||||
void paintEvent(QPaintEvent *e) override;
|
||||
QStyleOptionComboBox comboStyleOption() const;
|
||||
@ -257,18 +252,19 @@ Q_SIGNALS:
|
||||
|
||||
private:
|
||||
QComboBox *combo;
|
||||
QAbstractItemView *view;
|
||||
QComboBoxPrivateScroller *top;
|
||||
QComboBoxPrivateScroller *bottom;
|
||||
bool maybeIgnoreMouseButtonRelease;
|
||||
QAbstractItemView *view = nullptr;
|
||||
QComboBoxPrivateScroller *top = nullptr;
|
||||
QComboBoxPrivateScroller *bottom = nullptr;
|
||||
QElapsedTimer popupTimer;
|
||||
bool maybeIgnoreMouseButtonRelease = false;
|
||||
|
||||
friend class QComboBox;
|
||||
friend class QComboBoxPrivate;
|
||||
};
|
||||
|
||||
class Q_AUTOTEST_EXPORT QComboMenuDelegate : public QAbstractItemDelegate
|
||||
{ Q_OBJECT
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QComboMenuDelegate(QObject *parent, QComboBox *cmb) : QAbstractItemDelegate(parent), mCombo(cmb) {}
|
||||
|
||||
@ -355,8 +351,8 @@ public:
|
||||
void _q_complete();
|
||||
void _q_itemSelected(const QModelIndex &item);
|
||||
bool contains(const QString &text, int role);
|
||||
void emitActivated(const QModelIndex&);
|
||||
void _q_emitHighlighted(const QModelIndex&);
|
||||
void emitActivated(const QModelIndex &index);
|
||||
void _q_emitHighlighted(const QModelIndex &index);
|
||||
void _q_emitCurrentIndexChanged(const QModelIndex &index);
|
||||
void _q_modelDestroyed();
|
||||
void _q_modelReset();
|
||||
@ -366,8 +362,8 @@ public:
|
||||
void _q_resetButton();
|
||||
void _q_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight);
|
||||
void _q_updateIndexBeforeChange();
|
||||
void _q_rowsInserted(const QModelIndex & parent, int start, int end);
|
||||
void _q_rowsRemoved(const QModelIndex & parent, int start, int end);
|
||||
void _q_rowsInserted(const QModelIndex &parent, int start, int end);
|
||||
void _q_rowsRemoved(const QModelIndex &parent, int start, int end);
|
||||
void updateArrow(QStyle::StateFlag state);
|
||||
bool updateHoverControl(const QPoint &pos);
|
||||
QRect popupGeometry(int screen = -1) const;
|
||||
@ -402,40 +398,38 @@ public:
|
||||
};
|
||||
#endif
|
||||
|
||||
QAbstractItemModel *model;
|
||||
QLineEdit *lineEdit;
|
||||
QComboBoxPrivateContainer *container;
|
||||
QComboBox::InsertPolicy insertPolicy;
|
||||
QComboBox::SizeAdjustPolicy sizeAdjustPolicy;
|
||||
int minimumContentsLength;
|
||||
QSize iconSize;
|
||||
uint shownOnce : 1;
|
||||
uint autoCompletion : 1;
|
||||
uint duplicatesEnabled : 1;
|
||||
uint frame : 1;
|
||||
uint padding : 26;
|
||||
int maxVisibleItems;
|
||||
int maxCount;
|
||||
int modelColumn;
|
||||
QString placeholderText;
|
||||
bool inserting;
|
||||
mutable QSize minimumSizeHint;
|
||||
mutable QSize sizeHint;
|
||||
QStyle::StateFlag arrowState;
|
||||
QStyle::SubControl hoverControl;
|
||||
QRect hoverRect;
|
||||
QPersistentModelIndex currentIndex;
|
||||
QPersistentModelIndex root;
|
||||
Qt::CaseSensitivity autoCompletionCaseSensitivity;
|
||||
int indexBeforeChange;
|
||||
QAbstractItemModel *model = nullptr;
|
||||
QLineEdit *lineEdit = nullptr;
|
||||
QComboBoxPrivateContainer *container = nullptr;
|
||||
#ifdef Q_OS_MAC
|
||||
QPlatformMenu *m_platformMenu;
|
||||
QPlatformMenu *m_platformMenu = nullptr;
|
||||
#endif
|
||||
#if QT_CONFIG(completer)
|
||||
QPointer<QCompleter> completer;
|
||||
#endif
|
||||
static QPalette viewContainerPalette(QComboBox *cmb)
|
||||
{ return cmb->d_func()->viewContainer()->palette(); }
|
||||
QPersistentModelIndex currentIndex;
|
||||
QPersistentModelIndex root;
|
||||
QString placeholderText;
|
||||
QRect hoverRect;
|
||||
QSize iconSize;
|
||||
mutable QSize minimumSizeHint;
|
||||
mutable QSize sizeHint;
|
||||
QComboBox::InsertPolicy insertPolicy = QComboBox::InsertAtBottom;
|
||||
QComboBox::SizeAdjustPolicy sizeAdjustPolicy = QComboBox::AdjustToContentsOnFirstShow;
|
||||
QStyle::StateFlag arrowState = QStyle::State_None;
|
||||
QStyle::SubControl hoverControl = QStyle::SC_None;
|
||||
Qt::CaseSensitivity autoCompletionCaseSensitivity = Qt::CaseInsensitive;
|
||||
int minimumContentsLength = 0;
|
||||
int indexBeforeChange = -1;
|
||||
int maxVisibleItems = 10;
|
||||
int maxCount = std::numeric_limits<int>::max();
|
||||
int modelColumn = 0;
|
||||
int placeholderIndex = -1;
|
||||
bool shownOnce : 1;
|
||||
bool autoCompletion : 1;
|
||||
bool duplicatesEnabled : 1;
|
||||
bool frame : 1;
|
||||
bool inserting : 1;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -57,7 +57,7 @@ class Q_WIDGETS_EXPORT QGroupBox : public QWidget
|
||||
Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment)
|
||||
Q_PROPERTY(bool flat READ isFlat WRITE setFlat)
|
||||
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable)
|
||||
Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled USER true)
|
||||
Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled USER true)
|
||||
public:
|
||||
explicit QGroupBox(QWidget *parent = nullptr);
|
||||
explicit QGroupBox(const QString &title, QWidget *parent = nullptr);
|
||||
|
@ -59,15 +59,9 @@ class Q_WIDGETS_EXPORT QToolBar : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(bool movable READ isMovable WRITE setMovable
|
||||
DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) != 0)
|
||||
NOTIFY movableChanged)
|
||||
Q_PROPERTY(Qt::ToolBarAreas allowedAreas READ allowedAreas WRITE setAllowedAreas
|
||||
DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) != 0)
|
||||
NOTIFY allowedAreasChanged)
|
||||
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation
|
||||
DESIGNABLE (qobject_cast<QMainWindow *>(parentWidget()) == 0)
|
||||
NOTIFY orientationChanged)
|
||||
Q_PROPERTY(bool movable READ isMovable WRITE setMovable NOTIFY movableChanged)
|
||||
Q_PROPERTY(Qt::ToolBarAreas allowedAreas READ allowedAreas WRITE setAllowedAreas NOTIFY allowedAreasChanged)
|
||||
Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
|
||||
Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged)
|
||||
Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle
|
||||
NOTIFY toolButtonStyleChanged)
|
||||
|
@ -59,6 +59,7 @@
|
||||
#include <qvariant.h>
|
||||
#include <qshareddata.h>
|
||||
#include <qdebug.h>
|
||||
#include <qxmlstream.h>
|
||||
#include <stdio.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -5734,6 +5735,34 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QDomDocumentPrivate::setContent(QXmlStreamReader *reader, bool namespaceProcessing,
|
||||
QString *errorMsg, int *errorLine, int *errorColumn)
|
||||
{
|
||||
clear();
|
||||
impl = new QDomImplementationPrivate;
|
||||
type = new QDomDocumentTypePrivate(this, this);
|
||||
type->ref.deref();
|
||||
|
||||
if (!reader) {
|
||||
qWarning("Failed to set content, XML reader is not initialized");
|
||||
return false;
|
||||
}
|
||||
|
||||
QDomParser domParser(this, reader, namespaceProcessing);
|
||||
|
||||
if (!domParser.parse()) {
|
||||
if (errorMsg)
|
||||
*errorMsg = std::get<0>(domParser.errorInfo());
|
||||
if (errorLine)
|
||||
*errorLine = std::get<1>(domParser.errorInfo());
|
||||
if (errorColumn)
|
||||
*errorColumn = std::get<2>(domParser.errorInfo());
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QDomNodePrivate* QDomDocumentPrivate::cloneNode(bool deep)
|
||||
{
|
||||
QDomNodePrivate *p = new QDomDocumentPrivate(this, deep);
|
||||
@ -6153,9 +6182,16 @@ bool QDomDocument::setContent(const QString& text, bool namespaceProcessing, QSt
|
||||
{
|
||||
if (!impl)
|
||||
impl = new QDomDocumentPrivate();
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QXmlInputSource source;
|
||||
source.setData(text);
|
||||
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
|
||||
#else
|
||||
QXmlStreamReader streamReader(text);
|
||||
streamReader.setNamespaceProcessing(namespaceProcessing);
|
||||
return IMPL->setContent(&streamReader, namespaceProcessing, errorMsg, errorLine, errorColumn);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -6215,10 +6251,17 @@ bool QDomDocument::setContent(const QByteArray &data, bool namespaceProcessing,
|
||||
{
|
||||
if (!impl)
|
||||
impl = new QDomDocumentPrivate();
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QBuffer buf;
|
||||
buf.setData(data);
|
||||
QXmlInputSource source(&buf);
|
||||
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
|
||||
#else
|
||||
QXmlStreamReader streamReader(data);
|
||||
streamReader.setNamespaceProcessing(namespaceProcessing);
|
||||
return IMPL->setContent(&streamReader, namespaceProcessing, errorMsg, errorLine, errorColumn);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -6231,8 +6274,15 @@ bool QDomDocument::setContent(QIODevice* dev, bool namespaceProcessing, QString
|
||||
{
|
||||
if (!impl)
|
||||
impl = new QDomDocumentPrivate();
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QXmlInputSource source(dev);
|
||||
return IMPL->setContent(&source, namespaceProcessing, errorMsg, errorLine, errorColumn);
|
||||
#else
|
||||
QXmlStreamReader streamReader(dev);
|
||||
streamReader.setNamespaceProcessing(namespaceProcessing);
|
||||
return IMPL->setContent(&streamReader, namespaceProcessing, errorMsg, errorLine, errorColumn);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -6314,6 +6364,33 @@ bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QStri
|
||||
return IMPL->setContent(source, reader, nullptr, errorMsg, errorLine, errorColumn);
|
||||
}
|
||||
|
||||
/*!
|
||||
\overload
|
||||
\since 5.15
|
||||
|
||||
This function reads the XML document from the QXmlStreamReader \a reader
|
||||
and parses it. Returns \c true if the content was successfully parsed;
|
||||
otherwise returns \c false.
|
||||
|
||||
If \a namespaceProcessing is \c true, the parser recognizes namespaces in the XML
|
||||
file and sets the prefix name, local name and namespace URI to appropriate values.
|
||||
If \a namespaceProcessing is \c false, the parser does no namespace processing when
|
||||
it reads the XML file.
|
||||
|
||||
If a parse error occurs, the error message is placed in \c{*}\a{errorMsg}, the line
|
||||
number in \c{*}\a{errorLine} and the column number in \c{*}\a{errorColumn} (unless
|
||||
the associated pointer is set to 0).
|
||||
|
||||
\sa QXmlStreamReader
|
||||
*/
|
||||
bool QDomDocument::setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg,
|
||||
int *errorLine, int *errorColumn)
|
||||
{
|
||||
if (!impl)
|
||||
impl = new QDomDocumentPrivate();
|
||||
return IMPL->setContent(reader, namespaceProcessing, errorMsg, errorLine, errorColumn);
|
||||
}
|
||||
|
||||
/*!
|
||||
Converts the parsed document back to its textual representation.
|
||||
|
||||
|
@ -91,6 +91,7 @@ class QDomNode;
|
||||
class QDomEntity;
|
||||
class QDomNotation;
|
||||
class QDomCharacterData;
|
||||
class QXmlStreamReader;
|
||||
|
||||
class Q_XML_EXPORT QDomImplementation
|
||||
{
|
||||
@ -343,6 +344,8 @@ public:
|
||||
bool setContent(const QString& text, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
|
||||
bool setContent(QIODevice* dev, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
|
||||
bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg=nullptr, int *errorLine=nullptr, int *errorColumn=nullptr );
|
||||
bool setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg = nullptr,
|
||||
int *errorLine = nullptr, int *errorColumn = nullptr);
|
||||
|
||||
// Qt extensions
|
||||
QString toString(int = 1) const;
|
||||
|
@ -465,6 +465,8 @@ public:
|
||||
int *errorLine, int *errorColumn);
|
||||
bool setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader,
|
||||
QString *errorMsg, int *errorLine, int *errorColumn);
|
||||
bool setContent(QXmlStreamReader *reader, bool namespaceProcessing, QString *errorMsg,
|
||||
int *errorLine, int *errorColumn);
|
||||
|
||||
// Attributes
|
||||
QDomDocumentTypePrivate *doctype() { return type.data(); }
|
||||
|
@ -39,6 +39,7 @@
|
||||
|
||||
#include "qdomhelpers_p.h"
|
||||
#include "qdom_p.h"
|
||||
#include "qxmlstream.h"
|
||||
#include "private/qxml_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -166,6 +167,18 @@ QDomBuilder::ErrorInfo QDomHandler::errorInfo() const
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
int QDomDocumentLocator::column() const
|
||||
{
|
||||
Q_ASSERT(reader);
|
||||
return static_cast<int>(reader->columnNumber());
|
||||
}
|
||||
|
||||
int QDomDocumentLocator::line() const
|
||||
{
|
||||
Q_ASSERT(reader);
|
||||
return static_cast<int>(reader->lineNumber());
|
||||
}
|
||||
|
||||
void QSAXDocumentLocator::setLocator(QXmlLocator *l)
|
||||
{
|
||||
locator = l;
|
||||
@ -252,6 +265,44 @@ bool QDomBuilder::startElement(const QString &nsURI, const QString &qName,
|
||||
return true;
|
||||
}
|
||||
|
||||
inline QString stringRefToString(const QStringRef &stringRef)
|
||||
{
|
||||
// Calling QStringRef::toString() on a NULL QStringRef in some cases returns
|
||||
// an empty string (i.e. QString("")) instead of a NULL string (i.e. QString()).
|
||||
// QDom implementation differentiates between NULL and empty strings, so
|
||||
// we need this as workaround to keep the current behavior unchanged.
|
||||
return stringRef.isNull() ? QString() : stringRef.toString();
|
||||
}
|
||||
|
||||
bool QDomBuilder::startElement(const QString &nsURI, const QString &qName,
|
||||
const QXmlStreamAttributes &atts)
|
||||
{
|
||||
QDomNodePrivate *n =
|
||||
nsProcessing ? doc->createElementNS(nsURI, qName) : doc->createElement(qName);
|
||||
if (!n)
|
||||
return false;
|
||||
|
||||
n->setLocation(locator->line(), locator->column());
|
||||
|
||||
node->appendChild(n);
|
||||
node = n;
|
||||
|
||||
// attributes
|
||||
for (const auto &attr : atts) {
|
||||
auto domElement = static_cast<QDomElementPrivate *>(node);
|
||||
if (nsProcessing) {
|
||||
domElement->setAttributeNS(stringRefToString(attr.namespaceUri()),
|
||||
stringRefToString(attr.qualifiedName()),
|
||||
stringRefToString(attr.value()));
|
||||
} else {
|
||||
domElement->setAttribute(stringRefToString(attr.qualifiedName()),
|
||||
stringRefToString(attr.value()));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QDomBuilder::endElement()
|
||||
{
|
||||
if (!node || node == doc)
|
||||
@ -368,4 +419,225 @@ bool QDomBuilder::notationDecl(const QString &name, const QString &publicId,
|
||||
return true;
|
||||
}
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* QDomParser
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
QDomParser::QDomParser(QDomDocumentPrivate *d, QXmlStreamReader *r, bool namespaceProcessing)
|
||||
: reader(r), locator(r), domBuilder(d, &locator, namespaceProcessing)
|
||||
{
|
||||
}
|
||||
|
||||
bool QDomParser::parse()
|
||||
{
|
||||
return parseProlog() && parseBody();
|
||||
}
|
||||
|
||||
QDomBuilder::ErrorInfo QDomParser::errorInfo() const
|
||||
{
|
||||
return domBuilder.error();
|
||||
}
|
||||
|
||||
bool QDomParser::parseProlog()
|
||||
{
|
||||
Q_ASSERT(reader);
|
||||
|
||||
bool foundDtd = false;
|
||||
|
||||
while (!reader->atEnd()) {
|
||||
reader->readNext();
|
||||
|
||||
if (reader->hasError()) {
|
||||
domBuilder.fatalError(reader->errorString());
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (reader->tokenType()) {
|
||||
case QXmlStreamReader::StartDocument:
|
||||
if (!reader->documentVersion().isEmpty()) {
|
||||
QString value(QLatin1String("version='"));
|
||||
value += reader->documentVersion();
|
||||
value += QLatin1Char('\'');
|
||||
if (!reader->documentEncoding().isEmpty()) {
|
||||
value += QLatin1String(" encoding='");
|
||||
value += reader->documentEncoding();
|
||||
value += QLatin1Char('\'');
|
||||
}
|
||||
if (reader->isStandaloneDocument()) {
|
||||
value += QLatin1String(" standalone='yes'");
|
||||
} else {
|
||||
// TODO: Add standalone='no', if 'standalone' is specified. With the current
|
||||
// QXmlStreamReader there is no way to figure out if it was specified or not.
|
||||
// QXmlStreamReader needs to be modified for handling that case correctly.
|
||||
}
|
||||
|
||||
if (!domBuilder.processingInstruction(QLatin1String("xml"), value)) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing XML declaration"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::DTD:
|
||||
if (foundDtd) {
|
||||
domBuilder.fatalError(QDomParser::tr("Multiple DTD sections are not allowed"));
|
||||
return false;
|
||||
}
|
||||
foundDtd = true;
|
||||
|
||||
if (!domBuilder.startDTD(stringRefToString(reader->dtdName()),
|
||||
stringRefToString(reader->dtdPublicId()),
|
||||
stringRefToString(reader->dtdSystemId()))) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing document type declaration"));
|
||||
return false;
|
||||
}
|
||||
if (!parseMarkupDecl())
|
||||
return false;
|
||||
break;
|
||||
case QXmlStreamReader::Comment:
|
||||
if (!domBuilder.comment(reader->text().toString())) {
|
||||
domBuilder.fatalError(QDomParser::tr("Error occurred while processing comment"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::ProcessingInstruction:
|
||||
if (!domBuilder.processingInstruction(reader->processingInstructionTarget().toString(),
|
||||
reader->processingInstructionData().toString())) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing a processing instruction"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// If the token is none of the above, prolog processing is done.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QDomParser::parseBody()
|
||||
{
|
||||
Q_ASSERT(reader);
|
||||
|
||||
std::stack<QStringRef> tagStack;
|
||||
while (!reader->atEnd() && !reader->hasError()) {
|
||||
switch (reader->tokenType()) {
|
||||
case QXmlStreamReader::StartElement:
|
||||
tagStack.push(reader->qualifiedName());
|
||||
if (!domBuilder.startElement(stringRefToString(reader->namespaceUri()),
|
||||
stringRefToString(reader->qualifiedName()),
|
||||
reader->attributes())) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing a start element"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::EndElement:
|
||||
if (tagStack.empty() || reader->qualifiedName() != tagStack.top()) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Unexpected end element '%1'").arg(reader->name()));
|
||||
return false;
|
||||
}
|
||||
tagStack.pop();
|
||||
if (!domBuilder.endElement()) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing an end element"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::Characters:
|
||||
if (!reader->isWhitespace()) { // Skip the content consisting of only whitespaces
|
||||
if (!reader->text().toString().trimmed().isEmpty()) {
|
||||
if (!domBuilder.characters(reader->text().toString(), reader->isCDATA())) {
|
||||
domBuilder.fatalError(QDomParser::tr(
|
||||
"Error occurred while processing the element content"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::Comment:
|
||||
if (!domBuilder.comment(reader->text().toString())) {
|
||||
domBuilder.fatalError(QDomParser::tr("Error occurred while processing comments"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::ProcessingInstruction:
|
||||
if (!domBuilder.processingInstruction(reader->processingInstructionTarget().toString(),
|
||||
reader->processingInstructionData().toString())) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing a processing instruction"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case QXmlStreamReader::EntityReference:
|
||||
if (!domBuilder.skippedEntity(reader->name().toString())) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing an entity reference"));
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
domBuilder.fatalError(QDomParser::tr("Unexpected token"));
|
||||
return false;
|
||||
}
|
||||
|
||||
reader->readNext();
|
||||
}
|
||||
|
||||
if (reader->hasError()) {
|
||||
domBuilder.fatalError(reader->errorString());
|
||||
reader->readNext();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!tagStack.empty()) {
|
||||
domBuilder.fatalError(QDomParser::tr("Tag mismatch"));
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool QDomParser::parseMarkupDecl()
|
||||
{
|
||||
Q_ASSERT(reader);
|
||||
|
||||
const auto entities = reader->entityDeclarations();
|
||||
for (const auto &entityDecl : entities) {
|
||||
// Entity declarations are created only for Extrenal Entities. Internal Entities
|
||||
// are parsed, and QXmlStreamReader handles the parsing itself and returns the
|
||||
// parsed result. So we don't need to do anything for the Internal Entities.
|
||||
if (!entityDecl.publicId().isEmpty() || !entityDecl.systemId().isEmpty()) {
|
||||
// External Entity
|
||||
if (!domBuilder.unparsedEntityDecl(stringRefToString(entityDecl.name()),
|
||||
stringRefToString(entityDecl.publicId()),
|
||||
stringRefToString(entityDecl.systemId()),
|
||||
stringRefToString(entityDecl.notationName()))) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing entity declaration"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const auto notations = reader->notationDeclarations();
|
||||
for (const auto ¬ationDecl : notations) {
|
||||
if (!domBuilder.notationDecl(stringRefToString(notationDecl.name()),
|
||||
stringRefToString(notationDecl.publicId()),
|
||||
stringRefToString(notationDecl.systemId()))) {
|
||||
domBuilder.fatalError(
|
||||
QDomParser::tr("Error occurred while processing notation declaration"));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -39,6 +39,7 @@
|
||||
#ifndef QDOMHELPERS_P_H
|
||||
#define QDOMHELPERS_P_H
|
||||
|
||||
#include <qcoreapplication.h>
|
||||
#include <qglobal.h>
|
||||
#include <qxml.h>
|
||||
|
||||
@ -57,6 +58,8 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
class QDomDocumentPrivate;
|
||||
class QDomNodePrivate;
|
||||
class QXmlStreamReader;
|
||||
class QXmlStreamAttributes;
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
@ -77,6 +80,19 @@ public:
|
||||
virtual int line() const = 0;
|
||||
};
|
||||
|
||||
class QDomDocumentLocator : public QXmlDocumentLocator
|
||||
{
|
||||
public:
|
||||
QDomDocumentLocator(QXmlStreamReader *r) : reader(r) {}
|
||||
~QDomDocumentLocator() override = default;
|
||||
|
||||
int column() const override;
|
||||
int line() const override;
|
||||
|
||||
private:
|
||||
QXmlStreamReader *reader;
|
||||
};
|
||||
|
||||
class QSAXDocumentLocator : public QXmlDocumentLocator
|
||||
{
|
||||
public:
|
||||
@ -105,6 +121,7 @@ public:
|
||||
|
||||
bool endDocument();
|
||||
bool startElement(const QString &nsURI, const QString &qName, const QXmlAttributes &atts);
|
||||
bool startElement(const QString &nsURI, const QString &qName, const QXmlStreamAttributes &atts);
|
||||
bool endElement();
|
||||
bool characters(const QString &characters, bool cdata = false);
|
||||
bool processingInstruction(const QString &target, const QString &data);
|
||||
@ -188,6 +205,31 @@ private:
|
||||
QDomBuilder domBuilder;
|
||||
};
|
||||
|
||||
/**************************************************************
|
||||
*
|
||||
* QDomParser
|
||||
*
|
||||
**************************************************************/
|
||||
|
||||
class QDomParser
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(QDomParser)
|
||||
public:
|
||||
QDomParser(QDomDocumentPrivate *d, QXmlStreamReader *r, bool namespaceProcessing);
|
||||
|
||||
bool parse();
|
||||
QDomBuilder::ErrorInfo errorInfo() const;
|
||||
|
||||
private:
|
||||
bool parseProlog();
|
||||
bool parseBody();
|
||||
bool parseMarkupDecl();
|
||||
|
||||
QXmlStreamReader *reader;
|
||||
QDomDocumentLocator locator;
|
||||
QDomBuilder domBuilder;
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QDOMHELPERS_P_H
|
||||
|
@ -528,7 +528,7 @@ void tst_QDir::removeRecursivelyFailure()
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
QFile dirAsFile(path); // yay, I have to use QFile to change a dir's permissions...
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions(0))); // no permissions
|
||||
QVERIFY(dirAsFile.setPermissions({})); // no permissions
|
||||
|
||||
QVERIFY(!QDir().rmdir(path));
|
||||
QDir dir(path);
|
||||
|
@ -236,7 +236,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
QTest::addColumn<QStringList>("entries");
|
||||
|
||||
QTest::newRow("no flags")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/.,"
|
||||
@ -252,7 +252,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("NoDot")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDot) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/..,"
|
||||
@ -267,7 +267,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("NoDotDot")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDotDot) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/.,"
|
||||
@ -282,7 +282,7 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("NoDotAndDotDot")
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::AllEntries | QDir::NoDotAndDotDot) << QStringList("*")
|
||||
<< QString(
|
||||
"entrylist/file,"
|
||||
@ -335,12 +335,12 @@ void tst_QDirIterator::iterateRelativeDirectory_data()
|
||||
"entrylist/writable").split(',');
|
||||
|
||||
QTest::newRow("empty, default")
|
||||
<< QString("empty") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("empty") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList("*")
|
||||
<< QString("empty/.,empty/..").split(',');
|
||||
|
||||
QTest::newRow("empty, QDir::NoDotAndDotDot")
|
||||
<< QString("empty") << QDirIterator::IteratorFlags(0)
|
||||
<< QString("empty") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoDotAndDotDot) << QStringList("*")
|
||||
<< QStringList();
|
||||
}
|
||||
@ -399,13 +399,13 @@ void tst_QDirIterator::iterateResource_data()
|
||||
QTest::addColumn<QStringList>("nameFilters");
|
||||
QTest::addColumn<QStringList>("entries");
|
||||
|
||||
QTest::newRow("invalid") << QString::fromLatin1(":/testdata/burpaburpa") << QDirIterator::IteratorFlags(0)
|
||||
QTest::newRow("invalid") << QString::fromLatin1(":/testdata/burpaburpa") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList(QLatin1String("*"))
|
||||
<< QStringList();
|
||||
QTest::newRow(":/testdata") << QString::fromLatin1(":/testdata/") << QDirIterator::IteratorFlags(0)
|
||||
QTest::newRow(":/testdata") << QString::fromLatin1(":/testdata/") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList(QLatin1String("*"))
|
||||
<< QString::fromLatin1(":/testdata/entrylist").split(QLatin1String(","));
|
||||
QTest::newRow(":/testdata/entrylist") << QString::fromLatin1(":/testdata/entrylist") << QDirIterator::IteratorFlags(0)
|
||||
QTest::newRow(":/testdata/entrylist") << QString::fromLatin1(":/testdata/entrylist") << QDirIterator::IteratorFlags{}
|
||||
<< QDir::Filters(QDir::NoFilter) << QStringList(QLatin1String("*"))
|
||||
<< QString::fromLatin1(":/testdata/entrylist/directory,:/testdata/entrylist/file").split(QLatin1String(","));
|
||||
QTest::newRow(":/testdata recursive") << QString::fromLatin1(":/testdata") << QDirIterator::IteratorFlags(QDirIterator::Subdirectories)
|
||||
|
@ -444,7 +444,7 @@ void tst_QLockFile::noPermissions()
|
||||
|
||||
const QString fileName = dir.path() + "/staleLock";
|
||||
QFile dirAsFile(dir.path()); // I have to use QFile to change a dir's permissions...
|
||||
QVERIFY2(dirAsFile.setPermissions(QFile::Permissions(0)), qPrintable(dir.path())); // no permissions
|
||||
QVERIFY2(dirAsFile.setPermissions(QFile::Permissions{}), qPrintable(dir.path())); // no permissions
|
||||
PermissionRestorer permissionRestorer(dir.path());
|
||||
|
||||
QLockFile lockFile(fileName);
|
||||
|
@ -356,7 +356,7 @@ void tst_QSaveFile::transactionalWriteErrorRenaming()
|
||||
#ifdef Q_OS_UNIX
|
||||
// Make rename() fail for lack of permissions in the directory
|
||||
QFile dirAsFile(dir.path()); // yay, I have to use QFile to change a dir's permissions...
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions(0))); // no permissions
|
||||
QVERIFY(dirAsFile.setPermissions(QFile::Permissions{})); // no permissions
|
||||
PermissionRestorer permissionRestorer(dir.path());
|
||||
#else
|
||||
// Windows: Make rename() fail for lack of permissions on an existing target file
|
||||
|
@ -136,7 +136,7 @@ void tst_QAbstractProxyModel::flags_data()
|
||||
{
|
||||
QTest::addColumn<QModelIndex>("index");
|
||||
QTest::addColumn<Qt::ItemFlags>("flags");
|
||||
QTest::newRow("null") << QModelIndex() << (Qt::ItemFlags)0;
|
||||
QTest::newRow("null") << QModelIndex() << Qt::ItemFlags{};
|
||||
}
|
||||
|
||||
// public Qt::ItemFlags flags(QModelIndex const& index) const
|
||||
|
@ -243,7 +243,7 @@ void tst_QPluginLoader::loadHints()
|
||||
QSKIP("This test requires Qt to create shared libraries.");
|
||||
#endif
|
||||
QPluginLoader loader;
|
||||
QCOMPARE(loader.loadHints(), (QLibrary::LoadHints)0); //Do not crash
|
||||
QCOMPARE(loader.loadHints(), QLibrary::LoadHints{}); //Do not crash
|
||||
loader.setLoadHints(QLibrary::ResolveAllSymbolsHint);
|
||||
loader.setFileName( sys_qualifiedLibraryName("theplugin")); //a plugin
|
||||
QCOMPARE(loader.loadHints(), QLibrary::ResolveAllSymbolsHint);
|
||||
|
@ -365,22 +365,22 @@ void tst_QRegularExpression::provideRegularExpressions()
|
||||
QTest::addColumn<QRegularExpression::PatternOptions>("patternOptions");
|
||||
|
||||
QTest::newRow("emptynull01") << QString()
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("emptynull02") << QString()
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
| QRegularExpression::MultilineOption);
|
||||
QTest::newRow("emptynull03") << ""
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("emptynull04") << ""
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
| QRegularExpression::MultilineOption);
|
||||
|
||||
QTest::newRow("regexp01") << "a pattern"
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("regexp02") << "^a (.*) more complicated(?<P>pattern)$"
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("regexp03") << "(?:a) pAttErN"
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption);
|
||||
QTest::newRow("regexp04") << "a\nmultiline\npattern"
|
||||
@ -397,13 +397,13 @@ void tst_QRegularExpression::provideRegularExpressions()
|
||||
| QRegularExpression::InvertedGreedinessOption);
|
||||
|
||||
QTest::newRow("unicode01") << QString::fromUtf8("^s[ome] latin-1 \xc3\x80\xc3\x88\xc3\x8c\xc3\x92\xc3\x99 chars$")
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("unicode02") << QString::fromUtf8("^s[ome] latin-1 \xc3\x80\xc3\x88\xc3\x8c\xc3\x92\xc3\x99 chars$")
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
| QRegularExpression::InvertedGreedinessOption);
|
||||
QTest::newRow("unicode03") << QString::fromUtf8("Unicode \xf0\x9d\x85\x9d \xf0\x9d\x85\x9e\xf0\x9d\x85\x9f")
|
||||
<< QRegularExpression::PatternOptions(0);
|
||||
<< QRegularExpression::PatternOptions{};
|
||||
QTest::newRow("unicode04") << QString::fromUtf8("Unicode \xf0\x9d\x85\x9d \xf0\x9d\x85\x9e\xf0\x9d\x85\x9f")
|
||||
<< QRegularExpression::PatternOptions(QRegularExpression::CaseInsensitiveOption
|
||||
| QRegularExpression::DotMatchesEverythingOption
|
||||
|
@ -1739,7 +1739,7 @@ void tst_QPainter::renderHints()
|
||||
|
||||
// Turn off all...
|
||||
p.setRenderHints(QPainter::RenderHints(0xffffffff), false);
|
||||
QCOMPARE(p.renderHints(), QPainter::RenderHints(0));
|
||||
QCOMPARE(p.renderHints(), QPainter::RenderHints{});
|
||||
|
||||
// Single set/get
|
||||
p.setRenderHint(QPainter::Antialiasing);
|
||||
|
@ -1793,6 +1793,12 @@ void tst_QTextDocument::toHtml()
|
||||
QCOMPARE(output, expectedOutput);
|
||||
|
||||
QDomDocument document;
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
QEXPECT_FAIL("charfmt-for-list-item",
|
||||
"The attribute \"style\" is redefined in the generated HTML, which is not valid "
|
||||
"according to XML standard. The new QDomDocument implementation follows the XML "
|
||||
"standard.", Continue);
|
||||
#endif
|
||||
QVERIFY2(document.setContent(output), "Output was not valid XML");
|
||||
}
|
||||
|
||||
|
@ -302,7 +302,7 @@ static void netChat(int port, const QList<Chat> &chat)
|
||||
if (it + 1 != chat.constEnd())
|
||||
break;
|
||||
|
||||
// fall through:
|
||||
Q_FALLTHROUGH();
|
||||
case Chat::RemoteDisconnect:
|
||||
case Chat::DiscardUntilDisconnect:
|
||||
qDebug() << i << "Waiting for remote disconnect";
|
||||
|
@ -571,14 +571,15 @@ void tst_QFileDialog2::task227304_proxyOnFileDialog()
|
||||
dialog->close();
|
||||
fd.close();
|
||||
|
||||
QFileDialog fd2(0, "I should not crash with a proxy", tempDir.path(), 0);
|
||||
QFileDialog fd2(0, "I should not crash with a proxy", tempDir.path(), {});
|
||||
QSortFilterProxyModel *pm = new QSortFilterProxyModel;
|
||||
fd2.setProxyModel(pm);
|
||||
fd2.show();
|
||||
QSidebar *sidebar = fd2.findChild<QSidebar*>("sidebar");
|
||||
sidebar->setFocus();
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
QTest::qWait(250);
|
||||
//We shouldn't crash
|
||||
}
|
||||
@ -613,7 +614,7 @@ void tst_QFileDialog2::task227930_correctNavigationKeyboardBehavior()
|
||||
QVERIFY(list);
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
QTest::keyClick(list, Qt::Key_Return);
|
||||
QTest::mouseClick(list->viewport(), Qt::LeftButton,0);
|
||||
QTest::mouseClick(list->viewport(), Qt::LeftButton, {});
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
QTest::keyClick(list, Qt::Key_Backspace);
|
||||
QTest::keyClick(list, Qt::Key_Down);
|
||||
@ -972,7 +973,8 @@ void tst_QFileDialog2::task251321_sideBarHiddenEntries()
|
||||
QVERIFY(sidebar);
|
||||
sidebar->setFocus();
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
// give the background processes more time on windows mobile
|
||||
QTest::qWait(250);
|
||||
|
||||
@ -1027,7 +1029,8 @@ void tst_QFileDialog2::task251341_sideBarRemoveEntries()
|
||||
sidebar->setFocus();
|
||||
//We enter in the first bookmark
|
||||
sidebar->selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(0, 0)).center());
|
||||
|
||||
QFileSystemModel *model = fd.findChild<QFileSystemModel*>("qt_filesystem_model");
|
||||
QVERIFY(model);
|
||||
@ -1040,7 +1043,8 @@ void tst_QFileDialog2::task251341_sideBarRemoveEntries()
|
||||
sidebar->setFocus();
|
||||
//We enter in the second bookmark which is invalid
|
||||
sidebar->selectUrl(QUrl::fromLocalFile("NotFound"));
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, {},
|
||||
sidebar->visualRect(sidebar->model()->index(1, 0)).center());
|
||||
|
||||
//We fallback to root because the entry in the bookmark is invalid
|
||||
QCOMPARE(model->rowCount(model->index("NotFound")), model->rowCount(model->index(model->rootPath())));
|
||||
|
@ -190,7 +190,8 @@ void tst_QSidebar::goToUrl()
|
||||
qsidebar.show();
|
||||
|
||||
QSignalSpy spy(&qsidebar, SIGNAL(goToUrl(QUrl)));
|
||||
QTest::mousePress(qsidebar.viewport(), Qt::LeftButton, 0, qsidebar.visualRect(qsidebar.model()->index(0, 0)).center());
|
||||
QTest::mousePress(qsidebar.viewport(), Qt::LeftButton, {},
|
||||
qsidebar.visualRect(qsidebar.model()->index(0, 0)).center());
|
||||
#ifdef Q_OS_WINRT
|
||||
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
|
||||
#endif
|
||||
|
@ -238,7 +238,7 @@ void tst_QWizard::setButtonLayout()
|
||||
|
||||
QWizard wizard;
|
||||
wizard.setWizardStyle(QWizard::ClassicStyle);
|
||||
wizard.setOptions(0);
|
||||
wizard.setOptions({});
|
||||
wizard.setButtonLayout(layout);
|
||||
wizard.show();
|
||||
qApp->processEvents();
|
||||
|
@ -159,12 +159,7 @@ public:
|
||||
struct ItemDesc
|
||||
{
|
||||
ItemDesc(int row, int col)
|
||||
: m_pos(qMakePair(row, col)),
|
||||
m_rowSpan(1),
|
||||
m_colSpan(1),
|
||||
m_sizePolicy(QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred)),
|
||||
m_align(0),
|
||||
m_fnConstraint(0)
|
||||
: m_pos(qMakePair(row, col))
|
||||
{
|
||||
}
|
||||
|
||||
@ -278,17 +273,17 @@ struct ItemDesc
|
||||
|
||||
//private:
|
||||
QPair<int,int> m_pos; // row,col
|
||||
int m_rowSpan;
|
||||
int m_colSpan;
|
||||
QSizePolicy m_sizePolicy;
|
||||
int m_rowSpan = 1;
|
||||
int m_colSpan = 1;
|
||||
QSizePolicy m_sizePolicy{QSizePolicy::Preferred, QSizePolicy::Preferred};
|
||||
|
||||
// Initializer {} is a workaround for gcc bug 68949
|
||||
QSizeF m_sizeHints[Qt::NSizeHints] {};
|
||||
QSizeF m_sizes[Qt::NSizeHints] {};
|
||||
Qt::Alignment m_align;
|
||||
|
||||
Qt::Orientation m_constraintOrientation;
|
||||
QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &);
|
||||
Qt::Orientation m_constraintOrientation = Qt::Horizontal;
|
||||
QSizeF (*m_fnConstraint)(Qt::SizeHint, const QSizeF &) = nullptr;
|
||||
};
|
||||
|
||||
typedef QList<ItemDesc> ItemList;
|
||||
|
@ -245,7 +245,7 @@ void tst_QGraphicsLinearLayout::alignment()
|
||||
widget->setLayout(&layout);
|
||||
|
||||
static const Qt::Alignment alignmentsToTest[] = {
|
||||
(Qt::Alignment)0,
|
||||
Qt::Alignment{},
|
||||
Qt::AlignLeft,
|
||||
Qt::AlignRight,
|
||||
Qt::AlignHCenter,
|
||||
@ -253,7 +253,7 @@ void tst_QGraphicsLinearLayout::alignment()
|
||||
Qt::AlignBottom,
|
||||
Qt::AlignVCenter,
|
||||
Qt::AlignCenter,
|
||||
(Qt::Alignment)0,
|
||||
Qt::Alignment{},
|
||||
Qt::AlignLeft,
|
||||
Qt::AlignRight,
|
||||
Qt::AlignHCenter,
|
||||
|
@ -81,21 +81,21 @@ Q_DECLARE_METATYPE(ScrollBarCount)
|
||||
|
||||
static void sendMousePress(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::LeftButton)
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseButtonPress, point, widget->mapToGlobal(point), button, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseButtonPress, point, widget->mapToGlobal(point), button, {}, {});
|
||||
QApplication::sendEvent(widget, &event);
|
||||
}
|
||||
|
||||
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = 0)
|
||||
static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton, Qt::MouseButtons buttons = {})
|
||||
{
|
||||
QTest::mouseMove(widget, point);
|
||||
QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, buttons, 0);
|
||||
QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, buttons, {});
|
||||
QApplication::sendEvent(widget, &event);
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
static void sendMouseRelease(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::LeftButton)
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseButtonRelease, point, widget->mapToGlobal(point), button, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseButtonRelease, point, widget->mapToGlobal(point), button, {}, {});
|
||||
QApplication::sendEvent(widget, &event);
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ void tst_QGraphicsView::renderHints()
|
||||
QCOMPARE(view.renderHints(), QPainter::TextAntialiasing);
|
||||
view.setRenderHint(QPainter::Antialiasing);
|
||||
QCOMPARE(view.renderHints(), QPainter::TextAntialiasing | QPainter::Antialiasing);
|
||||
view.setRenderHints(0);
|
||||
view.setRenderHints({});
|
||||
QCOMPARE(view.renderHints(), 0);
|
||||
|
||||
TestItem *item = new TestItem;
|
||||
@ -380,7 +380,7 @@ void tst_QGraphicsView::alignment()
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
for (int j = 0; j < 3; ++j) {
|
||||
Qt::Alignment alignment = 0;
|
||||
Qt::Alignment alignment;
|
||||
switch (i) {
|
||||
case 0:
|
||||
alignment |= Qt::AlignLeft;
|
||||
@ -740,7 +740,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Press
|
||||
QMouseEvent event(QEvent::MouseButtonPress,
|
||||
view.viewport()->rect().center(),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -757,7 +757,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(10, 0),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -769,7 +769,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -783,7 +783,7 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Release
|
||||
QMouseEvent event(QEvent::MouseButtonRelease,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -805,14 +805,14 @@ void tst_QGraphicsView::dragMode_scrollHand()
|
||||
// Press
|
||||
QMouseEvent event(QEvent::MouseButtonPress,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
{
|
||||
// Release
|
||||
QMouseEvent event(QEvent::MouseButtonRelease,
|
||||
view.viewport()->rect().center() + QPoint(10, 10),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
|
||||
@ -862,7 +862,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Press
|
||||
QMouseEvent event(QEvent::MouseButtonPress,
|
||||
view.viewport()->rect().center(),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -877,7 +877,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(100, 0),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -892,7 +892,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Move
|
||||
QMouseEvent event(QEvent::MouseMove,
|
||||
view.viewport()->rect().center() + QPoint(100, 100),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -904,7 +904,7 @@ void tst_QGraphicsView::dragMode_rubberBand()
|
||||
// Release
|
||||
QMouseEvent event(QEvent::MouseButtonRelease,
|
||||
view.viewport()->rect().center() + QPoint(100, 100),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
event.setAccepted(true);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QVERIFY(event.isAccepted());
|
||||
@ -1009,7 +1009,8 @@ void tst_QGraphicsView::rubberBandExtendSelection()
|
||||
// now rubberband with modifier key
|
||||
{
|
||||
QPoint clickPoint = view.mapFromScene(20, 115);
|
||||
QMouseEvent event(QEvent::MouseButtonPress, clickPoint, view.viewport()->mapToGlobal(clickPoint), Qt::LeftButton, 0, Qt::ControlModifier);
|
||||
QMouseEvent event(QEvent::MouseButtonPress, clickPoint, view.viewport()->mapToGlobal(clickPoint),
|
||||
Qt::LeftButton, {}, Qt::ControlModifier);
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
sendMouseMove(view.viewport(), view.mapFromScene(20, 300), Qt::LeftButton, Qt::LeftButton);
|
||||
@ -2162,14 +2163,14 @@ void tst_QGraphicsView::sendEvent()
|
||||
QCOMPARE(item->events.at(item->events.size() - 1), QEvent::GraphicsSceneMousePress);
|
||||
|
||||
QMouseEvent mouseMoveEvent(QEvent::MouseMove, itemPoint, view.viewport()->mapToGlobal(itemPoint),
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(view.viewport(), &mouseMoveEvent);
|
||||
QCOMPARE(item->events.size(), 5);
|
||||
QCOMPARE(item->events.last(), QEvent::GraphicsSceneMouseMove);
|
||||
|
||||
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, itemPoint,
|
||||
view.viewport()->mapToGlobal(itemPoint),
|
||||
Qt::LeftButton, 0, 0);
|
||||
Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &mouseReleaseEvent);
|
||||
QCOMPARE(item->events.size(), 7);
|
||||
QCOMPARE(item->events.at(item->events.size() - 2), QEvent::GraphicsSceneMouseRelease);
|
||||
@ -3283,7 +3284,7 @@ void tst_QGraphicsView::task186827_deleteReplayedItem()
|
||||
|
||||
QCOMPARE(view.mouseMoves, 0);
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
QCOMPARE(view.mouseMoves, 1);
|
||||
@ -3291,7 +3292,7 @@ void tst_QGraphicsView::task186827_deleteReplayedItem()
|
||||
QTRY_COMPARE(view.mouseMoves, 1);
|
||||
QTest::qWait(25);
|
||||
{
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, 0, 0);
|
||||
QMouseEvent event(QEvent::MouseMove, view.mapFromScene(25, 25), Qt::NoButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
}
|
||||
QCOMPARE(view.mouseMoves, 2);
|
||||
@ -3337,8 +3338,8 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
|
||||
// Enable and do a drag
|
||||
{
|
||||
view.setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
QMouseEvent press(QEvent::MouseButtonPress, origPos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent move(QEvent::MouseMove, step1Pos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent press(QEvent::MouseButtonPress, origPos, Qt::LeftButton, {}, {});
|
||||
QMouseEvent move(QEvent::MouseMove, step1Pos, Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &press);
|
||||
QApplication::sendEvent(view.viewport(), &move);
|
||||
}
|
||||
@ -3346,7 +3347,7 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
|
||||
// unset drag and release mouse, inverse order
|
||||
{
|
||||
view.setDragMode(QGraphicsView::NoDrag);
|
||||
QMouseEvent release(QEvent::MouseButtonRelease, step1Pos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent release(QEvent::MouseButtonRelease, step1Pos, Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &release);
|
||||
}
|
||||
|
||||
@ -3355,7 +3356,7 @@ void tst_QGraphicsView::task210599_unsetDragWhileDragging()
|
||||
// reset drag, and move mouse without holding button down.
|
||||
{
|
||||
view.setDragMode(QGraphicsView::ScrollHandDrag);
|
||||
QMouseEvent move(QEvent::MouseMove, step2Pos, Qt::LeftButton, 0, 0);
|
||||
QMouseEvent move(QEvent::MouseMove, step2Pos, Qt::LeftButton, {}, {});
|
||||
QApplication::sendEvent(view.viewport(), &move);
|
||||
}
|
||||
|
||||
@ -3806,7 +3807,7 @@ void tst_QGraphicsView::mouseTracking2()
|
||||
EventSpy spy(&scene, QEvent::GraphicsSceneMouseMove);
|
||||
QCOMPARE(spy.count(), 0);
|
||||
QMouseEvent event(QEvent::MouseMove,view.viewport()->rect().center(), Qt::NoButton,
|
||||
Qt::MouseButtons(Qt::NoButton), 0);
|
||||
Qt::MouseButtons(Qt::NoButton), {});
|
||||
QApplication::sendEvent(view.viewport(), &event);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
}
|
||||
|
@ -1299,7 +1299,7 @@ void tst_QTableView::moveCursorStrikesBack()
|
||||
int newRow = -1;
|
||||
int newColumn = -1;
|
||||
for (auto cursorMoveAction : cursorMoveActions) {
|
||||
QModelIndex newIndex = view.moveCursor(cursorMoveAction, nullptr);
|
||||
QModelIndex newIndex = view.moveCursor(cursorMoveAction, {});
|
||||
view.setCurrentIndex(newIndex);
|
||||
newRow = newIndex.row();
|
||||
newColumn = newIndex.column();
|
||||
|
@ -4918,7 +4918,7 @@ void tst_QTreeView::taskQTBUG_61476()
|
||||
QEvent::MouseButtonPress)
|
||||
QTRY_VERIFY(!tv.isExpanded(mi));
|
||||
|
||||
QTest::mouseRelease(tv.viewport(), Qt::LeftButton, nullptr, pos);
|
||||
QTest::mouseRelease(tv.viewport(), Qt::LeftButton, {}, pos);
|
||||
QTRY_VERIFY(!tv.isExpanded(mi));
|
||||
QCOMPARE(lastTopLevel->checkState(), Qt::Checked);
|
||||
}
|
||||
|
@ -415,7 +415,7 @@ public:
|
||||
QSize minimumSize() const { return QSize(m_descr.minimumSize, 0); }
|
||||
QSize maximumSize() const { return QSize(m_descr.maximumSize, QLAYOUTSIZE_MAX); }
|
||||
Qt::Orientations expandingDirections() const
|
||||
{ return m_descr.expanding ? Qt::Horizontal : Qt::Orientations(0); }
|
||||
{ return m_descr.expanding ? Qt::Horizontal : Qt::Orientations{}; }
|
||||
void setGeometry(const QRect &r) { m_pos = r.x(); m_size = r.width();}
|
||||
QRect geometry() const { return QRect(m_pos, 0, m_size, 100); }
|
||||
bool isEmpty() const { return m_descr.empty; }
|
||||
|
@ -163,7 +163,7 @@ void tst_QLayout::smartMaxSize()
|
||||
QSizePolicy::MinimumExpanding,
|
||||
QSizePolicy::Ignored
|
||||
};
|
||||
Qt::Alignment alignments[] = { 0,
|
||||
Qt::Alignment alignments[] = { Qt::Alignment{},
|
||||
Qt::AlignLeft,
|
||||
Qt::AlignRight,
|
||||
Qt::AlignHCenter
|
||||
|
@ -845,12 +845,12 @@ void tst_QWidget_window::tst_dnd_propagation()
|
||||
auto posInsideLabel = QHighDpi::toNativePixels(QPoint(60, 60), window->screen());
|
||||
|
||||
// Enter DropTarget.
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideDropTarget, supportedActions, 0, 0);
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideDropTarget, supportedActions, {}, {});
|
||||
// Enter QLabel. This will propagate because default QLabel does
|
||||
// not accept the drop event in dragEnterEvent().
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideLabel, supportedActions, 0, 0);
|
||||
QWindowSystemInterface::handleDrag(window, &mimeData, posInsideLabel, supportedActions, {}, {});
|
||||
// Drop on QLabel. DropTarget will get dropEvent(), because it accepted the event.
|
||||
QWindowSystemInterface::handleDrop(window, &mimeData, posInsideLabel, supportedActions, 0, 0);
|
||||
QWindowSystemInterface::handleDrop(window, &mimeData, posInsideLabel, supportedActions, {}, {});
|
||||
|
||||
QGuiApplication::processEvents();
|
||||
|
||||
|
@ -1836,9 +1836,10 @@ void tst_QAbstractSlider::sliderPressedReleased()
|
||||
if (qApp->style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition))
|
||||
QSKIP("The result depends on system setting on mac");
|
||||
|
||||
QTest::mousePress(slider, Qt::LeftButton, 0, QPoint(rect.center().x() + 2, rect.center().y() + 2));
|
||||
QTest::mousePress(slider, Qt::LeftButton, {},
|
||||
QPoint(rect.center().x() + 2, rect.center().y() + 2));
|
||||
QCOMPARE(spy1.count(), expectedCount);
|
||||
QTest::mouseRelease(slider, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseRelease(slider, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(spy2.count(), expectedCount);
|
||||
|
||||
delete slider;
|
||||
|
@ -837,16 +837,16 @@ void tst_QComboBox::virtualAutocompletion()
|
||||
// well, and send a keypress & keyrelease right after each other.
|
||||
// This provokes the actual error, as there's no events in between to do
|
||||
// the text completion.
|
||||
QKeyEvent kp1(QEvent::KeyPress, Qt::Key_B, 0, "b");
|
||||
QKeyEvent kr1(QEvent::KeyRelease, Qt::Key_B, 0, "b");
|
||||
QKeyEvent kp1(QEvent::KeyPress, Qt::Key_B, {}, "b");
|
||||
QKeyEvent kr1(QEvent::KeyRelease, Qt::Key_B, {}, "b");
|
||||
QApplication::sendEvent(testWidget, &kp1);
|
||||
QApplication::sendEvent(testWidget, &kr1);
|
||||
|
||||
qApp->processEvents(); // Process events to trigger autocompletion
|
||||
QTRY_COMPARE(testWidget->currentIndex(), 1);
|
||||
|
||||
QKeyEvent kp2(QEvent::KeyPress, Qt::Key_O, 0, "o");
|
||||
QKeyEvent kr2(QEvent::KeyRelease, Qt::Key_O, 0, "o");
|
||||
QKeyEvent kp2(QEvent::KeyPress, Qt::Key_O, {}, "o");
|
||||
QKeyEvent kr2(QEvent::KeyRelease, Qt::Key_O, {}, "o");
|
||||
|
||||
QApplication::sendEvent(testWidget, &kp2);
|
||||
QApplication::sendEvent(testWidget, &kr2);
|
||||
@ -1722,7 +1722,7 @@ void tst_QComboBox::setCustomModelAndView()
|
||||
// why this happens.
|
||||
QTest::qWait(QApplication::doubleClickInterval());
|
||||
|
||||
QTest::mouseClick(window->windowHandle(), Qt::LeftButton, 0, view->mapTo(window, subItemRect.center()));
|
||||
QTest::mouseClick(window->windowHandle(), Qt::LeftButton, {}, view->mapTo(window, subItemRect.center()));
|
||||
#ifdef Q_OS_WINRT
|
||||
QEXPECT_FAIL("", "Fails on WinRT - QTBUG-68297", Abort);
|
||||
#endif
|
||||
|
@ -2303,7 +2303,7 @@ void tst_QDateTimeEdit::mousePress()
|
||||
QRect rectUp = testWidget->style()->subControlRect(QStyle::CC_SpinBox, &so, QStyle::SC_SpinBoxUp, testWidget);
|
||||
|
||||
// Send mouseClick to center of SC_SpinBoxUp
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, 0, rectUp.center());
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, {}, rectUp.center());
|
||||
QCOMPARE(testWidget->date().year(), 2005);
|
||||
}
|
||||
|
||||
@ -2916,7 +2916,8 @@ void tst_QDateTimeEdit::calendarPopup()
|
||||
opt.editable = true;
|
||||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
QRect rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, testWidget);
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QTest::mouseClick(testWidget, Qt::LeftButton, {},
|
||||
QPoint(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2));
|
||||
QWidget *wid = testWidget->findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(wid != 0);
|
||||
testWidget->hide();
|
||||
@ -2928,7 +2929,8 @@ void tst_QDateTimeEdit::calendarPopup()
|
||||
opt.initFrom(&timeEdit);
|
||||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &timeEdit);
|
||||
QTest::mouseClick(&timeEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QTest::mouseClick(&timeEdit, Qt::LeftButton, {},
|
||||
QPoint(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2));
|
||||
QWidget *wid2 = timeEdit.findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(!wid2);
|
||||
timeEdit.hide();
|
||||
@ -2942,7 +2944,8 @@ void tst_QDateTimeEdit::calendarPopup()
|
||||
opt.initFrom(&dateEdit);
|
||||
opt.subControls = QStyle::SC_ComboBoxArrow;
|
||||
rect = style->subControlRect(QStyle::CC_ComboBox, &opt, QStyle::SC_ComboBoxArrow, &dateEdit);
|
||||
QTest::mouseClick(&dateEdit, Qt::LeftButton, 0, QPoint(rect.left()+rect.width()/2, rect.top()+rect.height()/2));
|
||||
QTest::mouseClick(&dateEdit, Qt::LeftButton, {},
|
||||
QPoint(rect.left() + rect.width() / 2, rect.top() + rect.height() / 2));
|
||||
QWidget *wid3 = dateEdit.findChild<QWidget *>("qt_datetimedit_calendar");
|
||||
QVERIFY(!wid3);
|
||||
dateEdit.hide();
|
||||
|
@ -98,7 +98,7 @@ void tst_QDial::sliderMoved()
|
||||
QPoint init(dial.width()/4, dial.height()/2);
|
||||
|
||||
QMouseEvent pressevent(QEvent::MouseButtonPress, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &pressevent);
|
||||
|
||||
QSignalSpy sliderspy(&dial, SIGNAL(sliderMoved(int)));
|
||||
@ -108,7 +108,7 @@ void tst_QDial::sliderMoved()
|
||||
{ //move on top of the slider
|
||||
init = QPoint(dial.width()/2, dial.height()/4);
|
||||
QMouseEvent moveevent(QEvent::MouseMove, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &moveevent);
|
||||
QCOMPARE( sliderspy.count(), 1);
|
||||
QCOMPARE( valuespy.count(), 0);
|
||||
@ -118,14 +118,14 @@ void tst_QDial::sliderMoved()
|
||||
{ //move on the right of the slider
|
||||
init = QPoint(dial.width()*3/4, dial.height()/2);
|
||||
QMouseEvent moveevent(QEvent::MouseMove, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &moveevent);
|
||||
QCOMPARE( sliderspy.count(), 2);
|
||||
QCOMPARE( valuespy.count(), 0);
|
||||
}
|
||||
|
||||
QMouseEvent releaseevent(QEvent::MouseButtonRelease, init,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
qApp->sendEvent(&dial, &releaseevent);
|
||||
QCOMPARE( valuespy.count(), 1); // valuechanged signal should be called at this point
|
||||
|
||||
|
@ -163,7 +163,7 @@ void tst_QDialogButtonBox::testConstructor3_data()
|
||||
QTest::addColumn<QDialogButtonBox::StandardButtons>("buttons");
|
||||
QTest::addColumn<int>("buttonCount");
|
||||
|
||||
QTest::newRow("nothing") << int(Qt::Horizontal) << (QDialogButtonBox::StandardButtons)0 << 0;
|
||||
QTest::newRow("nothing") << int(Qt::Horizontal) << QDialogButtonBox::StandardButtons{} << 0;
|
||||
QTest::newRow("only 1") << int(Qt::Horizontal) << QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok) << 1;
|
||||
QTest::newRow("only 1.. twice") << int(Qt::Horizontal)
|
||||
<< (QDialogButtonBox::Ok | QDialogButtonBox::Ok)
|
||||
@ -199,7 +199,7 @@ void tst_QDialogButtonBox::testConstructor4_data()
|
||||
QTest::addColumn<QDialogButtonBox::StandardButtons>("buttons");
|
||||
QTest::addColumn<int>("buttonCount");
|
||||
|
||||
QTest::newRow("nothing") << (QDialogButtonBox::StandardButtons)0 << 0;
|
||||
QTest::newRow("nothing") << QDialogButtonBox::StandardButtons{} << 0;
|
||||
QTest::newRow("only 1") << QDialogButtonBox::StandardButtons(QDialogButtonBox::Ok) << 1;
|
||||
QTest::newRow("only 1.. twice")
|
||||
<< (QDialogButtonBox::Ok | QDialogButtonBox::Ok)
|
||||
|
@ -387,7 +387,7 @@ void tst_QGroupBox::clicked()
|
||||
QStyle::SubControl(areaToHit), &testWidget);
|
||||
|
||||
if (rect.isValid())
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, {}, rect.center());
|
||||
else
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton);
|
||||
|
||||
@ -420,7 +420,7 @@ void tst_QGroupBox::toggledVsClicked()
|
||||
QRect rect = groupBox.style()->subControlRect(QStyle::CC_GroupBox, &option,
|
||||
QStyle::SC_GroupBoxCheckBox, &groupBox);
|
||||
|
||||
QTest::mouseClick(&groupBox, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseClick(&groupBox, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(toggleSpy.count(), 2);
|
||||
QVERIFY(toggleTimeStamp < clickTimeStamp);
|
||||
@ -500,11 +500,11 @@ void tst_QGroupBox::task_QTBUG_19170_ignoreMouseReleaseEvent()
|
||||
QRect rect = box.style()->subControlRect(QStyle::CC_GroupBox, &option,
|
||||
QStyle::SC_GroupBoxCheckBox, &box);
|
||||
|
||||
QTest::mouseClick(&box, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseClick(&box, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(box.isChecked(), true);
|
||||
|
||||
box.setChecked(false);
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, rect.center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, rect.center());
|
||||
QCOMPARE(box.isChecked(), false);
|
||||
}
|
||||
|
||||
@ -558,19 +558,19 @@ void tst_QGroupBox::task_QTBUG_15519_propagateMouseEvents()
|
||||
// Without a checkbox, all mouse events should propagate
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mousePressed, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mousePressed, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mouseReleased, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mouseReleased, true);
|
||||
|
||||
parent.reset();
|
||||
@ -586,19 +586,19 @@ void tst_QGroupBox::task_QTBUG_15519_propagateMouseEvents()
|
||||
box.setCheckable(true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mousePressed, false);
|
||||
|
||||
parent.reset();
|
||||
QTest::mousePress(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mousePress(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mousePressed, true);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, checkBoxRect.center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, checkBoxRect.center());
|
||||
QCOMPARE(parent.mouseReleased, false);
|
||||
|
||||
parent.reset();
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, 0, box.rect().center());
|
||||
QTest::mouseRelease(&box, Qt::LeftButton, {}, box.rect().center());
|
||||
QCOMPARE(parent.mouseReleased, true);
|
||||
|
||||
parent.reset();
|
||||
|
@ -322,8 +322,8 @@ protected slots:
|
||||
|
||||
private:
|
||||
// keyClicks(..) is moved to QtTestCase
|
||||
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
|
||||
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = 0);
|
||||
void psKeyClick(QWidget *target, Qt::Key key, Qt::KeyboardModifiers pressState = {});
|
||||
void psKeyClick(QTestEventList &keys, Qt::Key key, Qt::KeyboardModifiers pressState = {});
|
||||
bool unselectingWithLeftOrRightChangesCursorPosition();
|
||||
#if QT_CONFIG(shortcut)
|
||||
void addKeySequenceStandardKey(QTestEventList &keys, QKeySequence::StandardKey);
|
||||
@ -2296,7 +2296,7 @@ void tst_QLineEdit::deleteSelectedText()
|
||||
|
||||
edit.selectAll();
|
||||
|
||||
QTest::keyClick(&edit, Qt::Key_Delete, 0);
|
||||
QTest::keyClick(&edit, Qt::Key_Delete, {});
|
||||
QVERIFY(edit.text().isEmpty());
|
||||
|
||||
edit.setText(text);
|
||||
@ -3596,7 +3596,7 @@ void tst_QLineEdit::textMargin()
|
||||
QCOMPARE(bottom, b);
|
||||
#endif
|
||||
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, 0, mousePressPos);
|
||||
QTest::mouseClick(&testWidget, Qt::LeftButton, {}, mousePressPos);
|
||||
QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition);
|
||||
}
|
||||
|
||||
@ -4510,7 +4510,7 @@ void tst_QLineEdit::clearButton()
|
||||
QTRY_COMPARE(filterModel->rowCount(), 1); // matches 'ab'
|
||||
QSignalSpy spyEdited(filterLineEdit, &QLineEdit::textEdited);
|
||||
const QPoint clearButtonCenterPos = QRect(QPoint(0, 0), clearButton->size()).center();
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, 0, clearButtonCenterPos);
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, {}, clearButtonCenterPos);
|
||||
QCOMPARE(spyEdited.count(), 1);
|
||||
QTRY_COMPARE(clearButton->cursor().shape(), filterLineEdit->cursor().shape());
|
||||
QTRY_COMPARE(filterModel->rowCount(), 3);
|
||||
@ -4555,7 +4555,7 @@ void tst_QLineEdit::clearButtonVisibleAfterSettingText_QTBUG_45518()
|
||||
QTRY_VERIFY(clearButton->opacity() > 0);
|
||||
QTRY_COMPARE(clearButton->cursor().shape(), Qt::ArrowCursor);
|
||||
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, nullptr, clearButton->rect().center());
|
||||
QTest::mouseClick(clearButton, Qt::LeftButton, {}, clearButton->rect().center());
|
||||
QTRY_COMPARE(edit.text(), QString());
|
||||
|
||||
QTRY_COMPARE(clearButton->opacity(), qreal(0));
|
||||
|
@ -67,13 +67,13 @@ public:
|
||||
}
|
||||
void timerEvent(QTimerEvent*)
|
||||
{
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonPress, QPoint(6, 7), Qt::LeftButton, 0, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(7, 8), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(27, 23), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(30, 27), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(162, 109), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(10, 4), Qt::LeftButton, Qt::LeftButton, 0));
|
||||
qApp->postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(9, 4), Qt::LeftButton, 0, 0));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonPress, QPoint(6, 7), Qt::LeftButton, {}, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(7, 8), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(27, 23), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(30, 27), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(162, 109), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseMove, QPoint(10, 4), Qt::LeftButton, Qt::LeftButton, {}));
|
||||
QCoreApplication::postEvent(m_tb, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(9, 4), Qt::LeftButton, {}, {}));
|
||||
}
|
||||
};
|
||||
|
||||
@ -91,8 +91,8 @@ public:
|
||||
|
||||
void timerEvent(QTimerEvent*)
|
||||
{
|
||||
qApp->postEvent(m_w, new QMouseEvent(QEvent::MouseButtonPress, QPoint(230, 370), Qt::LeftButton, 0, 0));
|
||||
qApp->postEvent(m_w, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(230, 370), Qt::LeftButton, 0, 0));
|
||||
QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonPress, QPoint(230, 370), Qt::LeftButton, {}, {}));
|
||||
QCoreApplication::postEvent(m_w, new QMouseEvent(QEvent::MouseButtonRelease, QPoint(230, 370), Qt::LeftButton, {}, {}));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -331,7 +331,7 @@ void tst_QMdiArea::subWindowActivated()
|
||||
int i;
|
||||
|
||||
for ( i = 0; i < count; ++i ) {
|
||||
QWidget *widget = new QWidget(workspace, 0);
|
||||
QWidget *widget = new QWidget(workspace, {});
|
||||
widget->setAttribute(Qt::WA_DeleteOnClose);
|
||||
widget->setFocus();
|
||||
workspace->addSubWindow(widget)->show();
|
||||
|
@ -319,12 +319,12 @@ void tst_QMenu::mouseActivation()
|
||||
menu.addAction("Menu Action");
|
||||
menu.move(topLevel.geometry().topRight() + QPoint(50, 0));
|
||||
menu.show();
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center(), 300);
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, {}, menu.rect().center(), 300);
|
||||
QVERIFY(!menu.isVisible());
|
||||
|
||||
//context menus can always be accessed with right click except on windows
|
||||
menu.show();
|
||||
QTest::mouseClick(&menu, Qt::RightButton, 0, menu.rect().center(), 300);
|
||||
QTest::mouseClick(&menu, Qt::RightButton, {}, menu.rect().center(), 300);
|
||||
QVERIFY(!menu.isVisible());
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
@ -643,7 +643,7 @@ void tst_QMenu::tearOff()
|
||||
MenuMetrics mm(menu.data());
|
||||
const int tearOffOffset = mm.fw + mm.vmargin + mm.tearOffHeight / 2;
|
||||
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, 0, QPoint(10, tearOffOffset), 10);
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, {}, QPoint(10, tearOffOffset), 10);
|
||||
QTRY_VERIFY(menu->isTearOffMenuVisible());
|
||||
QPointer<QMenu> torn = getTornOffMenu();
|
||||
QVERIFY(torn);
|
||||
@ -723,7 +723,7 @@ void tst_QMenu::submenuTearOffDontClose()
|
||||
const QPoint submenuPos(submenuRect.topLeft() + QPoint(3, 3));
|
||||
// Move then click to avoid the submenu moves from causing it to close
|
||||
QTest::mouseMove(menu, submenuPos, 100);
|
||||
QTest::mouseClick(menu, Qt::LeftButton, 0, submenuPos, 100);
|
||||
QTest::mouseClick(menu, Qt::LeftButton, {}, submenuPos, 100);
|
||||
QVERIFY(QTest::qWaitFor([&]() { return submenu->window()->windowHandle(); }));
|
||||
QVERIFY(QTest::qWaitForWindowActive(submenu));
|
||||
// Make sure we enter the submenu frame directly on the tear-off area
|
||||
@ -888,7 +888,7 @@ void tst_QMenu::task176201_clear()
|
||||
QAction *action = menu.addAction("test");
|
||||
menu.connect(action, SIGNAL(triggered()), SLOT(clear()));
|
||||
menu.popup(QPoint());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.rect().center());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, {}, menu.rect().center());
|
||||
}
|
||||
|
||||
void tst_QMenu::task250673_activeMultiColumnSubMenuPosition()
|
||||
@ -1212,13 +1212,13 @@ void tst_QMenu::click_while_dismissing_submenu()
|
||||
QVERIFY(sub.isVisible());
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&sub));
|
||||
//press over the submenu entry
|
||||
QTest::mousePress(menuWindow, Qt::LeftButton, 0, menu.rect().center() + QPoint(0,2), 300);
|
||||
QTest::mousePress(menuWindow, Qt::LeftButton, {}, menu.rect().center() + QPoint(0, 2), 300);
|
||||
//move over the main action
|
||||
QTest::mouseMove(menuWindow, menu.rect().center() - QPoint(0,2));
|
||||
QVERIFY(menuHiddenSpy.wait());
|
||||
//the submenu must have been hidden for the bug to be triggered
|
||||
QVERIFY(!sub.isVisible());
|
||||
QTest::mouseRelease(menuWindow, Qt::LeftButton, 0, menu.rect().center() - QPoint(0,2), 300);
|
||||
QTest::mouseRelease(menuWindow, Qt::LeftButton, {}, menu.rect().center() - QPoint(0, 2), 300);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
}
|
||||
#endif
|
||||
@ -1476,7 +1476,7 @@ void tst_QMenu::QTBUG_56917_wideSubmenuScreenNumber()
|
||||
menu.popup(screen->geometry().center());
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&menu));
|
||||
QVERIFY(menu.isVisible());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, 0, menu.actionGeometry(action).center());
|
||||
QTest::mouseClick(&menu, Qt::LeftButton, {}, menu.actionGeometry(action).center());
|
||||
QTest::qWait(100);
|
||||
QVERIFY(QTest::qWaitForWindowExposed(&submenu));
|
||||
QVERIFY(submenu.isVisible());
|
||||
@ -1688,7 +1688,7 @@ void tst_QMenu::tearOffMenuNotDisplayed()
|
||||
MenuMetrics mm(menu.data());
|
||||
const int tearOffOffset = mm.fw + mm.vmargin + mm.tearOffHeight / 2;
|
||||
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, 0, QPoint(10, tearOffOffset), 10);
|
||||
QTest::mouseClick(menu.data(), Qt::LeftButton, {}, QPoint(10, tearOffOffset), 10);
|
||||
QTRY_VERIFY(menu->isTearOffMenuVisible());
|
||||
QPointer<QMenu> torn = getTornOffMenu();
|
||||
QVERIFY(torn);
|
||||
|
@ -1267,7 +1267,7 @@ void tst_QMenuBar::check_menuPosition()
|
||||
const QPoint bottomRight = mb->actionGeometry(menu.menuAction()).bottomRight() - QPoint(1, 1);
|
||||
const QPoint localPos = widgetToWindowPos(mb, bottomRight);
|
||||
const QPoint globalPos = w.mapToGlobal(localPos);
|
||||
QTest::mouseClick(w.windowHandle(), Qt::LeftButton, 0, localPos);
|
||||
QTest::mouseClick(w.windowHandle(), Qt::LeftButton, {}, localPos);
|
||||
QTRY_VERIFY(menu.isActiveWindow());
|
||||
QCOMPARE(menu.geometry().right() - 1, globalPos.x());
|
||||
menu.close();
|
||||
@ -1332,9 +1332,9 @@ void tst_QMenuBar::task256322_highlight()
|
||||
|
||||
const QPoint filePos = menuBarActionWindowPos(win.menuBar(), file);
|
||||
QWindow *window = win.windowHandle();
|
||||
QTest::mousePress(window, Qt::LeftButton, 0, filePos);
|
||||
QTest::mousePress(window, Qt::LeftButton, {}, filePos);
|
||||
QTest::mouseMove(window, filePos);
|
||||
QTest::mouseRelease(window, Qt::LeftButton, 0, filePos);
|
||||
QTest::mouseRelease(window, Qt::LeftButton, {}, filePos);
|
||||
QTRY_VERIFY(menu.isVisible());
|
||||
QVERIFY(!menu2.isVisible());
|
||||
QCOMPARE(win.menuBar()->activeAction(), file);
|
||||
@ -1507,11 +1507,11 @@ void tst_QMenuBar::closeOnSecondClickAndOpenOnThirdClick() // QTBUG-32807, menu
|
||||
|
||||
QWindow *window = mainWindow.windowHandle();
|
||||
QTest::mouseMove(window, center);
|
||||
QTest::mouseClick(window, Qt::LeftButton, 0, center);
|
||||
QTest::mouseClick(window, Qt::LeftButton, {}, center);
|
||||
QTRY_VERIFY(fileMenu->isVisible());
|
||||
QTest::mouseClick(window, Qt::LeftButton, 0, fileMenu->mapFromGlobal(globalPos));
|
||||
QTest::mouseClick(window, Qt::LeftButton, {}, fileMenu->mapFromGlobal(globalPos));
|
||||
QTRY_VERIFY(!fileMenu->isVisible());
|
||||
QTest::mouseClick(window, Qt::LeftButton, 0, center);
|
||||
QTest::mouseClick(window, Qt::LeftButton, {}, center);
|
||||
QTRY_VERIFY(fileMenu->isVisible());
|
||||
}
|
||||
|
||||
@ -1600,12 +1600,12 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
|
||||
QApplication::setActiveWindow(&mainWindow);
|
||||
|
||||
// they can't be windows
|
||||
QWidget hiddenParent(&mainWindow, 0);
|
||||
QWidget hiddenParent(&mainWindow, {});
|
||||
//this one is going to be moved around
|
||||
QWidget movingParent(&hiddenParent, 0);
|
||||
QWidget movingParent(&hiddenParent, {});
|
||||
|
||||
//set up the container widget
|
||||
QWidget containerWidget(&movingParent,0);
|
||||
QWidget containerWidget(&movingParent, {});
|
||||
|
||||
//set the new parent, a window
|
||||
QScopedPointer<QWidget> windowedParent;
|
||||
@ -1616,7 +1616,7 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
|
||||
QVERIFY(QTest::qWaitForWindowExposed(windowedParent.data()));
|
||||
|
||||
//set the "container", can't be a window
|
||||
QWidget containedWidget(&containerWidget, 0);
|
||||
QWidget containedWidget(&containerWidget, {});
|
||||
|
||||
taskQTBUG53205MenuBar = new QMenuBar(&containedWidget);
|
||||
|
||||
@ -1624,13 +1624,13 @@ void tst_QMenuBar::taskQTBUG53205_crashReparentNested()
|
||||
//now, move things around
|
||||
//from : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
//to windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
movingParent.setParent(windowedParent.data(),0);
|
||||
movingParent.setParent(windowedParent.data(), {});
|
||||
// this resets the parenting and the menu bar's window
|
||||
taskQTBUG53205MenuBar->setParent(nullptr);
|
||||
taskQTBUG53205MenuBar->setParent(&containedWidget);
|
||||
//from windowedParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
//to : QMainWindow<-hiddenParent<-movingParent<-containerWidget<-containedWidget<-menuBar
|
||||
movingParent.setParent(&hiddenParent,0);
|
||||
movingParent.setParent(&hiddenParent, {});
|
||||
windowedParent.reset(); //make the old window invalid
|
||||
// trigger the aciton, reset the menu bar's window, this used to crash here.
|
||||
testMenus.actions[0]->trigger();
|
||||
|
@ -120,11 +120,11 @@ void tst_QScrollBar::task_209492()
|
||||
const QPoint pressPoint(verticalScrollBar->width() / 2, verticalScrollBar->height() - 10);
|
||||
const QPoint globalPressPoint = verticalScrollBar->mapToGlobal(globalPressPoint);
|
||||
QMouseEvent mousePressEvent(QEvent::MouseButtonPress, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(verticalScrollBar, &mousePressEvent);
|
||||
QTest::qWait(1);
|
||||
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(verticalScrollBar, &mouseReleaseEvent);
|
||||
|
||||
// Check that the action was triggered once.
|
||||
@ -189,11 +189,11 @@ void tst_QScrollBar::QTBUG_42871()
|
||||
const QPoint pressPoint(scrollBarWidget.width() / 2, scrollBarWidget.height() - 10);
|
||||
const QPoint globalPressPoint = scrollBarWidget.mapToGlobal(pressPoint);
|
||||
QMouseEvent mousePressEvent(QEvent::MouseButtonPress, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(&scrollBarWidget, &mousePressEvent);
|
||||
QTest::qWait(1);
|
||||
QMouseEvent mouseReleaseEvent(QEvent::MouseButtonRelease, pressPoint, globalPressPoint,
|
||||
Qt::LeftButton, Qt::LeftButton, 0);
|
||||
Qt::LeftButton, Qt::LeftButton, {});
|
||||
QApplication::sendEvent(&scrollBarWidget, &mouseReleaseEvent);
|
||||
// Check that the action was triggered once.
|
||||
QCOMPARE(myHandler.updatesCount, 1);
|
||||
|
@ -605,7 +605,7 @@ void tst_QTabBar::changeTitleWhileDoubleClickingTab()
|
||||
QPoint tabPos = bar.tabRect(0).center();
|
||||
|
||||
for(int i=0; i < 10; i++)
|
||||
QTest::mouseDClick(&bar, Qt::LeftButton, 0, tabPos);
|
||||
QTest::mouseDClick(&bar, Qt::LeftButton, {}, tabPos);
|
||||
}
|
||||
|
||||
class Widget10052 : public QWidget
|
||||
@ -655,12 +655,12 @@ void tst_QTabBar::tabBarClicked()
|
||||
while (button <= Qt::MaxMouseButton) {
|
||||
const QPoint tabPos = tabBar.tabRect(0).center();
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
@ -668,12 +668,12 @@ void tst_QTabBar::tabBarClicked()
|
||||
|
||||
const QPoint barPos(tabBar.tabRect(0).right() + 5, tabBar.tabRect(0).center().y());
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
|
@ -668,12 +668,12 @@ void tst_QTabWidget::tabBarClicked()
|
||||
while (button <= Qt::MaxMouseButton) {
|
||||
const QPoint tabPos = tabBar.tabRect(0).center();
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, tabPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, tabPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), 0);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
@ -681,12 +681,12 @@ void tst_QTabWidget::tabBarClicked()
|
||||
|
||||
const QPoint barPos(tabBar.tabRect(0).right() + 5, tabBar.tabRect(0).center().y());
|
||||
|
||||
QTest::mouseClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 0);
|
||||
|
||||
QTest::mouseDClick(&tabBar, button, 0, barPos);
|
||||
QTest::mouseDClick(&tabBar, button, {}, barPos);
|
||||
QCOMPARE(clickSpy.count(), 1);
|
||||
QCOMPARE(clickSpy.takeFirst().takeFirst().toInt(), -1);
|
||||
QCOMPARE(doubleClickSpy.count(), 1);
|
||||
|
@ -760,7 +760,7 @@ void tst_QTextEdit::cursorPositionChanged()
|
||||
ed->setTextCursor(cursor);
|
||||
spy.clear();
|
||||
QVERIFY(!ed->textCursor().hasSelection());
|
||||
QTest::mouseDClick(ed->viewport(), Qt::LeftButton, 0, ed->cursorRect().center());
|
||||
QTest::mouseDClick(ed->viewport(), Qt::LeftButton, {}, ed->cursorRect().center());
|
||||
QVERIFY(ed->textCursor().hasSelection());
|
||||
|
||||
QCOMPARE(spy.count(), 1);
|
||||
|
@ -553,7 +553,7 @@ void tst_QToolBar::actionGeometry()
|
||||
QToolBarExtension *extension = extensions.at(0);
|
||||
if (extension->isVisible()) {
|
||||
QRect rect0 = extension->geometry();
|
||||
QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 );
|
||||
QTest::mouseClick( extension, Qt::LeftButton, {}, rect0.center(), -1 );
|
||||
QApplication::processEvents();
|
||||
popupMenu = qobject_cast<QMenu *>(extension->menu());
|
||||
rect01 = popupMenu->actionGeometry(&action1);
|
||||
@ -875,7 +875,7 @@ void tst_QToolBar::actionTriggered()
|
||||
QToolBarExtension *extension = extensions.at(0);
|
||||
if (extension->isVisible()) {
|
||||
QRect rect0 = extension->geometry();
|
||||
QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 );
|
||||
QTest::mouseClick( extension, Qt::LeftButton, {}, rect0.center(), -1 );
|
||||
QApplication::processEvents();
|
||||
popupMenu = qobject_cast<QMenu *>(extension->menu());
|
||||
rect01 = popupMenu->actionGeometry(&action1);
|
||||
@ -916,28 +916,28 @@ void tst_QToolBar::actionTriggered()
|
||||
if (!rect01.isValid())
|
||||
QTest::mouseClick(button1, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect01.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect01.center(), -1 );
|
||||
QCOMPARE(::triggered, &action1);
|
||||
|
||||
::triggered = 0;
|
||||
if (!rect02.isValid())
|
||||
QTest::mouseClick(button2, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect02.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect02.center(), -1 );
|
||||
QCOMPARE(::triggered, &action2);
|
||||
|
||||
::triggered = 0;
|
||||
if (!rect03.isValid())
|
||||
QTest::mouseClick(button3, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect03.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect03.center(), -1 );
|
||||
QCOMPARE(::triggered, &action3);
|
||||
|
||||
::triggered = 0;
|
||||
if (!rect04.isValid())
|
||||
QTest::mouseClick(button4, Qt::LeftButton);
|
||||
else
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect04.center(), -1 );
|
||||
QTest::mouseClick(popupMenu, Qt::LeftButton, {}, rect04.center(), -1 );
|
||||
QCOMPARE(::triggered, &action4);
|
||||
}
|
||||
|
||||
|
@ -215,14 +215,14 @@ void tst_QToolButton::task176137_autoRepeatOfAction()
|
||||
|
||||
QSignalSpy spy(&action,SIGNAL(triggered()));
|
||||
QTest::mousePress (toolButton, Qt::LeftButton);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, 0, QPoint (), 2000);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, {}, QPoint (), 2000);
|
||||
QCOMPARE(spy.count(),1);
|
||||
|
||||
// try again with auto repeat
|
||||
toolButton->setAutoRepeat (true);
|
||||
QSignalSpy repeatSpy(&action,SIGNAL(triggered())); // new spy
|
||||
QTest::mousePress (toolButton, Qt::LeftButton);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, 0, QPoint (), 3000);
|
||||
QTest::mouseRelease (toolButton, Qt::LeftButton, {}, QPoint (), 3000);
|
||||
const qreal expected = (3000 - toolButton->autoRepeatDelay()) / toolButton->autoRepeatInterval() + 1;
|
||||
//we check that the difference is small (on some systems timers are not super accurate)
|
||||
qreal diff = (expected - repeatSpy.count()) / expected;
|
||||
@ -242,7 +242,7 @@ void tst_QToolButton::sendMouseClick()
|
||||
}
|
||||
if (!m_menu->isVisible())
|
||||
return;
|
||||
QTest::mouseClick(m_menu.data(), Qt::LeftButton, 0, QPoint(7, 7));
|
||||
QTest::mouseClick(m_menu.data(), Qt::LeftButton, {}, QPoint(7, 7));
|
||||
if (QTimer *timer = qobject_cast<QTimer *>(sender())) {
|
||||
timer->stop();
|
||||
timer->deleteLater();
|
||||
|
@ -173,6 +173,8 @@ void tst_QDom::setContent_data()
|
||||
" </b3>\n"
|
||||
"</a1>\n");
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
// These configurations cannot be supported by the QXmlStreamReader-based implementation
|
||||
QTest::newRow( "02" ) << doc01
|
||||
<< QString("http://trolltech.com/xml/features/report-whitespace-only-CharData").split(' ')
|
||||
<< QStringList()
|
||||
@ -227,6 +229,7 @@ void tst_QDom::setContent_data()
|
||||
" <c1/>\n"
|
||||
" </b3>\n"
|
||||
"</a1>\n");
|
||||
#endif
|
||||
|
||||
QTest::newRow("05") << QString("<message>\n"
|
||||
" <body><b>foo</b>>]]></body>\n"
|
||||
@ -242,6 +245,8 @@ void tst_QDom::setContent()
|
||||
{
|
||||
QFETCH( QString, doc );
|
||||
|
||||
QDomDocument domDoc;
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QXmlInputSource source;
|
||||
source.setData( doc );
|
||||
|
||||
@ -258,8 +263,11 @@ void tst_QDom::setContent()
|
||||
reader.setFeature( *it, false );
|
||||
}
|
||||
|
||||
QDomDocument domDoc;
|
||||
QVERIFY( domDoc.setContent( &source, &reader ) );
|
||||
#else
|
||||
QXmlStreamReader reader(doc);
|
||||
QVERIFY(domDoc.setContent(&reader, true));
|
||||
#endif
|
||||
|
||||
QString eRes;
|
||||
QTextStream ts( &eRes, QIODevice::WriteOnly );
|
||||
@ -1475,8 +1483,9 @@ void tst_QDom::normalizeAttributes() const
|
||||
QDomDocument doc;
|
||||
QVERIFY(doc.setContent(&buffer, true));
|
||||
|
||||
// ### Qt 5: fix this, if we keep QDom at all
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QEXPECT_FAIL("", "The parser doesn't perform Attribute Value Normalization. Fixing that would change behavior.", Continue);
|
||||
#endif
|
||||
QCOMPARE(doc.documentElement().attribute(QLatin1String("attribute")), QString::fromLatin1("a a"));
|
||||
}
|
||||
|
||||
@ -1517,9 +1526,10 @@ void tst_QDom::serializeNamespaces() const
|
||||
"<b:element b:name=''/>"
|
||||
"</doc>";
|
||||
|
||||
QDomDocument doc;
|
||||
QByteArray ba(input);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
QVERIFY(buffer.open(QIODevice::ReadOnly));
|
||||
|
||||
QXmlInputSource source(&buffer);
|
||||
@ -1527,8 +1537,11 @@ void tst_QDom::serializeNamespaces() const
|
||||
reader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
|
||||
QDomDocument doc;
|
||||
QVERIFY(doc.setContent(&source, &reader));
|
||||
#else
|
||||
QXmlStreamReader streamReader(input);
|
||||
QVERIFY(doc.setContent(&streamReader, true));
|
||||
#endif
|
||||
|
||||
const QByteArray serialized(doc.toByteArray());
|
||||
|
||||
@ -1552,7 +1565,9 @@ void tst_QDom::flagInvalidNamespaces() const
|
||||
|
||||
QDomDocument doc;
|
||||
QVERIFY(!doc.setContent(QString::fromLatin1(input, true)));
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QEXPECT_FAIL("", "The parser doesn't flag identical qualified attribute names. Fixing this would change behavior.", Continue);
|
||||
#endif
|
||||
QVERIFY(!doc.setContent(QString::fromLatin1(input)));
|
||||
}
|
||||
|
||||
@ -1563,7 +1578,9 @@ void tst_QDom::flagUndeclaredNamespace() const
|
||||
"<b:element b:name=''/>"
|
||||
"</a:doc>";
|
||||
|
||||
QDomDocument doc;
|
||||
QByteArray ba(input);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
QVERIFY(buffer.open(QIODevice::ReadOnly));
|
||||
@ -1573,9 +1590,12 @@ void tst_QDom::flagUndeclaredNamespace() const
|
||||
reader.setFeature("http://xml.org/sax/features/namespaces", true);
|
||||
reader.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
|
||||
|
||||
QDomDocument doc;
|
||||
QEXPECT_FAIL("", "The parser doesn't flag not declared prefixes. Fixing this would change behavior.", Continue);
|
||||
QVERIFY(!doc.setContent(&source, &reader));
|
||||
#else
|
||||
QXmlStreamReader streamReader(ba);
|
||||
QVERIFY(!doc.setContent(&streamReader, true));
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QDom::indentComments() const
|
||||
@ -1642,7 +1662,9 @@ void tst_QDom::reportDuplicateAttributes() const
|
||||
QDomDocument dd;
|
||||
bool isSuccess = dd.setContent(QLatin1String("<test x=\"1\" x=\"2\"/>"));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QEXPECT_FAIL("", "The parser doesn't flag duplicate attributes. Fixing this would change behavior.", Continue);
|
||||
#endif
|
||||
QVERIFY2(!isSuccess, "Duplicate attributes are well-formedness errors, and should be reported as such.");
|
||||
}
|
||||
|
||||
@ -1842,10 +1864,15 @@ void tst_QDom::doubleNamespaceDeclarations() const
|
||||
QFile file(testFile);
|
||||
QVERIFY(file.open(QIODevice::ReadOnly));
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QXmlSimpleReader reader;
|
||||
|
||||
QXmlInputSource source(&file);
|
||||
QVERIFY(doc.setContent(&source, &reader));
|
||||
#else
|
||||
QXmlStreamReader streamReader(&file);
|
||||
QVERIFY(doc.setContent(&streamReader, true));
|
||||
#endif
|
||||
|
||||
// tst_QDom relies on a specific QHash ordering, see QTBUG-25071
|
||||
QString docAsString = doc.toString(0);
|
||||
@ -1862,11 +1889,15 @@ void tst_QDom::setContentQXmlReaderOverload() const
|
||||
{
|
||||
QDomDocument doc;
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QXmlSimpleReader reader;
|
||||
QXmlInputSource data;
|
||||
data.setData(QByteArray("<e/>"));
|
||||
|
||||
doc.setContent(&data, true);
|
||||
#else
|
||||
QXmlStreamReader streamReader(QByteArray("<e/>"));
|
||||
doc.setContent(&streamReader, true);
|
||||
#endif
|
||||
QCOMPARE(doc.documentElement().nodeName(), QString::fromLatin1("e"));
|
||||
}
|
||||
|
||||
@ -1961,6 +1992,10 @@ void tst_QDom::setContentWhitespace_data() const
|
||||
|
||||
void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const
|
||||
{
|
||||
// QXmlStreamReader fails to read XML documents with unknown encoding. It
|
||||
// needs to be modified if we want to support this case with the QXmlStreamReader-based
|
||||
// implementation.
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
QString xmlWithUnknownEncoding("<?xml version='1.0' encoding='unknown-encoding'?>"
|
||||
"<foo>"
|
||||
" <bar>How will this sentence be handled?</bar>"
|
||||
@ -1970,6 +2005,7 @@ void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() co
|
||||
|
||||
QString dontAssert = d.toString(); // this should not assert
|
||||
QVERIFY(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QDom::cloneDTD_QTBUG8398() const
|
||||
|
@ -135,7 +135,7 @@ void MessageBoxPanel::setupMessageBox(QMessageBox &box)
|
||||
bool ok;
|
||||
QMessageBox::StandardButtons btns = (QMessageBox::StandardButtons) btnHexText.toUInt(&ok, 16);
|
||||
box.setStandardButtons((QMessageBox::StandardButtons) btns);
|
||||
if (box.standardButtons() == (QMessageBox::StandardButtons) 0)
|
||||
if (box.standardButtons() == QMessageBox::StandardButtons())
|
||||
box.setStandardButtons(QMessageBox::Ok); // just to have something.
|
||||
|
||||
#if QT_VERSION >= 0x050000
|
||||
|
@ -198,7 +198,7 @@ void WizardOptionsControl::setWizardOptions(int options)
|
||||
class Wizard : public QWizard {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Wizard(QWidget *parent = 0, Qt::WindowFlags flags = 0);
|
||||
explicit Wizard(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
|
||||
|
||||
public slots:
|
||||
void changeWizardStyle(int newStyle);
|
||||
|
@ -74,7 +74,7 @@ class Window;
|
||||
|
||||
class SlowWidget : public QGraphicsWidget {
|
||||
public:
|
||||
SlowWidget(QGraphicsWidget *w = 0, Qt::WindowFlags wFlags = 0) : QGraphicsWidget(w, wFlags)
|
||||
SlowWidget(QGraphicsWidget *w = nullptr, Qt::WindowFlags wFlags = {}) : QGraphicsWidget(w, wFlags)
|
||||
{
|
||||
m_window = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user