Merge remote-tracking branch 'origin/5.11' into dev
Change-Id: I8bb8227f9da982e7d5ebe5324fc27abd9ac0d4fc
This commit is contained in:
commit
8842d9d1e6
Binary file not shown.
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 25 KiB |
Binary file not shown.
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 20 KiB |
@ -51,7 +51,7 @@
|
||||
//! [0]
|
||||
class HelloWorldTask : public QRunnable
|
||||
{
|
||||
void run()
|
||||
void run() override
|
||||
{
|
||||
qDebug() << "Hello world from thread" << QThread::currentThread();
|
||||
}
|
||||
|
@ -52,7 +52,7 @@
|
||||
class ZipEngineHandler : public QAbstractFileEngineHandler
|
||||
{
|
||||
public:
|
||||
QAbstractFileEngine *create(const QString &fileName) const;
|
||||
QAbstractFileEngine *create(const QString &fileName) const override;
|
||||
};
|
||||
|
||||
QAbstractFileEngine *ZipEngineHandler::create(const QString &fileName) const
|
||||
@ -105,12 +105,12 @@ public:
|
||||
entries << "entry1" << "entry2" << "entry3";
|
||||
}
|
||||
|
||||
bool hasNext() const
|
||||
bool hasNext() const override
|
||||
{
|
||||
return index < entries.size() - 1;
|
||||
}
|
||||
|
||||
QString next()
|
||||
QString next() override
|
||||
{
|
||||
if (!hasNext())
|
||||
return QString();
|
||||
@ -118,7 +118,7 @@ public:
|
||||
return currentFilePath();
|
||||
}
|
||||
|
||||
QString currentFileName()
|
||||
QString currentFileName() override
|
||||
{
|
||||
return entries.at(index);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ class SandboxProcess : public QProcess
|
||||
{
|
||||
...
|
||||
protected:
|
||||
void setupChildProcess();
|
||||
void setupChildProcess() override;
|
||||
...
|
||||
};
|
||||
|
||||
|
@ -120,7 +120,7 @@ public:
|
||||
|
||||
...
|
||||
|
||||
QVariant data(const QModelIndex &index, int role)
|
||||
QVariant data(const QModelIndex &index, int role) override
|
||||
{
|
||||
if (role != Qt::BackgroundRole)
|
||||
return QSortFilterProxyModel::data(index, role);
|
||||
|
@ -101,7 +101,7 @@ public:
|
||||
MainWindow();
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *ev);
|
||||
bool eventFilter(QObject *obj, QEvent *ev) override;
|
||||
|
||||
private:
|
||||
QTextEdit *textEdit;
|
||||
@ -147,7 +147,7 @@ public:
|
||||
MyObject(QObject *parent = 0);
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
};
|
||||
|
||||
MyObject::MyObject(QObject *parent)
|
||||
@ -215,7 +215,7 @@ class KeyPressEater : public QObject
|
||||
...
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||
};
|
||||
|
||||
bool KeyPressEater::eventFilter(QObject *obj, QEvent *event)
|
||||
@ -508,7 +508,7 @@ public:
|
||||
MyClass(QWidget *parent = 0);
|
||||
~MyClass();
|
||||
|
||||
bool event(QEvent* ev)
|
||||
bool event(QEvent* ev) override
|
||||
{
|
||||
if (ev->type() == QEvent::PolishRequest) {
|
||||
// overwrite handling of PolishRequest if any
|
||||
|
@ -53,8 +53,8 @@
|
||||
class MyException : public QException
|
||||
{
|
||||
public:
|
||||
void raise() const { throw *this; }
|
||||
MyException *clone() const { return new MyException(*this); }
|
||||
void raise() const override { throw *this; }
|
||||
MyException *clone() const override { return new MyException(*this); }
|
||||
};
|
||||
|
||||
//! [0]
|
||||
|
@ -58,7 +58,7 @@ class DateFormatProxyModel : public QIdentityProxyModel
|
||||
m_formatString = formatString;
|
||||
}
|
||||
|
||||
QVariant data(const QModelIndex &index, int role) const
|
||||
QVariant data(const QModelIndex &index, int role) const override
|
||||
{
|
||||
if (role != Qt::DisplayRole)
|
||||
return QIdentityProxyModel::data(index, role);
|
||||
|
@ -59,7 +59,7 @@ class FilterObject : public QObject
|
||||
|
||||
public:
|
||||
FilterObject(QObject *parent = 0);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
bool eventFilter(QObject *object, QEvent *event) override;
|
||||
void setFilteredObject(QObject *object);
|
||||
|
||||
private:
|
||||
|
@ -54,7 +54,7 @@
|
||||
class MyCheckBox : public QCheckBox
|
||||
{
|
||||
public:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
};
|
||||
|
||||
//! [0]
|
||||
@ -72,7 +72,7 @@ void MyCheckBox::mousePressEvent(QMouseEvent *event)
|
||||
class MyWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
bool event(QEvent *event);
|
||||
bool event(QEvent *event) override;
|
||||
};
|
||||
|
||||
static const int MyCustomEventType = 1099;
|
||||
|
@ -143,7 +143,7 @@ public:
|
||||
void readSettings();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void closeEvent(QCloseEvent *event) override;
|
||||
};
|
||||
|
||||
//! [16]
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
protected:
|
||||
//![0]
|
||||
bool eventTest(QEvent *event)
|
||||
bool eventTest(QEvent *event) override
|
||||
{
|
||||
if (event->type() == QEvent::Wrapped) {
|
||||
QEvent *wrappedEvent = static_cast<QStateMachine::WrappedEvent *>(event)->event();
|
||||
@ -71,7 +71,7 @@ protected:
|
||||
}
|
||||
//![0]
|
||||
|
||||
void onTransition(QEvent *event)
|
||||
void onTransition(QEvent *event) override
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public:
|
||||
: m_value(value) {}
|
||||
|
||||
protected:
|
||||
virtual bool eventTest(QEvent *e)
|
||||
bool eventTest(QEvent *e) override
|
||||
{
|
||||
if (e->type() != QEvent::Type(QEvent::User+1)) // StringEvent
|
||||
return false;
|
||||
@ -80,7 +80,7 @@ protected:
|
||||
return (m_value == se->value);
|
||||
}
|
||||
|
||||
virtual void onTransition(QEvent *) {}
|
||||
void onTransition(QEvent *) override {}
|
||||
|
||||
private:
|
||||
QString m_value;
|
||||
|
@ -65,7 +65,7 @@ extern Q_AUTOTEST_EXPORT int qt_urlRecode(QString &appendTo, const QChar *begin,
|
||||
enum AceLeadingDot { AllowLeadingDot, ForbidLeadingDot };
|
||||
enum AceOperation { ToAceOnly, NormalizeAce };
|
||||
extern QString qt_ACE_do(const QString &domain, AceOperation op, AceLeadingDot dot);
|
||||
extern Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from);
|
||||
extern Q_AUTOTEST_EXPORT bool qt_nameprep(QString *source, int from);
|
||||
extern Q_AUTOTEST_EXPORT bool qt_check_std3rules(const QChar *uc, int len);
|
||||
extern Q_AUTOTEST_EXPORT void qt_punycodeEncoder(const QChar *s, int ucLength, QString *output);
|
||||
extern Q_AUTOTEST_EXPORT QString qt_punycodeDecoder(const QString &pc);
|
||||
|
@ -2021,7 +2021,7 @@ static bool isBidirectionalL(uint uc)
|
||||
return false;
|
||||
}
|
||||
|
||||
Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from)
|
||||
Q_AUTOTEST_EXPORT bool qt_nameprep(QString *source, int from)
|
||||
{
|
||||
QChar *src = source->data(); // causes a detach, so we're sure the only one using it
|
||||
QChar *out = src + from;
|
||||
@ -2036,7 +2036,7 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from)
|
||||
}
|
||||
}
|
||||
if (out == e)
|
||||
return; // everything was mapped easily (lowercased, actually)
|
||||
return true; // everything was mapped easily (lowercased, actually)
|
||||
int firstNonAscii = out - src;
|
||||
|
||||
// Characters unassigned in Unicode 3.2 are not allowed in "stored string" scheme
|
||||
@ -2059,7 +2059,7 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from)
|
||||
QChar::UnicodeVersion version = QChar::unicodeVersion(uc);
|
||||
if (version == QChar::Unicode_Unassigned || version > QChar::Unicode_3_2) {
|
||||
source->resize(from); // not allowed, clear the label
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!isMappedToNothing(uc)) {
|
||||
@ -2086,7 +2086,7 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from)
|
||||
// Strip prohibited output
|
||||
if (containsProhibitedOuptut(source, firstNonAscii)) {
|
||||
source->resize(from);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check for valid bidirectional characters
|
||||
@ -2110,9 +2110,13 @@ Q_AUTOTEST_EXPORT void qt_nameprep(QString *source, int from)
|
||||
}
|
||||
if (containsRandALCat) {
|
||||
if (containsLCat || (!isBidirectionalRorAL(src[from].unicode())
|
||||
|| !isBidirectionalRorAL(e[-1].unicode())))
|
||||
|| !isBidirectionalRorAL(e[-1].unicode()))) {
|
||||
source->resize(from); // not allowed, clear the label
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static const QChar *qt_find_nonstd3(const QChar *uc, int len, Qt::CaseSensitivity cs)
|
||||
@ -2553,7 +2557,8 @@ QString qt_ACE_do(const QString &domain, AceOperation op, AceLeadingDot dot)
|
||||
} else {
|
||||
// Punycode encoding and decoding cannot be done in-place
|
||||
// That means we need one or two temporaries
|
||||
qt_nameprep(&result, prevLen);
|
||||
if (!qt_nameprep(&result, prevLen))
|
||||
return QString(); // failed
|
||||
labelLength = result.length() - prevLen;
|
||||
int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
|
||||
aceForm.resize(0);
|
||||
|
@ -651,6 +651,7 @@ Q_ALWAYS_INLINE uint qt_builtin_clzs(quint16 v) Q_DECL_NOTHROW
|
||||
// So it's an acceptable compromise.
|
||||
#if defined(__AVX__) || defined(__SSE4_2__) || defined(__POPCNT__)
|
||||
#define QALGORITHMS_USE_BUILTIN_POPCOUNT
|
||||
#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
|
||||
Q_ALWAYS_INLINE uint qt_builtin_popcount(quint32 v) Q_DECL_NOTHROW
|
||||
{
|
||||
return __popcnt(v);
|
||||
@ -663,13 +664,15 @@ Q_ALWAYS_INLINE uint qt_builtin_popcount(quint16 v) Q_DECL_NOTHROW
|
||||
{
|
||||
return __popcnt16(v);
|
||||
}
|
||||
#if Q_PROCESSOR_WORDSIZE == 8
|
||||
#define QALGORITHMS_USE_BUILTIN_POPCOUNTLL
|
||||
Q_ALWAYS_INLINE uint qt_builtin_popcountll(quint64 v) Q_DECL_NOTHROW
|
||||
{
|
||||
#if Q_PROCESSOR_WORDSIZE == 8
|
||||
return __popcnt64(v);
|
||||
}
|
||||
#else
|
||||
return __popcnt(quint32(v)) + __popcnt(quint32(v >> 32));
|
||||
#endif // MSVC 64bit
|
||||
}
|
||||
|
||||
#endif // __AVX__ || __SSE4_2__ || __POPCNT__
|
||||
|
||||
#endif // MSVC
|
||||
|
@ -74,10 +74,10 @@ signals:
|
||||
void mimeTypes(const QStringList &types);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QByteArray data;
|
||||
|
@ -68,7 +68,7 @@ public:
|
||||
MainWindow(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
QLabel *iconLabel;
|
||||
|
@ -67,8 +67,8 @@ public:
|
||||
Window(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
QComboBox *mimeTypeCombo;
|
||||
|
@ -67,8 +67,8 @@ public:
|
||||
Window(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event) override;
|
||||
void dropEvent(QDropEvent *event) override;
|
||||
|
||||
private:
|
||||
QComboBox *mimeTypeCombo;
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
class SimpleTransformation : public QWidget
|
||||
{
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
|
||||
//! [0]
|
||||
@ -73,7 +73,7 @@ void SimpleTransformation::paintEvent(QPaintEvent *)
|
||||
|
||||
class CombinedTransformation : public QWidget
|
||||
{
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
|
||||
//! [1]
|
||||
@ -97,7 +97,7 @@ void CombinedTransformation::paintEvent(QPaintEvent *)
|
||||
|
||||
class BasicOperations : public QWidget
|
||||
{
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
|
||||
//! [2]
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
Window(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
QFont font;
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
bool event(QEvent *event)
|
||||
bool event(QEvent *event) override
|
||||
{
|
||||
if (event->type() == QEvent::FileOpen) {
|
||||
QFileOpenEvent *openEvent = static_cast<QFileOpenEvent *>(event);
|
||||
|
@ -71,8 +71,8 @@ public:
|
||||
const QPixmap *pixmap() const;
|
||||
|
||||
protected:
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
|
||||
private:
|
||||
void createImage();
|
||||
|
@ -59,8 +59,8 @@ class TextEdit : public QTextEdit
|
||||
|
||||
public:
|
||||
TextEdit(QWidget *parent=0);
|
||||
bool canInsertFromMimeData( const QMimeData *source ) const;
|
||||
void insertFromMimeData( const QMimeData *source );
|
||||
bool canInsertFromMimeData( const QMimeData *source ) const override;
|
||||
void insertFromMimeData( const QMimeData *source ) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
class SimpleTransformation : public QWidget
|
||||
{
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
|
||||
//! [0]
|
||||
@ -73,7 +73,7 @@ void SimpleTransformation::paintEvent(QPaintEvent *)
|
||||
|
||||
class CombinedTransformation : public QWidget
|
||||
{
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
|
||||
//! [1]
|
||||
@ -97,7 +97,7 @@ void CombinedTransformation::paintEvent(QPaintEvent *)
|
||||
|
||||
class BasicOperations : public QWidget
|
||||
{
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
|
||||
//! [2]
|
||||
|
@ -55,12 +55,16 @@ QT_BEGIN_NAMESPACE
|
||||
#ifndef QT_NO_DEBUG
|
||||
#define QT_RESET_GLERROR() \
|
||||
{ \
|
||||
while (QOpenGLContext::currentContext()->functions()->glGetError() != GL_NO_ERROR) {} \
|
||||
while (true) {\
|
||||
GLenum error = QOpenGLContext::currentContext()->functions()->glGetError(); \
|
||||
if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST) \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
#define QT_CHECK_GLERROR() \
|
||||
{ \
|
||||
GLenum err = QOpenGLContext::currentContext()->functions()->glGetError(); \
|
||||
if (err != GL_NO_ERROR) { \
|
||||
if (err != GL_NO_ERROR && err != GL_CONTEXT_LOST) { \
|
||||
qDebug("[%s line %d] OpenGL Error: %d", \
|
||||
__FILE__, __LINE__, (int)err); \
|
||||
} \
|
||||
@ -134,6 +138,10 @@ QT_BEGIN_NAMESPACE
|
||||
#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
|
||||
#endif
|
||||
|
||||
#ifndef GL_CONTEXT_LOST
|
||||
#define GL_CONTEXT_LOST 0x0507
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/*!
|
||||
@ -1327,8 +1335,11 @@ static QImage qt_gl_read_framebuffer(const QSize &size, GLenum internal_format,
|
||||
{
|
||||
QOpenGLContext *ctx = QOpenGLContext::currentContext();
|
||||
QOpenGLFunctions *funcs = ctx->functions();
|
||||
while (funcs->glGetError());
|
||||
|
||||
while (true) {
|
||||
GLenum error = funcs->glGetError();
|
||||
if (error == GL_NO_ERROR || error == GL_CONTEXT_LOST)
|
||||
break;
|
||||
}
|
||||
switch (internal_format) {
|
||||
case GL_RGB:
|
||||
case GL_RGB8:
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
void initializeGL()
|
||||
void initializeGL() override
|
||||
{
|
||||
// Set up the rendering context, define display lists etc.:
|
||||
...
|
||||
@ -155,7 +155,7 @@ protected:
|
||||
...
|
||||
}
|
||||
|
||||
void resizeGL(int w, int h)
|
||||
void resizeGL(int w, int h) override
|
||||
{
|
||||
// setup viewport, projection etc.:
|
||||
glViewport(0, 0, (GLint)w, (GLint)h);
|
||||
@ -164,7 +164,7 @@ protected:
|
||||
...
|
||||
}
|
||||
|
||||
void paintGL()
|
||||
void paintGL() override
|
||||
{
|
||||
// draw the scene:
|
||||
...
|
||||
|
@ -273,7 +273,7 @@ void QSqlQueryModel_snippets()
|
||||
class MyModel : public QSqlQueryModel
|
||||
{
|
||||
public:
|
||||
QVariant data(const QModelIndex &item, int role) const;
|
||||
QVariant data(const QModelIndex &item, int role) const override;
|
||||
|
||||
int m_specialColumnNo;
|
||||
};
|
||||
@ -526,15 +526,15 @@ public:
|
||||
~XyzResult() {}
|
||||
|
||||
protected:
|
||||
QVariant data(int /* index */) { return QVariant(); }
|
||||
bool isNull(int /* index */) { return false; }
|
||||
bool reset(const QString & /* query */) { return false; }
|
||||
bool fetch(int /* index */) { return false; }
|
||||
bool fetchFirst() { return false; }
|
||||
bool fetchLast() { return false; }
|
||||
int size() { return 0; }
|
||||
int numRowsAffected() { return 0; }
|
||||
QSqlRecord record() const { return QSqlRecord(); }
|
||||
QVariant data(int /* index */) override { return QVariant(); }
|
||||
bool isNull(int /* index */) override { return false; }
|
||||
bool reset(const QString & /* query */) override { return false; }
|
||||
bool fetch(int /* index */) override { return false; }
|
||||
bool fetchFirst() override { return false; }
|
||||
bool fetchLast() override { return false; }
|
||||
int size() override { return 0; }
|
||||
int numRowsAffected() override { return 0; }
|
||||
QSqlRecord record() const override { return QSqlRecord(); }
|
||||
};
|
||||
//! [47]
|
||||
|
||||
@ -545,13 +545,13 @@ public:
|
||||
XyzDriver() {}
|
||||
~XyzDriver() {}
|
||||
|
||||
bool hasFeature(DriverFeature /* feature */) const { return false; }
|
||||
bool hasFeature(DriverFeature /* feature */) const override { return false; }
|
||||
bool open(const QString & /* db */, const QString & /* user */,
|
||||
const QString & /* password */, const QString & /* host */,
|
||||
int /* port */, const QString & /* options */)
|
||||
int /* port */, const QString & /* options */) override
|
||||
{ return false; }
|
||||
void close() {}
|
||||
QSqlResult *createResult() const { return new XyzResult(this); }
|
||||
QSqlResult *createResult() const override { return new XyzResult(this); }
|
||||
};
|
||||
//! [48]
|
||||
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
MyGLWidget(QWidget *parent) : QOpenGLWidget(parent) { }
|
||||
|
||||
protected:
|
||||
void initializeGL()
|
||||
void initializeGL() override
|
||||
{
|
||||
// Set up the rendering context, load shaders and other resources, etc.:
|
||||
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
|
||||
@ -63,7 +63,7 @@ protected:
|
||||
...
|
||||
}
|
||||
|
||||
void resizeGL(int w, int h)
|
||||
void resizeGL(int w, int h) override
|
||||
{
|
||||
// Update projection matrix and other size related settings:
|
||||
m_projection.setToIdentity();
|
||||
@ -71,7 +71,7 @@ protected:
|
||||
...
|
||||
}
|
||||
|
||||
void paintGL()
|
||||
void paintGL() override
|
||||
{
|
||||
// Draw the scene:
|
||||
QOpenGLFunctions *f = QOpenGLContext::currentContext()->functions();
|
||||
@ -86,7 +86,7 @@ protected:
|
||||
class MyGLWidget : public QOpenGLWidget, protected QOpenGLFunctions
|
||||
{
|
||||
...
|
||||
void initializeGL()
|
||||
void initializeGL() override
|
||||
{
|
||||
initializeOpenGLFunctions();
|
||||
glClearColor(...);
|
||||
@ -108,7 +108,7 @@ widget->setFormat(format); // must be called before the widget or its parent win
|
||||
|
||||
//! [3]
|
||||
...
|
||||
void paintGL()
|
||||
void paintGL() override
|
||||
{
|
||||
QOpenGLFunctions_3_2_Core *f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_2_Core>();
|
||||
...
|
||||
|
@ -63,13 +63,13 @@ public:
|
||||
CardLayout(int dist): QLayout(dist) {}
|
||||
~CardLayout();
|
||||
|
||||
void addItem(QLayoutItem *item);
|
||||
QSize sizeHint() const;
|
||||
QSize minimumSize() const;
|
||||
int count() const;
|
||||
QLayoutItem *itemAt(int) const;
|
||||
QLayoutItem *takeAt(int);
|
||||
void setGeometry(const QRect &rect);
|
||||
void addItem(QLayoutItem *item) override;
|
||||
QSize sizeHint() const override;
|
||||
QSize minimumSize() const override;
|
||||
int count() const override;
|
||||
QLayoutItem *itemAt(int) const override;
|
||||
QLayoutItem *takeAt(int) override;
|
||||
void setGeometry(const QRect &rect) override;
|
||||
|
||||
private:
|
||||
QList<QLayoutItem*> list;
|
||||
|
@ -52,7 +52,7 @@
|
||||
class SimpleItem : public QGraphicsItem
|
||||
{
|
||||
public:
|
||||
QRectF boundingRect() const
|
||||
QRectF boundingRect() const override
|
||||
{
|
||||
qreal penWidth = 1;
|
||||
return QRectF(-10 - penWidth / 2, -10 - penWidth / 2,
|
||||
@ -60,7 +60,7 @@ public:
|
||||
}
|
||||
|
||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
|
||||
QWidget *widget)
|
||||
QWidget *widget) override
|
||||
{
|
||||
painter->drawRoundedRect(-10, -10, 20, 20, 5, 5);
|
||||
}
|
||||
@ -74,7 +74,7 @@ class CustomItem : public QGraphicsItem
|
||||
public:
|
||||
enum { Type = UserType + 1 };
|
||||
|
||||
int type() const
|
||||
int type() const override
|
||||
{
|
||||
// Enable the use of qgraphicsitem_cast with this item.
|
||||
return Type;
|
||||
@ -260,7 +260,7 @@ class QGraphicsPathItem : public QAbstractGraphicsShapeItem
|
||||
{
|
||||
public:
|
||||
enum { Type = 2 };
|
||||
int type() const { return Type; }
|
||||
int type() const override { return Type; }
|
||||
...
|
||||
};
|
||||
//! [18]
|
||||
|
@ -54,7 +54,7 @@ class MyProxyStyle : public QProxyStyle
|
||||
public:
|
||||
|
||||
int styleHint(StyleHint hint, const QStyleOption *option = 0,
|
||||
const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const
|
||||
const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const override
|
||||
{
|
||||
if (hint == QStyle::SH_UnderlineShortcut)
|
||||
return 1;
|
||||
@ -73,7 +73,7 @@ class MyProxyStyle : public QProxyStyle
|
||||
{
|
||||
public:
|
||||
int styleHint(StyleHint hint, const QStyleOption *option = 0,
|
||||
const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const
|
||||
const QWidget *widget = 0, QStyleHintReturn *returnData = 0) const override
|
||||
{
|
||||
if (hint == QStyle::SH_UnderlineShortcut)
|
||||
return 0;
|
||||
|
@ -54,9 +54,9 @@ class AppendText : public QUndoCommand
|
||||
public:
|
||||
AppendText(QString *doc, const QString &text)
|
||||
: m_document(doc), m_text(text) { setText("append text"); }
|
||||
virtual void undo()
|
||||
void undo() override
|
||||
{ m_document->chop(m_text.length()); }
|
||||
virtual void redo()
|
||||
void redo() override
|
||||
{ m_document->append(m_text); }
|
||||
private:
|
||||
QString *m_document;
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
~CustomStyle() {}
|
||||
|
||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
||||
QPainter *painter, const QWidget *widget) const;
|
||||
QPainter *painter, const QWidget *widget) const override;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
|
||||
void drawItems(QPainter *painter, int numItems, QGraphicsItem *items[],
|
||||
const QStyleOptionGraphicsItem options[],
|
||||
QWidget *widget = 0);
|
||||
QWidget *widget = 0) override;
|
||||
};
|
||||
|
||||
//! [0]
|
||||
|
@ -57,8 +57,8 @@ public:
|
||||
void setWidget(QWidget *w);
|
||||
|
||||
protected:
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
void scrollContentsBy(int dx, int dy) override;
|
||||
void resizeEvent(QResizeEvent *event) override;
|
||||
|
||||
private:
|
||||
void updateWidgetPosition();
|
||||
|
@ -61,15 +61,15 @@ class DragDropListModel : public QStringListModel
|
||||
public:
|
||||
DragDropListModel(const QStringList &strings, QObject *parent = 0);
|
||||
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
||||
|
||||
bool canDropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
int row, int column, const QModelIndex &parent);
|
||||
int row, int column, const QModelIndex &parent) override;
|
||||
bool dropMimeData(const QMimeData *data, Qt::DropAction action,
|
||||
int row, int column, const QModelIndex &parent);
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const;
|
||||
QStringList mimeTypes() const;
|
||||
Qt::DropActions supportedDropActions() const;
|
||||
int row, int column, const QModelIndex &parent) override;
|
||||
QMimeData *mimeData(const QModelIndexList &indexes) const override;
|
||||
QStringList mimeTypes() const override;
|
||||
Qt::DropActions supportedDropActions() const override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -56,7 +56,7 @@ class MyPushButton : public QPushButton
|
||||
public:
|
||||
MyPushButton(QWidget *parent = 0);
|
||||
|
||||
void paintEvent(QPaintEvent *);
|
||||
void paintEvent(QPaintEvent *) override;
|
||||
};
|
||||
|
||||
MyPushButton::MyPushButton(QWidget *parent)
|
||||
@ -87,7 +87,7 @@ class MyStyle : public QStyle
|
||||
public:
|
||||
|
||||
void drawPrimitive(PrimitiveElement element, const QStyleOption *option,
|
||||
QPainter *painter, const QWidget *widget);
|
||||
QPainter *painter, const QWidget *widget) override;
|
||||
};
|
||||
|
||||
//! [4]
|
||||
|
@ -59,7 +59,7 @@ class MyStylePlugin : public QStylePlugin
|
||||
public:
|
||||
MyStylePlugin(QObject *parent = 0);
|
||||
|
||||
QStyle *create(const QString &key);
|
||||
QStyle *create(const QString &key) override;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
|
@ -64,7 +64,7 @@ public:
|
||||
Splitter(Qt::Orientation orientation, QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
QSplitterHandle *createHandle();
|
||||
QSplitterHandle *createHandle() override;
|
||||
};
|
||||
//! [0]
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
SplitterHandle(Qt::Orientation orientation, QSplitter *parent);
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
private:
|
||||
QLinearGradient gradient;
|
||||
|
@ -55,7 +55,7 @@
|
||||
class MyWidget : public QWidget
|
||||
{
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void paintEvent2(QPaintEvent *event);
|
||||
|
||||
};
|
||||
|
@ -2067,6 +2067,21 @@ void tst_QUrl::isValid()
|
||||
qPrintable(url.errorString()));
|
||||
}
|
||||
|
||||
{
|
||||
QUrl url = QUrl::fromEncoded("foo://%f0%9f%93%99.example.la/g");
|
||||
QVERIFY(!url.isValid());
|
||||
QVERIFY(url.toString().isEmpty());
|
||||
QCOMPARE(url.path(), QString("/g"));
|
||||
url.setHost("%f0%9f%93%99.example.la/");
|
||||
QVERIFY(!url.isValid());
|
||||
QVERIFY(url.toString().isEmpty());
|
||||
url.setHost("\xf0\x9f\x93\x99.example.la/");
|
||||
QVERIFY(!url.isValid());
|
||||
QVERIFY(url.toString().isEmpty());
|
||||
QVERIFY2(url.errorString().contains("Invalid hostname"),
|
||||
qPrintable(url.errorString()));
|
||||
}
|
||||
|
||||
{
|
||||
QUrl url("http://example.com");
|
||||
QVERIFY(url.isValid());
|
||||
@ -2798,7 +2813,9 @@ void tst_QUrl::hosts()
|
||||
{
|
||||
QFETCH(QString, url);
|
||||
|
||||
QTEST(QUrl(url).host(), "host");
|
||||
QUrl u(url);
|
||||
QTEST(u.host(), "host");
|
||||
QVERIFY(u.isEmpty() || u.isValid());
|
||||
}
|
||||
|
||||
void tst_QUrl::hostFlags_data()
|
||||
|
Loading…
Reference in New Issue
Block a user