Merge remote-tracking branch 'origin/stable' into dev

Conflicts:
	src/plugins/platforms/qnx/qqnxscreen.cpp
	src/plugins/platforms/windows/qwindowsdialoghelpers.cpp

Change-Id: Ib64f21c077b54f2291d19187590bfe869b98477a
This commit is contained in:
Frederik Gladhorn 2013-03-06 14:38:07 +01:00
commit 49a2ec05b4
34 changed files with 143 additions and 70 deletions

View File

@ -1,6 +1,6 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the documentation of the Qt Toolkit.
@ -26,9 +26,11 @@
****************************************************************************/
/*!
\example customcompleter
\example tools/customcompleter
\title Custom Completer Example
\ingroup examples-widgets-tools
\brief The Custom Completer example shows how to provide string-completion
facilities for an input widget based on data provided by a model. The
completer pops up suggestions for possible words based on the first three
@ -43,7 +45,7 @@
that has a list of words to help QCompleter complete words. This file
contains the following:
\quotefile customcompleter/customcompleter.qrc
\quotefile tools/customcompleter/customcompleter.qrc
\section1 TextEdit Class Definition
@ -54,7 +56,7 @@
contains a private function \c textUnderCursor() and a private instance
of QCompleter, \c c.
\snippet customcompleter/textedit.h 0
\snippet tools/customcompleter/textedit.h 0
\section1 TextEdit Class Implementation
@ -63,11 +65,11 @@
the \c TextEdit object, using the
\l{QTextEdit::setPlainText()}{setPlainText()} function.
\snippet customcompleter/textedit.cpp 0
\snippet tools/customcompleter/textedit.cpp 0
In addition, \c TextEdit also includes a default destructor:
\snippet customcompleter/textedit.cpp 1
\snippet tools/customcompleter/textedit.cpp 1
The \c setCompleter() function accepts a \a completer and sets it up.
We use \c{if (c)} to check if \c c has been initialized. If it has been
@ -75,7 +77,7 @@
the signal from the slot. This is to ensure that no previous completer
object is still connected to the slot.
\snippet customcompleter/textedit.cpp 2
\snippet tools/customcompleter/textedit.cpp 2
We then instantiate \c c with \a completer and set it as \c{TextEdit}'s
widget. The completion mode and case sensitivity are also set and then
@ -84,7 +86,7 @@
The \c completer() function is a getter function that returns \c c.
\snippet customcompleter/textedit.cpp 3
\snippet tools/customcompleter/textedit.cpp 3
The completer pops up the options available, based on the contents of
\e wordlist.txt, but the text cursor is responsible for filling in the
@ -99,7 +101,7 @@
completer's widget is \c TextEdit before using \c tc to insert the extra
characters to complete the word.
\snippet customcompleter/textedit.cpp 4
\snippet tools/customcompleter/textedit.cpp 4
The figure below illustrates this process:
@ -116,13 +118,13 @@
The \c textUnderCursor() function uses a QTextCursor, \c tc, to select a
word under the cursor and return it.
\snippet customcompleter/textedit.cpp 5
\snippet tools/customcompleter/textedit.cpp 5
The \c TextEdit class reimplements \l{QWidget::focusInEvent()}
{focusInEvent()} function, which is an event handler used to receive
keyboard focus events for the widget.
\snippet customcompleter/textedit.cpp 6
\snippet tools/customcompleter/textedit.cpp 6
The \l{QAbstractScrollArea::keyPressEvent()}{keyPressEvent()} is
reimplemented to ignore key events like Qt::Key_Enter, Qt::Key_Return,
@ -131,12 +133,12 @@
If there is an active completer, we cannot process the shortcut, Ctrl+E.
\snippet customcompleter/textedit.cpp 7
\snippet tools/customcompleter/textedit.cpp 7
We also handle other modifiers and shortcuts for which we do not want the
completer to respond to.
\snippet customcompleter/textedit.cpp 8
\snippet tools/customcompleter/textedit.cpp 8
Finally, we pop up the completer.
@ -147,7 +149,7 @@
\c createMenu() and \c modelFromFile() as well as private instances of
QCompleter and \c TextEdit.
\snippet customcompleter/mainwindow.h 0
\snippet tools/customcompleter/mainwindow.h 0
\section1 MainWindow Class Implementation
@ -157,31 +159,31 @@
to populate the \c completer. The \c{MainWindow}'s central widget is set
to \c TextEdit and its size is set to 500 x 300.
\snippet customcompleter/mainwindow.cpp 0
\snippet tools/customcompleter/mainwindow.cpp 0
The \c createMenu() function creates the necessary QAction objects needed
for the "File" and "Help" menu and their \l{QAction::triggered()}
{triggered()} signals are connected to the \c quit(), \c about(), and
\c aboutQt() slots respectively.
\snippet customcompleter/mainwindow.cpp 1
\snippet tools/customcompleter/mainwindow.cpp 1
The \c modelFromFile() function accepts a \a fileName and attempts to
extract the contents of this file into a QStringListModel. We display the
Qt::WaitCursor when we are populating the QStringList, \c words, and
restore the mouse cursor when we are done.
\snippet customcompleter/mainwindow.cpp 2
\snippet tools/customcompleter/mainwindow.cpp 2
The \c about() function provides a brief description about the Custom
Completer example.
\snippet customcompleter/mainwindow.cpp 3
\snippet tools/customcompleter/mainwindow.cpp 3
\section1 \c main() Function
The \c main() function instantiates \c MainWindow and invokes the
\l{QWidget::show()}{show()} function.
\snippet customcompleter/main.cpp 0
\snippet tools/customcompleter/main.cpp 0
*/

