summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-05-25 19:53:30 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-05-25 19:53:30 (GMT)
commitef5891755bf760b68df1fc387e08a1b16980d6ad (patch)
treeffacc13c82dcadd1dda588e703ba43e440d9454c /src
parent5a7223450d0ebd4eaa47f263005c6d1c2e142a76 (diff)
parenta32c96e753c2f5a123e518a92762ec9c9ff3b0b7 (diff)
downloadQt-ef5891755bf760b68df1fc387e08a1b16980d6ad.zip
Qt-ef5891755bf760b68df1fc387e08a1b16980d6ad.tar.gz
Qt-ef5891755bf760b68df1fc387e08a1b16980d6ad.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (50 commits) Dont crash when assigning the same input context twice. Fixed a typo in variable name in qlocale data generator. Fix for Norwegian and Korean languages on symbian. Remove unused function in QDBusConnectionPrivate Doc: Fixing bugs in HTML generator Updating 4.7.0 change log. Doc: Correcting style to class lists qdoc: Improved class index page. Added MSVC 2010 project files to .gitignore Fix architecture detection on GNU/Hurd. Revert "tst_bic: make it possible to test for cross-compilation" fix typo in documentation Improve Bearer Management related documentation in QNetworkAccessManager Compile with QT_NO_ACTION. Unbreak compilation outside Mac QDBusAbstractInterface: don't set lastError outside the object's own thread tst_bic: make it possible to test for cross-compilation Remove Q_PACKED from QChar and QLocale::Data. QDebug operator for QFlags Removing unneeded qDebug statement. ...
Diffstat (limited to 'src')
-rw-r--r--src/corelib/corelib.pro1
-rw-r--r--src/corelib/io/qdebug.h23
-rw-r--r--src/corelib/tools/qchar.h6
-rw-r--r--src/corelib/tools/qlocale.cpp1
-rw-r--r--src/corelib/tools/qlocale.h6
-rw-r--r--src/corelib/tools/qlocale_symbian.cpp121
-rw-r--r--src/dbus/qdbusabstractinterface.cpp5
-rw-r--r--src/dbus/qdbusconnection.cpp8
-rw-r--r--src/dbus/qdbusconnection_p.h1
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp2
-rw-r--r--src/gui/gui.pro1
-rw-r--r--src/gui/image/qimage.cpp4
-rw-r--r--src/gui/image/qpixmap.cpp4
-rw-r--r--src/gui/itemviews/qlistwidget.cpp4
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp4
-rw-r--r--src/gui/itemviews/qtablewidget.cpp4
-rw-r--r--src/gui/itemviews/qtreewidget.cpp4
-rw-r--r--src/gui/kernel/qapplication.cpp18
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac_p.h5
-rw-r--r--src/gui/kernel/qwidget.cpp8
-rw-r--r--src/gui/math3d/qgenericmatrix.cpp4
-rw-r--r--src/gui/math3d/qmatrix4x4.cpp4
-rw-r--r--src/gui/math3d/qquaternion.cpp4
-rw-r--r--src/gui/math3d/qvector2d.cpp4
-rw-r--r--src/gui/math3d/qvector3d.cpp4
-rw-r--r--src/gui/math3d/qvector4d.cpp4
-rw-r--r--src/gui/painting/qbrush.cpp8
-rw-r--r--src/gui/painting/qpaintdevice.qdoc3
-rw-r--r--src/gui/painting/qpaintengine.cpp2
-rw-r--r--src/gui/painting/qpen.cpp6
-rw-r--r--src/gui/painting/qtransform.cpp10
-rw-r--r--src/gui/styles/qmacstyle_mac.mm210
-rw-r--r--src/gui/styles/qmacstyle_mac_p.h239
-rw-r--r--src/gui/styles/qmacstylepixmaps_mac_p.h5
-rw-r--r--src/gui/styles/qstyle.cpp2
-rw-r--r--src/gui/styles/styles.pri3
-rw-r--r--src/gui/widgets/qpushbutton.cpp35
-rw-r--r--src/gui/widgets/qpushbutton.h3
-rw-r--r--src/gui/widgets/qpushbutton_p.h3
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp26
-rw-r--r--src/opengl/opengl.pro1
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.h6
-rw-r--r--src/plugins/bearer/corewlan/qcorewlanengine.mm102
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.cpp91
-rw-r--r--src/plugins/bearer/nativewifi/qnativewifiengine.h5
46 files changed, 703 insertions, 313 deletions
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 83fa044..e39d326 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -3,6 +3,7 @@ QPRO_PWD = $$PWD
QT =
DEFINES += QT_BUILD_CORE_LIB QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
+irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
include(../qbase.pri)
include(animation/animation.pri)
diff --git a/src/corelib/io/qdebug.h b/src/corelib/io/qdebug.h
index bc68599..093312f 100644
--- a/src/corelib/io/qdebug.h
+++ b/src/corelib/io/qdebug.h
@@ -254,6 +254,29 @@ inline QDebug operator<<(QDebug debug, const QContiguousCache<T> &cache)
return debug.space();
}
+#if defined(FORCE_UREF)
+template <class T>
+inline QDebug &operator<<(QDebug debug, const QFlags<T> &flags)
+#else
+template <class T>
+inline QDebug operator<<(QDebug debug, const QFlags<T> &flags)
+#endif
+{
+ debug.nospace() << "QFlags(";
+ bool needSeparator = false;
+ for (uint i = 0; i < sizeof(T) * 8; ++i) {
+ if (flags.testFlag(T(1 << i))) {
+ if (needSeparator)
+ debug.nospace() << '|';
+ else
+ needSeparator = true;
+ debug.nospace() << "0x" << QByteArray::number(T(1 << i), 16).constData();
+ }
+ }
+ debug << ')';
+ return debug.space();
+}
+
#if !defined(QT_NO_DEBUG_STREAM)
Q_CORE_EXPORT_INLINE QDebug qDebug() { return QDebug(QtDebugMsg); }
diff --git a/src/corelib/tools/qchar.h b/src/corelib/tools/qchar.h
index 205f911..b9e7e01 100644
--- a/src/corelib/tools/qchar.h
+++ b/src/corelib/tools/qchar.h
@@ -358,11 +358,7 @@ private:
QChar(uchar c);
#endif
ushort ucs;
-}
-#if (defined(__arm__) || defined(__ARMEL__))
- Q_PACKED
-#endif
- ;
+};
Q_DECLARE_TYPEINFO(QChar, Q_MOVABLE_TYPE);
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 519ff3d..c000dc8 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -754,6 +754,7 @@ struct WindowsToISOListElt {
char iso_name[6];
};
+/* NOTE: This array should be sorted by the first column! */
static const WindowsToISOListElt windows_to_iso_list[] = {
{ 0x0401, "ar_SA" },
{ 0x0402, "bg\0 " },
diff --git a/src/corelib/tools/qlocale.h b/src/corelib/tools/qlocale.h
index 5023201..f2fd892 100644
--- a/src/corelib/tools/qlocale.h
+++ b/src/corelib/tools/qlocale.h
@@ -685,11 +685,7 @@ public:
struct Data {
quint16 index;
quint16 numberOptions;
- }
-#if (defined(__arm__) || defined(__ARMEL__))
- Q_PACKED
-#endif
- ;
+ };
private:
friend struct QLocalePrivate;
// ### We now use this field to pack an index into locale_data and NumberOptions.
diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp
index b6afa12..1e674af 100644
--- a/src/corelib/tools/qlocale_symbian.cpp
+++ b/src/corelib/tools/qlocale_symbian.cpp
@@ -93,72 +93,73 @@ struct symbianToISO {
/*
- Mapping from Symbian to ISO locale
+ Mapping from Symbian to ISO locale.
+ NOTE: This array should be sorted by the first column!
*/
static const symbianToISO symbian_to_iso_list[] = {
- { ELangEnglish, "en_GB" },
- { ELangFrench, "fr_FR" },
- { ELangGerman, "de_DE" },
- { ELangSpanish, "es_ES" },
- { ELangItalian, "it_IT" },
- { ELangSwedish, "sv_SE" },
- { ELangDanish, "da_DK" },
- { ELangNorwegian, "no_NO" },
- { ELangNorwegianNynorsk, "nn_NO" },
- { ELangFinnish, "fi_FI" },
- { ELangAmerican, "en_US" },
- { ELangPortuguese, "pt_PT" },
- { ELangTurkish, "tr_TR" },
- { ELangIcelandic, "is_IS" },
- { ELangRussian, "ru_RU" },
- { ELangHungarian, "hu_HU" },
- { ELangDutch, "nl_NL" },
- { ELangBelgianFlemish, "nl_BE" },
- { ELangCzech, "cs_CZ" },
- { ELangSlovak, "sk_SK" },
- { ELangPolish, "pl_PL" },
- { ELangSlovenian, "sl_SI" },
- { ELangTaiwanChinese, "zh_TW" },
- { ELangHongKongChinese, "zh_HK" },
- { ELangPrcChinese, "zh_CN" },
- { ELangJapanese, "ja_JP" },
- { ELangThai, "th_TH" },
- { ELangArabic, "ar_AE" },
- { ELangTagalog, "tl_PH" },
- { ELangBulgarian, "bg_BG" },
- { ELangCatalan, "ca_ES" },
- { ELangCroatian, "hr_HR" },
- { ELangEstonian, "et_EE" },
- { ELangFarsi, "fa_IR" },
- { ELangCanadianFrench, "fr_CA" },
- { ELangGreek, "el_GR" },
- { ELangHebrew, "he_IL" },
- { ELangHindi, "hi_IN" },
- { ELangIndonesian, "id_ID" },
- { ELangLatvian, "lv_LV" },
- { ELangLithuanian, "lt_LT" },
- { ELangMalay, "ms_MY" },
- { ELangBrazilianPortuguese, "pt_BR" },
- { ELangRomanian, "ro_RO" },
- { ELangSerbian, "sr_RS" },
- { ELangLatinAmericanSpanish,"es_419" },
- { ELangUkrainian, "uk_UA" },
- { ELangUrdu, "ur_PK" }, // India/Pakistan
- { ELangVietnamese, "vi_VN" },
- { ELangKorean, "ko_KO" },
+ { ELangEnglish, "en_GB" }, // 1
+ { ELangFrench, "fr_FR" }, // 2
+ { ELangGerman, "de_DE" }, // 3
+ { ELangSpanish, "es_ES" }, // 4
+ { ELangItalian, "it_IT" }, // 5
+ { ELangSwedish, "sv_SE" }, // 6
+ { ELangDanish, "da_DK" }, // 7
+ { ELangNorwegian, "no_NO" }, // 8
+ { ELangFinnish, "fi_FI" }, // 9
+ { ELangAmerican, "en_US" }, // 10
+ { ELangPortuguese, "pt_PT" }, // 13
+ { ELangTurkish, "tr_TR" }, // 14
+ { ELangIcelandic, "is_IS" }, // 15
+ { ELangRussian, "ru_RU" }, // 16
+ { ELangHungarian, "hu_HU" }, // 17
+ { ELangDutch, "nl_NL" }, // 18
+ { ELangBelgianFlemish, "nl_BE" }, // 19
+ { ELangCzech, "cs_CZ" }, // 25
+ { ELangSlovak, "sk_SK" }, // 26
+ { ELangPolish, "pl_PL" }, // 27
+ { ELangSlovenian, "sl_SI" }, // 28
+ { ELangTaiwanChinese, "zh_TW" }, // 29
+ { ELangHongKongChinese, "zh_HK" }, // 30
+ { ELangPrcChinese, "zh_CN" }, // 31
+ { ELangJapanese, "ja_JP" }, // 32
+ { ELangThai, "th_TH" }, // 33
+ { ELangArabic, "ar_AE" }, // 37
+ { ELangTagalog, "tl_PH" }, // 39
+ { ELangBulgarian, "bg_BG" }, // 42
+ { ELangCatalan, "ca_ES" }, // 44
+ { ELangCroatian, "hr_HR" }, // 45
+ { ELangEstonian, "et_EE" }, // 49
+ { ELangFarsi, "fa_IR" }, // 50
+ { ELangCanadianFrench, "fr_CA" }, // 51
+ { ELangGreek, "el_GR" }, // 54
+ { ELangHebrew, "he_IL" }, // 57
+ { ELangHindi, "hi_IN" }, // 58
+ { ELangIndonesian, "id_ID" }, // 59
+ { ELangKorean, "ko_KO" }, // 65
+ { ELangLatvian, "lv_LV" }, // 67
+ { ELangLithuanian, "lt_LT" }, // 68
+ { ELangMalay, "ms_MY" }, // 70
+ { ELangNorwegianNynorsk, "nn_NO" }, // 75
+ { ELangBrazilianPortuguese, "pt_BR" }, // 76
+ { ELangRomanian, "ro_RO" }, // 78
+ { ELangSerbian, "sr_RS" }, // 79
+ { ELangLatinAmericanSpanish,"es_419" }, // 83
+ { ELangUkrainian, "uk_UA" }, // 93
+ { ELangUrdu, "ur_PK" }, // 94 - India/Pakistan
+ { ELangVietnamese, "vi_VN" }, // 96
#ifdef __E32LANG_H__
// 5.0
- { ELangBasque, "eu_ES" },
- { ELangGalician, "gl_ES" },
+ { ELangBasque, "eu_ES" }, // 102
+ { ELangGalician, "gl_ES" }, // 103
#endif
#if !defined(__SERIES60_31__)
- { ELangEnglish_Apac, "en" },
- { ELangEnglish_Taiwan, "en_TW" },
- { ELangEnglish_HongKong, "en_HK" },
- { ELangEnglish_Prc, "en_CN" },
- { ELangEnglish_Japan, "en_JP"},
- { ELangEnglish_Thailand, "en_TH" },
- { ELangMalay_Apac, "ms" }
+ { ELangEnglish_Apac, "en" }, // 129
+ { ELangEnglish_Taiwan, "en_TW" }, // 157 ### Not supported by CLDR
+ { ELangEnglish_HongKong, "en_HK" }, // 158
+ { ELangEnglish_Prc, "en_CN" }, // 159 ### Not supported by CLDR
+ { ELangEnglish_Japan, "en_JP"}, // 160 ### Not supported by CLDR
+ { ELangEnglish_Thailand, "en_TH" }, // 161 ### Not supported by CLDR
+ { ELangMalay_Apac, "ms" } // 326
#endif
};
diff --git a/src/dbus/qdbusabstractinterface.cpp b/src/dbus/qdbusabstractinterface.cpp
index 1a7c417..4e9c1ad 100644
--- a/src/dbus/qdbusabstractinterface.cpp
+++ b/src/dbus/qdbusabstractinterface.cpp
@@ -42,6 +42,8 @@
#include "qdbusabstractinterface.h"
#include "qdbusabstractinterface_p.h"
+#include <qthread.h>
+
#include "qdbusargument.h"
#include "qdbuspendingcall.h"
#include "qdbusmessage_p.h"
@@ -440,7 +442,8 @@ QDBusMessage QDBusAbstractInterface::callWithArgumentList(QDBus::CallMode mode,
msg.setArguments(args);
QDBusMessage reply = d->connection.call(msg, mode);
- d->lastError = reply; // will clear if reply isn't an error
+ if (thread() == QThread::currentThread())
+ d->lastError = reply; // will clear if reply isn't an error
// ensure that there is at least one element
if (reply.arguments().isEmpty())
diff --git a/src/dbus/qdbusconnection.cpp b/src/dbus/qdbusconnection.cpp
index abb3224..4382032 100644
--- a/src/dbus/qdbusconnection.cpp
+++ b/src/dbus/qdbusconnection.cpp
@@ -1003,14 +1003,6 @@ void QDBusConnectionPrivate::setSender(const QDBusConnectionPrivate *s)
/*!
\internal
*/
-void QDBusConnectionPrivate::setConnection(const QString &name, QDBusConnectionPrivate *c)
-{
- _q_manager()->setConnection(name, c);
-}
-
-/*!
- \internal
-*/
void QDBusConnectionPrivate::setBusService(const QDBusConnection &connection)
{
busService = new QDBusConnectionInterface(connection, this);
diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h
index 34bb6b3..81af2c7 100644
--- a/src/dbus/qdbusconnection_p.h
+++ b/src/dbus/qdbusconnection_p.h
@@ -309,7 +309,6 @@ public:
static QDBusConnection q(QDBusConnectionPrivate *connection) { return QDBusConnection(connection); }
static void setSender(const QDBusConnectionPrivate *s);
- static void setConnection(const QString &name, QDBusConnectionPrivate *c);
friend class QDBusActivateObjectEvent;
friend class QDBusCallDeliveryEvent;
diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
index 7c55009..151a9e9 100644
--- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp
@@ -140,7 +140,9 @@ void QDeclarativeItemModule::defineModule()
qmlRegisterType<QDeclarativeScaleGrid>();
qmlRegisterType<QValidator>();
qmlRegisterType<QDeclarativeVisualModel>();
+#ifndef QT_NO_ACTION
qmlRegisterType<QAction>();
+#endif
qmlRegisterType<QDeclarativePen>();
qmlRegisterType<QDeclarativeFlickableVisibleArea>();
#ifndef QT_NO_GRAPHICSEFFECT
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 9dfcd2c..a83b528 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -53,7 +53,7 @@ static const int QGRAPHICSVIEW_PREALLOC_STYLE_OPTIONS = 503; // largest prime <
QGraphicsView visualizes the contents of a QGraphicsScene in a scrollable
viewport. To create a scene with geometrical items, see QGraphicsScene's
- documentation. QGraphicsView is part of \l{The Graphics View Framework}.
+ documentation. QGraphicsView is part of the \l{Graphics View Framework}.
To visualize a scene, you start by constructing a QGraphicsView object,
passing the address of the scene you want to visualize to QGraphicsView's
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index a6370b2..7f1cb78 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -3,6 +3,7 @@ QPRO_PWD = $$PWD
QT = core
DEFINES += QT_BUILD_GUI_LIB QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x65000000
+irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
!win32:!embedded:!mac:!symbian:CONFIG += x11
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 85be5b1..98f235e 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4812,7 +4812,7 @@ bool QImageData::doImageIO(const QImage *image, QImageWriter *writer, int qualit
or as a BMP image if the stream's version is 1. Note that writing
the stream to a file will not produce a valid image file.
- \sa QImage::save(), {Format of the QDataStream Operators}
+ \sa QImage::save(), {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &s, const QImage &image)
@@ -4838,7 +4838,7 @@ QDataStream &operator<<(QDataStream &s, const QImage &image)
Reads an image from the given \a stream and stores it in the given
\a image.
- \sa QImage::load(), {Format of the QDataStream Operators}
+ \sa QImage::load(), {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &s, QImage &image)
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 474cd2e..48c5d3f 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1281,7 +1281,7 @@ bool QPixmap::convertFromImage(const QImage &image, ColorMode mode)
image. Note that writing the stream to a file will not produce a
valid image file.
- \sa QPixmap::save(), {Format of the QDataStream Operators}
+ \sa QPixmap::save(), {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &stream, const QPixmap &pixmap)
@@ -1294,7 +1294,7 @@ QDataStream &operator<<(QDataStream &stream, const QPixmap &pixmap)
Reads an image from the given \a stream into the given \a pixmap.
- \sa QPixmap::load(), {Format of the QDataStream Operators}
+ \sa QPixmap::load(), {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap)
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 125f0c4..da1d5db 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -791,7 +791,7 @@ QListWidgetItem &QListWidgetItem::operator=(const QListWidgetItem &other)
This operator uses QListWidgetItem::write().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item)
{
@@ -806,7 +806,7 @@ QDataStream &operator<<(QDataStream &out, const QListWidgetItem &item)
This operator uses QListWidgetItem::read().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &in, QListWidgetItem &item)
{
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index 9d52c78..767b5a9 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1921,7 +1921,7 @@ void QStandardItem::write(QDataStream &out) const
This operator uses QStandardItem::read().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &in, QStandardItem &item)
{
@@ -1937,7 +1937,7 @@ QDataStream &operator>>(QDataStream &in, QStandardItem &item)
This operator uses QStandardItem::write().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &out, const QStandardItem &item)
{
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index f653a41..5bb242e 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1428,7 +1428,7 @@ void QTableWidgetItem::write(QDataStream &out) const
This operator uses QTableWidgetItem::read().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item)
{
@@ -1443,7 +1443,7 @@ QDataStream &operator>>(QDataStream &in, QTableWidgetItem &item)
This operator uses QTableWidgetItem::write().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &out, const QTableWidgetItem &item)
{
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 4c80325..0e06f34 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2199,7 +2199,7 @@ void QTreeWidgetItem::executePendingSort() const
This operator uses QTreeWidgetItem::write().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item)
{
@@ -2214,7 +2214,7 @@ QDataStream &operator<<(QDataStream &out, const QTreeWidgetItem &item)
This operator uses QTreeWidgetItem::read().
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &in, QTreeWidgetItem &item)
{
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index 7b62de1..57c4c99 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -2218,15 +2218,17 @@ void QApplication::closeAllWindows()
{
bool did_close = true;
QWidget *w;
- while((w = activeModalWidget()) && did_close) {
- if(!w->isVisible())
+ while ((w = activeModalWidget()) && did_close) {
+ if (!w->isVisible() || w->data->is_closing)
break;
did_close = w->close();
}
QWidgetList list = QApplication::topLevelWidgets();
for (int i = 0; did_close && i < list.size(); ++i) {
w = list.at(i);
- if (w->isVisible() && w->windowType() != Qt::Desktop) {
+ if (w->isVisible()
+ && w->windowType() != Qt::Desktop
+ && !w->data->is_closing) {
did_close = w->close();
list = QApplication::topLevelWidgets();
i = -1;
@@ -5268,18 +5270,20 @@ bool QApplication::keypadNavigationEnabled()
This function replaces the QInputContext instance used by the application
with \a inputContext.
+ Qt takes ownership of the given \a inputContext.
+
\sa inputContext()
*/
void QApplication::setInputContext(QInputContext *inputContext)
{
- Q_D(QApplication);
- Q_UNUSED(d);// only static members being used.
+ if (inputContext == QApplicationPrivate::inputContext)
+ return;
if (!inputContext) {
qWarning("QApplication::setInputContext: called with 0 input context");
return;
}
- delete d->inputContext;
- d->inputContext = inputContext;
+ delete QApplicationPrivate::inputContext;
+ QApplicationPrivate::inputContext = inputContext;
}
/*!
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
index 5db121a..44fb4f0 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h
+++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h
@@ -73,6 +73,9 @@
**
****************************************************************************/
+#ifndef QT_COCOA_HELPERS_MAC_P_H
+#define QT_COCOA_HELPERS_MAC_P_H
+
//
// W A R N I N G
// -------------
@@ -216,3 +219,5 @@ bool qt_cocoaPostMessage(id target, SEL selector);
void qt_mac_post_retranslateAppMenu();
QT_END_NAMESPACE
+
+#endif // QT_COCOA_HELPERS_MAC_P_H
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 1f2cd8c..569af42 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -312,6 +312,8 @@ QInputContext *QWidget::inputContext()
This function sets the input context \a context
on this widget.
+ Qt takes ownership of the given input \a context.
+
\sa inputContext()
*/
void QWidget::setInputContext(QInputContext *context)
@@ -320,6 +322,8 @@ void QWidget::setInputContext(QInputContext *context)
if (!testAttribute(Qt::WA_InputMethodEnabled))
return;
#ifndef QT_NO_IM
+ if (context == d->ic)
+ return;
if (d->ic)
delete d->ic;
d->ic = context;
@@ -670,8 +674,8 @@ void QWidget::setAutoFillBackground(bool enabled)
(to move the keyboard focus), and passes on most of the other events to
one of the more specialized handlers above.
- Events and the mechanism used to deliver them are covered in the
- \l{Events and Event Filters} document.
+ Events and the mechanism used to deliver them are covered in
+ \l{The Event System}.
\section1 Groups of Functions and Properties
diff --git a/src/gui/math3d/qgenericmatrix.cpp b/src/gui/math3d/qgenericmatrix.cpp
index 96405a8b..be30cb6 100644
--- a/src/gui/math3d/qgenericmatrix.cpp
+++ b/src/gui/math3d/qgenericmatrix.cpp
@@ -252,7 +252,7 @@ QT_BEGIN_NAMESPACE
Writes the given \a matrix to the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
/*!
@@ -262,7 +262,7 @@ QT_BEGIN_NAMESPACE
Reads a NxM matrix from the given \a stream into the given \a matrix
and returns a reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
#endif
diff --git a/src/gui/math3d/qmatrix4x4.cpp b/src/gui/math3d/qmatrix4x4.cpp
index 62d740c..16c7f97 100644
--- a/src/gui/math3d/qmatrix4x4.cpp
+++ b/src/gui/math3d/qmatrix4x4.cpp
@@ -1878,7 +1878,7 @@ QDebug operator<<(QDebug dbg, const QMatrix4x4 &m)
Writes the given \a matrix to the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix)
@@ -1896,7 +1896,7 @@ QDataStream &operator<<(QDataStream &stream, const QMatrix4x4 &matrix)
Reads a 4x4 matrix from the given \a stream into the given \a matrix
and returns a reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &stream, QMatrix4x4 &matrix)
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index ad71836..2fd66eb 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -595,7 +595,7 @@ QDebug operator<<(QDebug dbg, const QQuaternion &q)
Writes the given \a quaternion to the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
@@ -612,7 +612,7 @@ QDataStream &operator<<(QDataStream &stream, const QQuaternion &quaternion)
Reads a quaternion from the given \a stream into the given \a quaternion
and returns a reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &stream, QQuaternion &quaternion)
diff --git a/src/gui/math3d/qvector2d.cpp b/src/gui/math3d/qvector2d.cpp
index b67e8a1..6a5cfc8 100644
--- a/src/gui/math3d/qvector2d.cpp
+++ b/src/gui/math3d/qvector2d.cpp
@@ -434,7 +434,7 @@ QDebug operator<<(QDebug dbg, const QVector2D &vector)
Writes the given \a vector to the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
@@ -450,7 +450,7 @@ QDataStream &operator<<(QDataStream &stream, const QVector2D &vector)
Reads a 2D vector from the given \a stream into the given \a vector
and returns a reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &stream, QVector2D &vector)
diff --git a/src/gui/math3d/qvector3d.cpp b/src/gui/math3d/qvector3d.cpp
index 6a592b2..dfcce0e 100644
--- a/src/gui/math3d/qvector3d.cpp
+++ b/src/gui/math3d/qvector3d.cpp
@@ -585,7 +585,7 @@ QDebug operator<<(QDebug dbg, const QVector3D &vector)
Writes the given \a vector to the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
@@ -602,7 +602,7 @@ QDataStream &operator<<(QDataStream &stream, const QVector3D &vector)
Reads a 3D vector from the given \a stream into the given \a vector
and returns a reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &stream, QVector3D &vector)
diff --git a/src/gui/math3d/qvector4d.cpp b/src/gui/math3d/qvector4d.cpp
index f2f3cc6..abff1ba 100644
--- a/src/gui/math3d/qvector4d.cpp
+++ b/src/gui/math3d/qvector4d.cpp
@@ -538,7 +538,7 @@ QDebug operator<<(QDebug dbg, const QVector4D &vector)
Writes the given \a vector to the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
@@ -555,7 +555,7 @@ QDataStream &operator<<(QDataStream &stream, const QVector4D &vector)
Reads a 4D vector from the given \a stream into the given \a vector
and returns a reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &stream, QVector4D &vector)
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 96d547b..b468b11 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -329,8 +329,8 @@ struct QBrushDataPointerDeleter
\endtable
- For more information about painting in general, see \l{The Paint
- System} documentation.
+ For more information about painting in general, see the \l{Paint
+ System}.
\sa Qt::BrushStyle, QPainter, QColor
*/
@@ -1013,7 +1013,7 @@ QDebug operator<<(QDebug dbg, const QBrush &b)
Writes the given \a brush to the given \a stream and returns a
reference to the \a stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &s, const QBrush &b)
@@ -1081,7 +1081,7 @@ QDataStream &operator<<(QDataStream &s, const QBrush &b)
Reads the given \a brush from the given \a stream and returns a
reference to the \a stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &s, QBrush &b)
diff --git a/src/gui/painting/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc
index 8c73cc0..340db39 100644
--- a/src/gui/painting/qpaintdevice.qdoc
+++ b/src/gui/painting/qpaintdevice.qdoc
@@ -87,8 +87,7 @@
function returns the number of different colors available for the
paint device.
- \sa QPaintEngine, QPainter, {The Coordinate System}, {The Paint
- System}
+ \sa QPaintEngine, QPainter, {Coordinate System}, {Paint System}
*/
/*!
diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp
index 6aabde8..a2d0337 100644
--- a/src/gui/painting/qpaintengine.cpp
+++ b/src/gui/painting/qpaintengine.cpp
@@ -172,7 +172,7 @@ QFont QTextItem::font() const
possible to adapt to multiple technologies on each platform and take
advantage of each to the fullest.
- \sa QPainter, QPaintDevice::paintEngine(), {The Paint System}
+ \sa QPainter, QPaintDevice::paintEngine(), {Paint System}
*/
/*!
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp
index e290cbe..2e43984 100644
--- a/src/gui/painting/qpen.cpp
+++ b/src/gui/painting/qpen.cpp
@@ -92,7 +92,7 @@ typedef QPenPrivate QPenData;
convenience functions to extract and set the color of the pen's
brush, respectively. Pens may also be compared and streamed.
- For more information about painting in general, see \l{The Paint
+ For more information about painting in general, see the \l{Paint
System} documentation.
\tableofcontents
@@ -872,7 +872,7 @@ bool QPen::isDetached()
Writes the given \a pen to the given \a stream and returns a reference to
the \a stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator<<(QDataStream &s, const QPen &p)
@@ -918,7 +918,7 @@ QDataStream &operator<<(QDataStream &s, const QPen &p)
Reads a pen from the given \a stream into the given \a pen and
returns a reference to the \a stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream &operator>>(QDataStream &s, QPen &p)
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index aaa241f..423cce9 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -148,8 +148,8 @@ QT_BEGIN_NAMESPACE
coordinate system. The standard coordinate system of a
QPaintDevice has its origin located at the top-left position. The
\e x values increase to the right; \e y values increase
- downward. For a complete description, see the \l {The Coordinate
- System}{coordinate system} documentation.
+ downward. For a complete description, see the \l {Coordinate
+ System} {coordinate system} documentation.
QPainter has functions to translate, scale, shear and rotate the
coordinate system without using a QTransform. For example:
@@ -223,7 +223,7 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/transform/main.cpp 2
\endtable
- \sa QPainter, {The Coordinate System}, {demos/affine}{Affine
+ \sa QPainter, {Coordinate System}, {demos/affine}{Affine
Transformations Demo}, {Transformations Example}
*/
@@ -1028,7 +1028,7 @@ void QTransform::reset()
Writes the given \a matrix to the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream & operator<<(QDataStream &s, const QTransform &m)
{
@@ -1052,7 +1052,7 @@ QDataStream & operator<<(QDataStream &s, const QTransform &m)
Reads the given \a matrix from the given \a stream and returns a
reference to the stream.
- \sa {Format of the QDataStream Operators}
+ \sa {Serializing Qt Data Types}
*/
QDataStream & operator>>(QDataStream &s, QTransform &t)
{
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 2e2f374..f029602 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -100,23 +100,22 @@
#include <QtGui/qgraphicsproxywidget.h>
#include <QtGui/qgraphicsview.h>
#include <private/qt_cocoa_helpers_mac_p.h>
+#include "qmacstyle_mac_p.h"
#include <private/qstylehelper_p.h>
QT_BEGIN_NAMESPACE
-extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
-
// The following constants are used for adjusting the size
// of push buttons so that they are drawn inside their bounds.
-static const int PushButtonLeftOffset = 6;
-static const int PushButtonTopOffset = 4;
-static const int PushButtonRightOffset = 12;
-static const int PushButtonBottomOffset = 12;
-static const int MiniButtonH = 26;
-static const int SmallButtonH = 30;
-static const int BevelButtonW = 50;
-static const int BevelButtonH = 22;
-static const int PushButtonContentPadding = 6;
+const int QMacStylePrivate::PushButtonLeftOffset = 6;
+const int QMacStylePrivate::PushButtonTopOffset = 4;
+const int QMacStylePrivate::PushButtonRightOffset = 12;
+const int QMacStylePrivate::PushButtonBottomOffset = 12;
+const int QMacStylePrivate::MiniButtonH = 26;
+const int QMacStylePrivate::SmallButtonH = 30;
+const int QMacStylePrivate::BevelButtonW = 50;
+const int QMacStylePrivate::BevelButtonH = 22;
+const int QMacStylePrivate::PushButtonContentPadding = 6;
// These colors specify the titlebar gradient colors on
// Leopard. Ideally we should get them from the system.
@@ -132,25 +131,16 @@ static const QColor titlebarSeparatorLineInactive(131, 131, 131);
static const QColor mainWindowGradientBegin(240, 240, 240);
static const QColor mainWindowGradientEnd(200, 200, 200);
-#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
-enum {
- kThemePushButtonTextured = 31,
- kThemePushButtonTexturedSmall = 32,
- kThemePushButtonTexturedMini = 33
-};
-
-/* Search fields */
-enum {
- kHIThemeFrameTextFieldRound = 1000,
- kHIThemeFrameTextFieldRoundSmall = 1001,
- kHIThemeFrameTextFieldRoundMini = 1002
-};
-#endif
+static const int DisclosureOffset = 4;
// Resolve these at run-time, since the functions was moved in Leopard.
typedef HIRect * (*PtrHIShapeGetBounds)(HIShapeRef, HIRect *);
static PtrHIShapeGetBounds ptrHIShapeGetBounds = 0;
+static int closeButtonSize = 12;
+
+extern QRegion qt_mac_convert_mac_region(RgnHandle); //qregion_mac.cpp
+
static bool isVerticalTabs(const QTabBar::Shape shape) {
return (shape == QTabBar::RoundedEast
|| shape == QTabBar::TriangularEast
@@ -158,8 +148,6 @@ static bool isVerticalTabs(const QTabBar::Shape shape) {
|| shape == QTabBar::TriangularWest);
}
-static int closeButtonSize = 12;
-
void drawTabCloseButton(QPainter *p, bool hover, bool active, bool selected)
{
// draw background circle
@@ -378,32 +366,6 @@ void drawTabBase(QPainter *p, const QStyleOptionTabBarBaseV2 *tbb, const QWidget
p->drawLine(tabRect.x(), height - 1, width, height - 1);
}
-/*
- AHIG:
- Apple Human Interface Guidelines
- http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/
-
- Builder:
- Apple Interface Builder v. 3.1.1
-*/
-
-// this works as long as we have at most 16 different control types
-#define CT1(c) CT2(c, c)
-#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2))
-
-enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2,
- QAquaSizeUnknown = -1 };
-
-#define SIZE(large, small, mini) \
- (controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini))
-
-// same as return SIZE(...) but optimized
-#define return_SIZE(large, small, mini) \
- do { \
- static const int sizes[] = { (large), (small), (mini) }; \
- return sizes[controlSize]; \
- } while (0)
-
static int getControlSize(const QStyleOption *option, const QWidget *widget)
{
if (option) {
@@ -481,80 +443,9 @@ static inline ThemeTabDirection getTabDirection(QTabBar::Shape shape)
return ttd;
}
-class QMacStylePrivate : public QObject
-{
- Q_OBJECT
-
-public:
- QMacStylePrivate(QMacStyle *style);
-
- // Stuff from QAquaAnimate:
- bool addWidget(QWidget *);
- void removeWidget(QWidget *);
-
- enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen };
- bool animatable(Animates, const QWidget *) const;
- void stopAnimate(Animates, QWidget *);
- void startAnimate(Animates, QWidget *);
- static ThemeDrawState getDrawState(QStyle::State flags);
- QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg,
- QStyle::ContentsType ct = QStyle::CT_CustomBase,
- QSize szHint=QSize(-1, -1), QSize *insz = 0) const;
- void getSliderInfo(QStyle::ComplexControl cc, const QStyleOptionSlider *slider,
- HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe);
- bool doAnimate(Animates);
- inline int animateSpeed(Animates) const { return 33; }
-
- // Utility functions
- void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi,
- QPainter *p, const QStyleOption *opt) const;
-
- QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const;
-
- HIRect pushButtonContentBounds(const QStyleOptionButton *btn,
- const HIThemeButtonDrawInfo *bdi) const;
-
- void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi,
- const QWidget *widget, const ThemeDrawState &tds);
-
- static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind);
-
- static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi);
-
- static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p);
- static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder,
- const HIThemeButtonDrawInfo &bdi, QPainter *p);
- bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi,
- ThemeButtonKind buttonKindToCheck) const;
- void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget,
- const ThemeDrawState tds,
- HIThemeButtonDrawInfo *bdi) const;
- QPixmap generateBackgroundPattern() const;
-protected:
- bool eventFilter(QObject *, QEvent *);
- void timerEvent(QTimerEvent *);
-
-private slots:
- void startAnimationTimer();
-
-public:
- QPointer<QPushButton> defaultButton; //default push buttons
- int timerID;
- QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation
-
- struct ButtonState {
- int frame;
- enum { ButtonDark, ButtonLight } dir;
- } buttonState;
- UInt8 progressFrame;
- QPointer<QFocusFrame> focusWidget;
- CFAbsoluteTime defaultButtonStart;
- QMacStyle *q;
- bool mouseDown;
-};
-
QT_BEGIN_INCLUDE_NAMESPACE
-#include "qmacstyle_mac.moc"
+#include "moc_qmacstyle_mac.cpp"
+#include "moc_qmacstyle_mac_p.cpp"
QT_END_INCLUDE_NAMESPACE
/*****************************************************************************
@@ -1055,10 +946,10 @@ HIRect QMacStylePrivate::pushButtonContentBounds(const QStyleOptionButton *btn,
// Adjust the bounds to correct for
// carbon not calculating the content bounds fully correct
if (bdi->kind == kThemePushButton || bdi->kind == kThemePushButtonSmall){
- outerBounds.origin.y += PushButtonTopOffset;
- outerBounds.size.height -= PushButtonBottomOffset;
+ outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset;
+ outerBounds.size.height -= QMacStylePrivate::PushButtonBottomOffset;
} else if (bdi->kind == kThemePushButtonMini) {
- outerBounds.origin.y += PushButtonTopOffset;
+ outerBounds.origin.y += QMacStylePrivate::PushButtonTopOffset;
}
HIRect contentBounds;
@@ -1074,7 +965,7 @@ QSize QMacStylePrivate::pushButtonSizeFromContents(const QStyleOptionButton *btn
{
QSize csz(0, 0);
QSize iconSize = btn->icon.isNull() ? QSize(0, 0)
- : (btn->iconSize + QSize(PushButtonContentPadding, 0));
+ : (btn->iconSize + QSize(QMacStylePrivate::PushButtonContentPadding, 0));
QRect textRect = btn->text.isEmpty() ? QRect(0, 0, 1, 1)
: btn->fontMetrics.boundingRect(QRect(), Qt::AlignCenter, btn->text);
csz.setWidth(iconSize.width() + textRect.width()
@@ -1149,12 +1040,12 @@ void QMacStylePrivate::initHIThemePushButton(const QStyleOptionButton *btn,
// Choose the button kind that closest match the button rect, but at the
// same time displays the button contents without clipping.
bdi->kind = kThemeBevelButton;
- if (btn->rect.width() >= BevelButtonW && btn->rect.height() >= BevelButtonH){
+ if (btn->rect.width() >= QMacStylePrivate::BevelButtonW && btn->rect.height() >= QMacStylePrivate::BevelButtonH){
if (widget && widget->testAttribute(Qt::WA_MacVariableSize)) {
- if (btn->rect.height() <= MiniButtonH){
+ if (btn->rect.height() <= QMacStylePrivate::MiniButtonH){
if (contentFitsInPushButton(btn, bdi, kThemePushButtonMini))
bdi->kind = kThemePushButtonMini;
- } else if (btn->rect.height() <= SmallButtonH){
+ } else if (btn->rect.height() <= QMacStylePrivate::SmallButtonH){
if (contentFitsInPushButton(btn, bdi, kThemePushButtonSmall))
bdi->kind = kThemePushButtonSmall;
} else if (contentFitsInPushButton(btn, bdi, kThemePushButton)) {
@@ -3100,7 +2991,7 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
else
bi.value = opt->direction == Qt::LeftToRight ? kThemeDisclosureRight : kThemeDisclosureLeft;
bi.adornment = kThemeAdornmentNone;
- HIRect hirect = qt_hirectForQRect(opt->rect);
+ HIRect hirect = qt_hirectForQRect(opt->rect.adjusted(DisclosureOffset,0,-DisclosureOffset,0));
HIThemeDrawButton(&hirect, &bi, cg, kHIThemeOrientationNormal, 0);
break; }
@@ -3494,21 +3385,21 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
// the focus 'shadow' will be inside.
HIRect newRect = qt_hirectForQRect(btn->rect);
if (bdi.kind == kThemePushButton || bdi.kind == kThemePushButtonSmall) {
- newRect.origin.x += PushButtonLeftOffset;
- newRect.origin.y += PushButtonTopOffset;
- newRect.size.width -= PushButtonRightOffset;
- newRect.size.height -= PushButtonBottomOffset;
+ newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset;
+ newRect.origin.y += QMacStylePrivate::PushButtonTopOffset;
+ newRect.size.width -= QMacStylePrivate::PushButtonRightOffset;
+ newRect.size.height -= QMacStylePrivate::PushButtonBottomOffset;
} else if (bdi.kind == kThemePushButtonMini) {
- newRect.origin.x += PushButtonLeftOffset - 2;
- newRect.origin.y += PushButtonTopOffset;
- newRect.size.width -= PushButtonRightOffset - 4;
+ newRect.origin.x += QMacStylePrivate::PushButtonLeftOffset - 2;
+ newRect.origin.y += QMacStylePrivate::PushButtonTopOffset;
+ newRect.size.width -= QMacStylePrivate::PushButtonRightOffset - 4;
}
HIThemeDrawButton(&newRect, &bdi, cg, kHIThemeOrientationNormal, 0);
if (btn->features & QStyleOptionButton::HasMenu) {
int mbi = proxy()->pixelMetric(QStyle::PM_MenuButtonIndicator, btn, w);
QRect ir = btn->rect;
- HIRect arrowRect = CGRectMake(ir.right() - mbi - PushButtonRightOffset,
+ HIRect arrowRect = CGRectMake(ir.right() - mbi - QMacStylePrivate::PushButtonRightOffset,
ir.height() / 2 - 4, mbi, ir.height() / 2);
bool drawColorless = btn->palette.currentColorGroup() == QPalette::Active;
if (drawColorless && tds == kThemeStateInactive)
@@ -3602,14 +3493,14 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
if (btn->state & State_On)
state = QIcon::On;
QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state);
- contentW += pixmap.width() + PushButtonContentPadding;
+ contentW += pixmap.width() + QMacStylePrivate::PushButtonContentPadding;
int iconLeftOffset = freeContentRect.x() + (freeContentRect.width() - contentW) / 2;
int iconTopOffset = freeContentRect.y() + (freeContentRect.height() - pixmap.height()) / 2;
QRect iconDestRect(iconLeftOffset, iconTopOffset, pixmap.width(), pixmap.height());
QRect visualIconDestRect = visualRect(btn->direction, freeContentRect, iconDestRect);
proxy()->drawItemPixmap(p, visualIconDestRect, Qt::AlignLeft | Qt::AlignVCenter, pixmap);
int newOffset = iconDestRect.x() + iconDestRect.width()
- + PushButtonContentPadding - textRect.x();
+ + QMacStylePrivate::PushButtonContentPadding - textRect.x();
textRect.adjust(newOffset, 0, newOffset, 0);
}
// Draw the text:
@@ -4352,6 +4243,15 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
int controlSize = getControlSize(opt, widget);
switch (sr) {
+ case SE_ItemViewItemText:
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
+ int fw = proxy()->pixelMetric(PM_FocusFrameHMargin, opt, widget);
+ // We add the focusframeargin between icon and text in commonstyle
+ rect = QCommonStyle::subElementRect(sr, opt, widget);
+ if (vopt->features & QStyleOptionViewItemV2::HasDecoration)
+ rect.adjust(-fw, 0, 0, 0);
+ }
+ break;
case SE_ToolBoxTabContents:
rect = QCommonStyle::subElementRect(sr, opt, widget);
break;
@@ -4369,9 +4269,9 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
case SE_HeaderLabel:
if (qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
rect = QWindowsStyle::subElementRect(sr, opt, widget);
- if (widget && widget->height() <= qt_mac_aqua_get_metric(kThemeMetricListHeaderHeight)){
- // We need to allow the text a bit more space when the header is as
- // small as kThemeMetricListHeaderHeight, otherwise it gets clipped:
+ if (widget && widget->height() <= 22){
+ // We need to allow the text a bit more space when the header is
+ // small, otherwise it gets clipped:
rect.setY(0);
rect.setHeight(widget->height());
}
@@ -4398,8 +4298,9 @@ QRect QMacStyle::subElementRect(SubElement sr, const QStyleOption *opt,
HIRect outRect;
HIThemeGetButtonShape(&inRect, &bdi, &shape);
ptrHIShapeGetBounds(shape, &outRect);
- rect = QRect(int(outRect.origin.x), int(outRect.origin.y),
- int(contentRect.origin.x - outRect.origin.x), int(outRect.size.height));
+ rect = QRect(int(outRect.origin.x + DisclosureOffset), int(outRect.origin.y),
+ int(contentRect.origin.x - outRect.origin.x + DisclosureOffset),
+ int(outRect.size.height));
break;
}
case SE_TabWidgetLeftCorner:
@@ -5695,8 +5596,8 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
// By default, we fit the contents inside a normal rounded push button.
// Do this by add enough space around the contents so that rounded
// borders (including highlighting when active) will show.
- sz.rwidth() += PushButtonLeftOffset + PushButtonRightOffset + 12;
- sz.rheight() += PushButtonTopOffset + PushButtonBottomOffset;
+ sz.rwidth() += QMacStylePrivate::PushButtonLeftOffset + QMacStylePrivate::PushButtonRightOffset + 12;
+ sz.rheight() += QMacStylePrivate::PushButtonTopOffset + QMacStylePrivate::PushButtonBottomOffset;
break;
case QStyle::CT_MenuItem:
if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
@@ -5788,6 +5689,13 @@ QSize QMacStyle::sizeFromContents(ContentsType ct, const QStyleOption *opt,
sz = sz.expandedTo(QSize(sz.width(), minimumSize));
}
break;
+ case CT_ItemViewItem:
+ if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
+ sz = QCommonStyle::sizeFromContents(ct, vopt, csz, widget);
+ sz.setHeight(sz.height() + 2);
+ }
+ break;
+
default:
sz = QWindowsStyle::sizeFromContents(ct, opt, csz, widget);
}
diff --git a/src/gui/styles/qmacstyle_mac_p.h b/src/gui/styles/qmacstyle_mac_p.h
new file mode 100644
index 0000000..5a0ba4c
--- /dev/null
+++ b/src/gui/styles/qmacstyle_mac_p.h
@@ -0,0 +1,239 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#ifndef QMACSTYLE_MAC_P_H
+#define QMACSTYLE_MAC_P_H
+
+#include <qmacstyle_mac.h>
+#include <private/qapplication_p.h>
+#include <private/qcombobox_p.h>
+#include <private/qmacstylepixmaps_mac_p.h>
+#include <private/qpaintengine_mac_p.h>
+#include <private/qpainter_p.h>
+#include <private/qprintengine_mac_p.h>
+#include <private/qstylehelper_p.h>
+#include <qapplication.h>
+#include <qbitmap.h>
+#include <qcheckbox.h>
+#include <qcombobox.h>
+#include <qdialogbuttonbox.h>
+#include <qdockwidget.h>
+#include <qevent.h>
+#include <qfocusframe.h>
+#include <qformlayout.h>
+#include <qgroupbox.h>
+#include <qhash.h>
+#include <qheaderview.h>
+#include <qlayout.h>
+#include <qlineedit.h>
+#include <qlistview.h>
+#include <qmainwindow.h>
+#include <qmap.h>
+#include <qmenubar.h>
+#include <qpaintdevice.h>
+#include <qpainter.h>
+#include <qpixmapcache.h>
+#include <qpointer.h>
+#include <qprogressbar.h>
+#include <qpushbutton.h>
+#include <qradiobutton.h>
+#include <qrubberband.h>
+#include <qsizegrip.h>
+#include <qspinbox.h>
+#include <qsplitter.h>
+#include <qstyleoption.h>
+#include <qtextedit.h>
+#include <qtextstream.h>
+#include <qtoolbar.h>
+#include <qtoolbutton.h>
+#include <qtreeview.h>
+#include <qtableview.h>
+#include <qwizard.h>
+#include <qdebug.h>
+#include <qlibrary.h>
+#include <qdatetimeedit.h>
+#include <qmath.h>
+#include <QtGui/qgraphicsproxywidget.h>
+#include <QtGui/qgraphicsview.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+#if (MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5)
+enum {
+ kThemePushButtonTextured = 31,
+ kThemePushButtonTexturedSmall = 32,
+ kThemePushButtonTexturedMini = 33
+};
+
+/* Search fields */
+enum {
+ kHIThemeFrameTextFieldRound = 1000,
+ kHIThemeFrameTextFieldRoundSmall = 1001,
+ kHIThemeFrameTextFieldRoundMini = 1002
+};
+#endif
+
+/*
+ AHIG:
+ Apple Human Interface Guidelines
+ http://developer.apple.com/documentation/UserExperience/Conceptual/OSXHIGuidelines/
+
+ Builder:
+ Apple Interface Builder v. 3.1.1
+*/
+
+// this works as long as we have at most 16 different control types
+#define CT1(c) CT2(c, c)
+#define CT2(c1, c2) ((uint(c1) << 16) | uint(c2))
+
+enum QAquaWidgetSize { QAquaSizeLarge = 0, QAquaSizeSmall = 1, QAquaSizeMini = 2,
+ QAquaSizeUnknown = -1 };
+
+#define SIZE(large, small, mini) \
+ (controlSize == QAquaSizeLarge ? (large) : controlSize == QAquaSizeSmall ? (small) : (mini))
+
+// same as return SIZE(...) but optimized
+#define return_SIZE(large, small, mini) \
+ do { \
+ static const int sizes[] = { (large), (small), (mini) }; \
+ return sizes[controlSize]; \
+ } while (0)
+
+class QMacStylePrivate : public QObject
+{
+ Q_OBJECT
+
+public:
+ QMacStylePrivate(QMacStyle *style);
+
+ // Ideally these wouldn't exist, but since they already exist we need some accessors.
+ static const int PushButtonLeftOffset;
+ static const int PushButtonTopOffset;
+ static const int PushButtonRightOffset;
+ static const int PushButtonBottomOffset;
+ static const int MiniButtonH;
+ static const int SmallButtonH;
+ static const int BevelButtonW;
+ static const int BevelButtonH;
+ static const int PushButtonContentPadding;
+
+
+ // Stuff from QAquaAnimate:
+ bool addWidget(QWidget *);
+ void removeWidget(QWidget *);
+
+ enum Animates { AquaPushButton, AquaProgressBar, AquaListViewItemOpen };
+ bool animatable(Animates, const QWidget *) const;
+ void stopAnimate(Animates, QWidget *);
+ void startAnimate(Animates, QWidget *);
+ static ThemeDrawState getDrawState(QStyle::State flags);
+ QAquaWidgetSize aquaSizeConstrain(const QStyleOption *option, const QWidget *widg,
+ QStyle::ContentsType ct = QStyle::CT_CustomBase,
+ QSize szHint=QSize(-1, -1), QSize *insz = 0) const;
+ void getSliderInfo(QStyle::ComplexControl cc, const QStyleOptionSlider *slider,
+ HIThemeTrackDrawInfo *tdi, const QWidget *needToRemoveMe);
+ bool doAnimate(Animates);
+ inline int animateSpeed(Animates) const { return 33; }
+
+ // Utility functions
+ void drawColorlessButton(const HIRect &macRect, HIThemeButtonDrawInfo *bdi,
+ QPainter *p, const QStyleOption *opt) const;
+
+ QSize pushButtonSizeFromContents(const QStyleOptionButton *btn) const;
+
+ HIRect pushButtonContentBounds(const QStyleOptionButton *btn,
+ const HIThemeButtonDrawInfo *bdi) const;
+
+ void initComboboxBdi(const QStyleOptionComboBox *combo, HIThemeButtonDrawInfo *bdi,
+ const QWidget *widget, const ThemeDrawState &tds);
+
+ static HIRect comboboxInnerBounds(const HIRect &outerBounds, int buttonKind);
+
+ static QRect comboboxEditBounds(const QRect &outerBounds, const HIThemeButtonDrawInfo &bdi);
+
+ static void drawCombobox(const HIRect &outerBounds, const HIThemeButtonDrawInfo &bdi, QPainter *p);
+ static void drawTableHeader(const HIRect &outerBounds, bool drawTopBorder, bool drawLeftBorder,
+ const HIThemeButtonDrawInfo &bdi, QPainter *p);
+ bool contentFitsInPushButton(const QStyleOptionButton *btn, HIThemeButtonDrawInfo *bdi,
+ ThemeButtonKind buttonKindToCheck) const;
+ void initHIThemePushButton(const QStyleOptionButton *btn, const QWidget *widget,
+ const ThemeDrawState tds,
+ HIThemeButtonDrawInfo *bdi) const;
+ QPixmap generateBackgroundPattern() const;
+protected:
+ bool eventFilter(QObject *, QEvent *);
+ void timerEvent(QTimerEvent *);
+
+private slots:
+ void startAnimationTimer();
+
+public:
+ QPointer<QPushButton> defaultButton; //default push buttons
+ int timerID;
+ QList<QPointer<QWidget> > progressBars; //existing progress bars that need animation
+
+ struct ButtonState {
+ int frame;
+ enum { ButtonDark, ButtonLight } dir;
+ } buttonState;
+ UInt8 progressFrame;
+ QPointer<QFocusFrame> focusWidget;
+ CFAbsoluteTime defaultButtonStart;
+ QMacStyle *q;
+ bool mouseDown;
+};
+
+QT_END_NAMESPACE
+
+#endif // QMACSTYLE_MAC_P_H
diff --git a/src/gui/styles/qmacstylepixmaps_mac_p.h b/src/gui/styles/qmacstylepixmaps_mac_p.h
index 6a5e0e6..58038c3 100644
--- a/src/gui/styles/qmacstylepixmaps_mac_p.h
+++ b/src/gui/styles/qmacstylepixmaps_mac_p.h
@@ -39,6 +39,9 @@
**
****************************************************************************/
+#ifndef QMACSTYLEPIXMAPS_MAC_P_H
+#define QMACSTYLEPIXMAPS_MAC_P_H
+
//
// W A R N I N G
// -------------
@@ -65,3 +68,5 @@ static const char * const qt_mac_toolbar_ext[]={
"aab###bb###baa",
"ab###bb###baaa",
".###..###.aaaa"};
+
+#endif // QMACSTYLEPIXMAPS_MAC_P_H
diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp
index 429dafe..4cfa93f 100644
--- a/src/gui/styles/qstyle.cpp
+++ b/src/gui/styles/qstyle.cpp
@@ -325,7 +325,7 @@ static int unpackControlTypes(QSizePolicy::ControlTypes controls, QSizePolicy::C
control over size of header items and row and column sizes.
\sa QStyleOption, QStylePainter, {Styles Example},
- {Implementing Styles and Style Aware Widgets}, QStyledItemDelegate
+ {Styles &amp Style Aware Widgets}, QStyledItemDelegate
*/
/*!
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index f920032..0a96272 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -46,7 +46,8 @@ x11{
contains( styles, mac ) {
HEADERS += \
styles/qmacstyle_mac.h \
- styles/qmacstylepixmaps_mac_p.h
+ styles/qmacstylepixmaps_mac_p.h \
+ styles/qmacstyle_mac_p.h
OBJECTIVE_SOURCES += styles/qmacstyle_mac.mm
!contains( styles, windows ) {
diff --git a/src/gui/widgets/qpushbutton.cpp b/src/gui/widgets/qpushbutton.cpp
index 1a9adcc..8a18ed0 100644
--- a/src/gui/widgets/qpushbutton.cpp
+++ b/src/gui/widgets/qpushbutton.cpp
@@ -58,6 +58,10 @@
#include "qdebug.h"
#include "qlayoutitem.h"
#include "qdialogbuttonbox.h"
+#ifdef Q_WS_MAC
+#include "qmacstyle_mac.h"
+#include "private/qmacstyle_mac_p.h"
+#endif // Q_WS_MAC
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
@@ -679,6 +683,37 @@ bool QPushButton::event(QEvent *e)
return QAbstractButton::event(e);
}
+#ifdef Q_WS_MAC
+/*! \reimp */
+bool QPushButton::hitButton(const QPoint &pos) const
+{
+ // This is only required if we are using the native style, so check that first.
+ QMacStyle *macStyle = qobject_cast<QMacStyle *>(style());
+ // If this is a flat button we just bail out.
+ if(isFlat() || (0 == macStyle))
+ return QAbstractButton::hitButton(pos);
+ // Now that we know we are using the native style, let's proceed.
+ Q_D(const QPushButton);
+ QPushButtonPrivate *nonConst = const_cast<QPushButtonPrivate *>(d);
+ // In OSX buttons are round, which causes the hit method to be special.
+ // We cannot simply relay on detecting if something is inside the rect or not,
+ // we need to check if it is inside the "rounded area" or not. A point might
+ // be inside the rect but not inside the rounded area.
+ // Notice this method is only reimplemented for OSX.
+ return nonConst->hitButton(pos);
+}
+
+bool QPushButtonPrivate::hitButton(const QPoint &pos)
+{
+ Q_Q(QPushButton);
+ QRect roundedRect(q->rect().left() + QMacStylePrivate::PushButtonLeftOffset,
+ q->rect().top() + QMacStylePrivate::PushButtonContentPadding,
+ q->rect().width() - QMacStylePrivate::PushButtonRightOffset,
+ q->rect().height() - QMacStylePrivate::PushButtonBottomOffset);
+ return roundedRect.contains(pos);
+}
+#endif // Q_WS_MAC
+
#ifdef QT3_SUPPORT
/*!
Use one of the constructors that doesn't take the \a name
diff --git a/src/gui/widgets/qpushbutton.h b/src/gui/widgets/qpushbutton.h
index 2a4823d..cf28753 100644
--- a/src/gui/widgets/qpushbutton.h
+++ b/src/gui/widgets/qpushbutton.h
@@ -91,6 +91,9 @@ public Q_SLOTS:
protected:
bool event(QEvent *e);
+#ifdef Q_WS_MAC
+ bool hitButton(const QPoint &pos) const;
+#endif // Q_WS_MAC
void paintEvent(QPaintEvent *);
void keyPressEvent(QKeyEvent *);
void focusInEvent(QFocusEvent *);
diff --git a/src/gui/widgets/qpushbutton_p.h b/src/gui/widgets/qpushbutton_p.h
index f2ee09d..6feb726 100644
--- a/src/gui/widgets/qpushbutton_p.h
+++ b/src/gui/widgets/qpushbutton_p.h
@@ -69,6 +69,9 @@ public:
inline void init() { resetLayoutItemMargins(); }
static QPushButtonPrivate* get(QPushButton *b) { return b->d_func(); }
+#ifdef Q_WS_MAC
+ bool hitButton(const QPoint &pos);
+#endif
#ifndef QT_NO_MENU
QPoint adjustedMenuPosition();
#endif
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index b7539da..42c64fb 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -141,6 +141,32 @@ static void ensureInitialized()
can be:
\snippet doc/src/snippets/code/src_network_access_qnetworkaccessmanager.cpp 1
+ \section1 Network and Roaming support
+
+ With the addition of the \l {Bearer Management} API to Qt 4.7
+ QNetworkAccessManager gained the ability to manage network connections.
+ QNetworkAccessManager can start the network interface if the device is
+ offline and terminates the interface if the current process is the last
+ one to use the uplink. Note that some platform utilize grace periods from
+ when the last application stops using a uplink until the system actually
+ terminates the connectivity link. Roaming is equally transparent. Any
+ queued/pending network requests are automatically transferred to new
+ access point.
+
+ Clients wanting to utilize this feature should not require any changes. In fact
+ it is likely that existing platform specific connection code can simply be
+ removed from the application.
+
+ \note The network and roaming support in QNetworkAccessManager is conditional
+ upon the platform supporting connection management. The
+ \l QNetworkConfigurationManager::NetworkSessionRequired can be used to
+ detect whether QNetworkAccessManager utilizes this feature. Currently only
+ Meego/Harmattan and Symbian platforms provide connection management support.
+
+ \note This feature cannot be used in combination with the Bearer Management
+ API as provided by QtMobility. Applications have to migrate to the Qt version
+ of Bearer Management.
+
\section1 Symbian Platform Security Requirements
On Symbian, processes which use this class must have the
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 15795d2..d6011cf 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -5,6 +5,7 @@ DEFINES += QT_BUILD_OPENGL_LIB
DEFINES += QT_NO_USING_NAMESPACE
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000
solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
+irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h
index 3c24c54..4d90648 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.h
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.h
@@ -78,6 +78,10 @@ public:
QNetworkSession::State sessionStateForId(const QString &id);
+ quint64 bytesWritten(const QString &id);
+ quint64 bytesReceived(const QString &id);
+ quint64 startTime(const QString &id);
+
QNetworkConfigurationManager::Capabilities capabilities() const;
QNetworkSessionPrivate *createSessionBackend();
@@ -100,6 +104,8 @@ private:
bool scanning;
QScanThread *scanThread;
+ quint64 getBytes(const QString &interfaceName,bool b);
+
protected:
void startNetworkChangeLoop();
diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm
index 3206833..a9cb65b 100644
--- a/src/plugins/bearer/corewlan/qcorewlanengine.mm
+++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm
@@ -67,6 +67,9 @@
#include <private/qt_cocoa_helpers_mac_p.h>
#include "private/qcore_mac_p.h"
+#include <net/if.h>
+#include <ifaddrs.h>
+
@interface QNSListener : NSObject
{
NSNotificationCenter *center;
@@ -157,7 +160,7 @@ void QScanThread::quit()
void QScanThread::run()
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+ QMacCocoaAutoReleasePool pool;
QStringList found;
mutex.lock();
CWInterface *currentInterface = [CWInterface interfaceWithName:qt_mac_QStringToNSString(interfaceName)];
@@ -167,6 +170,7 @@ void QScanThread::run()
NSError *err = nil;
NSDictionary *parametersDict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:YES], kCWScanKeyMerge,
+ [NSNumber numberWithInt:kCWScanTypeFast], kCWScanKeyScanType,
[NSNumber numberWithInteger:100], kCWScanKeyRestTime, nil];
NSArray* apArray = [currentInterface scanForNetworksWithParameters:parametersDict error:&err];
@@ -204,11 +208,9 @@ void QScanThread::run()
found.append(foundNetwork(id, networkSsid, state, interfaceName, purpose));
- } //end row
-// [parametersDict release];
-
- } //end error
- } // endwifi power
+ }
+ }
+ }
// add known configurations that are not around.
QMapIterator<QString, QMap<QString,QString> > i(userProfiles);
while (i.hasNext()) {
@@ -248,7 +250,6 @@ void QScanThread::run()
}
}
emit networksChanged();
- [pool release];
}
QStringList QScanThread::foundNetwork(const QString &id, const QString &name, const QNetworkConfiguration::StateFlags state, const QString &interfaceName, const QNetworkConfiguration::Purpose purpose)
@@ -426,6 +427,7 @@ QCoreWlanEngine::~QCoreWlanEngine()
void QCoreWlanEngine::initialize()
{
QMutexLocker locker(&mutex);
+ QMacCocoaAutoReleasePool pool;
if([[CWInterface supportedInterfaces] count] > 0 && !listener) {
listener = [[QNSListener alloc] init];
@@ -659,7 +661,6 @@ bool QCoreWlanEngine::isWifiReady(const QString &wifiDeviceName)
QNetworkSession::State QCoreWlanEngine::sessionStateForId(const QString &id)
{
QMutexLocker locker(&mutex);
-
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
if (!ptr)
@@ -823,5 +824,90 @@ void QCoreWlanEngine::networksChanged()
}
+quint64 QCoreWlanEngine::bytesWritten(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ const QString interfaceStr = getInterfaceFromId(id);
+ return getBytes(interfaceStr,false);
+}
+
+quint64 QCoreWlanEngine::bytesReceived(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ const QString interfaceStr = getInterfaceFromId(id);
+ return getBytes(interfaceStr,true);
+}
+
+quint64 QCoreWlanEngine::startTime(const QString &id)
+{
+ QMutexLocker locker(&mutex);
+ QMacCocoaAutoReleasePool pool;
+ quint64 timestamp = 0;
+
+ NSString *filePath = @"/Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist";
+ NSDictionary* plistDict = [[[NSDictionary alloc] initWithContentsOfFile:filePath] autorelease];
+ NSString *input = @"KnownNetworks";
+ NSString *timeStampStr = @"_timeStamp";
+
+ NSString *ssidStr = @"SSID_STR";
+
+ for (id key in plistDict) {
+ if ([input isEqualToString:key]) {
+
+ NSDictionary *knownNetworksDict = [plistDict objectForKey:key];
+ for (id networkKey in knownNetworksDict) {
+ bool isFound = false;
+ NSDictionary *itemDict = [knownNetworksDict objectForKey:networkKey];
+ NSInteger dictSize = [itemDict count];
+ id objects[dictSize];
+ id keys[dictSize];
+
+ [itemDict getObjects:objects andKeys:keys];
+ bool ok = false;
+ for(int i = 0; i < dictSize; i++) {
+ if([ssidStr isEqualToString:keys[i]]) {
+ const QString ident = QString::number(qHash(QLatin1String("corewlan:") + qt_mac_NSStringToQString(objects[i])));
+ if(ident == id) {
+ ok = true;
+ }
+ }
+ if(ok && [timeStampStr isEqualToString:keys[i]]) {
+ timestamp = (quint64)[objects[i] timeIntervalSince1970];
+ isFound = true;
+ break;
+ }
+ }
+ if(isFound)
+ break;
+ }
+ }
+ }
+ return timestamp;
+}
+
+quint64 QCoreWlanEngine::getBytes(const QString &interfaceName, bool b)
+{
+ struct ifaddrs *ifAddressList, *ifAddress;
+ struct if_data *if_data;
+
+ quint64 bytes = 0;
+ ifAddressList = nil;
+ if(getifaddrs(&ifAddressList) == 0) {
+ for(ifAddress = ifAddressList; ifAddress; ifAddress = ifAddress->ifa_next) {
+ if(interfaceName == ifAddress->ifa_name) {
+ if_data = (struct if_data*)ifAddress->ifa_data;
+ if(b) {
+ bytes = if_data->ifi_ibytes;
+ break;
+ } else {
+ bytes = if_data->ifi_obytes;
+ break;
+ }
+ }
+ }
+ freeifaddrs(ifAddressList);
+ }
+ return bytes;
+}
QT_END_NAMESPACE
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
index 9b6ffa0..1a55402 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp
@@ -46,6 +46,7 @@
#include <QtNetwork/private/qnetworkconfiguration_p.h>
#include <QtCore/qstringlist.h>
+#include <QtCore/qcoreapplication.h>
#include <QtCore/qdebug.h>
@@ -79,38 +80,26 @@ void qNotificationCallback(WLAN_NOTIFICATION_DATA *data, QNativeWifiEngine *d)
}
QNativeWifiEngine::QNativeWifiEngine(QObject *parent)
-: QBearerEngineImpl(parent), handle(0)
+: QBearerEngineImpl(parent), handle(INVALID_HANDLE_VALUE)
{
- DWORD clientVersion;
-
- DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle);
- if (result != ERROR_SUCCESS) {
-#ifdef BEARER_MANAGEMENT_DEBUG
- if (result != ERROR_SERVICE_NOT_ACTIVE)
- qDebug("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result);
-#endif
-
- return;
- }
-
- result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true,
- WLAN_NOTIFICATION_CALLBACK(qNotificationCallback),
- this, 0, 0);
-#ifdef BEARER_MANAGEMENT_DEBUG
- if (result != ERROR_SUCCESS)
- qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
-#endif
+ connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(closeHandle()));
}
QNativeWifiEngine::~QNativeWifiEngine()
{
- local_WlanCloseHandle(handle, 0);
+ closeHandle();
}
void QNativeWifiEngine::scanComplete()
{
QMutexLocker locker(&mutex);
+ if (!available()) {
+ locker.unlock();
+ emit updateCompleted();
+ return;
+ }
+
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
@@ -249,6 +238,9 @@ QString QNativeWifiEngine::getInterfaceFromId(const QString &id)
{
QMutexLocker locker(&mutex);
+ if (!available())
+ return QString();
+
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
@@ -304,6 +296,9 @@ bool QNativeWifiEngine::hasIdentifier(const QString &id)
{
QMutexLocker locker(&mutex);
+ if (!available())
+ return false;
+
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
@@ -364,6 +359,12 @@ void QNativeWifiEngine::connectToId(const QString &id)
{
QMutexLocker locker(&mutex);
+ if (!available()) {
+ locker.unlock();
+ emit connectionError(id, InterfaceLookupError);
+ return;
+ }
+
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
if (result != ERROR_SUCCESS) {
@@ -440,6 +441,12 @@ void QNativeWifiEngine::disconnectFromId(const QString &id)
{
QMutexLocker locker(&mutex);
+ if (!available()) {
+ locker.unlock();
+ emit connectionError(id, InterfaceLookupError);
+ return;
+ }
+
QString interface = getInterfaceFromId(id);
if (interface.isEmpty()) {
@@ -479,6 +486,12 @@ void QNativeWifiEngine::requestUpdate()
{
QMutexLocker locker(&mutex);
+ if (!available()) {
+ locker.unlock();
+ emit updateCompleted();
+ return;
+ }
+
// enumerate interfaces
WLAN_INTERFACE_INFO_LIST *interfaceList;
DWORD result = local_WlanEnumInterfaces(handle, 0, &interfaceList);
@@ -555,6 +568,42 @@ QNetworkConfigurationPrivatePointer QNativeWifiEngine::defaultConfiguration()
return QNetworkConfigurationPrivatePointer();
}
+bool QNativeWifiEngine::available()
+{
+ if (handle != INVALID_HANDLE_VALUE)
+ return true;
+
+ DWORD clientVersion;
+
+ DWORD result = local_WlanOpenHandle(1, 0, &clientVersion, &handle);
+ if (result != ERROR_SUCCESS) {
+#ifdef BEARER_MANAGEMENT_DEBUG
+ if (result != ERROR_SERVICE_NOT_ACTIVE)
+ qDebug("%s: WlanOpenHandle failed with error %ld\n", __FUNCTION__, result);
+#endif
+
+ return false;
+ }
+
+ result = local_WlanRegisterNotification(handle, WLAN_NOTIFICATION_SOURCE_ALL, true,
+ WLAN_NOTIFICATION_CALLBACK(qNotificationCallback),
+ this, 0, 0);
+#ifdef BEARER_MANAGEMENT_DEBUG
+ if (result != ERROR_SUCCESS)
+ qDebug("%s: WlanRegisterNotification failed with error %ld\n", __FUNCTION__, result);
+#endif
+
+ return handle != INVALID_HANDLE_VALUE;
+}
+
+void QNativeWifiEngine::closeHandle()
+{
+ if (handle != INVALID_HANDLE_VALUE) {
+ local_WlanCloseHandle(handle, 0);
+ handle = INVALID_HANDLE_VALUE;
+ }
+}
+
bool QNativeWifiEngine::requiresPolling() const
{
// On Windows XP SP2 and SP3 only connection and disconnection notifications are available.
diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h
index 3b21985..0e9576b 100644
--- a/src/plugins/bearer/nativewifi/qnativewifiengine.h
+++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h
@@ -91,12 +91,13 @@ public:
QNetworkConfigurationPrivatePointer defaultConfiguration();
- inline bool available() const { return handle != 0; }
+ bool available();
bool requiresPolling() const;
-public Q_SLOTS:
+private Q_SLOTS:
void scanComplete();
+ void closeHandle();
private:
Qt::HANDLE handle;