summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/phonon/phononnamespace.h5
-rw-r--r--src/corelib/codecs/qtsciicodec_p.h2
-rw-r--r--src/corelib/global/qnamespace.h1
-rw-r--r--src/corelib/io/qdatastream.cpp2
-rw-r--r--src/corelib/io/qdir.cpp47
-rw-r--r--src/corelib/io/qfileinfo.cpp1
-rw-r--r--src/corelib/io/qfsfileengine_win.cpp2
-rw-r--r--src/corelib/io/qsettings_p.h2
-rw-r--r--src/corelib/io/qtemporaryfile.cpp9
-rw-r--r--src/corelib/io/qtextstream.cpp7
-rw-r--r--src/corelib/kernel/qobject.cpp249
-rw-r--r--src/corelib/kernel/qobject_p.h13
-rw-r--r--src/corelib/plugin/qplugin.h19
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp2
-rw-r--r--src/corelib/tools/qlocale.cpp9
-rw-r--r--src/corelib/tools/qringbuffer_p.h2
-rw-r--r--src/corelib/tools/qstring.h2
-rw-r--r--src/corelib/tools/qvector.h2
-rw-r--r--src/dbus/qdbusintegrator.cpp11
-rw-r--r--src/gui/dialogs/qcolordialog.cpp3
-rw-r--r--src/gui/dialogs/qcolordialog_mac.mm38
-rw-r--r--src/gui/dialogs/qfiledialog.cpp1
-rw-r--r--src/gui/dialogs/qfiledialog_p.h2
-rw-r--r--src/gui/dialogs/qprintpreviewdialog.cpp142
-rw-r--r--src/gui/graphicsview/qgraphicsview_p.h2
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.h2
-rw-r--r--src/gui/graphicsview/qgridlayoutengine.cpp18
-rw-r--r--src/gui/image/qnativeimage_p.h2
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/itemviews/qabstractitemview_p.h2
-rw-r--r--src/gui/kernel/qevent.cpp11
-rw-r--r--src/gui/kernel/qevent_p.h4
-rw-r--r--src/gui/kernel/qkeymapper.cpp2
-rw-r--r--src/gui/kernel/qkeymapper_mac.cpp17
-rw-r--r--src/gui/kernel/qkeysequence.cpp112
-rw-r--r--src/gui/kernel/qkeysequence.h4
-rw-r--r--src/gui/kernel/qwidget.cpp14
-rw-r--r--src/gui/kernel/qwidget_x11.cpp13
-rw-r--r--src/gui/painting/qpainter.cpp4
-rw-r--r--src/gui/painting/qpainterpath_p.h2
-rw-r--r--src/gui/painting/qprinter.cpp4
-rw-r--r--src/gui/painting/qstroker_p.h2
-rw-r--r--src/gui/styles/qcommonstyle.cpp19
-rw-r--r--src/gui/styles/qmacstyle_mac.mm1
-rw-r--r--src/gui/styles/qstyle.cpp2
-rw-r--r--src/gui/styles/qstyle.h2
-rw-r--r--src/gui/text/qcssparser.cpp16
-rw-r--r--src/gui/text/qcssparser_p.h22
-rw-r--r--src/gui/text/qfontengine_ft.cpp43
-rw-r--r--src/gui/text/qtextcursor.cpp25
-rw-r--r--src/gui/text/qtextdocument_p.cpp39
-rw-r--r--src/gui/text/qtextdocument_p.h3
-rw-r--r--src/gui/text/qtexttable.cpp7
-rw-r--r--src/gui/util/qcompleter.cpp2
-rw-r--r--src/gui/widgets/qabstractscrollarea_p.h2
-rw-r--r--src/gui/widgets/qframe_p.h2
-rw-r--r--src/gui/widgets/qmenu_mac.mm108
-rw-r--r--src/gui/widgets/qmenu_wince.cpp2
-rw-r--r--src/gui/widgets/qmenubar.cpp2
-rw-r--r--src/gui/widgets/qplaintextedit.cpp14
-rw-r--r--src/gui/widgets/qprintpreviewwidget.cpp44
-rw-r--r--src/gui/widgets/qtoolbar.cpp12
-rw-r--r--src/gui/widgets/qtoolbarlayout.cpp19
-rw-r--r--src/gui/widgets/qtoolbarlayout_p.h6
-rw-r--r--src/network/kernel/qauthenticator.cpp9
-rw-r--r--src/network/ssl/qsslsocket.cpp4
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp12
-rw-r--r--src/network/ssl/qsslsocket_openssl_p.h2
-rw-r--r--src/qbase.pri5
-rw-r--r--src/script/qscriptvalueiterator.cpp4
-rw-r--r--src/sql/drivers/ibase/qsql_ibase.cpp6
-rw-r--r--src/testlib/qtestcase.cpp29
72 files changed, 679 insertions, 574 deletions
diff --git a/src/3rdparty/phonon/phonon/phononnamespace.h b/src/3rdparty/phonon/phonon/phononnamespace.h
index 0bbf4f4..2492ee6 100644
--- a/src/3rdparty/phonon/phonon/phononnamespace.h
+++ b/src/3rdparty/phonon/phonon/phononnamespace.h
@@ -25,6 +25,11 @@
#include "phonon_export.h"
+#ifdef __QT_SYNCQT__
+// Tell syncqt to create a "Global" header here
+#pragma qt_class(Phonon::Global)
+#endif
+
/**
* Helper macro that can be used like
* \code
diff --git a/src/corelib/codecs/qtsciicodec_p.h b/src/corelib/codecs/qtsciicodec_p.h
index 8f11e48..425e7fd 100644
--- a/src/corelib/codecs/qtsciicodec_p.h
+++ b/src/corelib/codecs/qtsciicodec_p.h
@@ -88,7 +88,7 @@ QT_BEGIN_NAMESPACE
#ifndef QT_NO_CODECS
-class Q_CORE_EXPORT QTsciiCodec : public QTextCodec {
+class QTsciiCodec : public QTextCodec {
public:
~QTsciiCodec();
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 4873b17..3367581 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -504,6 +504,7 @@ public:
AA_DontCreateNativeWidgetSiblings = 4,
AA_MacPluginApplication = 5,
AA_DontUseNativeMenuBar = 6,
+ AA_MacDontSwapCtrlAndMeta = 7,
// Add new attributes before this line
AA_AttributeCount
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index 9990696..b203899 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -514,7 +514,7 @@ void QDataStream::setByteOrder(ByteOrder bo)
\value Qt_4_2 Version 8 (Qt 4.2)
\value Qt_4_3 Version 9 (Qt 4.3)
\value Qt_4_4 Version 10 (Qt 4.4)
- \value Qt_4_5 Version 10 (Qt 4.5)
+ \value Qt_4_5 Version 11 (Qt 4.5)
\omitvalue Qt_4_6
\sa setVersion(), version()
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index d62328f..0dc8a63 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -50,6 +50,7 @@
#include "qstring.h"
#include "qregexp.h"
#include "qvector.h"
+#include "qalgorithms.h"
#ifdef QT_BUILD_CORE_LIB
# include "qresource.h"
#endif
@@ -192,32 +193,28 @@ QDirPrivate::~QDirPrivate()
/* For sorting */
struct QDirSortItem {
- QString filename_cache;
- QString suffix_cache;
+ mutable QString filename_cache;
+ mutable QString suffix_cache;
QFileInfo item;
};
-static int qt_cmp_si_sort_flags;
-#if defined(Q_C_CALLBACKS)
-extern "C" {
-#endif
-#ifdef Q_OS_WINCE
-static int __cdecl qt_cmp_si(const void *n1, const void *n2)
-#else
-static int qt_cmp_si(const void *n1, const void *n2)
-#endif
-{
- if (!n1 || !n2)
- return 0;
+class QDirSortItemComparator {
+ int qt_cmp_si_sort_flags;
+public:
+ QDirSortItemComparator(int flags) : qt_cmp_si_sort_flags(flags) {}
+ bool operator()(const QDirSortItem &, const QDirSortItem &);
+};
- QDirSortItem* f1 = (QDirSortItem*)n1;
- QDirSortItem* f2 = (QDirSortItem*)n2;
+bool QDirSortItemComparator::operator()(const QDirSortItem &n1, const QDirSortItem &n2)
+{
+ const QDirSortItem* f1 = &n1;
+ const QDirSortItem* f2 = &n2;
if ((qt_cmp_si_sort_flags & QDir::DirsFirst) && (f1->item.isDir() != f2->item.isDir()))
- return f1->item.isDir() ? -1 : 1;
+ return f1->item.isDir();
if ((qt_cmp_si_sort_flags & QDir::DirsLast) && (f1->item.isDir() != f2->item.isDir()))
- return f1->item.isDir() ? 1 : -1;
+ return !f1->item.isDir();
int r = 0;
int sortBy = (qt_cmp_si_sort_flags & QDir::SortByMask)
@@ -266,18 +263,11 @@ static int qt_cmp_si(const void *n1, const void *n2)
: f1->filename_cache.compare(f2->filename_cache);
}
- if (r == 0) // Enforce an order - the order the items appear in the array
- r = (char*)n1 - (char*)n2;
-
if (qt_cmp_si_sort_flags & QDir::Reversed)
- return -r;
- return r;
+ return r > 0;
+ return r < 0;
}
-#if defined(Q_C_CALLBACKS)
-}
-#endif
-
inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l,
QStringList *names, QFileInfoList *infos) const
{
@@ -294,9 +284,8 @@ inline void QDirPrivate::sortFileList(QDir::SortFlags sort, QStringList &l,
path += QLatin1Char('/');
si[i].item = QFileInfo(path + l.at(i));
}
- qt_cmp_si_sort_flags = sort;
if ((sort & QDir::SortByMask) != QDir::Unsorted)
- qsort(si, i, sizeof(si[0]), qt_cmp_si);
+ qStableSort(si, si+i, QDirSortItemComparator(sort));
// put them back in the list(s)
for (int j = 0; j<i; j++) {
if(infos)
diff --git a/src/corelib/io/qfileinfo.cpp b/src/corelib/io/qfileinfo.cpp
index a8d28cb..36b1ed8 100644
--- a/src/corelib/io/qfileinfo.cpp
+++ b/src/corelib/io/qfileinfo.cpp
@@ -571,7 +571,6 @@ void QFileInfo::setFile(const QFile &file)
void QFileInfo::setFile(const QDir &dir, const QString &file)
{
- Q_D(QFileInfo);
*this = QFileInfo(dir.filePath(file));
}
diff --git a/src/corelib/io/qfsfileengine_win.cpp b/src/corelib/io/qfsfileengine_win.cpp
index 63506c2..c5b54b4 100644
--- a/src/corelib/io/qfsfileengine_win.cpp
+++ b/src/corelib/io/qfsfileengine_win.cpp
@@ -1392,8 +1392,6 @@ bool QFSFileEnginePrivate::doStat() const
if (tmpAttributes != -1) {
fileAttrib = tmpAttributes;
could_stat = true;
- } else {
- return false;
}
#endif
} else {
diff --git a/src/corelib/io/qsettings_p.h b/src/corelib/io/qsettings_p.h
index dd72fd9..93d07e0 100644
--- a/src/corelib/io/qsettings_p.h
+++ b/src/corelib/io/qsettings_p.h
@@ -146,7 +146,7 @@ inline QString QSettingsGroup::toString() const
return result;
}
-class Q_CORE_EXPORT QConfFile
+class QConfFile
{
public:
ParsedSettingsMap mergedKeyMap() const;
diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp
index 4856353..6a9125c 100644
--- a/src/corelib/io/qtemporaryfile.cpp
+++ b/src/corelib/io/qtemporaryfile.cpp
@@ -294,6 +294,8 @@ public:
QTemporaryFileEngine(const QString &file) : QFSFileEngine(file) { }
~QTemporaryFileEngine();
+ void setFileName(const QString &file);
+
bool open(QIODevice::OpenMode flags);
bool remove();
bool close();
@@ -304,6 +306,13 @@ QTemporaryFileEngine::~QTemporaryFileEngine()
QFSFileEngine::close();
}
+void QTemporaryFileEngine::setFileName(const QString &file)
+{
+ // Really close the file, so we don't leak
+ QFSFileEngine::close();
+ QFSFileEngine::setFileName(file);
+}
+
bool QTemporaryFileEngine::open(QIODevice::OpenMode openMode)
{
Q_D(QFSFileEngine);
diff --git a/src/corelib/io/qtextstream.cpp b/src/corelib/io/qtextstream.cpp
index f63d29e..612d7f7 100644
--- a/src/corelib/io/qtextstream.cpp
+++ b/src/corelib/io/qtextstream.cpp
@@ -67,9 +67,10 @@ static const int QTEXTSTREAM_BUFFERSIZE = 16384;
\snippet doc/src/snippets/code/src_corelib_io_qtextstream.cpp 1
Note that you cannot use QTextStream::atEnd(), which returns true when you
- have reached the end of the data stream, with stdin because as long as the
- application is running, stdin has no end.
-
+ have reached the end of the data stream, with stdin. The reason for this is
+ that as long as stdin doesn't give any input to the QTextStream, \c atEnd()
+ will return true even if the stdin is open and waiting for more characters.
+
Besides using QTextStream's constructors, you can also set the
device or string QTextStream operates on by calling setDevice() or
setString(). You can seek to a position by calling seek(), and
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 220e132..e6aeeef 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -70,7 +70,7 @@ static int DIRECT_CONNECTION_ONLY = 0;
static int *queuedConnectionTypes(const QList<QByteArray> &typeNames)
{
- int *types = static_cast<int *>(qMalloc((typeNames.count() + 1) * sizeof(int)));
+ int *types = new int [typeNames.count() + 1];
for (int i = 0; i < typeNames.count(); ++i) {
const QByteArray typeName = typeNames.at(i);
if (typeName.endsWith('*'))
@@ -82,7 +82,7 @@ static int *queuedConnectionTypes(const QList<QByteArray> &typeNames)
qWarning("QObject::connect: Cannot queue arguments of type '%s'\n"
"(Make sure '%s' is registered using qRegisterMetaType().)",
typeName.constData(), typeName.constData());
- qFree(types);
+ delete [] types;
return 0;
}
}
@@ -218,6 +218,7 @@ public:
}
};
+// Used by QAccessibleWidget
bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const
{
Q_Q(const QObject);
@@ -229,8 +230,8 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const
if (signal_index < connectionLists->count()) {
const ConnectionList &connectionList = connectionLists->at(signal_index);
for (int i = 0; i < connectionList.count(); ++i) {
- const QObjectPrivate::Connection &c = connectionList.at(i);
- if (c.receiver && c.receiver == receiver)
+ const QObjectPrivate::Connection *c = connectionList.at(i);
+ if (c->receiver == receiver)
return true;
}
}
@@ -238,6 +239,7 @@ bool QObjectPrivate::isSender(const QObject *receiver, const char *signal) const
return false;
}
+// Used by QAccessibleWidget
QObjectList QObjectPrivate::receiverList(const char *signal) const
{
Q_Q(const QObject);
@@ -250,21 +252,22 @@ QObjectList QObjectPrivate::receiverList(const char *signal) const
if (signal_index < connectionLists->count()) {
const ConnectionList &connectionList = connectionLists->at(signal_index);
for (int i = 0; i < connectionList.count(); ++i) {
- const QObjectPrivate::Connection &c = connectionList.at(i);
- if (c.receiver)
- returnValue << c.receiver;
+ const QObjectPrivate::Connection *c = connectionList.at(i);
+ if (c->receiver)
+ returnValue << c->receiver;
}
}
}
return returnValue;
}
+// Used by QAccessibleWidget
QObjectList QObjectPrivate::senderList() const
{
QObjectList returnValue;
QMutexLocker locker(&threadData->mutex);
for (int i = 0; i < senders.count(); ++i)
- returnValue << senders.at(i).sender;
+ returnValue << senders.at(i)->sender;
return returnValue;
}
@@ -276,33 +279,11 @@ void QObjectPrivate::addConnection(int signal, Connection *c)
connectionLists->resize(signal + 1);
ConnectionList &connectionList = (*connectionLists)[signal];
- connectionList.append(*c);
+ connectionList.append(c);
cleanConnectionLists();
}
-void QObjectPrivate::removeReceiver(int signal, QObject *receiver)
-{
- if (!connectionLists)
- return;
-
- if (signal >= connectionLists->count())
- return;
-
- ConnectionList &connectionList = (*connectionLists)[signal];
- for (int i = 0; i < connectionList.count(); ++i) {
- Connection &c = connectionList[i];
- if (c.receiver == receiver) {
- c.receiver = 0;
- if (c.argumentTypes && c.argumentTypes != &DIRECT_CONNECTION_ONLY) {
- qFree(c.argumentTypes);
- c.argumentTypes = 0;
- }
- connectionLists->dirty = true;
- }
- }
-}
-
void QObjectPrivate::cleanConnectionLists()
{
if (connectionLists->dirty && !connectionLists->inUse) {
@@ -310,55 +291,17 @@ void QObjectPrivate::cleanConnectionLists()
for (int signal = -1; signal < connectionLists->count(); ++signal) {
QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal];
for (int i = 0; i < connectionList.count(); ++i) {
- const QObjectPrivate::Connection &c = connectionList.at(i);
- if (!c.receiver)
+ QObjectPrivate::Connection *c = connectionList.at(i);
+ if (!c->receiver) {
+ delete c;
connectionList.removeAt(i--);
+ }
}
}
connectionLists->dirty = false;
}
}
-void QObjectPrivate::refSender(QObject *sender, int signal)
-{
- for (int i = 0; i < senders.count(); ++i) {
- Sender &s = senders[i];
- if (s.sender == sender && s.signal == signal) {
- ++s.ref;
- return;
- }
- }
-
- Sender s = { sender, signal, 1 };
- senders.append(s);
-}
-
-void QObjectPrivate::derefSender(QObject *sender, int signal)
-{
- for (int i = 0; i < senders.count(); ++i) {
- Sender &s = senders[i];
- if (s.sender == sender && s.signal == signal) {
- if (--s.ref == 0) {
- senders.removeAt(i);
- break;
- }
- }
- }
- // Q_ASSERT_X(false, "QObjectPrivate::derefSender", "sender not found");
-}
-
-void QObjectPrivate::removeSender(QObject *sender, int signal)
-{
- for (int i = 0; i < senders.count(); ++i) {
- Sender &s = senders[i];
- if (s.sender == sender && s.signal == signal) {
- senders.removeAt(i);
- return;
- }
- }
- // Q_ASSERT_X(false, "QObjectPrivate::removeSender", "sender not found");
-}
-
QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver,
Sender *sender)
{
@@ -784,23 +727,21 @@ QObject::~QObject()
for (int signal = -1; signal < d->connectionLists->count(); ++signal) {
QObjectPrivate::ConnectionList &connectionList = (*d->connectionLists)[signal];
for (int i = 0; i < connectionList.count(); ++i) {
- QObjectPrivate::Connection *c = &connectionList[i];
- if (!c->receiver)
+ QObjectPrivate::Connection *c = connectionList[i];
+ if (!c->receiver) {
+ delete c;
continue;
+ }
QMutex *m = &c->receiver->d_func()->threadData->mutex;
bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m);
- c = &connectionList[i];
+ c = connectionList[i];
if (c->receiver)
- c->receiver->d_func()->removeSender(this, signal);
+ c->receiver->d_func()->senders.removeOne(c);
if (needToUnlock)
m->unlock();
- if (c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) {
- qFree(c->argumentTypes);
- c->argumentTypes = 0;
- }
- c->receiver = 0;
+ delete c;
}
}
@@ -814,15 +755,20 @@ QObject::~QObject()
// disconnect all senders
for (int i = 0; i < d->senders.count(); ++i) {
- QObjectPrivate::Sender *s = &d->senders[i];
+ QObjectPrivate::Connection *s = d->senders[i];
if (!s->sender)
continue;
QMutex *m = &s->sender->d_func()->threadData->mutex;
bool needToUnlock = QOrderedMutexLocker::relock(locker.mutex(), m);
- s = &d->senders[i];
- if (s->sender)
- s->sender->d_func()->removeReceiver(s->signal, this);
+ s = d->senders[i];
+ s->receiver = 0;
+ if (s->sender) {
+ QObjectConnectionListVector *senderLists = s->sender->d_func()->connectionLists;
+ if (senderLists)
+ senderLists->dirty = true;
+ }
+
if (needToUnlock)
m->unlock();
}
@@ -876,6 +822,12 @@ QObject::~QObject()
d_ptr = 0;
}
+QObjectPrivate::Connection::~Connection()
+{
+ if (argumentTypes != &DIRECT_CONNECTION_ONLY)
+ delete [] argumentTypes;
+}
+
/*!
\fn QMetaObject *QObject::metaObject() const
@@ -2314,7 +2266,7 @@ QObject *QObject::sender() const
// Return 0 if d->currentSender isn't in d->senders
bool found = false;
for (int i = 0; !found && i < d->senders.count(); ++i)
- found = (d->senders.at(i).sender == d->currentSender->sender);
+ found = (d->senders.at(i)->sender == d->currentSender->sender);
if (!found)
return 0;
return d->currentSender->sender;
@@ -2369,8 +2321,8 @@ int QObject::receivers(const char *signal) const
const QObjectPrivate::ConnectionList &connectionList =
d->connectionLists->at(signal_index);
for (int i = 0; i < connectionList.count(); ++i) {
- const QObjectPrivate::Connection &c = connectionList.at(i);
- receivers += c.receiver ? 1 : 0;
+ const QObjectPrivate::Connection *c = connectionList.at(i);
+ receivers += c->receiver ? 1 : 0;
}
}
}
@@ -2803,20 +2755,18 @@ bool QMetaObject::connect(const QObject *sender, int signal_index,
QObject *s = const_cast<QObject *>(sender);
QObject *r = const_cast<QObject *>(receiver);
+ QObjectPrivate::Connection *c = new QObjectPrivate::Connection;
+ c->sender = s;
+ c->receiver = r;
+ c->method = method_index;
+ c->connectionType = type;
+ c->argumentTypes = types;
+
QOrderedMutexLocker locker(&s->d_func()->threadData->mutex,
&r->d_func()->threadData->mutex);
-#if defined(Q_CC_HPACC) && defined(QT_ARCH_PARISC)
- QObjectPrivate::Connection c;
- c.receiver = r;
- c.method = method_index;
- c.connectionType = type;
- c.argumentTypes = types;
-#else
- QObjectPrivate::Connection c = { r, method_index, type, Q_BASIC_ATOMIC_INITIALIZER(types) };
-#endif
- s->d_func()->addConnection(signal_index, &c);
- r->d_func()->refSender(s, signal_index);
+ s->d_func()->addConnection(signal_index, c);
+ r->d_func()->senders.append(c);
if (signal_index < 0)
sender->d_func()->connectedSignals = ~0u;
@@ -2855,27 +2805,23 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index,
for (signal_index = -1; signal_index < connectionLists->count(); ++signal_index) {
QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal_index];
for (int i = 0; i < connectionList.count(); ++i) {
- QObjectPrivate::Connection *c = &connectionList[i];
+ QObjectPrivate::Connection *c = connectionList[i];
if (c->receiver
&& (r == 0 || (c->receiver == r
&& (method_index < 0 || c->method == method_index)))) {
QMutex *m = &c->receiver->d_func()->threadData->mutex;
+ bool needToUnlock = false;
if (!receiverMutex && senderMutex != m) {
// need to relock this receiver and sender in the correct order
- bool needToUnlock = QOrderedMutexLocker::relock(senderMutex, m);
- c = &connectionList[i];
- if (c->receiver)
- c->receiver->d_func()->derefSender(s, signal_index);
- if (needToUnlock)
- m->unlock();
- } else {
- // no need to unlock
- c->receiver->d_func()->derefSender(s, signal_index);
- }
- if (c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) {
- qFree(c->argumentTypes);
- c->argumentTypes = 0;
+ needToUnlock = QOrderedMutexLocker::relock(senderMutex, m);
+ c = connectionList[i];
}
+ if (c->receiver)
+ c->receiver->d_func()->senders.removeOne(c);
+
+ if (needToUnlock)
+ m->unlock();
+
c->receiver = 0;
success = true;
@@ -2886,27 +2832,22 @@ bool QMetaObject::disconnect(const QObject *sender, int signal_index,
} else if (signal_index < connectionLists->count()) {
QObjectPrivate::ConnectionList &connectionList = (*connectionLists)[signal_index];
for (int i = 0; i < connectionList.count(); ++i) {
- QObjectPrivate::Connection *c = &connectionList[i];
+ QObjectPrivate::Connection *c = connectionList[i];
if (c->receiver
&& (r == 0 || (c->receiver == r
&& (method_index < 0 || c->method == method_index)))) {
QMutex *m = &c->receiver->d_func()->threadData->mutex;
+ bool needToUnlock = false;
if (!receiverMutex && senderMutex != m) {
// need to relock this receiver and sender in the correct order
- bool needToUnlock = QOrderedMutexLocker::relock(senderMutex, m);
- c = &connectionList[i];
- if (c->receiver)
- c->receiver->d_func()->derefSender(s, signal_index);
- if (needToUnlock)
- m->unlock();
- } else {
- // no need to unlock
- c->receiver->d_func()->derefSender(s, signal_index);
- }
- if (c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) {
- qFree(c->argumentTypes);
- c->argumentTypes = 0;
+ needToUnlock = QOrderedMutexLocker::relock(senderMutex, m);
+ c = connectionList[i];
}
+ if (c->receiver)
+ c->receiver->d_func()->senders.removeOne(c);
+
+ if (needToUnlock)
+ m->unlock();
c->receiver = 0;
success = true;
@@ -2989,32 +2930,31 @@ void QMetaObject::connectSlotsByName(QObject *o)
}
}
-static void queued_activate(QObject *sender, int signal, const QObjectPrivate::Connection &c,
+static void queued_activate(QObject *sender, int signal, QObjectPrivate::Connection *c,
void **argv, QSemaphore *semaphore = 0)
{
- if (!c.argumentTypes || c.argumentTypes != &DIRECT_CONNECTION_ONLY) {
+ if (!c->argumentTypes && c->argumentTypes != &DIRECT_CONNECTION_ONLY) {
QMetaMethod m = sender->metaObject()->method(signal);
- QObjectPrivate::Connection &x = const_cast<QObjectPrivate::Connection &>(c);
int *tmp = queuedConnectionTypes(m.parameterTypes());
if (!tmp) // cannot queue arguments
tmp = &DIRECT_CONNECTION_ONLY;
- if (!x.argumentTypes.testAndSetOrdered(0, tmp)) {
+ if (!c->argumentTypes.testAndSetOrdered(0, tmp)) {
if (tmp != &DIRECT_CONNECTION_ONLY)
- qFree(tmp);
+ delete [] tmp;
}
}
- if (c.argumentTypes == &DIRECT_CONNECTION_ONLY) // cannot activate
+ if (c->argumentTypes == &DIRECT_CONNECTION_ONLY) // cannot activate
return;
int nargs = 1; // include return type
- while (c.argumentTypes[nargs-1])
+ while (c->argumentTypes[nargs-1])
++nargs;
int *types = (int *) qMalloc(nargs*sizeof(int));
void **args = (void **) qMalloc(nargs*sizeof(void *));
types[0] = 0; // return type
args[0] = 0; // return value
for (int n = 1; n < nargs; ++n)
- args[n] = QMetaType::construct((types[n] = c.argumentTypes[n-1]), argv[n]);
- QCoreApplication::postEvent(c.receiver, new QMetaCallEvent(c.method,
+ args[n] = QMetaType::construct((types[n] = c->argumentTypes[n-1]), argv[n]);
+ QCoreApplication::postEvent(c->receiver, new QMetaCallEvent(c->method,
sender,
signal,
nargs,
@@ -3023,13 +2963,13 @@ static void queued_activate(QObject *sender, int signal, const QObjectPrivate::C
semaphore));
}
-static void blocking_activate(QObject *sender, int signal, const QObjectPrivate::Connection &c, void **argv)
+static void blocking_activate(QObject *sender, int signal, QObjectPrivate::Connection *c, void **argv)
{
- if (QThread::currentThread() == c.receiver->thread()) {
+ if (QThread::currentThread() == c->receiver->thread()) {
qWarning("Qt: Dead lock detected while activating a BlockingQueuedConnection: "
"Sender is %s(%p), receiver is %s(%p)",
sender->metaObject()->className(), sender,
- c.receiver->metaObject()->className(), c.receiver);
+ c->receiver->metaObject()->className(), c->receiver);
}
#ifdef QT_NO_THREAD
@@ -3079,7 +3019,7 @@ void QMetaObject::activate(QObject *sender, int from_signal_index, int to_signal
}
int count = connectionLists->at(signal).count();
for (int i = 0; i < count; ++i) {
- const QObjectPrivate::Connection *c = &connectionLists->at(signal)[i];
+ QObjectPrivate::Connection *c = connectionLists->at(signal)[i];
if (!c->receiver)
continue;
@@ -3091,10 +3031,10 @@ void QMetaObject::activate(QObject *sender, int from_signal_index, int to_signal
&& (currentThreadData != sender->d_func()->threadData
|| receiver->d_func()->threadData != sender->d_func()->threadData))
|| (c->connectionType == Qt::QueuedConnection)) {
- queued_activate(sender, signal, *c, argv);
+ queued_activate(sender, signal, c, argv);
continue;
} else if (c->connectionType == Qt::BlockingQueuedConnection) {
- blocking_activate(sender, signal, *c, argv);
+ blocking_activate(sender, signal, c, argv);
continue;
}
@@ -3422,16 +3362,16 @@ void QObject::dumpObjectInfo()
// receivers
const QObjectPrivate::ConnectionList &connectionList = d->connectionLists->at(signal_index);
for (int i = 0; i < connectionList.count(); ++i) {
- const QObjectPrivate::Connection &c = connectionList.at(i);
- if (!c.receiver) {
+ const QObjectPrivate::Connection *c = connectionList.at(i);
+ if (!c->receiver) {
qDebug(" <Disconnected receiver>");
continue;
}
- const QMetaObject *receiverMetaObject = c.receiver->metaObject();
- const QMetaMethod method = receiverMetaObject->method(c.method);
+ const QMetaObject *receiverMetaObject = c->receiver->metaObject();
+ const QMetaMethod method = receiverMetaObject->method(c->method);
qDebug(" --> %s::%s %s",
receiverMetaObject->className(),
- c.receiver->objectName().isEmpty() ? "unnamed" : qPrintable(c.receiver->objectName()),
+ c->receiver->objectName().isEmpty() ? "unnamed" : qPrintable(c->receiver->objectName()),
method.signature());
}
}
@@ -3444,13 +3384,12 @@ void QObject::dumpObjectInfo()
if (!d->senders.isEmpty()) {
for (int i = 0; i < d->senders.count(); ++i) {
- const QObjectPrivate::Sender &s = d->senders.at(i);
- const QMetaObject *senderMetaObject = s.sender->metaObject();
- const QMetaMethod signal = senderMetaObject->method(s.signal);
- qDebug(" <-- %s::%s %s",
- senderMetaObject->className(),
- s.sender->objectName().isEmpty() ? "unnamed" : qPrintable(s.sender->objectName()),
- signal.signature());
+ const QObjectPrivate::Connection *s = d->senders.at(i);
+ const QMetaMethod slot = metaObject()->method(s->method);
+ qDebug(" <-- %s::%s %s",
+ s->sender->metaObject()->className(),
+ s->sender->objectName().isEmpty() ? "unnamed" : qPrintable(s->sender->objectName()),
+ slot.signature());
}
} else {
qDebug(" <None>");
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 81d3aba..bc7995c 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -121,7 +121,6 @@ public:
int signal;
int ref;
};
-
// object currently activating the object
Sender *currentSender;
@@ -158,22 +157,20 @@ public:
// Note: you must hold the signalSlotLock() before accessing the lists below or calling the functions
struct Connection
{
+ QObject *sender;
QObject *receiver;
int method;
uint connectionType : 3; // 0 == auto, 1 == direct, 2 == queued, 4 == blocking
QBasicAtomicPointer<int> argumentTypes;
+ ~Connection();
};
- typedef QList<Connection> ConnectionList;
+ typedef QList<Connection *> ConnectionList;
QObjectConnectionListVector *connectionLists;
void addConnection(int signal, Connection *c);
- void removeReceiver(int signal, QObject *receiver);
void cleanConnectionLists();
- QList<Sender> senders;
- void refSender(QObject *sender, int signal);
- void derefSender(QObject *sender, int signal);
- void removeSender(QObject *sender, int signal);
+ ConnectionList senders;
static Sender *setCurrentSender(QObject *receiver,
Sender *sender);
@@ -218,7 +215,7 @@ private:
QSemaphore *semaphore_;
};
-class Q_CORE_EXPORT QBoolBlocker
+class QBoolBlocker
{
public:
inline QBoolBlocker(bool &b, bool value=true):block(b), reset(b){block = value;}
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 4d0e53c..121a875 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -63,6 +63,21 @@ typedef QObject *(*QtPluginInstanceFunction)();
void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunction function);
+struct qt_plugin_instance_deleter
+{
+ qt_plugin_instance_deleter(QPointer<QObject> &instance)
+ : instance_(instance)
+ {
+ }
+
+ ~qt_plugin_instance_deleter()
+ {
+ delete instance_;
+ }
+
+ QPointer<QObject> &instance_;
+};
+
#define Q_IMPORT_PLUGIN(PLUGIN) \
extern QT_PREPEND_NAMESPACE(QObject) *qt_plugin_instance_##PLUGIN(); \
class Static##PLUGIN##PluginInstance{ \
@@ -76,8 +91,10 @@ void Q_CORE_EXPORT qRegisterStaticPluginInstanceFunction(QtPluginInstanceFunctio
#define Q_PLUGIN_INSTANCE(IMPLEMENTATION) \
{ \
static QT_PREPEND_NAMESPACE(QPointer)<QT_PREPEND_NAMESPACE(QObject)> _instance; \
- if (!_instance) \
+ if (!_instance) { \
+ static QT_PREPEND_NAMESPACE(qt_plugin_instance_deleter) deleter(_instance); \
_instance = new IMPLEMENTATION; \
+ } \
return _instance; \
}
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index 21e564c..ff3fb7d 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -1282,7 +1282,7 @@ static int senderSignalIndex(const QObject *sender)
// Return -1 if d->currentSender isn't in d->senders
bool found = false;
for (int i = 0; !found && i < d->senders.count(); ++i)
- found = (d->senders.at(i).sender == d->currentSender->sender);
+ found = (d->senders.at(i)->sender == d->currentSender->sender);
if (!found)
return -1;
return d->currentSender->signal;
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 559ba81..a2154a9 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -5367,6 +5367,14 @@ static Bigint *mult(Bigint *a, Bigint *b)
static Bigint *p5s;
+struct p5s_deleter
+{
+ ~p5s_deleter()
+ {
+ Bfree(p5s);
+ }
+};
+
static Bigint *pow5mult(Bigint *b, int k)
{
Bigint *b1, *p5, *p51;
@@ -5388,6 +5396,7 @@ static Bigint *pow5mult(Bigint *b, int k)
return b;
if (!(p5 = p5s)) {
/* first time */
+ static p5s_deleter deleter;
p5 = p5s = i2b(625);
p5->next = 0;
}
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h
index 3a0901d..eed4ba9 100644
--- a/src/corelib/tools/qringbuffer_p.h
+++ b/src/corelib/tools/qringbuffer_p.h
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
-class Q_CORE_EXPORT QRingBuffer
+class QRingBuffer
{
public:
inline QRingBuffer(int growth = 4096) : basicBlockSize(growth) {
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h
index 1493dce..69c4f2f 100644
--- a/src/corelib/tools/qstring.h
+++ b/src/corelib/tools/qstring.h
@@ -113,7 +113,7 @@ public:
int capacity() const;
inline void reserve(int size);
- inline void squeeze() { if (d->size < d->alloc) realloc(); d->capacity = 0;}
+ inline void squeeze() { if (d->size < d->alloc || d->ref != 1) realloc(); d->capacity = 0;}
inline const QChar *unicode() const;
inline QChar *data();
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 3fd52ee..1f047b8 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -315,7 +315,7 @@ void QVector<T>::detach_helper()
{ realloc(d->size, d->alloc); }
template <typename T>
void QVector<T>::reserve(int asize)
-{ if (asize > d->alloc) realloc(d->size, asize); d->capacity = 1; }
+{ if (asize > d->alloc || d->ref != 1) realloc(d->size, asize); d->capacity = 1; }
template <typename T>
void QVector<T>::resize(int asize)
{ realloc(asize, (asize > d->alloc || (!d->capacity && asize < d->size && asize < (d->alloc >> 1))) ?
diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp
index 2c27381..f40a45f 100644
--- a/src/dbus/qdbusintegrator.cpp
+++ b/src/dbus/qdbusintegrator.cpp
@@ -1125,12 +1125,7 @@ void QDBusConnectionPrivate::objectDestroyed(QObject *obj)
void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, int signalId,
const QVariantList &args)
{
- int mciid = mo->indexOfClassInfo(QCLASSINFO_DBUS_INTERFACE);
- Q_ASSERT(mciid != -1);
-
- QMetaClassInfo mci = mo->classInfo(mciid);
- Q_ASSERT(mci.value());
- const char *interface = mci.value();
+ QString interface = qDBusInterfaceFromMetaObject(mo);
QMetaMethod mm = mo->method(signalId);
QByteArray memberName = mm.signature();
@@ -1146,12 +1141,12 @@ void QDBusConnectionPrivate::relaySignal(QObject *obj, const QMetaObject *mo, in
}
QDBusReadLocker locker(RelaySignalAction, this);
- QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), QLatin1String(interface),
+ QDBusMessage message = QDBusMessage::createSignal(QLatin1String("/"), interface,
QLatin1String(memberName));
message.setArguments(args);
DBusMessage *msg = QDBusMessagePrivate::toDBusMessage(message);
if (!msg) {
- qWarning("QDBusConnection: Could not emit signal %s.%s", interface, memberName.constData());
+ qWarning("QDBusConnection: Could not emit signal %s.%s", qPrintable(interface), memberName.constData());
return;
}
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index e06d14a..7e885da 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1578,10 +1578,11 @@ void QColorDialog::setCurrentColor(const QColor &color)
{
Q_D(QColorDialog);
d->setCurrentColor(color.rgb());
- d->selectColor(color.rgb());
+ d->selectColor(color);
d->setCurrentAlpha(color.alpha());
#ifdef Q_WS_MAC
+ d->setCurrentQColor(color);
if (d->delegate)
QColorDialogPrivate::setColor(d->delegate, color);
#endif
diff --git a/src/gui/dialogs/qcolordialog_mac.mm b/src/gui/dialogs/qcolordialog_mac.mm
index 2556265..9862c1c 100644
--- a/src/gui/dialogs/qcolordialog_mac.mm
+++ b/src/gui/dialogs/qcolordialog_mac.mm
@@ -234,16 +234,22 @@ QT_USE_NAMESPACE
CGFloat cyan, magenta, yellow, black, alpha;
[color getCyan:&cyan magenta:&magenta yellow:&yellow black:&black alpha:&alpha];
mQtColor->setCmykF(cyan, magenta, yellow, black, alpha);
+ } else if (colorSpace == NSCalibratedRGBColorSpace || colorSpace == NSDeviceRGBColorSpace) {
+ CGFloat red, green, blue, alpha;
+ [color getRed:&red green:&green blue:&blue alpha:&alpha];
+ mQtColor->setRgbF(red, green, blue, alpha);
} else {
- NSColor *tmpColor;
- if (colorSpace == NSCalibratedRGBColorSpace || colorSpace == NSDeviceRGBColorSpace) {
- tmpColor = color;
+ NSColorSpace *colorSpace = [color colorSpace];
+ if ([colorSpace colorSpaceModel] == NSCMYKColorSpaceModel && [color numberOfComponents] == 5){
+ CGFloat components[5];
+ [color getComponents:components];
+ mQtColor->setCmykF(components[0], components[1], components[2], components[3], components[4]);
} else {
- tmpColor = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+ NSColor *tmpColor = [color colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
+ CGFloat red, green, blue, alpha;
+ [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha];
+ mQtColor->setRgbF(red, green, blue, alpha);
}
- CGFloat red, green, blue, alpha;
- [tmpColor getRed:&red green:&green blue:&blue alpha:&alpha];
- mQtColor->setRgbF(red, green, blue, alpha);
}
if (mPriv)
@@ -414,10 +420,20 @@ void QColorDialogPrivate::setColor(void *delegate, const QColor &color)
{
QMacCocoaAutoReleasePool pool;
QCocoaColorPanelDelegate *theDelegate = static_cast<QCocoaColorPanelDelegate *>(delegate);
- NSColor *nsColor = [NSColor colorWithCalibratedRed:color.red() / 255.0
- green:color.green() / 255.0
- blue:color.blue() / 255.0
- alpha:color.alpha() / 255.0];
+ NSColor *nsColor;
+ const QColor::Spec spec = color.spec();
+ if (spec == QColor::Cmyk) {
+ nsColor = [NSColor colorWithDeviceCyan:color.cyanF()
+ magenta:color.magentaF()
+ yellow:color.yellowF()
+ black:color.blackF()
+ alpha:color.alphaF()];
+ } else {
+ nsColor = [NSColor colorWithCalibratedRed:color.redF()
+ green:color.greenF()
+ blue:color.blueF()
+ alpha:color.alphaF()];
+ }
[[theDelegate colorPanel] setColor:nsColor];
}
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 044aa43..903cd74 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -2142,7 +2142,6 @@ void QFileDialogPrivate::createWidgets()
#ifndef QT_NO_COMPLETER
completer = new QFSCompletor(model, q);
qFileDialogUi->fileNameEdit->setCompleter(completer);
- completer->sourceModel = model;
QObject::connect(qFileDialogUi->fileNameEdit, SIGNAL(textChanged(QString)),
q, SLOT(_q_autoCompleteFileName(QString)));
#endif // QT_NO_COMPLETER
diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h
index dc24390..ab4199e 100644
--- a/src/gui/dialogs/qfiledialog_p.h
+++ b/src/gui/dialogs/qfiledialog_p.h
@@ -97,7 +97,7 @@ class Ui_QFileDialog;
*/
class QFSCompletor : public QCompleter {
public:
- QFSCompletor(QAbstractItemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(0)
+ QFSCompletor(QFileSystemModel *model, QObject *parent = 0) : QCompleter(model, parent), proxyModel(0), sourceModel(model)
{
#ifdef Q_OS_WIN
setCaseSensitivity(Qt::CaseInsensitive);
diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp
index c00bd14..3580fdc 100644
--- a/src/gui/dialogs/qprintpreviewdialog.cpp
+++ b/src/gui/dialogs/qprintpreviewdialog.cpp
@@ -54,6 +54,9 @@
#include <QtGui/qtoolbutton.h>
#include <QtGui/qvalidator.h>
#include <QtGui/qfiledialog.h>
+#include <QtGui/qmainwindow.h>
+#include <QtGui/qtoolbar.h>
+#include <QtGui/qformlayout.h>
#include <QtCore/QCoreApplication>
#include <math.h>
@@ -63,6 +66,13 @@
QT_BEGIN_NAMESPACE
namespace {
+class QPrintPreviewMainWindow : public QMainWindow
+{
+public:
+ QPrintPreviewMainWindow(QWidget *parent) : QMainWindow(parent) {}
+ QMenu *createPopupMenu() { return 0; }
+};
+
class ZoomFactorValidator : public QDoubleValidator
{
public:
@@ -197,7 +207,6 @@ public:
QActionGroup *printerGroup;
QAction *printAction;
QAction *pageSetupAction;
- QAction *closeAction;
QPointer<QObject> receiverToDisconnectOnClose;
QByteArray memberToDisconnectOnClose;
@@ -219,27 +228,12 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
QObject::connect(preview, SIGNAL(previewChanged()), q, SLOT(_q_previewChanged()));
setupActions();
- // Navigation
- QToolButton* nextPageButton = new QToolButton;
- nextPageButton->setDefaultAction(nextPageAction);
- QToolButton* prevPageButton = new QToolButton;
- prevPageButton->setDefaultAction(prevPageAction);
- QToolButton* firstPageButton = new QToolButton;
- firstPageButton->setDefaultAction(firstPageAction);
- QToolButton* lastPageButton = new QToolButton;
- lastPageButton->setDefaultAction(lastPageAction);
-
pageNumEdit = new LineEdit;
pageNumEdit->setAlignment(Qt::AlignRight);
- pageNumEdit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::MinimumExpanding));
+ pageNumEdit->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
pageNumLabel = new QLabel;
QObject::connect(pageNumEdit, SIGNAL(editingFinished()), q, SLOT(_q_pageNumEdited()));
- QToolButton* fitWidthButton = new QToolButton;
- fitWidthButton->setDefaultAction(fitWidthAction);
- QToolButton* fitPageButton = new QToolButton;
- fitPageButton->setDefaultAction(fitPageAction);
-
zoomFactor = new QComboBox;
zoomFactor->setEditable(true);
zoomFactor->setMinimumContentsLength(7);
@@ -255,77 +249,66 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
QObject::connect(zoomFactor, SIGNAL(currentIndexChanged(int)),
q, SLOT(_q_zoomFactorChanged()));
- QToolButton* zoomInButton = new QToolButton;
- zoomInButton->setDefaultAction(zoomInAction);
+ QPrintPreviewMainWindow *mw = new QPrintPreviewMainWindow(q);
+ QToolBar *toolbar = new QToolBar(mw);
+ toolbar->addAction(fitWidthAction);
+ toolbar->addAction(fitPageAction);
+ toolbar->addSeparator();
+ toolbar->addWidget(zoomFactor);
+ toolbar->addAction(zoomOutAction);
+ toolbar->addAction(zoomInAction);
+ toolbar->addSeparator();
+ toolbar->addAction(portraitAction);
+ toolbar->addAction(landscapeAction);
+ toolbar->addSeparator();
+ toolbar->addAction(firstPageAction);
+ toolbar->addAction(prevPageAction);
+
+ // this is to ensure the label text and the editor text are
+ // aligned in all styles - the extra QVBoxLayout is a workaround
+ // for bug in QFormLayout
+ QWidget *pageEdit = new QWidget(toolbar);
+ QVBoxLayout *vboxLayout = new QVBoxLayout;
+ vboxLayout->setContentsMargins(0, 0, 0, 0);
+ QFormLayout *formLayout = new QFormLayout;
+ formLayout->setWidget(0, QFormLayout::LabelRole, pageNumEdit);
+ formLayout->setWidget(0, QFormLayout::FieldRole, pageNumLabel);
+ vboxLayout->addLayout(formLayout);
+ vboxLayout->setAlignment(Qt::AlignVCenter);
+ pageEdit->setLayout(vboxLayout);
+ toolbar->addWidget(pageEdit);
+
+ toolbar->addAction(nextPageAction);
+ toolbar->addAction(lastPageAction);
+ toolbar->addSeparator();
+ toolbar->addAction(singleModeAction);
+ toolbar->addAction(facingModeAction);
+ toolbar->addAction(overviewModeAction);
+ toolbar->addSeparator();
+ toolbar->addAction(pageSetupAction);
+ toolbar->addAction(printAction);
+
+ // Cannot use the actions' triggered signal here, since it doesn't autorepeat
+ QToolButton *zoomInButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomInAction));
+ QToolButton *zoomOutButton = static_cast<QToolButton *>(toolbar->widgetForAction(zoomOutAction));
zoomInButton->setAutoRepeat(true);
zoomInButton->setAutoRepeatInterval(200);
zoomInButton->setAutoRepeatDelay(200);
-
- QToolButton* zoomOutButton = new QToolButton;
- zoomOutButton->setDefaultAction(zoomOutAction);
zoomOutButton->setAutoRepeat(true);
zoomOutButton->setAutoRepeatInterval(200);
zoomOutButton->setAutoRepeatDelay(200);
-
- //Cannot use the actions' triggered signal here, since it doesnt autorepeat
QObject::connect(zoomInButton, SIGNAL(clicked()), q, SLOT(_q_zoomIn()));
QObject::connect(zoomOutButton, SIGNAL(clicked()), q, SLOT(_q_zoomOut()));
- QToolButton* portraitButton = new QToolButton;
- portraitButton->setDefaultAction(portraitAction);
- QToolButton* landscapeButton = new QToolButton;
- landscapeButton->setDefaultAction(landscapeAction);
-
- QToolButton* singleModeButton = new QToolButton;
- singleModeButton->setDefaultAction(singleModeAction);
- QToolButton* facingModeButton = new QToolButton;
- facingModeButton->setDefaultAction(facingModeAction);
- QToolButton* overviewModeButton = new QToolButton;
- overviewModeButton->setDefaultAction(overviewModeAction);
-
- QToolButton *printButton = new QToolButton;
- printButton->setDefaultAction(printAction);
- QToolButton *pageSetupButton = new QToolButton;
- pageSetupButton->setDefaultAction(pageSetupAction);
- QToolButton *closeButton = new QToolButton;
- closeButton->setDefaultAction(closeAction);
-
- QHBoxLayout* modeLayout = new QHBoxLayout;
- modeLayout->setSpacing(0);
- modeLayout->addWidget(singleModeButton);
- modeLayout->addWidget(facingModeButton);
- modeLayout->addWidget(overviewModeButton);
-
- QHBoxLayout *barLayout = new QHBoxLayout;
- barLayout->addWidget(fitWidthButton);
- barLayout->addWidget(fitPageButton);
- barLayout->addWidget(zoomFactor);
- barLayout->addWidget(zoomOutButton);
- barLayout->addWidget(zoomInButton);
- barLayout->addWidget(portraitButton);
- barLayout->addWidget(landscapeButton);
- barLayout->addStretch();
- barLayout->addWidget(firstPageButton);
- barLayout->addWidget(prevPageButton);
- barLayout->addWidget(pageNumEdit);
- barLayout->addWidget(pageNumLabel);
- barLayout->addWidget(nextPageButton);
- barLayout->addWidget(lastPageButton);
- barLayout->addStretch();
- barLayout->addLayout(modeLayout);
- barLayout->addStretch();
- barLayout->addWidget(pageSetupButton);
- barLayout->addWidget(printButton);
- barLayout->addWidget(closeButton);
-
- QWidget* buttonBar = new QWidget;
- buttonBar->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Maximum));
- barLayout->setMargin(0);
- buttonBar->setLayout(barLayout);
+ mw->addToolBar(toolbar);
+ mw->setCentralWidget(preview);
+ // QMainWindows are always created as top levels, force it to be a
+ // plain widget
+ mw->setParent(q, Qt::Widget);
QVBoxLayout *topLayout = new QVBoxLayout;
- topLayout->addWidget(buttonBar);
- topLayout->addWidget(preview);
+ topLayout->addWidget(mw);
+ topLayout->setMargin(0);
q->setLayout(topLayout);
QString caption = QCoreApplication::translate("QPrintPreviewDialog", "Print Preview");
@@ -338,7 +321,8 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer)
|| printer->outputFormat() != QPrinter::NativeFormat
#endif
)
- pageSetupButton->setEnabled(false);
+ pageSetupAction->setEnabled(false);
+ preview->setFocus();
}
static inline void qt_setupActionIcon(QAction *action, const QLatin1String &name)
@@ -418,12 +402,10 @@ void QPrintPreviewDialogPrivate::setupActions()
printerGroup = new QActionGroup(q);
printAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Print"));
pageSetupAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Page setup"));
- closeAction = printerGroup->addAction(QCoreApplication::translate("QPrintPreviewDialog", "Close"));
qt_setupActionIcon(printAction, QLatin1String("print"));
qt_setupActionIcon(pageSetupAction, QLatin1String("page-setup"));
QObject::connect(printAction, SIGNAL(triggered(bool)), q, SLOT(_q_print()));
QObject::connect(pageSetupAction, SIGNAL(triggered(bool)), q, SLOT(_q_pageSetup()));
- QObject::connect(closeAction, SIGNAL(triggered(bool)), q, SLOT(reject()));
// Initial state:
fitPageAction->setChecked(true);
diff --git a/src/gui/graphicsview/qgraphicsview_p.h b/src/gui/graphicsview/qgraphicsview_p.h
index a76279e..d573e8f 100644
--- a/src/gui/graphicsview/qgraphicsview_p.h
+++ b/src/gui/graphicsview/qgraphicsview_p.h
@@ -63,7 +63,7 @@
QT_BEGIN_NAMESPACE
-class Q_GUI_EXPORT QGraphicsViewPrivate : public QAbstractScrollAreaPrivate
+class QGraphicsViewPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QGraphicsView)
public:
diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h
index 3509a54..f4cdeca 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.h
+++ b/src/gui/graphicsview/qgraphicswidget_p.h
@@ -68,7 +68,7 @@ class QStyleOptionTitleBar;
#if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
-class Q_GUI_EXPORT QGraphicsWidgetPrivate : public QGraphicsItemPrivate
+class QGraphicsWidgetPrivate : public QGraphicsItemPrivate
{
Q_DECLARE_PUBLIC(QGraphicsWidget)
public:
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index dc5ca21..c150b0e 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -275,7 +275,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
if (hasIgnoreFlag) {
factors[i] = (stretch < 0) ? 1.0 : 0.0;
} else {
- factors[i] = (stretch < 0) ? sizes[i] : 0.0;
+ factors[i] = (stretch < 0) ? sizes[i] : 0.0;
}
} else if (stretch == sumStretches) {
factors[i] = 1.0;
@@ -615,7 +615,7 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig
QSizeF size = effectiveMaxSize().boundedTo(QSizeF(cellWidth, cellHeight));
width = size.width();
height = size.height();
-
+
Qt::Alignment align = q_engine->effectiveAlignment(this);
switch (align & Qt::AlignHorizontal_Mask) {
case Qt::AlignHCenter:
@@ -717,7 +717,7 @@ void QGridLayoutItem::dump(int indent) const
void QGridLayoutRowInfo::insertOrRemoveRows(int row, int delta)
{
count += delta;
-
+
insertOrRemoveItems(stretches, row, delta);
insertOrRemoveItems(spacings, row, delta);
insertOrRemoveItems(alignments, row, delta);
@@ -1076,7 +1076,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
break;
}
return QSizeF();
-}
+}
QSizePolicy::ControlTypes QGridLayoutEngine::controlTypes(LayoutSide side) const
{
@@ -1150,16 +1150,16 @@ void QGridLayoutEngine::dump(int indent) const
q_rowData.dump(indent + 2);
qDebug("%*s Geometries output", indent, "");
+ QVector<qreal> *cellPos = &q_yy;
for (int pass = 0; pass < 2; ++pass) {
- QVector<qreal> &cellPos = q_yy;
QString message;
- for (i = 0; i < cellPos.count(); ++i) {
+ for (i = 0; i < cellPos->count(); ++i) {
message += QLatin1String((message.isEmpty() ? "[" : ", "));
- message += QString::number(cellPos.at(i));
+ message += QString::number(cellPos->at(i));
}
message += QLatin1String("]");
qDebug("%*s %s %s", indent, "", (pass == 0 ? "rows:" : "columns:"), qPrintable(message));
- cellPos = q_xx;
+ cellPos = &q_xx;
}
}
#endif
@@ -1538,5 +1538,5 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo,
}
QT_END_NAMESPACE
-
+
#endif //QT_NO_GRAPHICSVIEW
diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h
index 860485a..6402af2 100644
--- a/src/gui/image/qnativeimage_p.h
+++ b/src/gui/image/qnativeimage_p.h
@@ -70,7 +70,7 @@ QT_BEGIN_NAMESPACE
class QWidget;
-class Q_GUI_EXPORT QNativeImage
+class QNativeImage
{
public:
QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer = false, QWidget *widget = 0);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 4c1f7fc..90c38ca 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -2845,9 +2845,9 @@ void QAbstractItemView::setIndexWidget(const QModelIndex &index, QWidget *widget
d->persistent.insert(widget);
d->addEditor(index, widget, true);
widget->show();
+ dataChanged(index, index); // update the geometry
if (!d->delayedPendingLayout)
widget->setGeometry(visualRect(index));
- dataChanged(index, index); // update the geometry
}
}
diff --git a/src/gui/itemviews/qabstractitemview_p.h b/src/gui/itemviews/qabstractitemview_p.h
index 16bd1ab..139d0b7 100644
--- a/src/gui/itemviews/qabstractitemview_p.h
+++ b/src/gui/itemviews/qabstractitemview_p.h
@@ -99,7 +99,7 @@ public:
QVariant data(const QModelIndex &, int) const { return QVariant(); }
};
-class Q_GUI_EXPORT QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate
+class QAbstractItemViewPrivate : public QAbstractScrollAreaPrivate
{
Q_DECLARE_PUBLIC(QAbstractItemView)
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index d3a0228..a77325c 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -899,6 +899,17 @@ bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const
uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference
uint platform = QApplicationPrivate::currentPlatform();
+#ifdef Q_WS_MAC
+ if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
+ uint oldSearchKey = searchkey;
+ searchkey &= ~(Qt::ControlModifier | Qt::MetaModifier);
+ if (oldSearchKey & Qt::ControlModifier)
+ searchkey |= Qt::MetaModifier;
+ if (oldSearchKey & Qt::MetaModifier)
+ searchkey |= Qt::ControlModifier;
+ }
+#endif
+
uint N = QKeySequencePrivate::numberOfKeyBindings;
int first = 0;
int last = N - 1;
diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h
index 9917ff5..484f335 100644
--- a/src/gui/kernel/qevent_p.h
+++ b/src/gui/kernel/qevent_p.h
@@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE
//
// ### Qt 5: remove
-class Q_GUI_EXPORT QKeyEventEx : public QKeyEvent
+class QKeyEventEx : public QKeyEvent
{
public:
QKeyEventEx(Type type, int key, Qt::KeyboardModifiers modifiers,
@@ -77,7 +77,7 @@ protected:
};
// ### Qt 5: remove
-class Q_GUI_EXPORT QMouseEventEx : public QMouseEvent
+class QMouseEventEx : public QMouseEvent
{
public:
QMouseEventEx(Type type, const QPointF &pos, const QPoint &globalPos,
diff --git a/src/gui/kernel/qkeymapper.cpp b/src/gui/kernel/qkeymapper.cpp
index 535d009..503a33b 100644
--- a/src/gui/kernel/qkeymapper.cpp
+++ b/src/gui/kernel/qkeymapper.cpp
@@ -116,6 +116,4 @@ QKeyMapperPrivate *qt_keymapper_private()
return QKeyMapper::instance()->d_func();
}
-Q_GUI_EXPORT QList<int> qt_keymapper_possibleKeys(QKeyEvent *e) { return QKeyMapper::instance()->possibleKeys(e); }
-
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index 39abc5e..01b2c13 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -161,6 +161,14 @@ Qt::KeyboardModifiers qt_mac_get_modifiers(int keys)
ret |= Qt::KeyboardModifier(qt_mac_modifier_symbols[i].qt_code);
}
}
+ if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
+ Qt::KeyboardModifiers oldModifiers = ret;
+ ret &= ~(Qt::MetaModifier | Qt::ControlModifier);
+ if (oldModifiers & Qt::ControlModifier)
+ ret |= Qt::MetaModifier;
+ if (oldModifiers & Qt::MetaModifier)
+ ret |= Qt::ControlModifier;
+ }
return ret;
}
static int qt_mac_get_mac_modifiers(Qt::KeyboardModifiers keys)
@@ -177,6 +185,15 @@ static int qt_mac_get_mac_modifiers(Qt::KeyboardModifiers keys)
ret |= qt_mac_modifier_symbols[i].mac_code;
}
}
+
+ if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
+ int oldModifiers = ret;
+ ret &= ~(controlKeyBit | cmdKeyBit);
+ if (oldModifiers & controlKeyBit)
+ ret |= cmdKeyBit;
+ if (oldModifiers & cmdKeyBit)
+ ret |= controlKeyBit;
+ }
return ret;
}
void qt_mac_send_modifiers_changed(quint32 modifiers, QObject *object)
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 352d26a..d1cb572 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -105,20 +105,39 @@ static bool operator<(int key, const MacSpecialKey &entry)
static const MacSpecialKey * const MacSpecialKeyEntriesEnd = entries + NumEntries;
-static QChar macSymbolForQtKey(int key)
+QChar qt_macSymbolForQtKey(int key)
{
const MacSpecialKey *i = qBinaryFind(entries, MacSpecialKeyEntriesEnd, key);
if (i == MacSpecialKeyEntriesEnd)
return QChar();
- return QChar(i->macSymbol);
+ ushort macSymbol = i->macSymbol;
+ if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)
+ && (macSymbol == kControlUnicode || macSymbol == kCommandUnicode)) {
+ if (macSymbol == kControlUnicode)
+ macSymbol = kCommandUnicode;
+ else
+ macSymbol = kControlUnicode;
+ }
+
+ return QChar(macSymbol);
}
static int qtkeyForMacSymbol(const QChar ch)
{
+ const ushort unicode = ch.unicode();
for (int i = 0; i < NumEntries; ++i) {
const MacSpecialKey &entry = entries[i];
- if (entry.macSymbol == ch.unicode())
- return entry.key;
+ if (entry.macSymbol == unicode) {
+ int key = entry.key;
+ if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)
+ && (unicode == kControlUnicode || unicode == kCommandUnicode)) {
+ if (unicode == kControlUnicode)
+ key = Qt::Key_Control;
+ else
+ key = Qt::Key_Meta;
+ }
+ return key;
+ }
}
return -1;
}
@@ -213,12 +232,14 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni
\row \i Open \i Ctrl+O \i Ctrl+O \i Ctrl+O \i Ctrl+O
\row \i Close \i Ctrl+F4, Ctrl+W \i Ctrl+W, Ctrl+F4 \i Ctrl+W \i Ctrl+W
\row \i Save \i Ctrl+S \i Ctrl+S \i Ctrl+S \i Ctrl+S
+ \row \i Quit \i \i Ctrl+Q \i Qtrl+Q \i Qtrl+Q
\row \i SaveAs \i \i Ctrl+Shift+S \i \i Ctrl+Shift+S
\row \i New \i Ctrl+N \i Ctrl+N \i Ctrl+N \i Ctrl+N
\row \i Delete \i Del \i Del, Meta+D \i Del, Ctrl+D \i Del, Ctrl+D
\row \i Cut \i Ctrl+X, Shift+Del \i Ctrl+X \i Ctrl+X, F20, Shift+Del \i Ctrl+X, F20, Shift+Del
\row \i Copy \i Ctrl+C, Ctrl+Ins \i Ctrl+C \i Ctrl+C, F16, Ctrl+Ins \i Ctrl+C, F16, Ctrl+Ins
\row \i Paste \i Ctrl+V, Shift+Ins \i Ctrl+V \i Ctrl+V, F18, Shift+Ins \i Ctrl+V, F18, Shift+Ins
+ \row \i Preferences \i \i Ctrl+, \i \i
\row \i Undo \i Ctrl+Z, Alt+Backspace \i Ctrl+Z \i Ctrl+Z, F14 \i Ctrl+Z, F14
\row \i Redo \i Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \i Ctrl+Shift+Z, Ctrl+Y \i Ctrl+Shift+Z \i Ctrl+Shift+Z
\row \i Back \i Alt+Left, Backspace \i Ctrl+[ \i Alt+Left \i Alt+Left
@@ -521,6 +542,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::FindPrevious, 1, Qt::SHIFT | Qt::Key_F3, QApplicationPrivate::KB_Win},
{QKeySequence::ZoomIn, 1, Qt::CTRL | Qt::Key_Plus, QApplicationPrivate::KB_All},
{QKeySequence::NextChild, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_KDE},
+ {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, QApplicationPrivate::KB_Mac},
{QKeySequence::ZoomOut, 1, Qt::CTRL | Qt::Key_Minus, QApplicationPrivate::KB_All},
{QKeySequence::PreviousChild, 0, Qt::CTRL | Qt::Key_Period, QApplicationPrivate::KB_KDE},
{QKeySequence::HelpContents, 1, Qt::CTRL | Qt::Key_Question, QApplicationPrivate::KB_Mac},
@@ -538,6 +560,7 @@ const QKeyBinding QKeySequencePrivate::keyBindings[] = {
{QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, QApplicationPrivate::KB_All},
{QKeySequence::Open, 1, Qt::CTRL | Qt::Key_O, QApplicationPrivate::KB_All},
{QKeySequence::Print, 1, Qt::CTRL | Qt::Key_P, QApplicationPrivate::KB_All},
+ {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_KDE | QApplicationPrivate::KB_Mac},
{QKeySequence::Refresh, 1, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_Gnome | QApplicationPrivate::KB_Mac},
{QKeySequence::Replace, 0, Qt::CTRL | Qt::Key_R, QApplicationPrivate::KB_KDE},
{QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, QApplicationPrivate::KB_All},
@@ -671,12 +694,14 @@ const uint QKeySequencePrivate::numberOfKeyBindings = sizeof(QKeySequencePrivate
\value NextChild Navigate to next tab or child window.
\value Open Open document.
\value Paste Paste.
+ \value Preferences Open the preferences dialog.
\value PreviousChild Navigate to previous tab or child window.
\value Print Print document.
+ \value Quit Quit the application.
\value Redo Redo.
\value Refresh Refresh or reload current document.
\value Replace Find and replace.
- \value SaveAs Save document after prompting the user for a file name.
+ \value SaveAs Save document after prompting the user for a file name.
\value Save Save document.
\value SelectAll Select all text.
\value SelectEndOfBlock Extend selection to the end of a text block. This shortcut is only used on OS X.
@@ -782,6 +807,21 @@ QKeySequence::QKeySequence(const QKeySequence& keysequence)
d->ref.ref();
}
+#ifdef Q_WS_MAC
+static inline int maybeSwapShortcut(int shortcut)
+{
+ if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
+ uint oldshortcut = shortcut;
+ shortcut &= ~(Qt::CTRL | Qt::META);
+ if (oldshortcut & Qt::CTRL)
+ shortcut |= Qt::META;
+ if (oldshortcut & Qt::META)
+ shortcut |= Qt::CTRL;
+ }
+ return shortcut;
+}
+#endif
+
/*!
\since 4.2
@@ -798,10 +838,16 @@ QList<QKeySequence> QKeySequence::keyBindings(StandardKey key)
for (uint i = 0; i < QKeySequencePrivate::numberOfKeyBindings ; ++i) {
QKeyBinding keyBinding = QKeySequencePrivate::keyBindings[i];
if (keyBinding.standardKey == key && (keyBinding.platform & platform)) {
- if (keyBinding.priority > 0)
- list.prepend(QKeySequence(QKeySequencePrivate::keyBindings[i].shortcut));
- else
- list.append(QKeySequence(QKeySequencePrivate::keyBindings[i].shortcut));
+ uint shortcut =
+#ifdef Q_WS_MAC
+ maybeSwapShortcut(QKeySequencePrivate::keyBindings[i].shortcut);
+#else
+ QKeySequencePrivate::keyBindings[i].shortcut;
+#endif
+ if (keyBinding.priority > 0)
+ list.prepend(QKeySequence(shortcut));
+ else
+ list.append(QKeySequence(shortcut));
}
}
return list;
@@ -969,9 +1015,16 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
gmodifs = globalModifs();
if (gmodifs->isEmpty()) {
#ifdef Q_WS_MAC
- *gmodifs << QModifKeyName(Qt::CTRL, QChar(kCommandUnicode));
+ const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
+ if (dontSwap)
+ *gmodifs << QModifKeyName(Qt::META, QChar(kCommandUnicode));
+ else
+ *gmodifs << QModifKeyName(Qt::CTRL, QChar(kCommandUnicode));
*gmodifs << QModifKeyName(Qt::ALT, QChar(kOptionUnicode));
- *gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode));
+ if (dontSwap)
+ *gmodifs << QModifKeyName(Qt::CTRL, QChar(kControlUnicode));
+ else
+ *gmodifs << QModifKeyName(Qt::META, QChar(kControlUnicode));
*gmodifs << QModifKeyName(Qt::SHIFT, QChar(kShiftUnicode));
#endif
*gmodifs << QModifKeyName(Qt::CTRL, QLatin1String("ctrl+"))
@@ -1069,8 +1122,6 @@ int QKeySequencePrivate::decodeString(const QString &str, QKeySequence::Sequence
if (found)
break;
}
-#ifdef Q_WS_MAC
-#endif
}
return ret;
}
@@ -1099,15 +1150,30 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
QString s;
#if defined(Q_WS_MAC)
if (nativeText) {
- // On MAC the order is Meta, Alt, Shift, Control.
- if ((key & Qt::META) == Qt::META)
- s += macSymbolForQtKey(Qt::Key_Meta);
- if ((key & Qt::ALT) == Qt::ALT)
- s += macSymbolForQtKey(Qt::Key_Alt);
- if ((key & Qt::SHIFT) == Qt::SHIFT)
- s += macSymbolForQtKey(Qt::Key_Shift);
- if ((key & Qt::CTRL) == Qt::CTRL)
- s += macSymbolForQtKey(Qt::Key_Control);
+ // On Mac OS X the order (by default) is Meta, Alt, Shift, Control.
+ // If the AA_MacDontSwapCtrlAndMeta is enabled, then the order
+ // is Ctrl, Alt, Shift, Meta. The macSymbolForQtKey does this swap
+ // for us, which means that we have to adjust our order here.
+ // The upshot is a lot more infrastructure to keep the number of
+ // if tests down and the code relatively clean.
+ static const int ModifierOrder[] = { Qt::META, Qt::ALT, Qt::SHIFT, Qt::CTRL, 0 };
+ static const int QtKeyOrder[] = { Qt::Key_Meta, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Control, 0 };
+ static const int DontSwapModifierOrder[] = { Qt::CTRL, Qt::ALT, Qt::SHIFT, Qt::META, 0 };
+ static const int DontSwapQtKeyOrder[] = { Qt::Key_Control, Qt::Key_Alt, Qt::Key_Shift, Qt::Key_Meta, 0 };
+ const int *modifierOrder;
+ const int *qtkeyOrder;
+ if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
+ modifierOrder = DontSwapModifierOrder;
+ qtkeyOrder = DontSwapQtKeyOrder;
+ } else {
+ modifierOrder = ModifierOrder;
+ qtkeyOrder = QtKeyOrder;
+ }
+
+ for (int i = 0; modifierOrder[i] != 0; ++i) {
+ if (key & modifierOrder[i])
+ s += qt_macSymbolForQtKey(qtkeyOrder[i]);
+ }
} else
#endif
{
@@ -1140,7 +1206,7 @@ QString QKeySequencePrivate::encodeString(int key, QKeySequence::SequenceFormat
int i=0;
#if defined(Q_WS_MAC)
if (nativeText) {
- QChar ch = macSymbolForQtKey(key);
+ QChar ch = qt_macSymbolForQtKey(key);
if (!ch.isNull())
p = ch;
else
diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h
index 1c4776f..f78e34a 100644
--- a/src/gui/kernel/qkeysequence.h
+++ b/src/gui/kernel/qkeysequence.h
@@ -136,7 +136,9 @@ public:
DeleteEndOfLine,
InsertParagraphSeparator,
InsertLineSeparator,
- SaveAs
+ SaveAs,
+ Preferences,
+ Quit
};
QKeySequence();
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index cbf9585..b7c4d33 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -11420,3 +11420,17 @@ void QWidget::clearMask()
setMask(QRegion());
}
+/*! \fn const QX11Info &QWidget::x11Info() const
+ Returns information about the configuration of the X display used to display
+ the widget.
+
+ \warning This function is only available on X11.
+*/
+
+/*! \fn Qt::HANDLE QWidget::x11PictureHandle() const
+ Returns the X11 Picture handle of the widget for XRender
+ support. Use of this function is not portable. This function will
+ return 0 if XRender support is not compiled into Qt, if the
+ XRender extension is not supported on the X11 display, or if the
+ handle could not be created.
+*/
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 76734d4..6202b35 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -2747,12 +2747,6 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal opacity)
32, PropModeReplace, (uchar*)&value, 1);
}
-/*!
- Returns information about the configuration of the X display used to display
- the widget.
-
- \warning This function is only available on X11.
-*/
const QX11Info &QWidget::x11Info() const
{
Q_D(const QWidget);
@@ -2789,13 +2783,6 @@ QWindowSurface *QWidgetPrivate::createDefaultWindowSurface_sys()
return new QX11WindowSurface(q_func());
}
-/*!
- Returns the X11 Picture handle of the widget for XRender
- support. Use of this function is not portable. This function will
- return 0 if XRender support is not compiled into Qt, if the
- XRender extension is not supported on the X11 display, or if the
- handle could not be created.
-*/
Qt::HANDLE QWidget::x11PictureHandle() const
{
#ifndef QT_NO_XRENDER
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index a5cfbbd..4744f14 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -7159,14 +7159,14 @@ QPoint QPainter::xFormDev(const QPoint &p) const
\fn QRect QPainter::xFormDev(const QRect &rectangle) const
\overload
- Use combineMatrix() combined with QMatrix::inverted() instead.
+ Use mapRect() combined with QMatrix::inverted() instead.
\oldcode
QPainter painter(this);
QRect transformed = painter.xFormDev(rectangle);
\newcode
QPainter painter(this);
- QRect transformed = rectangle * painter.combinedMatrix().inverted();
+ QRect transformed = painter.combinedMatrix().inverted(rectangle);
\endcode
*/
diff --git a/src/gui/painting/qpainterpath_p.h b/src/gui/painting/qpainterpath_p.h
index 29c48df..6fb439d 100644
--- a/src/gui/painting/qpainterpath_p.h
+++ b/src/gui/painting/qpainterpath_p.h
@@ -124,7 +124,7 @@ private:
Q_DISABLE_COPY(QVectorPathConverter)
};
-class Q_GUI_EXPORT QPainterPathData : public QPainterPathPrivate
+class QPainterPathData : public QPainterPathPrivate
{
public:
QPainterPathData() :
diff --git a/src/gui/painting/qprinter.cpp b/src/gui/painting/qprinter.cpp
index 5efe0be..154d90c 100644
--- a/src/gui/painting/qprinter.cpp
+++ b/src/gui/painting/qprinter.cpp
@@ -773,8 +773,8 @@ void QPrinter::setOutputFormat(OutputFormat format)
if (def_engine)
delete oldPrintEngine;
- d->validPrinter = (d->outputFormat == QPrinter::PdfFormat
- || d->outputFormat == QPrinter::PostScriptFormat);
+ if (d->outputFormat == QPrinter::PdfFormat || d->outputFormat == QPrinter::PostScriptFormat)
+ d->validPrinter = true;
#else
Q_UNUSED(format);
#endif
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index 72141aa..ca1f270 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -179,7 +179,7 @@ private:
};
-class Q_GUI_EXPORT QStroker : public QStrokerOps
+class QStroker : public QStrokerOps
{
public:
diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp
index 1d12bed..c0899f8 100644
--- a/src/gui/styles/qcommonstyle.cpp
+++ b/src/gui/styles/qcommonstyle.cpp
@@ -3187,6 +3187,25 @@ QRect QCommonStyle::subElementRect(SubElement sr, const QStyleOption *opt,
}
break;
#endif //QT_NO_ITEMVIEWS
+#ifndef QT_NO_TOOLBAR
+ case SE_ToolBarHandle:
+ if (const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
+ if (tbopt->features & QStyleOptionToolBar::Movable) {
+ ///we need to access the widget here because the style option doesn't
+ //have all the information we need (ie. the layout's margin)
+ const QToolBar *tb = qobject_cast<const QToolBar*>(widget);
+ const int margin = tb && tb->layout() ? tb->layout()->margin() : 2;
+ const int handleExtent = pixelMetric(QStyle::PM_ToolBarExtensionExtent, opt, tb);
+ if (tbopt->state & QStyle::State_Horizontal) {
+ r = QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin);
+ r = QStyle::visualRect(tbopt->direction, tbopt->rect, r);
+ } else {
+ r = QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent);
+ }
+ }
+ }
+ break;
+#endif //QT_NO_TOOLBAR
default:
break;
}
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 64ec29a..5e538cb 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -5274,7 +5274,6 @@ void QMacStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex
if (const QStyleOptionToolButton *tb
= qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
if (widget && qobject_cast<QToolBar *>(widget->parentWidget())) {
-// p->fillRect(tb->rect, QColor(155, 0, 155, 155));
if (tb->subControls & SC_ToolButtonMenu) {
QStyleOption arrowOpt(0);
arrowOpt.rect = subControlRect(cc, tb, SC_ToolButtonMenu, widget);
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 982f48f..b73332f 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -1048,6 +1048,8 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SE_TabBarTabRightButton Area for a widget on the right side of a tab in a tab bar.
\value SE_TabBarTabText Area for the text on a tab in a tab bar.
+ \value SE_ToolBarHandle Area for the handle of a tool bar.
+
\sa subElementRect()
*/
diff --git a/src/gui/styles/qstyle.h b/src/gui/styles/qstyle.h
index c1cbbdd..cc92459 100644
--- a/src/gui/styles/qstyle.h
+++ b/src/gui/styles/qstyle.h
@@ -373,6 +373,8 @@ public:
SE_ShapedFrameContents,
+ SE_ToolBarHandle,
+
// do not add any values below/greater than this
SE_CustomBase = 0xf0000000
};
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index db1e781..8214e54 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -278,19 +278,15 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
{ "xx-large", Value_XXLarge }
};
+//Map id to strings as they appears in the 'values' array above
+static const int indexOfId[NumKnownValues] = { 0, 40, 47, 41, 48, 53, 34, 26, 68, 69, 25, 42, 5, 62, 46,
+ 29, 57, 58, 27, 50, 60, 6, 10, 38, 55, 19, 13, 17, 18, 20, 21, 49, 24, 45, 65, 36, 3, 2, 39, 61, 16,
+ 11, 56, 14, 32, 63, 54, 64, 33, 67, 8, 28, 37, 12, 35, 59, 7, 9, 4, 66, 52, 22, 23, 30, 31, 1, 15, 0,
+ 51, 44, 43 };
+
QString Value::toString() const
{
- static int indexOfId[NumKnownValues - 1];
- static bool hasCachedIndexes = false;
-
if (type == KnownIdentifier) {
- if (!hasCachedIndexes) {
- for (int i = 0; i < NumKnownValues - 1; ++i)
- indexOfId[values[i].id] = i;
-
- hasCachedIndexes = true;
- }
-
return QLatin1String(values[indexOfId[variant.toInt()]].name);
} else {
return variant.toString();
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 97a0aef..fbd6c16 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -403,7 +403,7 @@ struct BorderData {
// 4. QVector<Declaration> - { prop1: value1; prop2: value2; }
// 5. Declaration - prop1: value1;
-struct Q_GUI_EXPORT Declaration
+struct Declaration
{
struct DeclarationData : public QSharedData
{
@@ -495,7 +495,7 @@ const quint64 PseudoClass_Alternate = Q_UINT64_C(0x0000100000000000);
const quint64 PseudoClass_Any = Q_UINT64_C(0x0000ffffffffffff);
const int NumPseudos = 46;
-struct Q_GUI_EXPORT Pseudo
+struct Pseudo
{
Pseudo() : negated(false) { }
quint64 type;
@@ -504,7 +504,7 @@ struct Q_GUI_EXPORT Pseudo
bool negated;
};
-struct Q_GUI_EXPORT AttributeSelector
+struct AttributeSelector
{
enum ValueMatchType {
NoMatch,
@@ -519,7 +519,7 @@ struct Q_GUI_EXPORT AttributeSelector
ValueMatchType valueMatchCriterium;
};
-struct Q_GUI_EXPORT BasicSelector
+struct BasicSelector
{
inline BasicSelector() : relationToNext(NoRelation) {}
@@ -539,7 +539,7 @@ struct Q_GUI_EXPORT BasicSelector
Relation relationToNext;
};
-struct Q_GUI_EXPORT Selector
+struct Selector
{
QVector<BasicSelector> basicSelectors;
int specificity() const;
@@ -552,7 +552,7 @@ struct MediaRule;
struct PageRule;
struct ImportRule;
-struct Q_GUI_EXPORT ValueExtractor
+struct ValueExtractor
{
ValueExtractor(const QVector<Declaration> &declarations, const QPalette & = QPalette());
@@ -586,7 +586,7 @@ private:
QPalette pal;
};
-struct Q_GUI_EXPORT StyleRule
+struct StyleRule
{
StyleRule() : order(0) { }
QVector<Selector> selectors;
@@ -594,19 +594,19 @@ struct Q_GUI_EXPORT StyleRule
int order;
};
-struct Q_GUI_EXPORT MediaRule
+struct MediaRule
{
QStringList media;
QVector<StyleRule> styleRules;
};
-struct Q_GUI_EXPORT PageRule
+struct PageRule
{
QString selector;
QVector<Declaration> declarations;
};
-struct Q_GUI_EXPORT ImportRule
+struct ImportRule
{
QString href;
QStringList media;
@@ -620,7 +620,7 @@ enum StyleSheetOrigin {
StyleSheetOrigin_Inline
};
-struct Q_GUI_EXPORT StyleSheet
+struct StyleSheet
{
StyleSheet() : origin(StyleSheetOrigin_Unspecified), depth(0) { }
QVector<StyleRule> styleRules; //only contains rules that are not indexed
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index de03a3c..7a236fd 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1521,6 +1521,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
return false;
}
+#if !defined(QT_NO_FONTCONFIG)
+ extern QMutex *qt_fontdatabase_mutex();
+ QMutex *mtx = 0;
+#endif
+
bool mirrored = flags & QTextEngine::RightToLeft;
int glyph_pos = 0;
if (freetype->symbol_map) {
@@ -1533,6 +1538,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
if ( !glyphs->glyphs[glyph_pos] ) {
glyph_t glyph;
#if !defined(QT_NO_FONTCONFIG)
+ if (!mtx) {
+ mtx = qt_fontdatabase_mutex();
+ mtx->lock();
+ }
+
if (FcCharSetHasChar(freetype->charset, uc)) {
#else
if (false) {
@@ -1561,20 +1571,26 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
if (mirrored)
uc = QChar::mirroredChar(uc);
glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
- if (!glyphs->glyphs[glyph_pos]
+ if (!glyphs->glyphs[glyph_pos]) {
#if !defined(QT_NO_FONTCONFIG)
- && FcCharSetHasChar(freetype->charset, uc)
+ if (!mtx) {
+ mtx = qt_fontdatabase_mutex();
+ mtx->lock();
+ }
+
+ if (FcCharSetHasChar(freetype->charset, uc))
#endif
- ) {
- redo:
- glyph_t glyph = FT_Get_Char_Index(face, uc);
- if (!glyph && (uc == 0xa0 || uc == 0x9)) {
- uc = 0x20;
- goto redo;
+ {
+ redo:
+ glyph_t glyph = FT_Get_Char_Index(face, uc);
+ if (!glyph && (uc == 0xa0 || uc == 0x9)) {
+ uc = 0x20;
+ goto redo;
+ }
+ glyphs->glyphs[glyph_pos] = glyph;
+ if (uc < QFreetypeFace::cmapCacheSize)
+ freetype->cmapCache[uc] = glyph;
}
- glyphs->glyphs[glyph_pos] = glyph;
- if (uc < QFreetypeFace::cmapCacheSize)
- freetype->cmapCache[uc] = glyph;
}
++glyph_pos;
}
@@ -1583,6 +1599,11 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
*nglyphs = glyph_pos;
glyphs->numGlyphs = glyph_pos;
+#if !defined(QT_NO_FONTCONFIG)
+ if (mtx)
+ mtx->unlock();
+#endif
+
if (flags & QTextEngine::GlyphIndicesOnly)
return true;
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 48963bb..d12e3fe 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -145,7 +145,6 @@ void QTextCursorPrivate::remove()
{
if (anchor == position)
return;
- priv->beginEditBlock();
currentCharFormat = -1;
int pos1 = position;
int pos2 = adjusted_anchor;
@@ -159,15 +158,18 @@ void QTextCursorPrivate::remove()
// deleting inside table? -> delete only content
QTextTable *table = complexSelectionTable();
if (table) {
+ priv->beginEditBlock();
int startRow, startCol, numRows, numCols;
selectedTableCells(&startRow, &numRows, &startCol, &numCols);
clearCells(table, startRow, startCol, numRows, numCols, op);
+ adjusted_anchor = anchor = position;
+ priv->endEditBlock();
} else {
priv->remove(pos1, pos2-pos1, op);
+ adjusted_anchor = anchor = position;
+ priv->finishEdit();
}
- adjusted_anchor = anchor = position;
- priv->endEditBlock();
}
void QTextCursorPrivate::clearCells(QTextTable *table, int startRow, int startCol, int numRows, int numCols, QTextUndoCommand::Operation op)
@@ -1291,9 +1293,14 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format
QTextCharFormat format = _format;
format.clearProperty(QTextFormat::ObjectIndex);
- d->priv->beginEditBlock();
+ bool hasEditBlock = false;
+
+ if (d->anchor != d->position) {
+ hasEditBlock = true;
+ d->priv->beginEditBlock();
+ d->remove();
+ }
- d->remove();
if (!text.isEmpty()) {
QTextFormatCollection *formats = d->priv->formatCollection();
int formatIdx = formats->indexForFormat(format);
@@ -1323,6 +1330,11 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format
|| ch == QChar::ParagraphSeparator
|| ch == QLatin1Char('\r')) {
+ if (!hasEditBlock) {
+ hasEditBlock = true;
+ d->priv->beginEditBlock();
+ }
+
if (blockEnd > blockStart)
d->priv->insert(d->position, textStart + blockStart, blockEnd - blockStart, formatIdx);
@@ -1333,7 +1345,8 @@ void QTextCursor::insertText(const QString &text, const QTextCharFormat &_format
if (textStart + blockStart < textEnd)
d->priv->insert(d->position, textStart + blockStart, textEnd - textStart - blockStart, formatIdx);
}
- d->priv->endEditBlock();
+ if (hasEditBlock)
+ d->priv->endEditBlock();
d->setX();
}
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 05ddf47..e1da4be 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -404,7 +404,7 @@ int QTextDocumentPrivate::insertBlock(const QChar &blockSeparator,
int b = blocks.findNode(pos);
QTextBlockData *B = blocks.fragment(b);
- QTextUndoCommand c = { QTextUndoCommand::BlockInserted, true,
+ QTextUndoCommand c = { QTextUndoCommand::BlockInserted, editBlock != 0,
op, charFormat, strPos, pos, { blockFormat },
B->revision };
@@ -439,20 +439,19 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format
Q_ASSERT(pos >= 0 && pos < fragments.length());
Q_ASSERT(formats.format(format).isCharFormat());
- beginEditBlock();
insert_string(pos, strPos, strLength, format, QTextUndoCommand::MoveCursor);
if (undoEnabled) {
int b = blocks.findNode(pos);
QTextBlockData *B = blocks.fragment(b);
- QTextUndoCommand c = { QTextUndoCommand::Inserted, true,
+ QTextUndoCommand c = { QTextUndoCommand::Inserted, editBlock != 0,
QTextUndoCommand::MoveCursor, format, strPos, pos, { strLength },
B->revision };
appendUndoItem(c);
B->revision = undoState;
Q_ASSERT(undoState == undoStack.size());
}
- endEditBlock();
+ finishEdit();
}
void QTextDocumentPrivate::insert(int pos, const QString &str, int format)
@@ -584,8 +583,6 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
Q_ASSERT(startAndEndInSameFrame || endIsEndOfChildFrame || startIsStartOfFrameAndEndIsEndOfFrameWithCommonParent || isFirstTableCell);
#endif
- beginEditBlock();
-
split(pos);
split(pos+length);
@@ -605,10 +602,10 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
int blockRevision = B->revision;
QTextFragmentData *X = fragments.fragment(x);
- QTextUndoCommand c = { QTextUndoCommand::Removed, true,
+ QTextUndoCommand c = { QTextUndoCommand::Removed, editBlock != 0,
op, X->format, X->stringPosition, key, { X->size_array[0] },
blockRevision };
- QTextUndoCommand cInsert = { QTextUndoCommand::Inserted, true,
+ QTextUndoCommand cInsert = { QTextUndoCommand::Inserted, editBlock != 0,
op, X->format, X->stringPosition, dstKey, { X->size_array[0] },
blockRevision };
@@ -648,7 +645,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
Q_ASSERT(blocks.length() == fragments.length());
- endEditBlock();
+ finishEdit();
}
void QTextDocumentPrivate::remove(int pos, int length, QTextUndoCommand::Operation op)
@@ -1004,8 +1001,12 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c)
if (!undoStack.isEmpty() && modified) {
QTextUndoCommand &last = undoStack[undoState - 1];
- if (last.tryMerge(c))
- return;
+ if ( (last.block && c.block) // part of the same block => can merge
+ || (!c.block && !last.block // two single undo items => can merge
+ && (undoState < 2 || !undoStack[undoState-2].block))) {
+ if (last.tryMerge(c))
+ return;
+ }
}
if (modifiedState > undoState)
modifiedState = -1;
@@ -1013,6 +1014,9 @@ void QTextDocumentPrivate::appendUndoItem(const QTextUndoCommand &c)
undoState++;
emitUndoAvailable(true);
emitRedoAvailable(false);
+
+ if (!c.block)
+ emit document()->undoCommandAdded();
}
void QTextDocumentPrivate::truncateUndoStack()
@@ -1082,7 +1086,6 @@ void QTextDocumentPrivate::joinPreviousEditBlock()
void QTextDocumentPrivate::endEditBlock()
{
- Q_Q(QTextDocument);
if (--editBlock)
return;
@@ -1093,6 +1096,16 @@ void QTextDocumentPrivate::endEditBlock()
emit document()->undoCommandAdded();
}
+ finishEdit();
+}
+
+void QTextDocumentPrivate::finishEdit()
+{
+ Q_Q(QTextDocument);
+
+ if (editBlock)
+ return;
+
if (framesDirty)
scan_frames(docChangeFrom, docChangeOldLength, docChangeLength);
@@ -1279,7 +1292,7 @@ void QTextDocumentPrivate::changeObjectFormat(QTextObject *obj, int format)
if (f)
documentChange(f->firstPosition(), f->lastPosition() - f->firstPosition());
- QTextUndoCommand c = { QTextUndoCommand::GroupFormatChange, true, QTextUndoCommand::MoveCursor, oldFormatIndex,
+ QTextUndoCommand c = { QTextUndoCommand::GroupFormatChange, editBlock != 0, QTextUndoCommand::MoveCursor, oldFormatIndex,
0, 0, { obj->d_func()->objectIndex }, 0 };
appendUndoItem(c);
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index 25763e1..d754ff0 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -139,7 +139,7 @@ public:
MoveCursor = 1
};
quint16 command;
- quint8 block; ///< All undo commands that have this set to zero/false are combined with the preceding command on undo/redo.
+ quint8 block; ///< All undo commands that have this set to true are combined with the preceding command on undo/redo.
quint8 operation;
int format;
quint32 strPos;
@@ -202,6 +202,7 @@ public:
inline void beginEditBlock() { editBlock++; }
void joinPreviousEditBlock();
void endEditBlock();
+ void finishEdit();
inline bool isInEditBlock() const { return editBlock; }
void enableUndoRedo(bool enable);
inline bool isUndoRedoEnabled() const { return undoEnabled; }
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index ba1c04f..48708c9 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -525,7 +525,12 @@ void QTextTablePrivate::update() const
Rows and columns within a QTextTable can be merged and split using
the mergeCells() and splitCell() functions. However, only cells that span multiple
rows or columns can be split. (Merging or splitting does not increase or decrease
- the number of rows and columns.)
+ the number of rows and columns.)
+
+ Note that if you have merged multiple columns and rows into one cell, you will not
+ be able to split the merged cell into new cells spanning over more than one row
+ or column. To be able to split cells spanning over several rows and columns you
+ need to do this over several iterations.
\table 80%
\row
diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp
index a622385..faa4e7b 100644
--- a/src/gui/util/qcompleter.cpp
+++ b/src/gui/util/qcompleter.cpp
@@ -824,7 +824,7 @@ void QCompleterPrivate::_q_complete(QModelIndex index, bool highlighted)
Q_Q(QCompleter);
QString completion;
- if (!index.isValid() || (index.row() >= proxy->engine->matchCount())) {
+ if (!index.isValid() || (!proxy->showAll && (index.row() >= proxy->engine->matchCount()))) {
completion = prefix;
} else {
QModelIndex si = proxy->mapToSource(index);
diff --git a/src/gui/widgets/qabstractscrollarea_p.h b/src/gui/widgets/qabstractscrollarea_p.h
index e4c47e9..f153711 100644
--- a/src/gui/widgets/qabstractscrollarea_p.h
+++ b/src/gui/widgets/qabstractscrollarea_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
class QScrollBar;
class QAbstractScrollAreaScrollBarContainer;
-class Q_GUI_EXPORT QAbstractScrollAreaPrivate: public QFramePrivate
+class QAbstractScrollAreaPrivate: public QFramePrivate
{
Q_DECLARE_PUBLIC(QAbstractScrollArea)
diff --git a/src/gui/widgets/qframe_p.h b/src/gui/widgets/qframe_p.h
index 4fd341d..3ea0c8b 100644
--- a/src/gui/widgets/qframe_p.h
+++ b/src/gui/widgets/qframe_p.h
@@ -58,7 +58,7 @@
QT_BEGIN_NAMESPACE
-class Q_GUI_EXPORT QFramePrivate : public QWidgetPrivate
+class QFramePrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QFrame)
public:
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index d2aad99..cce083f 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -142,6 +142,39 @@ static int qt_mac_CountMenuItems(OSMenuRef menu)
return 0;
}
+static quint32 constructModifierMask(quint32 accel_key)
+{
+ quint32 ret = 0;
+ const bool dontSwap = qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta);
+#ifndef QT_MAC_USE_COCOA
+ if ((accel_key & Qt::ALT) == Qt::ALT)
+ ret |= kMenuOptionModifier;
+ if ((accel_key & Qt::SHIFT) == Qt::SHIFT)
+ ret |= kMenuShiftModifier;
+ if (dontSwap) {
+ if ((accel_key & Qt::META) != Qt::META)
+ ret |= kMenuNoCommandModifier;
+ if ((accel_key & Qt::CTRL) == Qt::CTRL)
+ ret |= kMenuControlModifier;
+ } else {
+ if ((accel_key & Qt::CTRL) != Qt::CTRL)
+ ret |= kMenuNoCommandModifier;
+ if ((accel_key & Qt::META) == Qt::META)
+ ret |= kMenuControlModifier;
+ }
+#else
+ if ((accel_key & Qt::CTRL) == Qt::CTRL)
+ ret |= (dontSwap ? NSControlKeyMask : NSCommandKeyMask);
+ if ((accel_key & Qt::META) == Qt::META)
+ ret |= (dontSwap ? NSCommandKeyMask : NSControlKeyMask);
+ if ((accel_key & Qt::ALT) == Qt::ALT)
+ ret |= NSAlternateKeyMask;
+ if ((accel_key & Qt::SHIFT) == Qt::SHIFT)
+ ret |= NSShiftKeyMask;
+#endif
+ return ret;
+}
+
static bool actualMenuItemVisibility(const QMenuBarPrivate::QMacMenuBarPrivate *mbp,
const QMacMenuAction *action)
{
@@ -525,15 +558,7 @@ static bool qt_mac_auto_apple_menu(MenuCommand cmd)
static void qt_mac_get_accel(quint32 accel_key, quint32 *modif, quint32 *key) {
if (modif) {
- *modif = 0;
- if ((accel_key & Qt::CTRL) != Qt::CTRL)
- *modif |= kMenuNoCommandModifier;
- if ((accel_key & Qt::META) == Qt::META)
- *modif |= kMenuControlModifier;
- if ((accel_key & Qt::ALT) == Qt::ALT)
- *modif |= kMenuOptionModifier;
- if ((accel_key & Qt::SHIFT) == Qt::SHIFT)
- *modif |= kMenuShiftModifier;
+ *modif = constructModifierMask(accel_key);
}
accel_key &= ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL);
@@ -928,14 +953,14 @@ static QKeySequence qt_mac_menu_merge_accel(QMacMenuAction *action)
ret = action->action->shortcut();
#ifndef QT_MAC_USE_COCOA
else if (action->command == kHICommandPreferences)
- ret = QKeySequence(Qt::CTRL+Qt::Key_Comma);
+ ret = QKeySequence(QKeySequence::Preferences);
else if (action->command == kHICommandQuit)
- ret = QKeySequence(Qt::CTRL+Qt::Key_Q);
+ ret = QKeySequence(QKeySequence::Quit);
#else
else if (action->menuItem == [loader preferencesMenuItem])
- ret = QKeySequence(Qt::CTRL+Qt::Key_Comma);
+ ret = QKeySequence(QKeySequence::Preferences);
else if (action->menuItem == [loader quitMenuItem])
- ret = QKeySequence(Qt::CTRL+Qt::Key_Q);
+ ret = QKeySequence(QKeySequence::Quit);
#endif
return ret;
}
@@ -1220,58 +1245,21 @@ QMenuPrivate::QMacMenuPrivate::addAction(QMacMenuAction *action, QMacMenuAction
NSString *keySequenceToKeyEqivalent(const QKeySequence &accel)
{
quint32 accel_key = (accel[0] & ~(Qt::MODIFIER_MASK | Qt::UNICODE_ACCEL));
- unichar keyEquiv[1] = { 0 };
- if (accel_key == Qt::Key_Return)
- keyEquiv[0] = kReturnCharCode;
- else if (accel_key == Qt::Key_Enter)
- keyEquiv[0] = kEnterCharCode;
- else if (accel_key == Qt::Key_Tab)
- keyEquiv[0] = kTabCharCode;
- else if (accel_key == Qt::Key_Backspace)
- keyEquiv[0] = kBackspaceCharCode;
- else if (accel_key == Qt::Key_Delete)
- keyEquiv[0] = NSDeleteFunctionKey;
- else if (accel_key == Qt::Key_Escape)
- keyEquiv[0] = kEscapeCharCode;
- else if (accel_key == Qt::Key_PageUp)
- keyEquiv[0] = NSPageUpFunctionKey;
- else if (accel_key == Qt::Key_PageDown)
- keyEquiv[0] = NSPageDownFunctionKey;
- else if (accel_key == Qt::Key_Up)
- keyEquiv[0] = NSUpArrowFunctionKey;
- else if (accel_key == Qt::Key_Down)
- keyEquiv[0] = NSDownArrowFunctionKey;
- else if (accel_key == Qt::Key_Left)
- keyEquiv[0] = NSLeftArrowFunctionKey;
- else if (accel_key == Qt::Key_Right)
- keyEquiv[0] = NSRightArrowFunctionKey;
- else if (accel_key == Qt::Key_CapsLock)
- keyEquiv[0] = kMenuCapsLockGlyph; // ### Cocoa has no equivalent
- else if (accel_key >= Qt::Key_F1 && accel_key <= Qt::Key_F15)
- keyEquiv[0] = (accel_key - Qt::Key_F1) + NSF1FunctionKey;
- else if (accel_key == Qt::Key_Home)
- keyEquiv[0] = NSHomeFunctionKey;
- else if (accel_key == Qt::Key_End)
- keyEquiv[0] = NSEndFunctionKey;
- else
- keyEquiv[0] = unichar(QChar(accel_key).toLower().unicode());
- return [NSString stringWithCharacters:keyEquiv length:1];
+ extern QChar qt_macSymbolForQtKey(int key); // qkeysequence.cpp
+ QChar keyEquiv = qt_macSymbolForQtKey(accel_key);
+ if (keyEquiv.isNull()) {
+ if (accel_key >= Qt::Key_F1 && accel_key <= Qt::Key_F15)
+ keyEquiv = (accel_key - Qt::Key_F1) + NSF1FunctionKey;
+ else
+ keyEquiv = unichar(QChar(accel_key).toLower().unicode());
+ }
+ return [NSString stringWithCharacters:&keyEquiv.unicode() length:1];
}
// return the cocoa modifier mask for the QKeySequence (currently only looks at the first one).
NSUInteger keySequenceModifierMask(const QKeySequence &accel)
{
- NSUInteger ret = 0;
- quint32 accel_key = accel[0];
- if ((accel_key & Qt::CTRL) == Qt::CTRL)
- ret |= NSCommandKeyMask;
- if ((accel_key & Qt::META) == Qt::META)
- ret |= NSControlKeyMask;
- if ((accel_key & Qt::ALT) == Qt::ALT)
- ret |= NSAlternateKeyMask;
- if ((accel_key & Qt::SHIFT) == Qt::SHIFT)
- ret |= NSShiftKeyMask;
- return ret;
+ return constructModifierMask(accel[0]);
}
void
diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp
index 9a7374a..0befa6d 100644
--- a/src/gui/widgets/qmenu_wince.cpp
+++ b/src/gui/widgets/qmenu_wince.cpp
@@ -214,10 +214,12 @@ static HWND qt_wce_create_menubar(HWND parentHandle, HINSTANCE resourceHandle, i
mbi.nToolBarId = toolbarID;
if (ptrCreateMenuBar(&mbi)) {
+#ifdef Q_WS_WINCE_WM
// Tell the menu bar that we want to override hot key behaviour.
LPARAM lparam = MAKELPARAM(SHMBOF_NODEFAULT | SHMBOF_NOTIFY,
SHMBOF_NODEFAULT | SHMBOF_NOTIFY);
SendMessage(mbi.hwndMB, SHCMBM_OVERRIDEKEY, VK_TBACK, lparam);
+#endif
return mbi.hwndMB;
}
}
diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp
index d4de5bd..d2e6bfb 100644
--- a/src/gui/widgets/qmenubar.cpp
+++ b/src/gui/widgets/qmenubar.cpp
@@ -1273,6 +1273,8 @@ void QMenuBar::actionEvent(QActionEvent *e)
#else
QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar;
#endif
+ if (!nativeMenuBar)
+ return;
if(e->type() == QEvent::ActionAdded)
nativeMenuBar->addAction(e->action(), nativeMenuBar->findAction(e->before()));
else if(e->type() == QEvent::ActionRemoved)
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index 14efd23..f317742 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -560,7 +560,8 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const {
if (!currentBlock.isValid())
return QRectF();
Q_ASSERT(currentBlock.blockNumber() == currentBlockNumber);
- QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(document()->documentLayout());
+ QTextDocument *doc = document();
+ QPlainTextDocumentLayout *documentLayout = qobject_cast<QPlainTextDocumentLayout*>(doc->documentLayout());
Q_ASSERT(documentLayout);
QPointF offset;
@@ -571,13 +572,22 @@ QRectF QPlainTextEditControl::blockBoundingRect(const QTextBlock &block) const {
offset.ry() += r.height();
currentBlock = currentBlock.next();
++currentBlockNumber;
+ if (!currentBlock.isVisible()) {
+ currentBlock = doc->findBlockByLineNumber(currentBlock.firstLineNumber());
+ currentBlockNumber = currentBlock.blockNumber();
+ }
r = documentLayout->blockBoundingRect(currentBlock);
}
while (currentBlockNumber > blockNumber && offset.y() >= -textEdit->viewport()->height()) {
currentBlock = currentBlock.previous();
+ --currentBlockNumber;
+ while (!currentBlock.isVisible()) {
+ currentBlock = currentBlock.previous();
+ --currentBlockNumber;
+ }
if (!currentBlock.isValid())
break;
- --currentBlockNumber;
+
r = documentLayout->blockBoundingRect(currentBlock);
offset.ry() -= r.height();
}
diff --git a/src/gui/widgets/qprintpreviewwidget.cpp b/src/gui/widgets/qprintpreviewwidget.cpp
index 16334b8..d4e5122 100644
--- a/src/gui/widgets/qprintpreviewwidget.cpp
+++ b/src/gui/widgets/qprintpreviewwidget.cpp
@@ -98,29 +98,8 @@ void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QRectF paperRect(0,0, paperSize.width(), paperSize.height());
- painter->setClipRect(paperRect & option->exposedRect);
- painter->fillRect(paperRect, Qt::white);
- if (!pagePicture)
- return;
- painter->drawPicture(pageRect.topLeft(), *pagePicture);
-
- // Effect: make anything drawn in the margins look washed out.
- QPainterPath path;
- path.addRect(paperRect);
- path.addRect(pageRect);
- painter->setPen(QPen(Qt::NoPen));
- painter->setBrush(QColor(255, 255, 255, 180));
- painter->drawPath(path);
-
- painter->setClipRect(option->exposedRect);
-#if 0
- // Draw frame around paper.
- painter->setPen(QPen(Qt::black, 0));
- painter->setBrush(Qt::NoBrush);
- painter->drawRect(paperRect);
-#endif
-
// Draw shadow
+ painter->setClipRect(option->exposedRect);
qreal shWidth = paperRect.width()/100;
QRectF rshadow(paperRect.topRight() + QPointF(0, shWidth),
paperRect.bottomRight() + QPointF(shWidth, 0));
@@ -141,6 +120,27 @@ void PageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
cgrad.setColorAt(1.0, QColor(0,0,0,0));
painter->fillRect(cshadow, QBrush(cgrad));
+ painter->setClipRect(paperRect & option->exposedRect);
+ painter->fillRect(paperRect, Qt::white);
+ if (!pagePicture)
+ return;
+ painter->drawPicture(pageRect.topLeft(), *pagePicture);
+
+ // Effect: make anything drawn in the margins look washed out.
+ QPainterPath path;
+ path.addRect(paperRect);
+ path.addRect(pageRect);
+ painter->setPen(QPen(Qt::NoPen));
+ painter->setBrush(QColor(255, 255, 255, 180));
+ painter->drawPath(path);
+
+#if 0
+ // Draw frame around paper.
+ painter->setPen(QPen(Qt::black, 0));
+ painter->setBrush(Qt::NoBrush);
+ painter->drawRect(paperRect);
+#endif
+
// todo: drawtext "Page N" below paper
}
diff --git a/src/gui/widgets/qtoolbar.cpp b/src/gui/widgets/qtoolbar.cpp
index fadccbc..d765794 100644
--- a/src/gui/widgets/qtoolbar.cpp
+++ b/src/gui/widgets/qtoolbar.cpp
@@ -274,9 +274,11 @@ void QToolBarPrivate::endDrag()
bool QToolBarPrivate::mousePressEvent(QMouseEvent *event)
{
- if (layout->handleRect().contains(event->pos()) == false) {
+ Q_Q(QToolBar);
+ QStyleOptionToolBar opt;
+ q->initStyleOption(&opt);
+ if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) {
#ifdef Q_WS_MAC
- Q_Q(QToolBar);
// When using the unified toolbar on Mac OS X the user can can click and
// drag between toolbar contents to move the window. Make this work by
// implementing the standard mouse-dragging code and then call
@@ -1041,7 +1043,7 @@ void QToolBar::paintEvent(QPaintEvent *)
style->drawControl(QStyle::CE_ToolBar, &opt, &p, this);
}
- opt.rect = d->layout->handleRect();
+ opt.rect = style->subElementRect(QStyle::SE_ToolBarHandle, &opt, this);
if (opt.rect.isValid())
style->drawPrimitive(QStyle::PE_IndicatorToolBarHandle, &opt, &p, this);
}
@@ -1142,7 +1144,9 @@ bool QToolBar::event(QEvent *event)
case QEvent::HoverMove: {
#ifndef QT_NO_CURSOR
QHoverEvent *e = static_cast<QHoverEvent*>(event);
- if (d->layout->handleRect().contains(e->pos()))
+ QStyleOptionToolBar opt;
+ initStyleOption(&opt);
+ if (style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, this).contains(e->pos()))
setCursor(Qt::SizeAllCursor);
else
unsetCursor();
diff --git a/src/gui/widgets/qtoolbarlayout.cpp b/src/gui/widgets/qtoolbarlayout.cpp
index 7771f46..0bfa493 100644
--- a/src/gui/widgets/qtoolbarlayout.cpp
+++ b/src/gui/widgets/qtoolbarlayout.cpp
@@ -334,7 +334,7 @@ void QToolBarLayout::updateGeomArray() const
if (QMainWindow *mw = qobject_cast<QMainWindow *>(parentWidget()->parentWidget())) {
if (mw->unifiedTitleAndToolBarOnMac()
&& mw->toolBarArea(static_cast<QToolBar *>(parentWidget())) == Qt::TopToolBarArea) {
- if (that->expandFlag) {
+ if (expandFlag) {
tb->setMaximumSize(0xFFFFFF, 0xFFFFFF);
} else {
tb->setMaximumSize(hint);
@@ -360,23 +360,11 @@ void QToolBarLayout::setGeometry(const QRect &rect)
QStyle *style = tb->style();
QStyleOptionToolBar opt;
tb->initStyleOption(&opt);
- const int handleExtent = movable()
- ? style->pixelMetric(QStyle::PM_ToolBarHandleExtent, &opt, tb) : 0;
const int margin = this->margin();
const int extensionExtent = style->pixelMetric(QStyle::PM_ToolBarExtensionExtent, &opt, tb);
Qt::Orientation o = tb->orientation();
QLayout::setGeometry(rect);
- if (movable()) {
- if (o == Qt::Horizontal) {
- handRect = QRect(margin, margin, handleExtent, rect.height() - 2*margin);
- handRect = QStyle::visualRect(parentWidget()->layoutDirection(), rect, handRect);
- } else {
- handRect = QRect(margin, margin, rect.width() - 2*margin, handleExtent);
- }
- } else {
- handRect = QRect();
- }
bool ranOutOfSpace = false;
if (!animating)
@@ -742,11 +730,6 @@ QToolBarItem *QToolBarLayout::createItem(QAction *action)
return result;
}
-QRect QToolBarLayout::handleRect() const
-{
- return handRect;
-}
-
QT_END_NAMESPACE
#endif // QT_NO_TOOLBAR
diff --git a/src/gui/widgets/qtoolbarlayout_p.h b/src/gui/widgets/qtoolbarlayout_p.h
index 2eca773..37755b1 100644
--- a/src/gui/widgets/qtoolbarlayout_p.h
+++ b/src/gui/widgets/qtoolbarlayout_p.h
@@ -65,7 +65,7 @@ class QAction;
class QToolBarExtension;
class QMenu;
-class Q_GUI_EXPORT QToolBarItem : public QWidgetItem
+class QToolBarItem : public QWidgetItem
{
public:
QToolBarItem(QWidget *widget);
@@ -75,7 +75,7 @@ public:
bool customWidget;
};
-class Q_GUI_EXPORT QToolBarLayout : public QLayout
+class QToolBarLayout : public QLayout
{
Q_OBJECT
@@ -100,8 +100,6 @@ public:
int indexOf(QAction *action) const;
int indexOf(QWidget *widget) const { return QLayout::indexOf(widget); }
- QRect handleRect() const;
-
bool layoutActions(const QSize &size);
QSize expandedSize(const QSize &size) const;
bool expanded, animating;
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index c9161f8..33795aa 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -73,6 +73,15 @@ static QByteArray qNtlmPhase3(QAuthenticatorPrivate *ctx, const QByteArray& phas
authentication information to the socket when accessing services that
require authentication.
+ QAuthenticator supports the following authentication methods:
+ \list
+ \o Basic
+ \o NTLM version 1
+ \o Digest-MD5
+ \endlist
+
+ Note that, in particular, NTLM version 2 is not supported.
+
\sa QSslSocket
*/
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 39ac5da..92054a4 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -113,8 +113,8 @@
readLine(), or getChar() to read decrypted data from QSslSocket's
internal buffer, and you can call write() or putChar() to write
data back to the peer. QSslSocket will automatically encrypt the
- written data for you, and emit bytesWritten() once the data has
- been written to the peer.
+ written data for you, and emit encryptedBytesWritten() once
+ the data has been written to the peer.
As a convenience, QSslSocket supports QTcpSocket's blocking
functions waitForConnected(), waitForReadyRead(),
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 827f461..49798e0 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -523,7 +523,7 @@ void QSslSocketBackendPrivate::startClientEncryption()
// Start connecting. This will place outgoing data in the BIO, so we
// follow up with calling transmit().
- testConnection();
+ startHandshake();
transmit();
}
@@ -536,7 +536,7 @@ void QSslSocketBackendPrivate::startServerEncryption()
// Start connecting. This will place outgoing data in the BIO, so we
// follow up with calling transmit().
- testConnection();
+ startHandshake();
transmit();
}
@@ -624,7 +624,7 @@ void QSslSocketBackendPrivate::transmit()
#ifdef QSSLSOCKET_DEBUG
qDebug() << "QSslSocketBackendPrivate::transmit: testing encryption";
#endif
- if (testConnection()) {
+ if (startHandshake()) {
#ifdef QSSLSOCKET_DEBUG
qDebug() << "QSslSocketBackendPrivate::transmit: encryption established";
#endif
@@ -643,7 +643,7 @@ void QSslSocketBackendPrivate::transmit()
}
// If the request is small and the remote host closes the transmission
- // after sending, there's a chance that testConnection() will already
+ // after sending, there's a chance that startHandshake() will already
// have triggered a shutdown.
if (!ssl)
continue;
@@ -743,7 +743,7 @@ static QSslError _q_OpenSSL_to_QSslError(int errorCode, const QSslCertificate &c
return error;
}
-bool QSslSocketBackendPrivate::testConnection()
+bool QSslSocketBackendPrivate::startHandshake()
{
Q_Q(QSslSocket);
@@ -784,7 +784,7 @@ bool QSslSocketBackendPrivate::testConnection()
q->setErrorString(QSslSocket::tr("Error during SSL handshake: %1").arg(SSL_ERRORSTR()));
q->setSocketError(QAbstractSocket::SslHandshakeFailedError);
#ifdef QSSLSOCKET_DEBUG
- qDebug() << "QSslSocketBackendPrivate::testConnection: error!" << q->errorString();
+ qDebug() << "QSslSocketBackendPrivate::startHandshake: error!" << q->errorString();
#endif
emit q->error(QAbstractSocket::SslHandshakeFailedError);
q->abort();
diff --git a/src/network/ssl/qsslsocket_openssl_p.h b/src/network/ssl/qsslsocket_openssl_p.h
index b3be42a..f53d4e8 100644
--- a/src/network/ssl/qsslsocket_openssl_p.h
+++ b/src/network/ssl/qsslsocket_openssl_p.h
@@ -102,7 +102,7 @@ public:
void startClientEncryption();
void startServerEncryption();
void transmit();
- bool testConnection();
+ bool startHandshake();
void disconnectFromHost();
void disconnected();
QSslCipher sessionCipher() const;
diff --git a/src/qbase.pri b/src/qbase.pri
index 9ba8e70..0ab04e6 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -67,11 +67,6 @@ mac:!static:contains(QT_CONFIG, qt_framework) {
mac {
CONFIG += explicitlib
- true { #we want to use O2 on Qt itself (Os was used to fix other failures in older GCC)
- QMAKE_CFLAGS_RELEASE ~= s,-Os,-O2,
- QMAKE_CXXFLAGS_RELEASE ~= s,-Os,-O2,
- QMAKE_OBJECTIVE_CFLAGS_RELEASE ~= s,-Os,-O2,
- }
macx-g++ {
QMAKE_CFLAGS += -fconstant-cfstrings
QMAKE_CXXFLAGS += -fconstant-cfstrings
diff --git a/src/script/qscriptvalueiterator.cpp b/src/script/qscriptvalueiterator.cpp
index fe5ef9f..1a60632 100644
--- a/src/script/qscriptvalueiterator.cpp
+++ b/src/script/qscriptvalueiterator.cpp
@@ -106,6 +106,7 @@ QScriptValueIteratorPrivate::QScriptValueIteratorPrivate()
*/
QScriptValueIteratorPrivate::~QScriptValueIteratorPrivate()
{
+ delete it;
}
/*!
@@ -130,7 +131,6 @@ QScriptValueIterator::QScriptValueIterator(const QScriptValue &object)
QScriptValueIterator::~QScriptValueIterator()
{
if (d_ptr) {
- delete d_ptr->it;
delete d_ptr;
d_ptr = 0;
}
@@ -312,7 +312,7 @@ void QScriptValueIterator::remove()
QScriptValueIterator& QScriptValueIterator::operator=(QScriptValue &object)
{
if (d_ptr) {
- delete d_ptr->it;
+ delete d_ptr;
d_ptr = 0;
}
QScriptValueImpl val = QScriptValuePrivate::valueOf(object);
diff --git a/src/sql/drivers/ibase/qsql_ibase.cpp b/src/sql/drivers/ibase/qsql_ibase.cpp
index 9eeb41d..6834d9a 100644
--- a/src/sql/drivers/ibase/qsql_ibase.cpp
+++ b/src/sql/drivers/ibase/qsql_ibase.cpp
@@ -871,7 +871,7 @@ QIBaseResult::~QIBaseResult()
bool QIBaseResult::prepare(const QString& query)
{
- //qDebug("prepare: %s\n", qPrintable(query));
+// qDebug("prepare: %s", qPrintable(query));
if (!driver() || !driver()->isOpen() || driver()->isOpenError())
return false;
d->cleanup();
@@ -1025,7 +1025,7 @@ bool QIBaseResult::exec()
}
if (ok) {
- if (colCount()) {
+ if (colCount() && d->queryType != isc_info_sql_stmt_exec_procedure) {
isc_dsql_free_statement(d->status, &d->stmt, DSQL_close);
if (d->isError(QT_TRANSLATE_NOOP("QIBaseResult", "Unable to close statement")))
return false;
@@ -1039,7 +1039,7 @@ bool QIBaseResult::exec()
return false;
// Not all stored procedures necessarily return values.
- if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda->sqld == 0)
+ if (d->queryType == isc_info_sql_stmt_exec_procedure && d->sqlda && d->sqlda->sqld == 0)
delDA(d->sqlda);
if (d->sqlda)
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 936b936..8c76c5d 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -54,6 +54,7 @@
#include <QtCore/qdir.h>
#include <QtCore/qprocess.h>
#include <QtCore/qdebug.h>
+#include <QtCore/qlibraryinfo.h>
#include "QtTest/private/qtestlog_p.h"
#include "QtTest/private/qtesttable_p.h"
@@ -846,9 +847,8 @@ static void qParseArgs(int argc, char *argv[])
" -iterations n : Sets the number of accumulation iterations.\n"
" -median n : Sets the number of median iterations.\n"
" -vb : Print out verbose benchmarking information.\n"
-#ifndef QT_NO_PROCESS
-// Will be enabled when tools are integrated.
-// " -chart : Runs the chart generator after the test. No output is printed to the console\n"
+#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
+ " -chart : Create chart based on the benchmark result.\n"
#endif
"\n"
" -help : This help\n";
@@ -963,7 +963,7 @@ static void qParseArgs(int argc, char *argv[])
} else if (strcmp(argv[i], "-vb") == 0) {
QBenchmarkGlobalData::current->verboseOutput = true;
-#ifndef QT_NO_PROCESS
+#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
} else if (strcmp(argv[i], "-chart") == 0) {
QBenchmarkGlobalData::current->createChart = true;
QTestLog::setLogMode(QTestLog::XML);
@@ -1463,26 +1463,17 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#endif
-#ifndef QT_NO_PROCESS
+#if !defined(QT_NO_PROCESS) || !defined(QT_NO_SETTINGS)
if (QBenchmarkGlobalData::current->createChart) {
-
-#define XSTR(s) STR(s)
-#define STR(s) #s
-#ifdef Q_OS_WIN
- const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport.exe";
-#else
- const char * path = XSTR(QBENCHLIB_BASE) "/tools/generatereport/generatereport";
-#endif
-#undef XSTR
-#undef STR
-
- if (QFile::exists(QLatin1String(path))) {
+ QString chartLocation = QLibraryInfo::location(QLibraryInfo::BinariesPath)
+ + QLatin1String("/../tools/qtestlib/chart/chart");
+ if (QFile::exists(chartLocation)) {
QProcess p;
p.setProcessChannelMode(QProcess::ForwardedChannels);
- p.start(QLatin1String(path), QStringList() << QLatin1String("results.xml"));
+ p.start(chartLocation, QStringList() << QLatin1String("results.xml"));
p.waitForFinished(-1);
} else {
- qWarning("Could not find %s, please make sure it is compiled.", path);
+ qDebug() << QLatin1String("Could not find the chart tool in ") + chartLocation + QLatin1String(", please make sure it is compiled.");
}
}
#endif