View File

@ -307,6 +307,11 @@ void NmakeMakefileGenerator::init()
project->values("QMAKE_CLEAN").append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
project->values("QMAKE_CLEAN").append("vc*.pdb");
project->values("QMAKE_CLEAN").append("vc*.idb");
project->values("DEFINES").removeAll("NDEBUG");
} else {
ProStringList &defines = project->values("DEFINES");
if (!defines.contains("NDEBUG"))
defines.append("NDEBUG");
}
}

View File

@ -57,7 +57,6 @@ ProFileCache *Option::proFileCache;
QMakeParser *Option::parser;
//convenience
const char *Option::application_argv0 = 0;
QString Option::prf_ext;
QString Option::prl_ext;
QString Option::libtool_ext;
@ -318,13 +317,11 @@ Option::parseCommandLine(QStringList &args, QMakeCmdLineParserState &state)
int
Option::init(int argc, char **argv)
{
Option::application_argv0 = 0;
Option::prf_ext = ".prf";
Option::pro_ext = ".pro";
Option::field_sep = ' ';
if(argc && argv) {
Option::application_argv0 = argv[0];
QString argv0 = argv[0];
if(Option::qmake_mode == Option::QMAKE_GENERATE_NOTHING)
Option::qmake_mode = default_mode(argv0);

View File

@ -109,7 +109,6 @@ struct Option
static QString pro_ext;
static QString res_ext;
static char field_sep;
static const char *application_argv0;
enum CmdLineFlags {
QMAKE_CMDLINE_SUCCESS = 0x00,

View File

@ -66,11 +66,7 @@
by Qt's own \l{moc}{Meta-Object Compiler (moc)}.
The meta-object system is a C++ extension that makes the language
better suited to true component GUI programming. Although
templates can be used to extend C++, the meta-object system
provides benefits using standard C++ that cannot be achieved with
templates; see \l{Why Doesn't Qt Use Templates for Signals and
Slots?}
better suited to true component GUI programming.
\section1 Important Classes

View File

@ -870,6 +870,7 @@
const bool valueOfExpression = Expr;\
Q_ASSERT_X(valueOfExpression, "Q_ASSUME()", "Assumption in Q_ASSUME(\"" #Expr "\") was not correct");\
Q_ASSUME_IMPL(valueOfExpression);\
Q_UNUSED(valueOfExpression); /* the value may not be used if Q_ASSERT_X and Q_ASSUME_IMPL are noop */\
} while (0)
#endif // QCOMPILERDETECTION_H

View File

@ -4194,7 +4194,7 @@ void qDeleteInEventHandler(QObject *o)
connecting to a static function or a functor
\a slot a pointer only used when using Qt::UniqueConnection
\a type the Qt::ConnctionType passed as argument to connect
\a types an array of integer with the metatype id of the parametter of the signal
\a types an array of integer with the metatype id of the parameter of the signal
to be used with queued connection
must stay valid at least for the whole time of the connection, this function
do not take ownership. typically static data.
@ -4209,7 +4209,7 @@ QMetaObject::Connection QObject::connectImpl(const QObject *sender, void **signa
const int *types, const QMetaObject *senderMetaObject)
{
if (!sender || !signal || !slotObj || !senderMetaObject) {
qWarning("QObject::connect: invalid null parametter");
qWarning("QObject::connect: invalid null parameter");
if (slotObj)
slotObj->destroyIfLastRef();
return QMetaObject::Connection();

View File

@ -62,7 +62,7 @@ namespace QtPrivate {
/*
The following List classes are used to help to handle the list of arguments.
It follow the same principles as the lisp lists.
List_Left<L,N> take a list and a number as a parametter and returns (via the Value typedef,
List_Left<L,N> take a list and a number as a parameter and returns (via the Value typedef,
the list composed of the first N element of the list
*/
#ifndef Q_COMPILER_VARIADIC_TEMPLATES
@ -116,7 +116,7 @@ namespace QtPrivate {
- ArgumentCount is the number of argument, or -1 if it is unknown
- the Object typedef is the Object of a pointer to member function
- the Arguments typedef is the list of argument (in a QtPrivate::List)
- the Function typedef is an alias to the template parametter Func
- the Function typedef is an alias to the template parameter Func
- the call<Args, R>(f,o,args) method is used to call that slot
Args is the list of argument of the signal
R is the return type of the signal

View File

@ -418,7 +418,7 @@ QMimeType QMimeDatabase::mimeTypeForFile(const QString &fileName, MatchMode mode
} else {
// Implemented as a wrapper around mimeTypeForFile(QFileInfo), so no mutex.
QFileInfo fileInfo(fileName);
return mimeTypeForFile(fileInfo);
return mimeTypeForFile(fileInfo, mode);
}
}

View File

@ -4045,6 +4045,16 @@ static void localToUtc(QDate &date, QTime &time, int isdst)
_tzset();
#endif
time_t secsSince1Jan1970UTC = mktime(&localTM);
#ifdef Q_OS_QNX
//mktime sometimes fails on QNX. Following workaround converts the date and time then manually
if (secsSince1Jan1970UTC == (time_t)-1) {
QDateTime tempTime = QDateTime(date, time, Qt::UTC);;
tempTime = tempTime.addMSecs(timezone * 1000);
date = tempTime.date();
time = tempTime.time();
return;
}
#endif
#endif
tm *brokenDown = 0;
#if defined(Q_OS_WINCE)

View File

@ -784,6 +784,7 @@ QXmlStreamPrivateTagStack::QXmlStreamPrivateTagStack()
NamespaceDeclaration &namespaceDeclaration = namespaceDeclarations.push();
namespaceDeclaration.prefix = addToStringStorage(QLatin1String("xml"));
namespaceDeclaration.namespaceUri = addToStringStorage(QLatin1String("http://www.w3.org/XML/1998/namespace"));
initialTagStackStringStorageSize = tagStackStringStorageSize;
}
#ifndef QT_NO_XMLSTREAMREADER
@ -854,6 +855,7 @@ void QXmlStreamReaderPrivate::init()
rawReadBuffer.clear();
dataBuffer.clear();
readBuffer.clear();
tagStackStringStorageSize = initialTagStackStringStorageSize;
type = QXmlStreamReader::NoToken;
error = QXmlStreamReader::NoError;

View File

@ -697,6 +697,7 @@ public:
QXmlStreamSimpleStack<NamespaceDeclaration> namespaceDeclarations;
QString tagStackStringStorage;
int tagStackStringStorageSize;
int initialTagStackStringStorageSize;
bool tagsDone;
inline QStringRef addToStringStorage(const QStringRef &s) {

View File

@ -6,6 +6,8 @@ MODULE_CONFIG = dbusadaptors dbusinterfaces
!isEmpty(DBUS_PATH) {
INCLUDEPATH += $$DBUS_PATH/include
QMAKE_LIBDIR += $$DBUS_PATH/lib
win32:CONFIG(debug, debug|release):QT_LIBS_DBUS += -ldbus-1d
else:QT_LIBS_DBUS += -ldbus-1
}
DEFINES += DBUS_API_SUBJECT_TO_CHANGE
@ -21,8 +23,6 @@ win32 {
-ladvapi32 \
-lnetapi32 \
-luser32
CONFIG(debug, debug|release):LIBS_PRIVATE += -ldbus-1d
else:LIBS_PRIVATE += -ldbus-1
}
QMAKE_DOCS = $$PWD/doc/qtdbus.qdocconf

View File

@ -623,8 +623,8 @@ int QNativeSocketEngine::accept()
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::accept(), -1);
Q_CHECK_STATE(QNativeSocketEngine::accept(), QAbstractSocket::ListeningState, false);
Q_CHECK_TYPE(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket, false);
Q_CHECK_STATE(QNativeSocketEngine::accept(), QAbstractSocket::ListeningState, -1);
Q_CHECK_TYPE(QNativeSocketEngine::accept(), QAbstractSocket::TcpSocket, -1);
return d->nativeAccept();
}
@ -702,7 +702,7 @@ qint64 QNativeSocketEngine::bytesAvailable() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::bytesAvailable(), -1);
Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, false);
Q_CHECK_NOT_STATE(QNativeSocketEngine::bytesAvailable(), QAbstractSocket::UnconnectedState, -1);
return d->nativeBytesAvailable();
}
@ -732,7 +732,7 @@ qint64 QNativeSocketEngine::pendingDatagramSize() const
{
Q_D(const QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::pendingDatagramSize(), -1);
Q_CHECK_TYPE(QNativeSocketEngine::pendingDatagramSize(), QAbstractSocket::UdpSocket, false);
Q_CHECK_TYPE(QNativeSocketEngine::pendingDatagramSize(), QAbstractSocket::UdpSocket, -1);
return d->nativePendingDatagramSize();
}
@ -757,7 +757,7 @@ qint64 QNativeSocketEngine::readDatagram(char *data, qint64 maxSize, QHostAddres
{
Q_D(QNativeSocketEngine);
Q_CHECK_VALID_SOCKETLAYER(QNativeSocketEngine::readDatagram(), -1);
Q_CHECK_TYPE(QNativeSocketEngine::readDatagram(), QAbstractSocket::UdpSocket, false);
Q_CHECK_TYPE(QNativeSocketEngine::readDatagram(), QAbstractSocket::UdpSocket, -1);
return d->nativeReceiveDatagram(data, maxSize, address, port);
}

View File

@ -174,7 +174,7 @@ bool QSpiApplicationAdaptor::eventFilter(QObject *target, QEvent *event)
SLOT(notifyKeyboardListenerError(QDBusError, QDBusMessage)), timeout);
if (sent) {
//queue the event and send it after callback
keyEvents.enqueue(QPair<QObject*, QKeyEvent*> (target, copyKeyEvent(keyEvent)));
keyEvents.enqueue(QPair<QPointer<QObject>, QKeyEvent*> (QPointer<QObject>(target), copyKeyEvent(keyEvent)));
#ifdef KEYBOARD_DEBUG
qDebug() << QStringLiteral("Sent key: ") << de.text;
#endif
@ -200,11 +200,12 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerCallback(const QDBusMessage&
}
Q_ASSERT(message.arguments().length() == 1);
if (message.arguments().at(0).toBool() == true) {
QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
delete event.second;
} else {
QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
QCoreApplication::postEvent(event.first, event.second);
QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
if (event.first)
QCoreApplication::postEvent(event.first.data(), event.second);
}
}
@ -212,8 +213,9 @@ void QSpiApplicationAdaptor::notifyKeyboardListenerError(const QDBusError& error
{
qWarning() << QStringLiteral("QSpiApplication::keyEventError ") << error.name() << error.message();
while (!keyEvents.isEmpty()) {
QPair<QObject*, QKeyEvent*> event = keyEvents.dequeue();
QCoreApplication::postEvent(event.first, event.second);
QPair<QPointer<QObject>, QKeyEvent*> event = keyEvents.dequeue();
if (event.first)
QCoreApplication::postEvent(event.first.data(), event.second);
}
}

View File

@ -42,6 +42,7 @@
#ifndef Q_SPI_APPLICATION_H
#define Q_SPI_APPLICATION_H
#include <QtCore/QPointer>
#include <QtCore/QQueue>
#include <QtDBus/QDBusConnection>
#include <QtGui/QAccessibleInterface>
@ -75,7 +76,7 @@ private Q_SLOTS:
private:
static QKeyEvent* copyKeyEvent(QKeyEvent*);
QQueue<QPair<QObject*, QKeyEvent*> > keyEvents;
QQueue<QPair<QPointer<QObject>, QKeyEvent*> > keyEvents;
QDBusConnection dbusConnection;
};

View File

@ -380,7 +380,7 @@ QVariant QGnomeTheme::themeHint(QPlatformTheme::ThemeHint hint) const
return QVariant(QGenericUnixTheme::xdgIconThemePaths());
case QPlatformTheme::StyleNames: {
QStringList styleNames;
styleNames << QStringLiteral("GTK+") << QStringLiteral("cleanlooks") << QStringLiteral("windows");
styleNames << QStringLiteral("GTK+") << QStringLiteral("fusion") << QStringLiteral("windows");
return QVariant(styleNames);
}
case QPlatformTheme::KeyboardScheme:

View File

@ -777,7 +777,6 @@ void QCocoaWindow::setNSWindow(NSWindow *window)
{
m_nsWindowDelegate = [[QNSWindowDelegate alloc] initWithQCocoaWindow:this];
[window setDelegate:m_nsWindowDelegate];
[window setAcceptsMouseMovedEvents:YES];
// Prevent Cocoa from releasing the window on close. Qt
// handles the close event asynchronously and we want to

View File

@ -151,6 +151,8 @@ QQnxScreen::QQnxScreen(screen_context_t screenContext, screen_display_t display,
QQnxScreen::~QQnxScreen()
{
qScreenDebug() << Q_FUNC_INFO;
Q_FOREACH (QQnxWindow *childWindow, m_childWindows)
childWindow->setScreen(0);
delete m_cursor;
}
@ -501,6 +503,11 @@ QPlatformCursor * QQnxScreen::cursor() const
return m_cursor;
}
QPlatformCursor * QQnxScreen::cursor() const
{
return m_cursor;
}
void QQnxScreen::keyboardHeightChanged(int height)
{
if (height == m_keyboardHeight)

View File

@ -156,7 +156,8 @@ QQnxWindow::~QQnxWindow()
// Remove from parent's Hierarchy.
removeFromParent();
m_screen->updateHierarchy();
if (m_screen)
m_screen->updateHierarchy();
// Cleanup QNX window and its buffers
screen_destroy_window(m_window);
@ -497,6 +498,11 @@ void QQnxWindow::setScreen(QQnxScreen *platformScreen)
{
qWindowDebug() << Q_FUNC_INFO << "window =" << window() << "platformScreen =" << platformScreen;
if (platformScreen == 0) { // The screen has been destroyed
m_screen = 0;
return;
}
if (m_screen == platformScreen)
return;
@ -539,7 +545,7 @@ void QQnxWindow::removeFromParent()
m_parentWindow = 0;
else
qFatal("QQnxWindow: Window Hierarchy broken; window has parent, but parent hasn't got child.");
} else {
} else if (m_screen) {
m_screen->removeWindow(this);
}
}

View File

@ -1495,8 +1495,9 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
// Apply settings.
const QSharedPointer<QFileDialogOptions> &opts = options();
m_data.fromOptions(opts);
const QFileDialogOptions::FileMode mode = opts->fileMode();
result->setWindowTitle(opts->windowTitle());
result->setMode(opts->fileMode(), opts->options());
result->setMode(mode, opts->options());
result->setHideFiltersDetails(opts->testOption(QFileDialogOptions::HideNameFilterDetails));
const QStringList nameFilters = opts->nameFilters();
if (!nameFilters.isEmpty())
@ -1513,6 +1514,12 @@ QWindowsNativeDialogBase *QWindowsFileDialogHelper::createNativeDialog()
if (!info.isDir())
result->selectFile(info.fileName());
}
// No need to select initialNameFilter if mode is Dir
if (mode != QFileDialogOptions::Directory && mode != QFileDialogOptions::DirectoryOnly) {
const QString initialNameFilter = opts->initiallySelectedNameFilter();
if (!initialNameFilter.isEmpty())
result->selectNameFilter(initialNameFilter);
}
const QString defaultSuffix = opts->defaultSuffix();
if (!defaultSuffix.isEmpty())
result->setDefaultSuffix(defaultSuffix);

View File

@ -109,6 +109,8 @@ Qt::KeyboardModifiers QWindowsMouseHandler::keyStateToModifiers(int wParam)
mods |= Qt::ControlModifier;
if (wParam & MK_SHIFT)
mods |= Qt::ShiftModifier;
if (GetKeyState(VK_MENU) < 0)
mods |= Qt::AltModifier;
return mods;
}

View File

@ -257,6 +257,8 @@ static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qr
} else {
QWindowsContext::user32dll.setLayeredWindowAttributes(hwnd, 0, (int)(level * 255), LWA_ALPHA);
}
} else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered.
InvalidateRect(hwnd, NULL, TRUE);
}
#endif // !Q_OS_WINCE
}

View File

@ -3291,7 +3291,7 @@ QString Doc::canonicalTitle(const QString &title)
for (int i = 0; i != title.size(); ++i) {
uint c = title.at(i).unicode();
if (c >= 'A' && c <= 'Z')
c -= 'A' - 'a';
c += 'a' - 'A';
bool alnum = (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9');
if (alnum) {
result += QLatin1Char(c);

View File

@ -360,7 +360,7 @@ QString Generator::fileBase(const Node *node) const
QChar c = base.at(i);
uint u = c.unicode();
if (u >= 'A' && u <= 'Z')
u -= 'A' - 'a';
u += 'a' - 'A';
if ((u >= 'a' && u <= 'z') || (u >= '0' && u <= '9')) {
res += QLatin1Char(u);
begun = true;

View File

@ -291,29 +291,29 @@ DocNode* QDocDatabase::addToModule(const QString& name, Node* node)
*/
DocNode* QDocDatabase::addToQmlModule(const QString& name, Node* node)
{
QString longQmid, shortQmid;
QStringList qmid;
QStringList dotSplit;
QStringList blankSplit = name.split(QLatin1Char(' '));
qmid.append(blankSplit[0]);
if (blankSplit.size() > 1) {
longQmid = blankSplit[0] + blankSplit[1];
qmid.append(blankSplit[0] + blankSplit[1]);
dotSplit = blankSplit[1].split(QLatin1Char('.'));
shortQmid = blankSplit[0] + dotSplit[0];
qmid.append(blankSplit[0] + dotSplit[0]);
}
DocNode* dn = findQmlModule(name);
dn->addMember(node);
node->setQmlModuleInfo(name);
if (node->subType() == Node::QmlClass) {
QmlClassNode* n = static_cast<QmlClassNode*>(node);
QString key = longQmid + "::" + node->name();
for (int i=0; i<2; ++i) {
for (int i=0; i<qmid.size(); ++i) {
QString key = qmid[i] + "::" + node->name();
if (!qmlTypeMap_.contains(key))
qmlTypeMap_.insert(key,n);
if (!masterMap_.contains(key))
masterMap_.insert(key,node);
if (!masterMap_.contains(node->name(),node))
masterMap_.insert(node->name(),node);
key = shortQmid + "::" + node->name();
}
if (!masterMap_.contains(node->name(),node))
masterMap_.insert(node->name(),node);
}
return dn;
}

View File

@ -424,8 +424,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectDefinition *definition)
*/
void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectDefinition *definition)
{
if (nestingLevel > 0)
if (nestingLevel > 0) {
--nestingLevel;
}
lastEndOffset = definition->lastSourceLocation().end();
}
@ -461,6 +462,26 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
lastEndOffset = definition->lastSourceLocation().end();
}
bool QmlDocVisitor::visit(QQmlJS::AST::UiObjectBinding *)
{
++nestingLevel;
return true;
}
void QmlDocVisitor::endVisit(QQmlJS::AST::UiObjectBinding *)
{
--nestingLevel;
}
bool QmlDocVisitor::visit(QQmlJS::AST::UiArrayBinding *)
{
return true;
}
void QmlDocVisitor::endVisit(QQmlJS::AST::UiArrayBinding *)
{
}
/*!
Visits the public \a member declaration, which can be a
signal or a property. It is a custom signal or property.
@ -468,8 +489,9 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::UiImportList *definition)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::UiPublicMember *member)
{
if (nestingLevel > 1)
if (nestingLevel > 1) {
return true;
}
switch (member->type) {
case QQmlJS::AST::UiPublicMember::Signal:
{
@ -535,8 +557,9 @@ bool QmlDocVisitor::visit(QQmlJS::AST::IdentifierPropertyName *)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::FunctionDeclaration* fd)
{
if (nestingLevel > 1)
if (nestingLevel > 1) {
return true;
}
if (current->type() == Node::Document) {
QmlClassNode* qmlClass = static_cast<QmlClassNode*>(current);
if (qmlClass) {
@ -581,8 +604,9 @@ void QmlDocVisitor::endVisit(QQmlJS::AST::FunctionDeclaration* fd)
*/
bool QmlDocVisitor::visit(QQmlJS::AST::UiScriptBinding* sb)
{
if (nestingLevel > 1)
if (nestingLevel > 1) {
return true;
}
if (current->type() == Node::Document) {
QString handler = sb->qualifiedId->name.toString();
if (handler.length() > 2 && handler.startsWith("on") && handler.at(2).isUpper()) {

View File

@ -85,6 +85,11 @@ public:
bool visit(QQmlJS::AST::UiPublicMember *member);
void endVisit(QQmlJS::AST::UiPublicMember *definition);
virtual bool visit(QQmlJS::AST::UiObjectBinding *);
virtual void endVisit(QQmlJS::AST::UiObjectBinding *);
virtual void endVisit(QQmlJS::AST::UiArrayBinding *);
virtual bool visit(QQmlJS::AST::UiArrayBinding *);
bool visit(QQmlJS::AST::IdentifierPropertyName *idproperty);
bool visit(QQmlJS::AST::FunctionDeclaration *);

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -2265,11 +2265,11 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt,
case QFrame::VLine: {
QPoint p1, p2;
if (frameShape == QFrame::HLine) {
p1 = QPoint(opt->rect.x(), opt->rect.height() / 2);
p1 = QPoint(opt->rect.x(), opt->rect.y() + opt->rect.height() / 2);
p2 = QPoint(opt->rect.x() + opt->rect.width(), p1.y());
} else {
p1 = QPoint(opt->rect.x()+opt->rect.width() / 2, 0);
p2 = QPoint(p1.x(), opt->rect.height());
p1 = QPoint(opt->rect.x() + opt->rect.width() / 2, opt->rect.y());
p2 = QPoint(p1.x(), p1.y() + opt->rect.height());
}
if (frameShadow == QFrame::Plain) {
QPen oldPen = p->pen();

View File

@ -33,3 +33,4 @@ SUBDIRS=\
# This test is only applicable on Windows
!win32*:SUBDIRS -= qwineventnotifier
qnx: SUBDIRS -= qsharedmemory qsystemsemaphore

View File

@ -442,6 +442,8 @@ void tst_QMimeDatabase::mimeTypeForFileWithContent()
txtTempFile.close();
mime = db.mimeTypeForFile(txtTempFileName);
QCOMPARE(mime.name(), QString::fromLatin1("text/plain"));
mime = db.mimeTypeForFile(txtTempFileName, QMimeDatabase::MatchContent);
QCOMPARE(mime.name(), QString::fromLatin1("application/smil"));
}
// Test what happens with an incorrect path
@ -714,6 +716,8 @@ void tst_QMimeDatabase::findByData()
QFileInfo info(filePath);
QString mimeForInfo = database.mimeTypeForFile(info, QMimeDatabase::MatchContent).name();
QCOMPARE(mimeForInfo, resultMimeTypeName);
QString mimeForFile = database.mimeTypeForFile(filePath, QMimeDatabase::MatchContent).name();
QCOMPARE(mimeForFile, resultMimeTypeName);
}
void tst_QMimeDatabase::findByFile_data()

View File

@ -139,7 +139,7 @@ void tst_PlatformSocketEngine::construction()
QVERIFY(socketDevice.error() == QAbstractSocket::UnknownSocketError);
QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::bytesAvailable() was called in QAbstractSocket::UnconnectedState");
QVERIFY(socketDevice.bytesAvailable() == 0);
QVERIFY(socketDevice.bytesAvailable() == -1);
QTest::ignoreMessage(QtWarningMsg, PLATFORMSOCKETENGINESTRING "::hasPendingDatagrams() was called in QAbstractSocket::UnconnectedState");
QVERIFY(!socketDevice.hasPendingDatagrams());