summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTobias Koenig <tokoe@kde.org>2009-06-10 15:11:59 (GMT)
committerTobias Koenig <tokoe@kde.org>2009-06-10 15:11:59 (GMT)
commitf1e6e89f7ee452af0e4404af537f5fed2a2b2dc5 (patch)
tree045fbf67a4806e4e217ef23cdf4f363ac359bef1 /src
parent5d87f2542bbcb0877f4a9a9b5be4df80cd6aa4cd (diff)
parent5b24c5793607c809b1bac82c7cc3696001ee9217 (diff)
downloadQt-f1e6e89f7ee452af0e4404af537f5fed2a2b2dc5.zip
Qt-f1e6e89f7ee452af0e4404af537f5fed2a2b2dc5.tar.gz
Qt-f1e6e89f7ee452af0e4404af537f5fed2a2b2dc5.tar.bz2
Merge branch 'master' of git://gitorious.org/qt/qt
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/phonon/qt7/mediaobject.h18
-rw-r--r--src/3rdparty/phonon/qt7/mediaobject.mm109
-rw-r--r--src/3rdparty/phonon/qt7/quicktimemetadata.h8
-rw-r--r--src/3rdparty/phonon/qt7/quicktimemetadata.mm41
-rw-r--r--src/3rdparty/phonon/qt7/quicktimevideoplayer.h19
-rw-r--r--src/3rdparty/phonon/qt7/quicktimevideoplayer.mm163
-rw-r--r--src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h2
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp8
-rw-r--r--src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp22
-rw-r--r--src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc3
-rw-r--r--src/corelib/animation/qabstractanimation.cpp4
-rw-r--r--src/corelib/animation/qanimationgroup.cpp4
-rw-r--r--src/corelib/animation/qparallelanimationgroup.cpp37
-rw-r--r--src/corelib/animation/qpauseanimation.cpp4
-rw-r--r--src/corelib/animation/qpropertyanimation.cpp4
-rw-r--r--src/corelib/animation/qsequentialanimationgroup.cpp6
-rw-r--r--src/corelib/animation/qvariantanimation.cpp4
-rw-r--r--src/corelib/codecs/qisciicodec.cpp2
-rw-r--r--src/corelib/codecs/qutfcodec.cpp2
-rw-r--r--src/corelib/global/qfeatures.h5
-rw-r--r--src/corelib/global/qfeatures.txt7
-rw-r--r--src/corelib/global/qglobal.h1
-rw-r--r--src/corelib/global/qt_windows.h3
-rw-r--r--src/corelib/io/qdatastream.h3
-rw-r--r--src/corelib/io/qnoncontiguousbytedevice_p.h5
-rw-r--r--src/corelib/kernel/qcoreapplication_win.cpp4
-rw-r--r--src/corelib/kernel/qeventdispatcher_unix.cpp14
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp3
-rw-r--r--src/corelib/kernel/qmetaobject.cpp5
-rw-r--r--src/corelib/kernel/qmetatype.cpp5
-rw-r--r--src/corelib/kernel/qmetatype.h11
-rw-r--r--src/corelib/kernel/qobject.cpp7
-rw-r--r--src/corelib/kernel/qobjectdefs.h2
-rw-r--r--src/corelib/kernel/qtimer.cpp2
-rw-r--r--src/corelib/kernel/qtranslator.cpp3
-rw-r--r--src/corelib/kernel/qtranslator_p.h1
-rw-r--r--src/corelib/kernel/qvariant.cpp2
-rw-r--r--src/corelib/kernel/qvariant_p.h20
-rw-r--r--src/corelib/plugin/qplugin.h2
-rw-r--r--src/corelib/plugin/quuid.cpp2
-rw-r--r--src/corelib/statemachine/qabstractstate.cpp5
-rw-r--r--src/corelib/statemachine/qabstractstate.h4
-rw-r--r--src/corelib/statemachine/qabstracttransition.cpp5
-rw-r--r--src/corelib/statemachine/qabstracttransition.h4
-rw-r--r--src/corelib/statemachine/qeventtransition.cpp5
-rw-r--r--src/corelib/statemachine/qeventtransition.h4
-rw-r--r--src/corelib/statemachine/qfinalstate.cpp5
-rw-r--r--src/corelib/statemachine/qfinalstate.h4
-rw-r--r--src/corelib/statemachine/qhistorystate.cpp5
-rw-r--r--src/corelib/statemachine/qhistorystate.h4
-rw-r--r--src/corelib/statemachine/qsignalevent.h4
-rw-r--r--src/corelib/statemachine/qsignaltransition.cpp5
-rw-r--r--src/corelib/statemachine/qsignaltransition.h4
-rw-r--r--src/corelib/statemachine/qstate.cpp5
-rw-r--r--src/corelib/statemachine/qstate.h4
-rw-r--r--src/corelib/statemachine/qstatemachine.cpp5
-rw-r--r--src/corelib/statemachine/qstatemachine.h4
-rw-r--r--src/corelib/statemachine/qwrappedevent.h4
-rw-r--r--src/corelib/thread/qthread.cpp6
-rw-r--r--src/corelib/thread/qthread_p.h54
-rw-r--r--src/corelib/tools/qbitarray.cpp5
-rw-r--r--src/corelib/tools/qbytearray.cpp5
-rw-r--r--src/corelib/tools/qchar.cpp2
-rw-r--r--src/corelib/tools/qlocale.cpp4
-rw-r--r--src/corelib/tools/qlocale_data_p.h10
-rw-r--r--src/corelib/tools/qlocale_p.h38
-rw-r--r--src/corelib/tools/qregexp.cpp2
-rw-r--r--src/corelib/tools/qsize.h4
-rw-r--r--src/corelib/tools/qstringbuilder.cpp4
-rw-r--r--src/corelib/tools/qstringbuilder.h34
-rw-r--r--src/corelib/tools/qunicodetables_p.h2
-rw-r--r--src/corelib/tools/qvector.h9
-rw-r--r--src/corelib/xml/qxmlstream.cpp7
-rw-r--r--src/corelib/xml/qxmlstream_p.h41
-rw-r--r--src/dbus/qdbus_symbols_p.h2
-rw-r--r--src/dbus/qdbusmessage.cpp1
-rw-r--r--src/dbus/qdbusthreaddebug_p.h2
-rw-r--r--src/gui/accessible/qaccessible.cpp2
-rw-r--r--src/gui/animation/qguivariantanimation.cpp4
-rw-r--r--src/gui/dialogs/qcolordialog.cpp2
-rw-r--r--src/gui/dialogs/qfiledialog.cpp5
-rw-r--r--src/gui/dialogs/qfontdialog.cpp2
-rw-r--r--src/gui/dialogs/qinputdialog.cpp12
-rw-r--r--src/gui/embedded/qkbd_qws_p.h3
-rw-r--r--src/gui/embedded/qscreenproxy_qws.cpp1
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp2
-rw-r--r--src/gui/image/qimage.cpp2
-rw-r--r--src/gui/image/qpicture.cpp2
-rw-r--r--src/gui/image/qpicture.h2
-rw-r--r--src/gui/image/qpicture_p.h2
-rw-r--r--src/gui/image/qpixmap.cpp2
-rw-r--r--src/gui/image/qpixmapcache.cpp5
-rw-r--r--src/gui/image/qpixmapdatafactory.cpp2
-rw-r--r--src/gui/itemviews/qheaderview.cpp13
-rw-r--r--src/gui/itemviews/qlistview.cpp8
-rw-r--r--src/gui/itemviews/qlistview_p.h2
-rw-r--r--src/gui/itemviews/qlistwidget.cpp3
-rw-r--r--src/gui/itemviews/qstandarditemmodel.cpp2
-rw-r--r--src/gui/itemviews/qtablewidget.cpp10
-rw-r--r--src/gui/itemviews/qtreewidget.cpp36
-rw-r--r--src/gui/itemviews/qtreewidget_p.h1
-rw-r--r--src/gui/kernel/qaction.cpp2
-rw-r--r--src/gui/kernel/qapplication.cpp6
-rw-r--r--src/gui/kernel/qapplication_mac.mm28
-rw-r--r--src/gui/kernel/qapplication_win.cpp22
-rw-r--r--src/gui/kernel/qapplication_x11.cpp87
-rw-r--r--src/gui/kernel/qlayout.cpp4
-rw-r--r--src/gui/kernel/qpalette.cpp4
-rw-r--r--src/gui/kernel/qsizepolicy.h2
-rw-r--r--src/gui/kernel/qt_x11_p.h6
-rw-r--r--src/gui/kernel/qwidget.cpp16
-rw-r--r--src/gui/kernel/qwidget_mac.mm13
-rw-r--r--src/gui/kernel/qwidget_p.h8
-rw-r--r--src/gui/kernel/qwidget_win.cpp3
-rw-r--r--src/gui/kernel/qwidget_x11.cpp28
-rw-r--r--src/gui/painting/qcolor.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp8
-rw-r--r--src/gui/painting/qfixed_p.h2
-rw-r--r--src/gui/painting/qmatrix.h2
-rw-r--r--src/gui/painting/qpaintengine_mac_p.h2
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp4
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp17
-rw-r--r--src/gui/painting/qpaintengineex.cpp80
-rw-r--r--src/gui/painting/qpaintengineex_p.h32
-rw-r--r--src/gui/painting/qpainter.h1
-rw-r--r--src/gui/painting/qpainter_p.h4
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qpdf_p.h2
-rw-r--r--src/gui/painting/qpolygon.cpp2
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h2
-rw-r--r--src/gui/painting/qtransform.h2
-rw-r--r--src/gui/painting/qvectorpath_p.h2
-rw-r--r--src/gui/painting/qwindowsurface_raster.cpp2
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qbasickeyeventtransition_p.h5
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qbasicmouseeventtransition_p.h5
-rw-r--r--src/gui/statemachine/qguistatemachine.cpp5
-rw-r--r--src/gui/statemachine/qkeyeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qkeyeventtransition.h4
-rw-r--r--src/gui/statemachine/qmouseeventtransition.cpp5
-rw-r--r--src/gui/statemachine/qmouseeventtransition.h4
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp33
-rw-r--r--src/gui/styles/qgtkstyle.cpp3
-rw-r--r--src/gui/styles/qmacstyle_mac.mm14
-rw-r--r--src/gui/styles/qmotifstyle.cpp5
-rw-r--r--src/gui/styles/qplastiquestyle.cpp60
-rw-r--r--src/gui/styles/qstyle_p.h2
-rw-r--r--src/gui/styles/qstylehelper.cpp1
-rw-r--r--src/gui/styles/qstylehelper_p.h1
-rw-r--r--src/gui/text/qcssparser.cpp42
-rw-r--r--src/gui/text/qcssparser_p.h1
-rw-r--r--src/gui/text/qfontdatabase_x11.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp6
-rw-r--r--src/gui/text/qfontengine_p.h1
-rw-r--r--src/gui/text/qfontengine_win.cpp32
-rw-r--r--src/gui/text/qfontengine_win_p.h3
-rw-r--r--src/gui/text/qfontengineglyphcache_p.h4
-rw-r--r--src/gui/text/qtextdocument_p.cpp8
-rw-r--r--src/gui/text/qtextdocument_p.h6
-rw-r--r--src/gui/text/qtextformat.cpp4
-rw-r--r--src/gui/text/qtextformat.h4
-rw-r--r--src/gui/text/qtexthtmlparser.cpp2
-rw-r--r--src/gui/util/qdesktopservices_win.cpp67
-rw-r--r--src/gui/widgets/qmainwindowlayout_p.h30
-rw-r--r--src/gui/widgets/qmenu_mac.mm52
-rw-r--r--src/gui/widgets/qplaintextedit.cpp4
-rw-r--r--src/gui/widgets/qprogressbar.cpp2
-rw-r--r--src/gui/widgets/qstatusbar.cpp2
-rw-r--r--src/gui/widgets/qtoolbararealayout.cpp86
-rw-r--r--src/gui/widgets/qtoolbararealayout_p.h57
-rw-r--r--src/gui/widgets/qvalidator.cpp2
-rw-r--r--src/network/access/qnetworkaccesshttpbackend.cpp10
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp21
-rw-r--r--src/network/access/qnetworkaccessmanager.h2
-rw-r--r--src/network/kernel/qauthenticator.cpp1
-rw-r--r--src/network/kernel/qnetworkproxy.cpp2
-rw-r--r--src/network/socket/qlocalsocket_win.cpp4
-rw-r--r--src/network/socket/qnativesocketengine_win.cpp5
-rw-r--r--src/network/ssl/qsslsocket.cpp2
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager.cpp3
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadermanager_p.h4
-rw-r--r--src/opengl/gl2paintengineex/qglengineshadersource_p.h14
-rw-r--r--src/opengl/gl2paintengineex/qglgradientcache_p.h2
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp420
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h26
-rw-r--r--src/opengl/qegl.cpp10
-rw-r--r--src/opengl/qgl.cpp23
-rw-r--r--src/opengl/qgl_p.h3
-rw-r--r--src/opengl/qgl_x11.cpp2
-rw-r--r--src/opengl/qglextensions.cpp3
-rw-r--r--src/opengl/qglframebufferobject.cpp2
-rw-r--r--src/opengl/qglpixelbuffer.cpp4
-rw-r--r--src/opengl/qglshaderprogram.h4
-rw-r--r--src/opengl/qpixmapdata_gl.cpp5
-rw-r--r--src/opengl/util/fragmentprograms_p.h8
-rw-r--r--src/opengl/util/generator.cpp1
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp7
-rw-r--r--src/plugins/imageformats/jpeg/qjpeghandler.cpp3
-rw-r--r--src/plugins/imageformats/tiff/qtiffhandler.cpp342
-rw-r--r--src/qt3support/widgets/q3action.cpp2
-rw-r--r--src/script/qscriptextqobject.cpp23
-rw-r--r--src/script/qscriptsyntaxchecker_p.h2
-rw-r--r--src/script/qscriptvalue.cpp1
-rw-r--r--src/script/qscriptvalueimpl.cpp2
-rw-r--r--src/script/qscriptvalueimplfwd_p.h2
-rw-r--r--src/testlib/qbenchmark_p.h2
-rw-r--r--src/testlib/qtestbasicstreamer.h6
-rw-r--r--src/testlib/qtestcase.cpp6
-rw-r--r--src/testlib/qtestcoreelement.h10
-rw-r--r--src/testlib/qtestcorelist.h6
-rw-r--r--src/testlib/qtestelement.h8
-rw-r--r--src/testlib/qtestelementattribute.h8
-rw-r--r--src/testlib/qtestfilelogger.h6
-rw-r--r--src/testlib/qtestlightxmlstreamer.h8
-rw-r--r--src/testlib/qtestresult.cpp2
-rw-r--r--src/testlib/qtestxmlstreamer.h8
-rw-r--r--src/testlib/qtestxunitstreamer.h8
-rw-r--r--src/tools/moc/generator.cpp20
-rw-r--r--src/tools/moc/moc.cpp2
-rw-r--r--src/tools/moc/outputrevision.h2
221 files changed, 2101 insertions, 948 deletions
diff --git a/src/3rdparty/phonon/qt7/mediaobject.h b/src/3rdparty/phonon/qt7/mediaobject.h
index ae623a9..c93eddc 100644
--- a/src/3rdparty/phonon/qt7/mediaobject.h
+++ b/src/3rdparty/phonon/qt7/mediaobject.h
@@ -42,7 +42,10 @@ namespace QT7
class MediaObjectAudioNode;
class MediaObject : public MediaNode,
- public Phonon::MediaObjectInterface, public Phonon::AddonInterface
+ public Phonon::MediaObjectInterface
+#ifndef QT_NO_PHONON_MEDIACONTROLLER
+ , public Phonon::AddonInterface
+#endif
{
Q_OBJECT
Q_INTERFACES(Phonon::MediaObjectInterface Phonon::AddonInterface)
@@ -113,6 +116,16 @@ namespace QT7
void metaDataChanged(QMultiMap<QString,QString>);
void currentSourceChanged(const MediaSource &newSource);
+ // Add-on interface:
+ void availableSubtitlesChanged();
+ void availableAudioChannelsChanged();
+ void titleChanged(int);
+ void availableTitlesChanged(int);
+ void chapterChanged(int);
+ void availableChaptersChanged(int);
+ void angleChanged(int);
+ void availableAnglesChanged(int);
+
protected:
void mediaNodeEvent(const MediaNodeEvent *event);
bool event(QEvent *event);
@@ -126,7 +139,6 @@ namespace QT7
QuickTimeVideoPlayer *m_nextVideoPlayer;
QuickTimeAudioPlayer *m_nextAudioPlayer;
MediaObjectAudioNode *m_mediaObjectAudioNode;
- QuickTimeMetaData *m_metaData;
#if QT_ALLOW_QUICKTIME
CVDisplayLinkRef m_displayLink;
@@ -150,6 +162,7 @@ namespace QT7
bool m_waitNextSwap;
int m_swapTimeLeft;
QTime m_swapTime;
+ bool m_autoplayTitles;
void synchAudioVideo();
void updateCurrentTime();
@@ -170,6 +183,7 @@ namespace QT7
void inspectVideoGraphRecursive(MediaNode *node, int &effectCount, int &outputCount);
void inspectGraph();
bool isCrossFading();
+ void setCurrentTrack(int track);
QString m_errorString;
Phonon::ErrorType m_errorType;
diff --git a/src/3rdparty/phonon/qt7/mediaobject.mm b/src/3rdparty/phonon/qt7/mediaobject.mm
index 6886a3c..677640c 100644
--- a/src/3rdparty/phonon/qt7/mediaobject.mm
+++ b/src/3rdparty/phonon/qt7/mediaobject.mm
@@ -46,7 +46,6 @@ MediaObject::MediaObject(QObject *parent) : MediaNode(AudioSource | VideoSource,
m_mediaObjectAudioNode = new MediaObjectAudioNode(m_audioPlayer, m_nextAudioPlayer);
setAudioNode(m_mediaObjectAudioNode);
- m_metaData = new QuickTimeMetaData();
m_audioGraph = new AudioGraph(this);
m_tickInterval = 0;
@@ -55,6 +54,7 @@ MediaObject::MediaObject(QObject *parent) : MediaNode(AudioSource | VideoSource,
m_transitionTime = 0;
m_percentageLoaded = 0;
m_waitNextSwap = false;
+ m_autoplayTitles = true;
m_audioEffectCount = 0;
m_audioOutputCount = 0;
m_videoEffectCount = 0;
@@ -85,7 +85,6 @@ MediaObject::~MediaObject()
m_nextAudioPlayer->unsetVideoPlayer();
delete m_videoPlayer;
delete m_nextVideoPlayer;
- delete m_metaData;
checkForError();
}
@@ -131,7 +130,7 @@ void MediaObject::inspectGraph()
// Inspect the graph to check wether there are any
// effects or outputs connected. This will have
// influence on the audio system and video system that ends up beeing used:
- int prevVideoOutputCount = m_videoOutputCount;
+ int prevVideoOutputCount = m_videoOutputCount;
m_audioEffectCount = 0;
m_audioOutputCount = 0;
m_videoEffectCount = 0;
@@ -143,7 +142,7 @@ void MediaObject::inspectGraph()
if (m_videoOutputCount != prevVideoOutputCount){
MediaNodeEvent e1(MediaNodeEvent::VideoOutputCountChanged, &m_videoOutputCount);
notify(&e1);
- }
+ }
}
void MediaObject::setupAudioSystem()
@@ -176,14 +175,14 @@ void MediaObject::setupAudioSystem()
if (newAudioSystem == m_audioSystem)
return;
-
+
// Enable selected audio system:
- m_audioSystem = newAudioSystem;
+ m_audioSystem = newAudioSystem;
switch (newAudioSystem){
case AS_Silent:
m_audioGraph->stop();
m_videoPlayer->enableAudio(false);
- m_nextVideoPlayer->enableAudio(false);
+ m_nextVideoPlayer->enableAudio(false);
m_audioPlayer->enableAudio(false);
m_nextAudioPlayer->enableAudio(false);
break;
@@ -227,6 +226,7 @@ void MediaObject::setSource(const MediaSource &source)
// Save current state for event/signal handling below:
bool prevHasVideo = m_videoPlayer->hasVideo();
qint64 prevTotalTime = totalTime();
+ int prevTrackCount = m_videoPlayer->trackCount();
m_waitNextSwap = false;
// Cancel cross-fade if any:
@@ -238,11 +238,10 @@ void MediaObject::setSource(const MediaSource &source)
m_audioPlayer->unsetVideoPlayer();
m_videoPlayer->setMediaSource(source);
m_audioPlayer->setVideoPlayer(m_videoPlayer);
- m_metaData->setVideo(m_videoPlayer);
m_audioGraph->updateStreamSpecifications();
m_nextAudioPlayer->unsetVideoPlayer();
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_currentTime = 0;
// Emit/notify information about the new source:
@@ -255,12 +254,14 @@ void MediaObject::setSource(const MediaSource &source)
updateVideo(emptyFrame);
emit currentSourceChanged(source);
- emit metaDataChanged(m_metaData->metaData());
+ emit metaDataChanged(m_videoPlayer->metaData());
if (prevHasVideo != m_videoPlayer->hasVideo())
- emit hasVideoChanged(m_videoPlayer->hasVideo());
+ emit hasVideoChanged(m_videoPlayer->hasVideo());
if (prevTotalTime != totalTime())
- emit totalTimeChanged(totalTime());
+ emit totalTimeChanged(totalTime());
+ if (prevTrackCount != m_videoPlayer->trackCount())
+ emit availableTitlesChanged(m_videoPlayer->trackCount());
if (checkForError())
return;
if (!m_videoPlayer->isDrmAuthorized())
@@ -269,7 +270,7 @@ void MediaObject::setSource(const MediaSource &source)
return;
if (!m_videoPlayer->canPlayMedia())
SET_ERROR("Cannot play media.", FATAL_ERROR)
-
+
// The state might have changed from LoadingState
// as a response to an error state change. So we
// need to check it before stopping:
@@ -296,12 +297,12 @@ void MediaObject::swapCurrentWithNext(qint32 transitionTime)
// Save current state for event/signal handling below:
bool prevHasVideo = m_videoPlayer->hasVideo();
qint64 prevTotalTime = totalTime();
+ int prevTrackCount = m_videoPlayer->trackCount();
qSwap(m_audioPlayer, m_nextAudioPlayer);
qSwap(m_videoPlayer, m_nextVideoPlayer);
m_mediaObjectAudioNode->startCrossFade(transitionTime);
m_audioGraph->updateStreamSpecifications();
- m_metaData->setVideo(m_videoPlayer);
m_waitNextSwap = false;
m_currentTime = 0;
@@ -312,12 +313,14 @@ void MediaObject::swapCurrentWithNext(qint32 transitionTime)
notify(&e1);
emit currentSourceChanged(m_videoPlayer->mediaSource());
- emit metaDataChanged(m_metaData->metaData());
+ emit metaDataChanged(m_videoPlayer->metaData());
if (prevHasVideo != m_videoPlayer->hasVideo())
emit hasVideoChanged(m_videoPlayer->hasVideo());
if (prevTotalTime != totalTime())
emit totalTimeChanged(totalTime());
+ if (prevTrackCount != m_videoPlayer->trackCount())
+ emit availableTitlesChanged(m_videoPlayer->trackCount());
if (checkForError())
return;
if (!m_videoPlayer->isDrmAuthorized())
@@ -517,7 +520,7 @@ void MediaObject::stop()
if (!setState(Phonon::StoppedState))
return;
m_waitNextSwap = false;
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_nextAudioPlayer->unsetVideoPlayer();
pause_internal();
seek(0);
@@ -531,7 +534,7 @@ void MediaObject::seek(qint64 milliseconds)
return;
// Stop cross-fade if any:
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_nextAudioPlayer->unsetVideoPlayer();
m_mediaObjectAudioNode->cancelCrossFade();
@@ -651,7 +654,7 @@ bool MediaObject::isSeekable() const
qint64 MediaObject::currentTime() const
{
IMPLEMENTED_SILENT;
- const_cast<MediaObject *>(this)->updateCurrentTime();
+ const_cast<MediaObject *>(this)->updateCurrentTime();
return m_currentTime;
}
@@ -661,19 +664,24 @@ void MediaObject::updateCurrentTime()
m_currentTime = (m_audioSystem == AS_Graph) ? m_audioPlayer->currentTime() : m_videoPlayer->currentTime();
quint64 total = m_videoPlayer->duration();
- // Check if it's time to emit aboutToFinish:
- quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000));
- if (lastUpdateTime < mark && mark <= m_currentTime)
- emit aboutToFinish();
-
- // Check if it's time to emit prefinishMarkReached:
- mark = qMax(quint64(0), total - m_prefinishMark);
- if (lastUpdateTime < mark && mark <= m_currentTime)
- emit prefinishMarkReached(total - m_currentTime);
+ if (m_videoPlayer->currentTrack() < m_videoPlayer->trackCount() - 1){
+ // There are still more tracks to play after the current track.
+ if (m_autoplayTitles) {
+ if (lastUpdateTime < m_currentTime && m_currentTime == total)
+ setCurrentTrack(m_videoPlayer->currentTrack() + 1);
+ }
+ } else if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){
+ // There is no more sources or tracks to play after the current source.
+ // Check if it's time to emit aboutToFinish:
+ quint32 mark = qMax(quint64(0), qMin(total, total + m_transitionTime - 2000));
+ if (lastUpdateTime < mark && mark <= m_currentTime)
+ emit aboutToFinish();
+
+ // Check if it's time to emit prefinishMarkReached:
+ mark = qMax(quint64(0), total - m_prefinishMark);
+ if (lastUpdateTime < mark && mark <= m_currentTime)
+ emit prefinishMarkReached(total - m_currentTime);
- if (m_nextVideoPlayer->state() == QuickTimeVideoPlayer::NoMedia){
- // There is no next source in que.
- // Check if it's time to emit finished:
if (lastUpdateTime < m_currentTime && m_currentTime == total){
emit finished();
m_currentTime = (m_audioSystem == AS_Graph) ? m_audioPlayer->currentTime() : m_videoPlayer->currentTime();
@@ -683,7 +691,7 @@ void MediaObject::updateCurrentTime()
} else {
// We have a next source.
// Check if it's time to swap to next source:
- mark = qMax(quint64(0), total + m_transitionTime);
+ quint32 mark = qMax(quint64(0), total + m_transitionTime);
if (m_waitNextSwap && m_state == Phonon::PlayingState &&
m_transitionTime < m_swapTime.msecsTo(QTime::currentTime())){
swapCurrentWithNext(0);
@@ -786,11 +794,11 @@ bool MediaObject::setAudioDeviceOnMovie(int id)
void MediaObject::updateCrossFade()
{
- m_mediaObjectAudioNode->updateCrossFade(m_currentTime);
+ m_mediaObjectAudioNode->updateCrossFade(m_currentTime);
// Clean-up previous movie if done fading:
if (m_mediaObjectAudioNode->m_fadeDuration == 0){
if (m_nextVideoPlayer->isPlaying() || m_nextAudioPlayer->isPlaying()){
- m_nextVideoPlayer->unsetVideo();
+ m_nextVideoPlayer->unsetCurrentMediaSource();
m_nextAudioPlayer->unsetVideoPlayer();
}
}
@@ -927,13 +935,42 @@ bool MediaObject::event(QEvent *event)
return QObject::event(event);
}
-bool MediaObject::hasInterface(Interface /*interface*/) const
+void MediaObject::setCurrentTrack(int track)
{
- return false;
+ if (track == m_videoPlayer->currentTrack() || track < 0 || track >= m_videoPlayer->trackCount())
+ return;
+
+ m_videoPlayer->setCurrentTrack(track);
+ emit titleChanged(track);
+ emit metaDataChanged(m_videoPlayer->metaData());
+}
+
+bool MediaObject::hasInterface(Interface iface) const
+{
+ return iface == AddonInterface::TitleInterface;
}
-QVariant MediaObject::interfaceCall(Interface /*interface*/, int /*command*/, const QList<QVariant> &/*arguments*/)
+QVariant MediaObject::interfaceCall(Interface iface, int command, const QList<QVariant> &params)
{
+ switch (iface) {
+ case TitleInterface:
+ switch (command) {
+ case availableTitles:
+ return m_videoPlayer->trackCount();
+ case title:
+ return m_videoPlayer->currentTrack();
+ case setTitle:
+ setCurrentTrack(params.first().toInt());
+ break;
+ case autoplayTitles:
+ return m_autoplayTitles;
+ case setAutoplayTitles:
+ m_autoplayTitles = params.first().toBool();
+ break;
+ }
+ default:
+ break;
+ }
return QVariant();
}
diff --git a/src/3rdparty/phonon/qt7/quicktimemetadata.h b/src/3rdparty/phonon/qt7/quicktimemetadata.h
index d524183..c589535 100644
--- a/src/3rdparty/phonon/qt7/quicktimemetadata.h
+++ b/src/3rdparty/phonon/qt7/quicktimemetadata.h
@@ -38,10 +38,8 @@ namespace QT7
class QuickTimeMetaData
{
public:
- QuickTimeMetaData();
- virtual ~QuickTimeMetaData();
-
- void setVideo(QuickTimeVideoPlayer *videoPlayer);
+ QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer);
+ void update();
QMultiMap<QString, QString> metaData();
private:
@@ -49,6 +47,8 @@ namespace QT7
bool m_movieChanged;
QuickTimeVideoPlayer *m_videoPlayer;
void readMetaData();
+ void guessMetaDataForCD();
+ void readMetaDataFromMovie();
#ifdef QUICKTIME_C_API_AVAILABLE
QString stripCopyRightSymbol(const QString &key);
diff --git a/src/3rdparty/phonon/qt7/quicktimemetadata.mm b/src/3rdparty/phonon/qt7/quicktimemetadata.mm
index 851e707..2dcc152 100644
--- a/src/3rdparty/phonon/qt7/quicktimemetadata.mm
+++ b/src/3rdparty/phonon/qt7/quicktimemetadata.mm
@@ -15,6 +15,7 @@
along with this library. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <QtCore/QFileInfo>
#include "quicktimemetadata.h"
#include "quicktimevideoplayer.h"
@@ -25,19 +26,14 @@ namespace Phonon
namespace QT7
{
-QuickTimeMetaData::QuickTimeMetaData()
+QuickTimeMetaData::QuickTimeMetaData(QuickTimeVideoPlayer *videoPlayer)
{
- m_videoPlayer = 0;
+ m_videoPlayer = videoPlayer;
m_movieChanged = false;
}
-QuickTimeMetaData::~QuickTimeMetaData()
+void QuickTimeMetaData::update()
{
-}
-
-void QuickTimeMetaData::setVideo(QuickTimeVideoPlayer *videoPlayer)
-{
- m_videoPlayer = videoPlayer;
m_movieChanged = true;
m_metaData.clear();
}
@@ -145,14 +141,22 @@ void QuickTimeMetaData::readFormattedData(QTMetaDataRef metaDataRef, OSType form
#endif // QUICKTIME_C_API_AVAILABLE
-void QuickTimeMetaData::readMetaData()
+void QuickTimeMetaData::guessMetaDataForCD()
+{
+ QString album = QFileInfo(m_videoPlayer->movieCompactDiscPath()).fileName();
+ QString title = QFileInfo(m_videoPlayer->currentTrackPath()).fileName();
+ title = title.left(title.lastIndexOf('.'));
+ m_metaData.insert(QLatin1String("ALBUM"), album);
+ m_metaData.insert(QLatin1String("TITLE"), title);
+ m_metaData.insert(QLatin1String("TRACKNUMBER"), QString::number(m_videoPlayer->currentTrack()));
+}
+
+void QuickTimeMetaData::readMetaDataFromMovie()
{
- if (!m_videoPlayer)
- return;
QMultiMap<QString, QString> metaMap;
-
+
#ifdef QUICKTIME_C_API_AVAILABLE
- QTMetaDataRef metaDataRef;
+ QTMetaDataRef metaDataRef;
OSStatus err = QTCopyMovieMetaData([m_videoPlayer->qtMovie() quickTimeMovie], &metaDataRef);
BACKEND_ASSERT2(err == noErr, "Could not read QuickTime meta data", NORMAL_ERROR)
@@ -173,6 +177,17 @@ void QuickTimeMetaData::readMetaData()
m_metaData.insert(QLatin1String("DESCRIPTION"), metaMap.value(QLatin1String("des")));
}
+void QuickTimeMetaData::readMetaData()
+{
+ if (!m_videoPlayer)
+ return;
+
+ if (m_videoPlayer->mediaSource().type() == Phonon::MediaSource::Disc)
+ guessMetaDataForCD();
+ else
+ readMetaDataFromMovie();
+}
+
QMultiMap<QString, QString> QuickTimeMetaData::metaData()
{
if (m_videoPlayer && m_videoPlayer->hasMovie() && m_movieChanged)
diff --git a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
index bf4f216..98eacb5 100644
--- a/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
+++ b/src/3rdparty/phonon/qt7/quicktimevideoplayer.h
@@ -39,6 +39,7 @@ namespace Phonon
namespace QT7
{
class QuickTimeStreamReader;
+ class QuickTimeMetaData;
class VideoRenderWidgetQTMovieView;
class QuickTimeVideoPlayer : QObject
@@ -56,7 +57,7 @@ namespace QT7
void setMediaSource(const MediaSource &source);
MediaSource mediaSource() const;
- void unsetVideo();
+ void unsetCurrentMediaSource();
void play();
void pause();
@@ -86,6 +87,7 @@ namespace QT7
bool setAudioDevice(int id);
void setPlaybackRate(float rate);
QTMovie *qtMovie() const;
+ QMultiMap<QString, QString> metaData();
float playbackRate() const;
float prefferedPlaybackRate() const;
@@ -105,6 +107,12 @@ namespace QT7
float percentageLoaded();
quint64 timeLoaded();
+ int trackCount() const;
+ int currentTrack() const;
+ void setCurrentTrack(int track);
+ QString movieCompactDiscPath() const;
+ QString currentTrackPath() const;
+
static QString timeToString(quint64 ms);
// Help functions when drawing to more that one widget in cocoa 64:
@@ -118,6 +126,7 @@ namespace QT7
QTMovie *m_QTMovie;
State m_state;
QGLPixelBuffer *m_QImagePixelBuffer;
+ QuickTimeMetaData *m_metaData;
CVOpenGLTextureRef m_cachedCVTextureRef;
QImage m_cachedQImage;
@@ -140,6 +149,9 @@ namespace QT7
qreal m_contrast;
qreal m_hue;
qreal m_saturation;
+ NSArray *m_folderTracks;
+ int m_currentTrack;
+ QString m_movieCompactDiscPath;
#ifdef QUICKTIME_C_API_AVAILABLE
QTVisualContextRef m_visualContext;
@@ -147,16 +159,21 @@ namespace QT7
VideoFrame m_currentFrame;
QuickTimeStreamReader *m_streamReader;
+ void prepareCurrentMovieForPlayback();
void createVisualContext();
void openMovieFromCurrentMediaSource();
void openMovieFromDataRef(QTDataReference *dataRef);
void openMovieFromFile();
void openMovieFromUrl();
void openMovieFromStream();
+ void openMovieFromCompactDisc();
void openMovieFromData(QByteArray *data, char *fileType);
void openMovieFromDataGuessType(QByteArray *data);
QString mediaSourcePath();
bool codecExistsAccordingToSuffix(const QString &fileName);
+ NSString* pathToCompactDisc();
+ bool isCompactDisc(NSString *path);
+ NSArray* scanFolder(NSString *path);
void setError(NSError *error);
bool errorOccured();
diff --git a/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm b/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
index de7c6ed..9a3c811 100644
--- a/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
+++ b/src/3rdparty/phonon/qt7/quicktimevideoplayer.mm
@@ -20,6 +20,7 @@
#include "videowidget.h"
#include "audiodevice.h"
#include "quicktimestreamreader.h"
+#include "quicktimemetadata.h"
#include <QtCore/QCoreApplication>
#include <QtCore/QEventLoop>
@@ -52,6 +53,7 @@ QuickTimeVideoPlayer::QuickTimeVideoPlayer() : QObject(0)
{
m_state = NoMedia;
m_mediaSource = MediaSource();
+ m_metaData = new QuickTimeMetaData(this);
m_QTMovie = 0;
m_streamReader = 0;
m_playbackRate = 1.0f;
@@ -69,6 +71,8 @@ QuickTimeVideoPlayer::QuickTimeVideoPlayer() : QObject(0)
m_primaryRenderingCIImage = 0;
m_QImagePixelBuffer = 0;
m_cachedCVTextureRef = 0;
+ m_folderTracks = 0;
+ m_currentTrack = 0;
#ifdef QUICKTIME_C_API_AVAILABLE
OSStatus err = EnterMovies();
@@ -80,7 +84,8 @@ QuickTimeVideoPlayer::QuickTimeVideoPlayer() : QObject(0)
QuickTimeVideoPlayer::~QuickTimeVideoPlayer()
{
PhononAutoReleasePool pool;
- unsetVideo();
+ unsetCurrentMediaSource();
+ delete m_metaData;
[(NSObject*)m_primaryRenderingTarget release];
m_primaryRenderingTarget = 0;
#ifdef QUICKTIME_C_API_AVAILABLE
@@ -420,7 +425,7 @@ QRect QuickTimeVideoPlayer::videoRect() const
return QRect(0, 0, size.width, size.height);
}
-void QuickTimeVideoPlayer::unsetVideo()
+void QuickTimeVideoPlayer::unsetCurrentMediaSource()
{
if (!m_QTMovie)
return;
@@ -436,11 +441,14 @@ void QuickTimeVideoPlayer::unsetVideo()
m_hasVideo = false;
m_staticFps = 0;
m_mediaSource = MediaSource();
+ m_movieCompactDiscPath.clear();
[(CIImage *)m_primaryRenderingCIImage release];
m_primaryRenderingCIImage = 0;
delete m_QImagePixelBuffer;
m_QImagePixelBuffer = 0;
releaseImageCache();
+ [m_folderTracks release];
+ m_folderTracks = 0;
}
QuickTimeVideoPlayer::State QuickTimeVideoPlayer::state() const
@@ -550,18 +558,25 @@ bool QuickTimeVideoPlayer::codecExistsAccordingToSuffix(const QString &fileName)
void QuickTimeVideoPlayer::setMediaSource(const MediaSource &mediaSource)
{
PhononAutoReleasePool pool;
- unsetVideo();
+ unsetCurrentMediaSource();
+
m_mediaSource = mediaSource;
if (mediaSource.type() == MediaSource::Empty || mediaSource.type() == MediaSource::Invalid){
m_state = NoMedia;
return;
}
+
openMovieFromCurrentMediaSource();
if (errorOccured()){
- unsetVideo();
+ unsetCurrentMediaSource();
return;
}
+ prepareCurrentMovieForPlayback();
+}
+
+void QuickTimeVideoPlayer::prepareCurrentMovieForPlayback()
+{
#ifdef QUICKTIME_C_API_AVAILABLE
if (m_visualContext)
SetMovieVisualContext([m_QTMovie quickTimeMovie], m_visualContext);
@@ -569,14 +584,14 @@ void QuickTimeVideoPlayer::setMediaSource(const MediaSource &mediaSource)
waitStatePlayable();
if (errorOccured()){
- unsetVideo();
+ unsetCurrentMediaSource();
return;
}
readProtection();
preRollMovie();
if (errorOccured()){
- unsetVideo();
+ unsetCurrentMediaSource();
return;
}
@@ -587,6 +602,7 @@ void QuickTimeVideoPlayer::setMediaSource(const MediaSource &mediaSource)
enableAudio(m_audioEnabled);
setMute(m_mute);
setVolume(m_masterVolume, m_relativeVolume);
+ m_metaData->update();
pause();
}
@@ -600,7 +616,7 @@ void QuickTimeVideoPlayer::openMovieFromCurrentMediaSource()
openMovieFromUrl();
break;
case MediaSource::Disc:
- CASE_UNSUPPORTED("Could not open media source.", FATAL_ERROR)
+ openMovieFromCompactDisc();
break;
case MediaSource::Stream:
openMovieFromStream();
@@ -662,7 +678,7 @@ void QuickTimeVideoPlayer::openMovieFromDataGuessType(QByteArray *data)
// than using e.g [QTMovie movieFileTypes:QTIncludeCommonTypes]. Some
// codecs *think* they can decode the stream, and crash...
#define TryOpenMovieWithCodec(type) gClearError(); \
- openMovieFromData(data, "."type); \
+ openMovieFromData(data, (char *)"."type); \
if (m_QTMovie) return;
TryOpenMovieWithCodec("avi");
@@ -702,6 +718,50 @@ void QuickTimeVideoPlayer::openMovieFromStream()
openMovieFromDataGuessType(m_streamReader->pointerToData());
}
+typedef void (*qt_sighandler_t)(int);
+static void sigtest(int) {
+ qApp->exit(0);
+}
+
+void QuickTimeVideoPlayer::openMovieFromCompactDisc()
+{
+ // Interrupting the application while the device is open
+ // causes the application to hang. So we need to handle
+ // this in a more graceful way:
+ qt_sighandler_t hndl = signal(SIGINT, sigtest);
+ if (hndl)
+ signal(SIGINT, hndl);
+
+ PhononAutoReleasePool pool;
+ NSString *cd = 0;
+ QString devName = m_mediaSource.deviceName();
+ if (devName.isEmpty()) {
+ cd = pathToCompactDisc();
+ if (!cd) {
+ SET_ERROR("Could not open media source.", NORMAL_ERROR)
+ return;
+ }
+ m_movieCompactDiscPath = PhononCFString::toQString(reinterpret_cast<CFStringRef>(cd));
+ } else {
+ if (!QFileInfo(devName).isAbsolute())
+ devName = QLatin1String("/Volumes/") + devName;
+ cd = [reinterpret_cast<const NSString *>(PhononCFString::toCFStringRef(devName)) autorelease];
+ if (!isCompactDisc(cd)) {
+ SET_ERROR("Could not open media source.", NORMAL_ERROR)
+ return;
+ }
+ m_movieCompactDiscPath = devName;
+ }
+
+ m_folderTracks = [scanFolder(cd) retain];
+ setCurrentTrack(0);
+}
+
+QString QuickTimeVideoPlayer::movieCompactDiscPath() const
+{
+ return m_movieCompactDiscPath;
+}
+
MediaSource QuickTimeVideoPlayer::mediaSource() const
{
return m_mediaSource;
@@ -1015,6 +1075,93 @@ void QuickTimeVideoPlayer::readProtection()
}
}
+QMultiMap<QString, QString> QuickTimeVideoPlayer::metaData()
+{
+ return m_metaData->metaData();
+}
+
+int QuickTimeVideoPlayer::trackCount() const
+{
+ if (!m_folderTracks)
+ return 0;
+ return [m_folderTracks count];
+}
+
+int QuickTimeVideoPlayer::currentTrack() const
+{
+ return m_currentTrack;
+}
+
+QString QuickTimeVideoPlayer::currentTrackPath() const
+{
+ if (!m_folderTracks)
+ return QString();
+
+ PhononAutoReleasePool pool;
+ NSString *trackPath = [m_folderTracks objectAtIndex:m_currentTrack];
+ return PhononCFString::toQString(reinterpret_cast<CFStringRef>(trackPath));
+}
+
+NSString* QuickTimeVideoPlayer::pathToCompactDisc()
+{
+ PhononAutoReleasePool pool;
+ NSArray *devices = [[NSWorkspace sharedWorkspace] mountedRemovableMedia];
+ for (NSString *dev in devices) {
+ if (isCompactDisc(dev))
+ return [dev retain];
+ }
+ return 0;
+}
+
+bool QuickTimeVideoPlayer::isCompactDisc(NSString *path)
+{
+ PhononAutoReleasePool pool;
+ NSString *type = [NSString string];
+ [[NSWorkspace sharedWorkspace] getFileSystemInfoForPath:path
+ isRemovable:0
+ isWritable:0
+ isUnmountable:0
+ description:0
+ type:&type];
+ return [type hasPrefix:@"cdd"];
+}
+
+NSArray* QuickTimeVideoPlayer::scanFolder(NSString *path)
+{
+ NSMutableArray *tracks = [NSMutableArray arrayWithCapacity:20];
+ if (!path)
+ return tracks;
+
+ NSDirectoryEnumerator *enumerator = [[NSFileManager defaultManager] enumeratorAtPath:path];
+ while (NSString *track = [enumerator nextObject]) {
+ if (![track hasPrefix:@"."])
+ [tracks addObject:[path stringByAppendingPathComponent:track]];
+ }
+ return tracks;
+}
+
+void QuickTimeVideoPlayer::setCurrentTrack(int track)
+{
+ PhononAutoReleasePool pool;
+ [m_QTMovie release];
+ m_QTMovie = 0;
+ m_currentTime = 0;
+ m_currentTrack = track;
+
+ if (!m_folderTracks)
+ return;
+ if (track < 0 || track >= (int)[m_folderTracks count])
+ return;
+
+ NSString *trackPath = [m_folderTracks objectAtIndex:track];
+ QTDataReference *dataRef = [QTDataReference dataReferenceWithReferenceToFile:trackPath];
+ State currentState = m_state;
+ openMovieFromDataRef(dataRef);
+ prepareCurrentMovieForPlayback();
+ if (currentState == Playing)
+ play();
+}
+
}}
QT_END_NAMESPACE
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
index e6e8f23..5b849e4 100644
--- a/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
+++ b/src/3rdparty/webkit/JavaScriptCore/wtf/unicode/Unicode.h
@@ -32,6 +32,6 @@
#error "Unknown Unicode implementation"
#endif
-COMPILE_ASSERT(sizeof(UChar) == 2, UCharIsTwoBytes);
+COMPILE_ASSERT(sizeof(UChar) == 2, UCharIsTwoBytes)
#endif // WTF_UNICODE_H
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
index 01b68eb..77add54 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp
@@ -1986,10 +1986,12 @@ bool QWebPage::isContentEditable() const
/*!
\property QWebPage::forwardUnsupportedContent
- \brief whether QWebPage should forward unsupported content through the
- unsupportedContent signal
+ \brief whether QWebPage should forward unsupported content
- If disabled the download of such content is aborted immediately.
+ If enabled, the unsupportedContent() signal is emitted with a network reply that
+ can be used to read the content.
+
+ If disabled, the download of such content is aborted immediately.
By default unsupported content is not forwarded.
*/
diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
index 1ad23f6..b516263 100644
--- a/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
+++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp
@@ -213,17 +213,25 @@ QWebSettings *QWebSettings::globalSettings()
Each QWebPage object has its own QWebSettings object, which configures the
settings for that page. If a setting is not configured, then it is looked
up in the global settings object, which can be accessed using
- QWebSettings::globalSettings().
+ globalSettings().
- QWebSettings allows configuring font properties such as font size and font
- family, the location of a custom stylesheet, and generic attributes like java
- script, plugins, etc. The \l{QWebSettings::WebAttribute}{WebAttribute}
- enum further describes this.
+ QWebSettings allows configuration of browser properties, such as font sizes and
+ families, the location of a custom style sheet, and generic attributes like
+ JavaScript and plugins. Individual attributes are set using the setAttribute()
+ function. The \l{QWebSettings::WebAttribute}{WebAttribute} enum further describes
+ each attribute.
- QWebSettings also configures global properties such as the web page memory
- cache and the web page icon database, local database storage and offline
+ QWebSettings also configures global properties such as the Web page memory
+ cache and the Web page icon database, local database storage and offline
applications storage.
+ \section1 Enabling Plugins
+
+ Support for browser plugins can enabled by setting the
+ \l{QWebSettings::PluginsEnabled}{PluginsEnabled} attribute. For many applications,
+ this attribute is enabled for all pages by setting it on the
+ \l{globalSettings()}{global settings object}.
+
\section1 Web Application Support
WebKit provides support for features specified in \l{HTML 5} that improve the
diff --git a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
index 06305e0..119c126 100644
--- a/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
+++ b/src/3rdparty/webkit/WebKit/qt/docs/qtwebkit.qdoc
@@ -96,7 +96,8 @@
Since WebKit supports the Netscape Plugin API, Qt applications can display
Web pages that embed common plugins, as long as the user has the appropriate
- binary files for those plugins installed.
+ binary files for those plugins installed and the \l{QWebSettings::PluginsEnabled}
+ attribute is set for the application.
The following locations are searched for plugins:
diff --git a/src/corelib/animation/qabstractanimation.cpp b/src/corelib/animation/qabstractanimation.cpp
index 61d61df..fcc63a4 100644
--- a/src/corelib/animation/qabstractanimation.cpp
+++ b/src/corelib/animation/qabstractanimation.cpp
@@ -142,8 +142,6 @@
\sa direction
*/
-#ifndef QT_NO_ANIMATION
-
#include "qabstractanimation.h"
#include "qanimationgroup.h"
#include <QtCore/qdebug.h>
@@ -155,6 +153,8 @@
#include <QtCore/qcoreevent.h>
#include <QtCore/qpointer.h>
+#ifndef QT_NO_ANIMATION
+
#define DEFAULT_TIMER_INTERVAL 16
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/animation/qanimationgroup.cpp b/src/corelib/animation/qanimationgroup.cpp
index 839b522..e192a6c 100644
--- a/src/corelib/animation/qanimationgroup.cpp
+++ b/src/corelib/animation/qanimationgroup.cpp
@@ -89,13 +89,13 @@
\sa QAbstractAnimation, QVariantAnimation, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
-
#include "qanimationgroup.h"
#include <QtCore/qdebug.h>
#include <QtCore/qcoreevent.h>
#include "qanimationgroup_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
diff --git a/src/corelib/animation/qparallelanimationgroup.cpp b/src/corelib/animation/qparallelanimationgroup.cpp
index 13f6073..6ec4679 100644
--- a/src/corelib/animation/qparallelanimationgroup.cpp
+++ b/src/corelib/animation/qparallelanimationgroup.cpp
@@ -68,11 +68,13 @@
\sa QAnimationGroup, QPropertyAnimation, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
#include "qparallelanimationgroup.h"
#include "qparallelanimationgroup_p.h"
//#define QANIMATION_DEBUG
+
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
/*!
@@ -133,13 +135,14 @@ void QParallelAnimationGroup::updateCurrentTime(int)
// simulate completion of the loop
int dura = duration();
if (dura > 0) {
- foreach (QAbstractAnimation *animation, d->animations) {
- animation->setCurrentTime(dura); // will stop
+ for (int i = 0; i < d->animations.size(); ++i) {
+ d->animations.at(i)->setCurrentTime(dura); // will stop
}
}
} else if (d->currentLoop < d->lastLoop) {
// simulate completion of the loop seeking backwards
- foreach (QAbstractAnimation *animation, d->animations) {
+ for (int i = 0; i < d->animations.size(); ++i) {
+ QAbstractAnimation *animation = d->animations.at(i);
animation->setCurrentTime(0);
animation->stop();
}
@@ -152,7 +155,8 @@ void QParallelAnimationGroup::updateCurrentTime(int)
__LINE__, d->currentTime, d->currentLoop, d->lastLoop, timeFwd, d->lastCurrentTime, state());
#endif
// finally move into the actual time of the current loop
- foreach (QAbstractAnimation *animation, d->animations) {
+ for (int i = 0; i < d->animations.size(); ++i) {
+ QAbstractAnimation *animation = d->animations.at(i);
const int dura = animation->totalDuration();
if (dura == -1 && d->isUncontrolledAnimationFinished(animation))
continue;
@@ -198,17 +202,18 @@ void QParallelAnimationGroup::updateState(QAbstractAnimation::State oldState,
switch (newState) {
case Stopped:
- foreach (QAbstractAnimation *animation, d->animations)
- animation->stop();
+ for (int i = 0; i < d->animations.size(); ++i)
+ d->animations.at(i)->stop();
d->disconnectUncontrolledAnimations();
break;
case Paused:
- foreach (QAbstractAnimation *animation, d->animations)
- animation->pause();
+ for (int i = 0; i < d->animations.size(); ++i)
+ d->animations.at(i)->pause();
break;
case Running:
d->connectUncontrolledAnimations();
- foreach (QAbstractAnimation *animation, d->animations) {
+ for (int i = 0; i < d->animations.size(); ++i) {
+ QAbstractAnimation *animation = d->animations.at(i);
animation->stop();
animation->setDirection(d->direction);
animation->start();
@@ -241,8 +246,8 @@ void QParallelAnimationGroupPrivate::_q_uncontrolledAnimationFinished()
return;
int maxDuration = 0;
- foreach (QAbstractAnimation *a, animations)
- maxDuration = qMax(maxDuration, a->totalDuration());
+ for (int i = 0; i < animations.size(); ++i)
+ maxDuration = qMax(maxDuration, animations.at(i)->totalDuration());
if (currentTime >= maxDuration)
q->stop();
@@ -265,7 +270,8 @@ void QParallelAnimationGroupPrivate::connectUncontrolledAnimations()
{
Q_Q(QParallelAnimationGroup);
- foreach (QAbstractAnimation *animation, animations) {
+ for (int i = 0; i < animations.size(); ++i) {
+ QAbstractAnimation *animation = animations.at(i);
if (animation->duration() == -1 || animation->loopCount() < 0) {
uncontrolledFinishTime[animation] = -1;
QObject::connect(animation, SIGNAL(finished()), q, SLOT(_q_uncontrolledAnimationFinished()));
@@ -286,8 +292,9 @@ void QParallelAnimationGroup::updateDirection(QAbstractAnimation::Direction dire
Q_D(QParallelAnimationGroup);
//we need to update the direction of the current animation
if (state() != Stopped) {
- foreach(QAbstractAnimation *anim, d->animations) {
- anim->setDirection(direction);
+ for (int i = 0; i < d->animations.size(); ++i) {
+ QAbstractAnimation *animation = d->animations.at(i);
+ animation->setDirection(direction);
}
} else {
if (direction == Forward) {
diff --git a/src/corelib/animation/qpauseanimation.cpp b/src/corelib/animation/qpauseanimation.cpp
index b175f0c..93043c2 100644
--- a/src/corelib/animation/qpauseanimation.cpp
+++ b/src/corelib/animation/qpauseanimation.cpp
@@ -62,12 +62,12 @@
\sa QSequentialAnimationGroup
*/
-#ifndef QT_NO_ANIMATION
-
#include "qpauseanimation.h"
#include "qabstractanimation_p.h"
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
class QPauseAnimationPrivate : public QAbstractAnimationPrivate
diff --git a/src/corelib/animation/qpropertyanimation.cpp b/src/corelib/animation/qpropertyanimation.cpp
index 357a6ac..65f1361 100644
--- a/src/corelib/animation/qpropertyanimation.cpp
+++ b/src/corelib/animation/qpropertyanimation.cpp
@@ -87,8 +87,6 @@
\sa QVariantAnimation, QAnimationGroup, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
-
#include "qpropertyanimation.h"
#include "qanimationgroup.h"
#include "qpropertyanimation_p.h"
@@ -97,6 +95,8 @@
#include <QtCore/qmutex.h>
#include <private/qmutexpool_p.h>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
typedef QPair<QObject *, QByteArray> QPropertyAnimationPair;
diff --git a/src/corelib/animation/qsequentialanimationgroup.cpp b/src/corelib/animation/qsequentialanimationgroup.cpp
index 14814a7..25db52f 100644
--- a/src/corelib/animation/qsequentialanimationgroup.cpp
+++ b/src/corelib/animation/qsequentialanimationgroup.cpp
@@ -77,8 +77,6 @@
\sa QAnimationGroup, QAbstractAnimation, {The Animation Framework}
*/
-#ifndef QT_NO_ANIMATION
-
#include "qsequentialanimationgroup.h"
#include "qsequentialanimationgroup_p.h"
@@ -86,9 +84,9 @@
#include <QtCore/qdebug.h>
-QT_BEGIN_NAMESPACE
-
+#ifndef QT_NO_ANIMATION
+QT_BEGIN_NAMESPACE
bool QSequentialAnimationGroupPrivate::atEnd() const
{
diff --git a/src/corelib/animation/qvariantanimation.cpp b/src/corelib/animation/qvariantanimation.cpp
index a3fa93a..ab73373 100644
--- a/src/corelib/animation/qvariantanimation.cpp
+++ b/src/corelib/animation/qvariantanimation.cpp
@@ -39,8 +39,6 @@
**
****************************************************************************/
-#ifndef QT_NO_ANIMATION
-
#include "qvariantanimation.h"
#include "qvariantanimation_p.h"
@@ -49,6 +47,8 @@
#include <QtCore/qmutex.h>
#include <private/qmutexpool_p.h>
+#ifndef QT_NO_ANIMATION
+
QT_BEGIN_NAMESPACE
/*!
diff --git a/src/corelib/codecs/qisciicodec.cpp b/src/corelib/codecs/qisciicodec.cpp
index dd2bc8d..de1e477 100644
--- a/src/corelib/codecs/qisciicodec.cpp
+++ b/src/corelib/codecs/qisciicodec.cpp
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
struct Codecs {
- const char *name;
+ const char name[10];
ushort base;
};
diff --git a/src/corelib/codecs/qutfcodec.cpp b/src/corelib/codecs/qutfcodec.cpp
index 1ac592e..d9defe1 100644
--- a/src/corelib/codecs/qutfcodec.cpp
+++ b/src/corelib/codecs/qutfcodec.cpp
@@ -478,7 +478,7 @@ QByteArray QUtf32Codec::convertFromUnicode(const QChar *uc, int len, ConverterSt
data[2] = 0;
data[3] = 0;
}
- data += 2;
+ data += 4;
}
if (endian == BE) {
for (int i = 0; i < len; ++i) {
diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h
index f11c9df..9f7c7ba 100644
--- a/src/corelib/global/qfeatures.h
+++ b/src/corelib/global/qfeatures.h
@@ -311,6 +311,11 @@
#define QT_NO_ACCESSIBILITY
#endif
+// Animation
+#if !defined(QT_NO_ANIMATION) && (defined(QT_NO_PROPERTIES))
+#define QT_NO_ANIMATION
+#endif
+
// QButtonGroup
#if !defined(QT_NO_BUTTONGROUP) && (defined(QT_NO_GROUPBOX))
#define QT_NO_BUTTONGROUP
diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt
index 23ec7b0..9408a5b 100644
--- a/src/corelib/global/qfeatures.txt
+++ b/src/corelib/global/qfeatures.txt
@@ -1164,6 +1164,13 @@ Requires: PROPERTIES
Name: Animation
SeeAlso: ???
+Feature: STATEMACHINE
+Description: Provides hierarchical finite state machines.
+Section: Utilities
+Requires: PROPERTIES
+Name: State machine
+SeeAlso: ???
+
# SVG
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 3990c7d..a10b6d6 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1004,6 +1004,7 @@ typedef int QNoImplicitBoolCast;
#define QT_NO_FPU
#endif
+// This logic must match the one in qmetatype.h
#if defined(QT_COORD_TYPE)
typedef QT_COORD_TYPE qreal;
#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
diff --git a/src/corelib/global/qt_windows.h b/src/corelib/global/qt_windows.h
index 2ce4059..7fc7f47 100644
--- a/src/corelib/global/qt_windows.h
+++ b/src/corelib/global/qt_windows.h
@@ -106,6 +106,9 @@
#ifndef WM_MOUSEWHEEL
#define WM_MOUSEWHEEL 0x020A
#endif
+#ifndef WM_MOUSEHWHEEL
+#define WM_MOUSEHWHEEL 0x020E
+#endif
#ifndef ETO_PDY
#define ETO_PDY 0x2000
#endif
diff --git a/src/corelib/io/qdatastream.h b/src/corelib/io/qdatastream.h
index ec5780c..077e720 100644
--- a/src/corelib/io/qdatastream.h
+++ b/src/corelib/io/qdatastream.h
@@ -65,9 +65,8 @@ template <typename T> class QSet;
template <class Key, class T> class QHash;
template <class Key, class T> class QMap;
-class QDataStreamPrivate;
-
#ifndef QT_NO_DATASTREAM
+class QDataStreamPrivate;
class Q_CORE_EXPORT QDataStream
{
public:
diff --git a/src/corelib/io/qnoncontiguousbytedevice_p.h b/src/corelib/io/qnoncontiguousbytedevice_p.h
index acfc6eb..562b759 100644
--- a/src/corelib/io/qnoncontiguousbytedevice_p.h
+++ b/src/corelib/io/qnoncontiguousbytedevice_p.h
@@ -96,7 +96,6 @@ public:
class QNonContiguousByteDeviceByteArrayImpl : public QNonContiguousByteDevice
{
- Q_OBJECT
public:
QNonContiguousByteDeviceByteArrayImpl(QByteArray *ba);
~QNonContiguousByteDeviceByteArrayImpl();
@@ -112,7 +111,6 @@ protected:
class QNonContiguousByteDeviceRingBufferImpl : public QNonContiguousByteDevice
{
- Q_OBJECT
public:
QNonContiguousByteDeviceRingBufferImpl(QRingBuffer *rb);
~QNonContiguousByteDeviceRingBufferImpl();
@@ -129,7 +127,6 @@ protected:
class QNonContiguousByteDeviceIoDeviceImpl : public QNonContiguousByteDevice
{
- Q_OBJECT
public:
QNonContiguousByteDeviceIoDeviceImpl(QIODevice *d);
~QNonContiguousByteDeviceIoDeviceImpl();
@@ -151,7 +148,6 @@ protected:
class QNonContiguousByteDeviceBufferImpl : public QNonContiguousByteDevice
{
- Q_OBJECT
public:
QNonContiguousByteDeviceBufferImpl(QBuffer *b);
~QNonContiguousByteDeviceBufferImpl();
@@ -169,7 +165,6 @@ protected:
// ... and the reverse thing
class QByteDeviceWrappingIoDevice : public QIODevice
{
- Q_OBJECT
public:
QByteDeviceWrappingIoDevice (QNonContiguousByteDevice *bd);
~QByteDeviceWrappingIoDevice ();
diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp
index 815a558..9c1c235 100644
--- a/src/corelib/kernel/qcoreapplication_win.cpp
+++ b/src/corelib/kernel/qcoreapplication_win.cpp
@@ -409,6 +409,7 @@ struct {
{ 0x020B, "WM_XBUTTONDOWN" },
{ 0x020C, "WM_XBUTTONUP" },
{ 0x020D, "WM_XBUTTONDBLCLK" },
+ { 0x020E, "WM_MOUSEHWHEEL" },
{ 0x0210, "WM_PARENTNOTIFY" },
{ 0x0211, "WM_ENTERMENULOOP" },
{ 0x0212, "WM_EXITMENULOOP" },
@@ -898,6 +899,9 @@ QString decodeMSG(const MSG& msg)
#ifdef WM_MOUSEWHEEL
case WM_MOUSEWHEEL:
#endif
+#ifdef WM_MOUSEHWHEEL
+ case WM_MOUSEHWHEEL:
+#endif
#ifdef WM_LBUTTONDBLCLK
case WM_LBUTTONDBLCLK:
#endif
diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp
index 1b9cb93..033225b 100644
--- a/src/corelib/kernel/qeventdispatcher_unix.cpp
+++ b/src/corelib/kernel/qeventdispatcher_unix.cpp
@@ -420,10 +420,18 @@ bool QTimerInfoList::timerWait(timeval &tm)
timeval currentTime = updateCurrentTime();
repairTimersIfNeeded();
- if (isEmpty())
- return false;
+ // Find first waiting timer not already active
+ QTimerInfo *t = 0;
+ for (QTimerInfoList::const_iterator it = constBegin(); it != constEnd(); ++it) {
+ if (!(*it)->inTimerEvent) {
+ t = *it;
+ break;
+ }
+ }
+
+ if (!t)
+ return false;
- QTimerInfo *t = first(); // first waiting timer
if (currentTime < t->timeout) {
// time to wait
tm = t->timeout - currentTime;
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 2dd5534..7d3a13a 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -696,7 +696,8 @@ bool QEventDispatcherWin32::processEvents(QEventLoop::ProcessEventsFlags flags)
&& msg.message <= WM_KEYLAST)
|| (msg.message >= WM_MOUSEFIRST
&& msg.message <= WM_MOUSELAST)
- || msg.message == WM_MOUSEWHEEL)) {
+ || msg.message == WM_MOUSEWHEEL
+ || msg.message == WM_MOUSEHWHEEL)) {
// queue user input events for later processing
haveMessage = false;
d->queuedUserInputEvents.append(msg);
diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp
index b65f956..6f3316c 100644
--- a/src/corelib/kernel/qmetaobject.cpp
+++ b/src/corelib/kernel/qmetaobject.cpp
@@ -2003,6 +2003,11 @@ QVariant::Type QMetaProperty::type() const
if (enumMetaTypeId == 0)
return QVariant::Int;
}
+#ifdef QT_COORD_TYPE
+ // qreal metatype must be resolved at runtime.
+ if (strcmp(typeName(), "qreal") == 0)
+ return QVariant::Type(qMetaTypeId<qreal>());
+#endif
return QVariant::UserType;
}
diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp
index ce10bae..6b40f46 100644
--- a/src/corelib/kernel/qmetatype.cpp
+++ b/src/corelib/kernel/qmetatype.cpp
@@ -179,6 +179,7 @@ QT_BEGIN_NAMESPACE
\omitvalue LastCoreExtType
\omitvalue LastCoreType
\omitvalue LastGuiType
+ \omitvalue QReal
Additional types can be registered using Q_DECLARE_METATYPE().
@@ -359,7 +360,7 @@ void QMetaType::registerStreamOperators(const char *typeName, SaveOperator saveO
inf.saveOp = saveOp;
inf.loadOp = loadOp;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
Returns the type name associated with the given \a type, or 0 if no
@@ -884,7 +885,7 @@ bool QMetaType::load(QDataStream &stream, int type, void *data)
}
return true;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
Returns a copy of \a copy, assuming it is of type \a type. If \a
diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h
index 648f933..22214a4 100644
--- a/src/corelib/kernel/qmetatype.h
+++ b/src/corelib/kernel/qmetatype.h
@@ -86,6 +86,15 @@ public:
UShort = 133, UChar = 134, Float = 135, QObjectStar = 136, QWidgetStar = 137,
LastCoreExtType = 137 /* QWidgetStar */,
+// This logic must match the one in qglobal.h
+#if defined(QT_COORD_TYPE)
+ QReal = 0,
+#elif defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE)
+ QReal = Float,
+#else
+ QReal = Double,
+#endif
+
User = 256
};
@@ -174,7 +183,7 @@ void qRegisterMetaTypeStreamOperators(const char *typeName
QMetaType::registerStreamOperators(typeName, reinterpret_cast<QMetaType::SaveOperator>(sptr),
reinterpret_cast<QMetaType::LoadOperator>(lptr));
}
-#endif
+#endif // QT_NO_DATASTREAM
template <typename T>
struct QMetaTypeId
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index 543422c..5e33a71 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -897,7 +897,8 @@ QObjectPrivate::Connection::~Connection()
\relates QObject
Returns the given \a object cast to type T if the object is of type
- T (or of a subclass); otherwise returns 0.
+ T (or of a subclass); otherwise returns 0. If \a object is 0 then
+ it will also return 0.
The class T must inherit (directly or indirectly) QObject and be
declared with the \l Q_OBJECT macro.
@@ -2227,11 +2228,11 @@ static void err_method_notfound(const QObject *object,
if (strchr(method,')') == 0) // common typing mistake
qWarning("Object::%s: Parentheses expected, %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1,
- loc ? " in ":"\0", loc ? loc : "\0");
+ loc ? " in ": "", loc ? loc : "");
else
qWarning("Object::%s: No such %s %s::%s%s%s",
func, type, object->metaObject()->className(), method+1,
- loc ? " in ":"\0", loc ? loc : "\0");
+ loc ? " in ": "", loc ? loc : "");
}
diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h
index 3a22323..f5d08ce 100644
--- a/src/corelib/kernel/qobjectdefs.h
+++ b/src/corelib/kernel/qobjectdefs.h
@@ -55,7 +55,7 @@ class QByteArray;
class QString;
#ifndef Q_MOC_OUTPUT_REVISION
-#define Q_MOC_OUTPUT_REVISION 61
+#define Q_MOC_OUTPUT_REVISION 62
#endif
// The following macros are our "extensions" to C++
diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp
index 8ca53b9..29bdf7e 100644
--- a/src/corelib/kernel/qtimer.cpp
+++ b/src/corelib/kernel/qtimer.cpp
@@ -251,7 +251,7 @@ void QTimer::stop()
/*!
- \reimp
+ \reimp
*/
void QTimer::timerEvent(QTimerEvent *e)
{
diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp
index 5ba9898..38fa216 100644
--- a/src/corelib/kernel/qtranslator.cpp
+++ b/src/corelib/kernel/qtranslator.cpp
@@ -149,6 +149,9 @@ static int numerusHelper(int n, const uchar *rules, int rulesSize)
leftOperand %= 10;
} else if (opcode & Q_MOD_100) {
leftOperand %= 100;
+ } else if (opcode & Q_LEAD_1000) {
+ while (leftOperand >= 1000)
+ leftOperand /= 1000;
}
int op = opcode & Q_OP_MASK;
diff --git a/src/corelib/kernel/qtranslator_p.h b/src/corelib/kernel/qtranslator_p.h
index 77ec8f5..a7d58c5 100644
--- a/src/corelib/kernel/qtranslator_p.h
+++ b/src/corelib/kernel/qtranslator_p.h
@@ -62,6 +62,7 @@ enum {
Q_NOT = 0x08,
Q_MOD_10 = 0x10,
Q_MOD_100 = 0x20,
+ Q_LEAD_1000 = 0x40,
Q_AND = 0xFD,
Q_OR = 0xFE,
diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp
index 2ff9818..e6f1c48 100644
--- a/src/corelib/kernel/qvariant.cpp
+++ b/src/corelib/kernel/qvariant.cpp
@@ -1823,7 +1823,7 @@ QVariant::Type QVariant::nameToType(const char *name)
#ifndef QT_NO_DATASTREAM
enum { MapFromThreeCount = 35 };
-static const uint map_from_three[MapFromThreeCount] =
+static const ushort map_from_three[MapFromThreeCount] =
{
QVariant::Invalid,
QVariant::Map,
diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h
index 033b760..02b507e 100644
--- a/src/corelib/kernel/qvariant_p.h
+++ b/src/corelib/kernel/qvariant_p.h
@@ -105,28 +105,28 @@ private:
// constructs a new variant if copy is 0, otherwise copy-constructs
template <class T>
-inline void v_construct(QVariant::Private *x, const T &t)
+inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
{
if (sizeof(T) > sizeof(QVariant::Private::Data)) {
- x->data.shared = new QVariantPrivateSharedEx<T>(t);
+ x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy))
+ : new QVariantPrivateSharedEx<T>;
x->is_shared = true;
} else {
- new (&x->data.ptr) T(t);
+ if (copy)
+ new (&x->data.ptr) T(*static_cast<const T *>(copy));
+ else
+ new (&x->data.ptr) T;
}
}
template <class T>
-inline void v_construct(QVariant::Private *x, const void *copy, T * = 0)
+inline void v_construct(QVariant::Private *x, const T &t)
{
if (sizeof(T) > sizeof(QVariant::Private::Data)) {
- x->data.shared = copy ? new QVariantPrivateSharedEx<T>(*static_cast<const T *>(copy))
- : new QVariantPrivateSharedEx<T>;
+ x->data.shared = new QVariantPrivateSharedEx<T>(t);
x->is_shared = true;
} else {
- if (copy)
- new (&x->data.ptr) T(*static_cast<const T *>(copy));
- else
- new (&x->data.ptr) T;
+ new (&x->data.ptr) T(t);
}
}
diff --git a/src/corelib/plugin/qplugin.h b/src/corelib/plugin/qplugin.h
index 121a875..e3b9d32 100644
--- a/src/corelib/plugin/qplugin.h
+++ b/src/corelib/plugin/qplugin.h
@@ -131,7 +131,7 @@ struct qt_plugin_instance_deleter
"pattern=""QT_PLUGIN_VERIFICATION_DATA""\n" \
"version="QT_VERSION_STR"\n" \
"debug="QPLUGIN_DEBUG_STR"\n" \
- "buildkey="QT_BUILD_KEY"\0";
+ "buildkey="QT_BUILD_KEY;
# if defined (Q_OS_WIN32) && defined(Q_CC_BOR)
# define Q_STANDARD_CALL __stdcall
diff --git a/src/corelib/plugin/quuid.cpp b/src/corelib/plugin/quuid.cpp
index 3e05d28..cee8bf7 100644
--- a/src/corelib/plugin/quuid.cpp
+++ b/src/corelib/plugin/quuid.cpp
@@ -405,7 +405,7 @@ QDataStream &operator>>(QDataStream &s, QUuid &id)
}
return s;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
Returns true if this is the null UUID
diff --git a/src/corelib/statemachine/qabstractstate.cpp b/src/corelib/statemachine/qabstractstate.cpp
index 942722f..b9a50a2 100644
--- a/src/corelib/statemachine/qabstractstate.cpp
+++ b/src/corelib/statemachine/qabstractstate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qabstractstate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qabstractstate_p.h"
#include "qstate.h"
#include "qstate_p.h"
@@ -200,3 +203,5 @@ bool QAbstractState::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qabstractstate.h b/src/corelib/statemachine/qabstractstate.h
index d0ebb52..ee55541 100644
--- a/src/corelib/statemachine/qabstractstate.h
+++ b/src/corelib/statemachine/qabstractstate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QState;
class QStateMachine;
@@ -83,6 +85,8 @@ private:
Q_DECLARE_PRIVATE(QAbstractState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qabstracttransition.cpp b/src/corelib/statemachine/qabstracttransition.cpp
index dfcafeb..f582b8c 100644
--- a/src/corelib/statemachine/qabstracttransition.cpp
+++ b/src/corelib/statemachine/qabstracttransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qabstracttransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qabstracttransition_p.h"
#include "qabstractstate.h"
#include "qstate.h"
@@ -340,3 +343,5 @@ bool QAbstractTransition::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qabstracttransition.h b/src/corelib/statemachine/qabstracttransition.h
index c63d55a..a1a62c9 100644
--- a/src/corelib/statemachine/qabstracttransition.h
+++ b/src/corelib/statemachine/qabstracttransition.h
@@ -52,6 +52,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QEvent;
class QAbstractState;
class QState;
@@ -104,6 +106,8 @@ private:
Q_DECLARE_PRIVATE(QAbstractTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qeventtransition.cpp b/src/corelib/statemachine/qeventtransition.cpp
index f25d821..4c40256 100644
--- a/src/corelib/statemachine/qeventtransition.cpp
+++ b/src/corelib/statemachine/qeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qeventtransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qeventtransition_p.h"
#include "qwrappedevent.h"
#include "qstate.h"
@@ -283,3 +286,5 @@ bool QEventTransition::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qeventtransition.h b/src/corelib/statemachine/qeventtransition.h
index 3530bdd..40ffecf 100644
--- a/src/corelib/statemachine/qeventtransition.h
+++ b/src/corelib/statemachine/qeventtransition.h
@@ -51,6 +51,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QEventTransitionPrivate;
class Q_CORE_EXPORT QEventTransition : public QAbstractTransition
{
@@ -89,6 +91,8 @@ private:
Q_DECLARE_PRIVATE(QEventTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qfinalstate.cpp b/src/corelib/statemachine/qfinalstate.cpp
index 0980336..0eb531f 100644
--- a/src/corelib/statemachine/qfinalstate.cpp
+++ b/src/corelib/statemachine/qfinalstate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qfinalstate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qabstractstate_p.h"
QT_BEGIN_NAMESPACE
@@ -132,3 +135,5 @@ bool QFinalState::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qfinalstate.h b/src/corelib/statemachine/qfinalstate.h
index fa68394..865f333 100644
--- a/src/corelib/statemachine/qfinalstate.h
+++ b/src/corelib/statemachine/qfinalstate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QFinalStatePrivate;
class Q_CORE_EXPORT QFinalState : public QAbstractState
{
@@ -69,6 +71,8 @@ private:
Q_DECLARE_PRIVATE(QFinalState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qhistorystate.cpp b/src/corelib/statemachine/qhistorystate.cpp
index 517faa8..4304da3 100644
--- a/src/corelib/statemachine/qhistorystate.cpp
+++ b/src/corelib/statemachine/qhistorystate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qhistorystate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qhistorystate_p.h"
QT_BEGIN_NAMESPACE
@@ -221,3 +224,5 @@ bool QHistoryState::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qhistorystate.h b/src/corelib/statemachine/qhistorystate.h
index a0682bd..eee43d1 100644
--- a/src/corelib/statemachine/qhistorystate.h
+++ b/src/corelib/statemachine/qhistorystate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QHistoryStatePrivate;
class Q_CORE_EXPORT QHistoryState : public QAbstractState
{
@@ -84,6 +86,8 @@ private:
Q_DECLARE_PRIVATE(QHistoryState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qsignalevent.h b/src/corelib/statemachine/qsignalevent.h
index 8221f68..79d1053 100644
--- a/src/corelib/statemachine/qsignalevent.h
+++ b/src/corelib/statemachine/qsignalevent.h
@@ -53,6 +53,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class Q_CORE_EXPORT QSignalEvent : public QEvent
{
public:
@@ -70,6 +72,8 @@ private:
QList<QVariant> m_arguments;
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qsignaltransition.cpp b/src/corelib/statemachine/qsignaltransition.cpp
index 9ffcb9c..2e150a7 100644
--- a/src/corelib/statemachine/qsignaltransition.cpp
+++ b/src/corelib/statemachine/qsignaltransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qsignaltransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qsignaltransition_p.h"
#include "qsignalevent.h"
#include "qstate.h"
@@ -258,3 +261,5 @@ bool QSignalTransition::event(QEvent *e)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qsignaltransition.h b/src/corelib/statemachine/qsignaltransition.h
index b485785..02b1de9 100644
--- a/src/corelib/statemachine/qsignaltransition.h
+++ b/src/corelib/statemachine/qsignaltransition.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QSignalTransitionPrivate;
class Q_CORE_EXPORT QSignalTransition : public QAbstractTransition
{
@@ -82,6 +84,8 @@ private:
Q_DECLARE_PRIVATE(QSignalTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qstate.cpp b/src/corelib/statemachine/qstate.cpp
index ebb0b47..5dd56c0 100644
--- a/src/corelib/statemachine/qstate.cpp
+++ b/src/corelib/statemachine/qstate.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qstate.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qstate_p.h"
#include "qhistorystate.h"
#include "qhistorystate_p.h"
@@ -482,3 +485,5 @@ bool QState::event(QEvent *e)
*/
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qstate.h b/src/corelib/statemachine/qstate.h
index 6729c69..c98bb64 100644
--- a/src/corelib/statemachine/qstate.h
+++ b/src/corelib/statemachine/qstate.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QAbstractTransition;
class QSignalTransition;
@@ -106,6 +108,8 @@ private:
Q_DECLARE_PRIVATE(QState)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp
index d5f6b76..64b33ac 100644
--- a/src/corelib/statemachine/qstatemachine.cpp
+++ b/src/corelib/statemachine/qstatemachine.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qstatemachine.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qstate.h"
#include "qstate_p.h"
#include "qstatemachine_p.h"
@@ -2207,3 +2210,5 @@ QWrappedEvent::~QWrappedEvent()
QT_END_NAMESPACE
#include "moc_qstatemachine.cpp"
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/corelib/statemachine/qstatemachine.h b/src/corelib/statemachine/qstatemachine.h
index 2a98a9a..0b3c728 100644
--- a/src/corelib/statemachine/qstatemachine.h
+++ b/src/corelib/statemachine/qstatemachine.h
@@ -54,6 +54,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QEvent;
class QAbstractState;
class QState;
@@ -159,6 +161,8 @@ private:
#endif
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/statemachine/qwrappedevent.h b/src/corelib/statemachine/qwrappedevent.h
index b01c608..cb4261b 100644
--- a/src/corelib/statemachine/qwrappedevent.h
+++ b/src/corelib/statemachine/qwrappedevent.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Core)
+#ifndef QT_NO_STATEMACHINE
+
class QObject;
class Q_CORE_EXPORT QWrappedEvent : public QEvent
@@ -69,6 +71,8 @@ private:
Q_DISABLE_COPY(QWrappedEvent)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp
index 2fb6335..8fba574 100644
--- a/src/corelib/thread/qthread.cpp
+++ b/src/corelib/thread/qthread.cpp
@@ -113,12 +113,6 @@ QThreadData::~QThreadData()
// fprintf(stderr, "QThreadData %p destroyed\n", this);
}
-QThreadData *QThreadData::get2(QThread *thread)
-{
- Q_ASSERT_X(thread != 0, "QThread", "internal error");
- return thread->d_func()->data;
-}
-
void QThreadData::ref()
{
#ifndef QT_NO_THREAD
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index 75293ce..eb290db 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -107,32 +107,6 @@ public:
{ }
};
-class Q_CORE_EXPORT QThreadData
-{
- QAtomicInt _ref;
-
-public:
- QThreadData(int initialRefCount = 1);
- ~QThreadData();
-
- static QThreadData *current();
- static QThreadData *get2(QThread *thread);
-
- void ref();
- void deref();
-
- QThread *thread;
- bool quitNow;
- int loopLevel;
- QAbstractEventDispatcher *eventDispatcher;
- QStack<QEventLoop *> eventLoops;
- QPostEventList postEventList;
- bool canWait;
- QMap<int, void *> tls;
-
- QMutex mutex;
-};
-
#ifndef QT_NO_THREAD
class QThreadPrivate : public QObjectPrivate
{
@@ -210,6 +184,34 @@ public:
#endif // QT_NO_THREAD
+class QThreadData
+{
+ QAtomicInt _ref;
+
+public:
+ QThreadData(int initialRefCount = 1);
+ ~QThreadData();
+
+ static QThreadData *current();
+ static QThreadData *get2(QThread *thread)
+ { Q_ASSERT_X(thread != 0, "QThread", "internal error"); return thread->d_func()->data; }
+
+
+ void ref();
+ void deref();
+
+ QThread *thread;
+ bool quitNow;
+ int loopLevel;
+ QAbstractEventDispatcher *eventDispatcher;
+ QStack<QEventLoop *> eventLoops;
+ QPostEventList postEventList;
+ bool canWait;
+ QMap<int, void *> tls;
+
+ QMutex mutex;
+};
+
QT_END_NAMESPACE
#endif // QTHREAD_P_H
diff --git a/src/corelib/tools/qbitarray.cpp b/src/corelib/tools/qbitarray.cpp
index a947ab5..591cfa9 100644
--- a/src/corelib/tools/qbitarray.cpp
+++ b/src/corelib/tools/qbitarray.cpp
@@ -653,6 +653,7 @@ QBitArray operator^(const QBitArray &a1, const QBitArray &a2)
QBitArray stream functions
*****************************************************************************/
+#ifndef QT_NO_DATASTREAM
/*!
\relates QBitArray
@@ -660,7 +661,7 @@ QBitArray operator^(const QBitArray &a1, const QBitArray &a2)
\sa \link datastreamformat.html Format of the QDataStream operators \endlink
*/
-#ifndef QT_NO_DATASTREAM
+
QDataStream &operator<<(QDataStream &out, const QBitArray &ba)
{
quint32 len = ba.size();
@@ -713,7 +714,7 @@ QDataStream &operator>>(QDataStream &in, QBitArray &ba)
*ba.d.data() = ba.d.size() * 8 - len;
return in;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
\fn DataPtr &QBitArray::data_ptr()
diff --git a/src/corelib/tools/qbytearray.cpp b/src/corelib/tools/qbytearray.cpp
index 49dd52d..cbd9d4e 100644
--- a/src/corelib/tools/qbytearray.cpp
+++ b/src/corelib/tools/qbytearray.cpp
@@ -2591,6 +2591,8 @@ void QByteArray::clear()
d->ref.ref();
}
+#ifndef QT_NO_DATASTREAM
+
/*! \relates QByteArray
Writes byte array \a ba to the stream \a out and returns a reference
@@ -2598,7 +2600,6 @@ void QByteArray::clear()
\sa {Format of the QDataStream operators}
*/
-#ifndef QT_NO_DATASTREAM
QDataStream &operator<<(QDataStream &out, const QByteArray &ba)
{
@@ -2641,7 +2642,7 @@ QDataStream &operator>>(QDataStream &in, QByteArray &ba)
return in;
}
-#endif //QT_NO_DATASTREAM
+#endif // QT_NO_DATASTREAM
/*! \fn bool QByteArray::operator==(const QString &str) const
diff --git a/src/corelib/tools/qchar.cpp b/src/corelib/tools/qchar.cpp
index a940cda..250dad0 100644
--- a/src/corelib/tools/qchar.cpp
+++ b/src/corelib/tools/qchar.cpp
@@ -1321,7 +1321,7 @@ QDataStream &operator>>(QDataStream &in, QChar &chr)
chr.unicode() = ushort(u);
return in;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
\fn ushort & QChar::unicode()
diff --git a/src/corelib/tools/qlocale.cpp b/src/corelib/tools/qlocale.cpp
index 8c740bd..4898e10 100644
--- a/src/corelib/tools/qlocale.cpp
+++ b/src/corelib/tools/qlocale.cpp
@@ -772,7 +772,7 @@ QVariant QSystemLocale::query(QueryType type, QVariant in = QVariant()) const
Instead it can return a "Windows code". This maps windows codes to ISO country names. */
struct WindowsToISOListElt {
- int windows_code;
+ ushort windows_code;
char iso_name[6];
};
@@ -1533,7 +1533,7 @@ QDataStream &operator>>(QDataStream &ds, QLocale &l)
l = QLocale(s);
return ds;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
diff --git a/src/corelib/tools/qlocale_data_p.h b/src/corelib/tools/qlocale_data_p.h
index 37f59a4..e0eecf3 100644
--- a/src/corelib/tools/qlocale_data_p.h
+++ b/src/corelib/tools/qlocale_data_p.h
@@ -60,8 +60,8 @@ QT_BEGIN_NAMESPACE
*/
struct CountryLanguage
{
- quint32 languageId;
- quint32 countryId;
+ quint16 languageId;
+ quint16 countryId;
};
static const CountryLanguage ImperialMeasurementSystems[] = {
{ 31, 225 },
@@ -83,7 +83,7 @@ static const int ImperialMeasurementSystemsCount =
*/
-static const uint locale_index[] = {
+static const quint16 locale_index[] = {
0, // unused
0, // C
0, // Abkhazian
@@ -2313,7 +2313,7 @@ static const char language_name_list[] =
"Chewa\0"
;
-static const uint language_name_index[] = {
+static const quint16 language_name_index[] = {
0, // Unused
8, // C
10, // Abkhazian
@@ -2727,7 +2727,7 @@ static const char country_name_list[] =
"SerbiaAndMontenegro\0"
;
-static const uint country_name_index[] = {
+static const quint16 country_name_index[] = {
0, // AnyCountry
8, // Afghanistan
20, // Albania
diff --git a/src/corelib/tools/qlocale_p.h b/src/corelib/tools/qlocale_p.h
index b07b948..ed7fc10 100644
--- a/src/corelib/tools/qlocale_p.h
+++ b/src/corelib/tools/qlocale_p.h
@@ -140,29 +140,29 @@ public:
QString dateTimeToString(const QString &format, const QDate *date, const QTime *time,
const QLocale *q) const;
- quint32 m_language_id, m_country_id;
+ quint16 m_language_id, m_country_id;
quint16 m_decimal, m_group, m_list, m_percent,
m_zero, m_minus, m_plus, m_exponential;
- quint32 m_short_date_format_idx, m_short_date_format_size;
- quint32 m_long_date_format_idx, m_long_date_format_size;
- quint32 m_short_time_format_idx, m_short_time_format_size;
- quint32 m_long_time_format_idx, m_long_time_format_size;
- quint32 m_standalone_short_month_names_idx, m_standalone_short_month_names_size;
- quint32 m_standalone_long_month_names_idx, m_standalone_long_month_names_size;
- quint32 m_standalone_narrow_month_names_idx, m_standalone_narrow_month_names_size;
- quint32 m_short_month_names_idx, m_short_month_names_size;
- quint32 m_long_month_names_idx, m_long_month_names_size;
- quint32 m_narrow_month_names_idx, m_narrow_month_names_size;
- quint32 m_standalone_short_day_names_idx, m_standalone_short_day_names_size;
- quint32 m_standalone_long_day_names_idx, m_standalone_long_day_names_size;
- quint32 m_standalone_narrow_day_names_idx, m_standalone_narrow_day_names_size;
- quint32 m_short_day_names_idx, m_short_day_names_size;
- quint32 m_long_day_names_idx, m_long_day_names_size;
- quint32 m_narrow_day_names_idx, m_narrow_day_names_size;
- quint32 m_am_idx, m_am_size;
- quint32 m_pm_idx, m_pm_size;
+ quint16 m_short_date_format_idx, m_short_date_format_size;
+ quint16 m_long_date_format_idx, m_long_date_format_size;
+ quint16 m_short_time_format_idx, m_short_time_format_size;
+ quint16 m_long_time_format_idx, m_long_time_format_size;
+ quint16 m_standalone_short_month_names_idx, m_standalone_short_month_names_size;
+ quint16 m_standalone_long_month_names_idx, m_standalone_long_month_names_size;
+ quint16 m_standalone_narrow_month_names_idx, m_standalone_narrow_month_names_size;
+ quint16 m_short_month_names_idx, m_short_month_names_size;
+ quint16 m_long_month_names_idx, m_long_month_names_size;
+ quint16 m_narrow_month_names_idx, m_narrow_month_names_size;
+ quint16 m_standalone_short_day_names_idx, m_standalone_short_day_names_size;
+ quint16 m_standalone_long_day_names_idx, m_standalone_long_day_names_size;
+ quint16 m_standalone_narrow_day_names_idx, m_standalone_narrow_day_names_size;
+ quint16 m_short_day_names_idx, m_short_day_names_size;
+ quint16 m_long_day_names_idx, m_long_day_names_size;
+ quint16 m_narrow_day_names_idx, m_narrow_day_names_size;
+ quint16 m_am_idx, m_am_size;
+ quint16 m_pm_idx, m_pm_size;
};
inline char QLocalePrivate::digitToCLocale(const QChar &in) const
diff --git a/src/corelib/tools/qregexp.cpp b/src/corelib/tools/qregexp.cpp
index 664dfc0..3877121 100644
--- a/src/corelib/tools/qregexp.cpp
+++ b/src/corelib/tools/qregexp.cpp
@@ -4394,6 +4394,6 @@ QDataStream &operator>>(QDataStream &in, QRegExp &regExp)
regExp = newRegExp;
return in;
}
-#endif
+#endif // QT_NO_DATASTREAM
QT_END_NAMESPACE
diff --git a/src/corelib/tools/qsize.h b/src/corelib/tools/qsize.h
index 34a6c99..237625e 100644
--- a/src/corelib/tools/qsize.h
+++ b/src/corelib/tools/qsize.h
@@ -98,8 +98,10 @@ Q_DECLARE_TYPEINFO(QSize, Q_MOVABLE_TYPE);
QSize stream functions
*****************************************************************************/
+#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QSize &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSize &);
+#endif
/*****************************************************************************
@@ -249,8 +251,10 @@ Q_DECLARE_TYPEINFO(QSizeF, Q_MOVABLE_TYPE);
QSizeF stream functions
*****************************************************************************/
+#ifndef QT_NO_DATASTREAM
Q_CORE_EXPORT QDataStream &operator<<(QDataStream &, const QSizeF &);
Q_CORE_EXPORT QDataStream &operator>>(QDataStream &, QSizeF &);
+#endif
/*****************************************************************************
diff --git a/src/corelib/tools/qstringbuilder.cpp b/src/corelib/tools/qstringbuilder.cpp
index 4f24f76..03d8160 100644
--- a/src/corelib/tools/qstringbuilder.cpp
+++ b/src/corelib/tools/qstringbuilder.cpp
@@ -111,7 +111,7 @@
The QStringBuilder class is not to be used explicitly in user code.
Instances of the class are created as return values of the operator%()
function, acting on objects of type \c QString, \c QLatin1String,
- \c QLatin1Literal, \c \QStringRef, \c QChar,
+ \c QLatin1Literal, \c \QStringRef, \c QChar, \c QCharRef,
\c QLatin1Char, and \c char.
Concatenating strings with operator%() generally yields better
@@ -130,6 +130,6 @@
This function is usable with arguments of type \c QString,
\c QLatin1String, \c QLatin1Literal, \c QStringRef,
- \c QChar, \c QLatin1Char, and \c char.
+ \c QChar, \c QCharRef, \c QLatin1Char, and \c char.
*/
diff --git a/src/corelib/tools/qstringbuilder.h b/src/corelib/tools/qstringbuilder.h
index 1e67b7d..2c31476 100644
--- a/src/corelib/tools/qstringbuilder.h
+++ b/src/corelib/tools/qstringbuilder.h
@@ -122,6 +122,16 @@ template <> struct QConcatenable<QChar>
}
};
+template <> struct QConcatenable<QCharRef>
+{
+ typedef QCharRef type;
+ static int size(const QCharRef &) { return 1; }
+ static inline void appendTo(const QCharRef &c, QChar *&out)
+ {
+ *out++ = QChar(c);
+ }
+};
+
template <> struct QConcatenable<QLatin1String>
{
typedef QLatin1String type;
@@ -169,6 +179,30 @@ template <> struct QConcatenable<QStringRef>
}
};
+#ifndef QT_NO_CAST_FROM_ASCII
+template <int N> struct QConcatenable<char[N]>
+{
+ typedef char type[N];
+ static int size(const char[N]) { return N - 1; }
+ static inline void appendTo(const char a[N], QChar *&out)
+ {
+ for (int i = 0; i < N - 1; ++i)
+ *out++ = QLatin1Char(a[i]);
+ }
+};
+
+template <> struct QConcatenable<const char *>
+{
+ typedef char const *type;
+ static int size(const char *a) { return qstrlen(a); }
+ static inline void appendTo(const char *a, QChar *&out)
+ {
+ while (*a)
+ *out++ = QLatin1Char(*a++);
+ }
+};
+#endif
+
template <typename A, typename B>
struct QConcatenable< QStringBuilder<A, B> >
{
diff --git a/src/corelib/tools/qunicodetables_p.h b/src/corelib/tools/qunicodetables_p.h
index e588313..5f696dd 100644
--- a/src/corelib/tools/qunicodetables_p.h
+++ b/src/corelib/tools/qunicodetables_p.h
@@ -178,7 +178,7 @@ namespace QUnicodeTables {
}
Q_CORE_EXPORT int QT_FASTCALL script(uint ucs4);
- Q_CORE_EXPORT_INLINE int QT_FASTCALL script(const QChar &ch) {
+ inline int script(const QChar &ch) {
return script(ch.unicode());
}
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index 7bdcba0..38254cd 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -94,7 +94,14 @@ template <typename T>
class QVector
{
typedef QVectorTypedData<T> Data;
- union { QVectorData *d; Data *p; };
+ union {
+ QVectorData *d;
+#if defined(Q_CC_SUN) && (__SUNPRO_CC <= 0x550)
+ QVectorTypedData<T> *p;
+#else
+ Data *p;
+#endif
+ };
public:
inline QVector() : d(&QVectorData::shared_null) { d->ref.ref(); }
diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp
index 5e1fec3..fddcecf 100644
--- a/src/corelib/xml/qxmlstream.cpp
+++ b/src/corelib/xml/qxmlstream.cpp
@@ -629,7 +629,7 @@ while (<STDIN>) {
$sizes[$i++] = $counter;
$counter += length 1 + $_;
}
-print " \"\\0\";\n\nstatic const int QXmlStreamReader_tokenTypeString_indices[] = {\n ";
+print " \"\\0\";\n\nstatic const short QXmlStreamReader_tokenTypeString_indices[] = {\n ";
for ($j = 0; $j < $i; ++$j) {
printf "$sizes[$j], ";
}
@@ -660,10 +660,9 @@ static const char QXmlStreamReader_tokenTypeString_string[] =
"Comment\0"
"DTD\0"
"EntityReference\0"
- "ProcessingInstruction\0"
- "\0";
+ "ProcessingInstruction\0";
-static const int QXmlStreamReader_tokenTypeString_indices[] = {
+static const short QXmlStreamReader_tokenTypeString_indices[] = {
0, 8, 16, 30, 42, 55, 66, 77, 85, 89, 105, 0
};
diff --git a/src/corelib/xml/qxmlstream_p.h b/src/corelib/xml/qxmlstream_p.h
index cf1d228..26509ff 100644
--- a/src/corelib/xml/qxmlstream_p.h
+++ b/src/corelib/xml/qxmlstream_p.h
@@ -127,27 +127,22 @@ public:
GOTO_CHECK_OFFSET = 1017
};
- static const char *const spell [];
- static const int lhs [];
- static const int rhs [];
- static const int goto_default [];
- static const int action_default [];
- static const int action_index [];
- static const int action_info [];
- static const int action_check [];
+ static const char *const spell [];
+ static const qint16 lhs [];
+ static const qint16 rhs [];
+ static const qint16 goto_default [];
+ static const qint16 action_default [];
+ static const qint16 action_index [];
+ static const qint16 action_info [];
+ static const qint16 action_check [];
static inline int nt_action (int state, int nt)
{
- const int *const goto_index = &action_index [GOTO_INDEX_OFFSET];
- const int *const goto_check = &action_check [GOTO_CHECK_OFFSET];
-
- const int yyn = goto_index [state] + nt;
-
- if (yyn < 0 || goto_check [yyn] != nt)
+ const int yyn = action_index [GOTO_INDEX_OFFSET + state] + nt;
+ if (yyn < 0 || action_check [GOTO_CHECK_OFFSET + yyn] != nt)
return goto_default [nt];
- const int *const goto_info = &action_info [GOTO_INFO_OFFSET];
- return goto_info [yyn];
+ return action_info [GOTO_INFO_OFFSET + yyn];
}
static inline int t_action (int state, int token)
@@ -170,7 +165,7 @@ const char *const QXmlStreamReader_Table::spell [] = {
"EMPTY", "ANY", "PCDATA", 0, 0, 0, 0, "CDATA", "ID", "IDREF",
"IDREFS", "ENTITIES", "NMTOKEN", "NMTOKENS", "<?xml", "version", 0};
-const int QXmlStreamReader_Table::lhs [] = {
+const qint16 QXmlStreamReader_Table::lhs [] = {
57, 57, 59, 59, 59, 59, 59, 59, 59, 59,
67, 68, 64, 72, 72, 72, 75, 66, 66, 66,
66, 79, 78, 80, 80, 80, 80, 80, 80, 81,
@@ -199,7 +194,7 @@ const int QXmlStreamReader_Table::lhs [] = {
58, 58, 58, 58, 58, 58, 58, 58, 74, 69,
69, 77, 111, 102, 102, 102, 102, 102, 140};
-const int QXmlStreamReader_Table:: rhs[] = {
+const qint16 QXmlStreamReader_Table:: rhs[] = {
2, 1, 4, 2, 2, 2, 2, 2, 2, 0,
1, 1, 9, 2, 4, 0, 4, 4, 6, 6,
4, 1, 3, 1, 1, 1, 2, 2, 2, 1,
@@ -228,7 +223,7 @@ const int QXmlStreamReader_Table:: rhs[] = {
2, 2, 2, 2, 2, 2, 2, 0, 1, 0,
1, 1, 1, 1, 1, 1, 1, 1, 2};
-const int QXmlStreamReader_Table::action_default [] = {
+const qint16 QXmlStreamReader_Table::action_default [] = {
10, 258, 0, 2, 1, 0, 124, 116, 118, 119,
126, 128, 122, 11, 113, 107, 0, 108, 127, 110,
114, 112, 120, 123, 125, 106, 109, 111, 117, 115,
@@ -273,7 +268,7 @@ const int QXmlStreamReader_Table::action_default [] = {
260, 0, 230, 0, 0, 13, 269, 9, 5, 8,
4, 0, 7, 258, 6, 0, 3};
-const int QXmlStreamReader_Table::goto_default [] = {
+const qint16 QXmlStreamReader_Table::goto_default [] = {
2, 4, 3, 49, 388, 43, 37, 52, 47, 41,
249, 53, 127, 84, 393, 81, 85, 126, 42, 46,
169, 130, 131, 146, 145, 149, 138, 136, 140, 147,
@@ -284,7 +279,7 @@ const int QXmlStreamReader_Table::goto_default [] = {
264, 252, 251, 250, 339, 326, 325, 329, 398, 399,
50, 51, 59, 0};
-const int QXmlStreamReader_Table::action_index [] = {
+const qint16 QXmlStreamReader_Table::action_index [] = {
-21, -57, 33, 119, 960, 70, -57, -57, -57, -57,
-57, -57, -57, -57, -57, -57, 105, -57, -57, -57,
-57, -57, -57, -57, -57, -57, -57, -57, -57, -57,
@@ -373,7 +368,7 @@ const int QXmlStreamReader_Table::action_index [] = {
28, 15, 82, -84, -84, -84, -84, -84, -84, -84,
-84, -84, -84, 3, -84, 98, -84};
-const int QXmlStreamReader_Table::action_info [] = {
+const qint16 QXmlStreamReader_Table::action_info [] = {
65, 332, 65, 405, 392, 385, 377, 65, 414, 410,
415, 55, 397, 374, 373, 217, 206, 408, 65, 65,
207, 211, 216, 1, 55, 199, 182, 192, 70, 70,
@@ -507,7 +502,7 @@ const int QXmlStreamReader_Table::action_info [] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0};
-const int QXmlStreamReader_Table::action_check [] = {
+const qint16 QXmlStreamReader_Table::action_check [] = {
26, 18, 26, 14, 4, 4, 4, 26, 24, 14,
4, 26, 4, 4, 4, 4, 22, 55, 26, 26,
42, 4, 4, 44, 26, 22, 19, 12, 2, 2,
diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h
index 764d368..db5e1bb 100644
--- a/src/dbus/qdbus_symbols_p.h
+++ b/src/dbus/qdbus_symbols_p.h
@@ -353,7 +353,7 @@ DEFINEFUNC(dbus_bool_t , dbus_signature_validate_single, (const char *
DBusError *error),
(signature, error), return)
DEFINEFUNC(dbus_bool_t , dbus_type_is_basic, (int typecode),
- (typecode), return);
+ (typecode), return)
DEFINEFUNC(dbus_bool_t , dbus_type_is_fixed, (int typecode),
(typecode), return)
diff --git a/src/dbus/qdbusmessage.cpp b/src/dbus/qdbusmessage.cpp
index 19f0b04..96dcd3b 100644
--- a/src/dbus/qdbusmessage.cpp
+++ b/src/dbus/qdbusmessage.cpp
@@ -161,7 +161,6 @@ DBusMessage *QDBusMessagePrivate::toDBusMessage(const QDBusMessage &message)
// not ok;
q_dbus_message_unref(msg);
- Q_ASSERT(false);
return 0;
}
diff --git a/src/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h
index 20d819f..f2ac598 100644
--- a/src/dbus/qdbusthreaddebug_p.h
+++ b/src/dbus/qdbusthreaddebug_p.h
@@ -100,7 +100,7 @@ enum ThreadAction {
RemoveWatchAction = 61,
ToggleWatchAction = 62,
SocketReadAction = 63,
- SocketWriteAction = 64,
+ SocketWriteAction = 64
};
struct QDBusLockerBase
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index b0878ab..bd8a9ec 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -394,7 +394,7 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
(QAccessibleFactoryInterface_iid, QLatin1String("/accessible")))
#endif
-Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories);
+Q_GLOBAL_STATIC(QList<QAccessible::InterfaceFactory>, qAccessibleFactories)
QAccessible::UpdateHandler QAccessible::updateHandler = 0;
QAccessible::RootObjectHandler QAccessible::rootObjectHandler = 0;
diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp
index 37ca6a1..bcffb85 100644
--- a/src/gui/animation/qguivariantanimation.cpp
+++ b/src/gui/animation/qguivariantanimation.cpp
@@ -65,7 +65,9 @@ Q_CONSTRUCTOR_FUNCTION(qRegisterGuiGetInterpolator)
static int qUnregisterGuiGetInterpolator()
{
- qRegisterAnimationInterpolator<QColor>(0);
+ qRegisterAnimationInterpolator<QColor>(
+ (QVariant (*)(const QColor &, const QColor &, qreal))0); // cast required by Sun CC 5.5
+
return 1;
}
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiGetInterpolator)
diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp
index 7e885da..dc7e3cc 100644
--- a/src/gui/dialogs/qcolordialog.cpp
+++ b/src/gui/dialogs/qcolordialog.cpp
@@ -1750,7 +1750,7 @@ void QColorDialog::setVisible(bool visible)
\overload
\since 4.5
- Opens the dialog and connects its accepted() signal to the slot specified
+ Opens the dialog and connects its colorSelected() signal to the slot specified
by \a receiver and \a member.
The signal will be disconnected from the slot when the dialog is closed.
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 76f0309..493cec5 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -638,8 +638,9 @@ QFileDialog::Options QFileDialog::options() const
\since 4.5
- Opens the dialog and connects its accepted() signal to the slot specified
- by \a receiver and \a member.
+ This function connects one of its signals to the slot specified by \a receiver
+ and \a member. The specific signal depends is filesSelected() if fileMode is
+ ExistingFiles and fileSelected() if fileMode is anything else.
The signal will be disconnected from the slot when the dialog is closed.
*/
diff --git a/src/gui/dialogs/qfontdialog.cpp b/src/gui/dialogs/qfontdialog.cpp
index c7484e7..3384132 100644
--- a/src/gui/dialogs/qfontdialog.cpp
+++ b/src/gui/dialogs/qfontdialog.cpp
@@ -940,7 +940,7 @@ bool QFontDialogPrivate::sharedFontPanelAvailable = true;
\since 4.5
\overload
- Opens the dialog and connects its accepted() signal to the slot specified
+ Opens the dialog and connects its fontSelected() signal to the slot specified
by \a receiver and \a member.
The signal will be disconnected from the slot when the dialog is closed.
diff --git a/src/gui/dialogs/qinputdialog.cpp b/src/gui/dialogs/qinputdialog.cpp
index 8608334..30f3151 100644
--- a/src/gui/dialogs/qinputdialog.cpp
+++ b/src/gui/dialogs/qinputdialog.cpp
@@ -1019,8 +1019,16 @@ QString QInputDialog::cancelButtonText() const
\since 4.5
\overload
- Opens the dialog and connects its accepted() signal to the slot specified
- by \a receiver and \a member.
+ This function connects one of its signals to the slot specified by \a receiver
+ and \a member. The specific signal depends on the arguments that are specified
+ in \a member. These are:
+
+ \list
+ \o textValueSelected() if \a member has a QString for its first argument.
+ \o intValueSelected() if \a member has an int for its first argument.
+ \o doubleValueSelected() if \a member has a double for its first argument.
+ \o accepted() if \a member has NO arguments.
+ \endlist
The signal will be disconnected from the slot when the dialog is closed.
*/
diff --git a/src/gui/embedded/qkbd_qws_p.h b/src/gui/embedded/qkbd_qws_p.h
index 3224da2..2ef1d0c 100644
--- a/src/gui/embedded/qkbd_qws_p.h
+++ b/src/gui/embedded/qkbd_qws_p.h
@@ -105,6 +105,7 @@ namespace QWSKeyboard {
};
};
+#ifndef QT_NO_DATASTREAM
inline QDataStream &operator>>(QDataStream &ds, QWSKeyboard::Mapping &m)
{
return ds >> m.keycode >> m.unicode >> m.qtcode >> m.modifiers >> m.flags >> m.special;
@@ -124,6 +125,6 @@ inline QDataStream &operator<<(QDataStream &ds, const QWSKeyboard::Composing &c)
{
return ds << c.first << c.second << c.result;
}
-
+#endif // QT_NO_DATASTREAM
#endif // QWSKEYBOARD_H
diff --git a/src/gui/embedded/qscreenproxy_qws.cpp b/src/gui/embedded/qscreenproxy_qws.cpp
index 5b8f6f0..7652bd9 100644
--- a/src/gui/embedded/qscreenproxy_qws.cpp
+++ b/src/gui/embedded/qscreenproxy_qws.cpp
@@ -279,6 +279,7 @@ void QProxyScreen::exposeRegion(QRegion r, int changing)
}
realScreen->exposeRegion(r, changing);
+ r &= realScreen->region();
const QVector<QRect> rects = r.rects();
for (int i = 0; i < rects.size(); ++i)
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 1fc4567..49c2329 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2924,11 +2924,13 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
d->allItemsIgnoreHoverEvents = false;
d->enableMouseTrackingOnViews();
}
+#ifndef QT_NO_CURSOR
if (d->allItemsUseDefaultCursor && item->hasCursor()) {
d->allItemsUseDefaultCursor = false;
if (d->allItemsIgnoreHoverEvents) // already enabled otherwise
d->enableMouseTrackingOnViews();
}
+#endif //QT_NO_CURSOR
// Update selection lists
if (item->isSelected())
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index c1c5631..0377ca7 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -4763,7 +4763,7 @@ QDataStream &operator>>(QDataStream &s, QImage &image)
image = QImageReader(s.device(), 0).read();
return s;
}
-#endif
+#endif // QT_NO_DATASTREAM
#ifdef QT3_SUPPORT
diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp
index 92023e0..23baa96 100644
--- a/src/gui/image/qpicture.cpp
+++ b/src/gui/image/qpicture.cpp
@@ -1143,6 +1143,7 @@ QPaintEngine *QPicture::paintEngine() const
QPicture stream functions
*****************************************************************************/
+#ifndef QT_NO_DATASTREAM
/*!
\relates QPicture
@@ -1188,6 +1189,7 @@ QDataStream &operator>>(QDataStream &s, QPicture &r)
r.d_func()->resetFormat();
return s;
}
+#endif // QT_NO_DATASTREAM
#ifndef QT_NO_PICTUREIO
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index fe86e8d..edfac71 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -184,8 +184,10 @@ private:
QPicture stream functions
*****************************************************************************/
+#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QPicture &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QPicture &);
+#endif
#endif // QT_NO_PICTURE
diff --git a/src/gui/image/qpicture_p.h b/src/gui/image/qpicture_p.h
index a3fd34f..3e8391f 100644
--- a/src/gui/image/qpicture_p.h
+++ b/src/gui/image/qpicture_p.h
@@ -69,7 +69,7 @@ class QPaintEngine;
extern const char *qt_mfhdr_tag;
-class Q_GUI_EXPORT QPicturePrivate
+class QPicturePrivate
{
Q_DECLARE_PUBLIC(QPicture)
friend class QPicturePaintEngine;
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index 8ed9e93..f6b5de2 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -1317,7 +1317,7 @@ QDataStream &operator>>(QDataStream &stream, QPixmap &pixmap)
return stream;
}
-#endif //QT_NO_DATASTREAM
+#endif // QT_NO_DATASTREAM
#ifdef QT3_SUPPORT
Q_GUI_EXPORT void copyBlt(QPixmap *dst, int dx, int dy,
diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp
index 82b42b4..bdcddfd 100644
--- a/src/gui/image/qpixmapcache.cpp
+++ b/src/gui/image/qpixmapcache.cpp
@@ -65,7 +65,10 @@ QT_BEGIN_NAMESPACE
object for caching the pixmaps.
The cache associates a pixmap with a string as a key or with a QPixmapCache::Key.
- The QPixmapCache::Key is faster than using strings as key.
+ The QPixmapCache::Key is faster than using strings as key. The string API is
+ very convenient for complex keys but the QPixmapCache::Key API will be very efficient
+ and convenient for a 1 object <-> 1 pixmap mapping (then you can store the key as
+ a member).
If two pixmaps are inserted into the cache using equal keys, then the
last pixmap will hide the first pixmap. The QHash and QCache classes do
exactly the same.
diff --git a/src/gui/image/qpixmapdatafactory.cpp b/src/gui/image/qpixmapdatafactory.cpp
index 699489d..bba7378 100644
--- a/src/gui/image/qpixmapdatafactory.cpp
+++ b/src/gui/image/qpixmapdatafactory.cpp
@@ -84,7 +84,7 @@ QPixmapData* QSimplePixmapDataFactory::create(QPixmapData::PixelType type)
#endif
}
-Q_GLOBAL_STATIC(QSimplePixmapDataFactory, factory);
+Q_GLOBAL_STATIC(QSimplePixmapDataFactory, factory)
#endif // !defined(Q_WS_QWS)
diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp
index ad93922..7ad825a 100644
--- a/src/gui/itemviews/qheaderview.cpp
+++ b/src/gui/itemviews/qheaderview.cpp
@@ -62,9 +62,11 @@
#ifndef QT_NO_DATASTREAM
#include <qdatastream.h>
+#endif
QT_BEGIN_NAMESPACE
+#ifndef QT_NO_DATASTREAM
QDataStream &operator<<(QDataStream &out, const QHeaderViewPrivate::SectionSpan &span)
{
span.write(out);
@@ -76,7 +78,7 @@ QDataStream &operator>>(QDataStream &in, QHeaderViewPrivate::SectionSpan &span)
span.read(in);
return in;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
@@ -1151,7 +1153,8 @@ void QHeaderView::setResizeMode(ResizeMode mode)
\overload
Sets the constraints on how the section specified by \a logicalIndex in
- the header can be resized to those described by the given \a mode.
+ the header can be resized to those described by the given \a mode. The logical
+ index should exist at the time this function is called.
\note This setting will be ignored for the last section if the stretchLastSection
property is set to true. This is the default for the horizontal headers provided
@@ -1535,7 +1538,7 @@ bool QHeaderView::restoreState(const QByteArray &state)
}
return false;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
\reimp
@@ -3571,9 +3574,9 @@ bool QHeaderViewPrivate::read(QDataStream &in)
return true;
}
-QT_END_NAMESPACE
+#endif // QT_NO_DATASTREAM
-#endif // QT_NO_DATASTREAEM
+QT_END_NAMESPACE
#endif // QT_NO_ITEMVIEWS
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 8b50d0e..03ba641 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1100,14 +1100,8 @@ void QListView::paintEvent(QPaintEvent *e)
QPainter painter(d->viewport);
QRect area = e->rect();
- QVector<QModelIndex> toBeRendered;
-// QVector<QRect> rects = e->region().rects();
-// for (int i = 0; i < rects.size(); ++i) {
-// d->intersectingSet(rects.at(i).translated(horizontalOffset(), verticalOffset()));
-// toBeRendered += d->intersectVector;
-// }
d->intersectingSet(e->rect().translated(horizontalOffset(), verticalOffset()), false);
- toBeRendered = d->intersectVector;
+ const QVector<QModelIndex> toBeRendered = d->intersectVector;
const QModelIndex current = currentIndex();
const QModelIndex hover = d->hover;
diff --git a/src/gui/itemviews/qlistview_p.h b/src/gui/itemviews/qlistview_p.h
index 4568d8c..6514496 100644
--- a/src/gui/itemviews/qlistview_p.h
+++ b/src/gui/itemviews/qlistview_p.h
@@ -84,7 +84,7 @@ public:
inline bool operator!=(const QListViewItem &other) const
{ return !(*this == other); }
inline bool isValid() const
- { return (x > -1) && (y > -1) && (w > 0) && (h > 0) && (indexHint > -1); }
+ { return rect().isValid() && (indexHint > -1); }
inline void invalidate()
{ x = -1; y = -1; w = 0; h = 0; }
inline void resize(const QSize &size)
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index bf3b43c..e1e509d 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -711,6 +711,7 @@ void QListWidgetItem::write(QDataStream &out) const
{
out << d->values;
}
+#endif // QT_NO_DATASTREAM
/*!
\since 4.1
@@ -745,6 +746,8 @@ QListWidgetItem &QListWidgetItem::operator=(const QListWidgetItem &other)
return *this;
}
+#ifndef QT_NO_DATASTREAM
+
/*!
\relates QListWidgetItem
diff --git a/src/gui/itemviews/qstandarditemmodel.cpp b/src/gui/itemviews/qstandarditemmodel.cpp
index 10aac9a..d8adbd2 100644
--- a/src/gui/itemviews/qstandarditemmodel.cpp
+++ b/src/gui/itemviews/qstandarditemmodel.cpp
@@ -1938,7 +1938,7 @@ QDataStream &operator<<(QDataStream &out, const QStandardItem &item)
return out;
}
-#endif // !QT_NO_DATASTREAM
+#endif // QT_NO_DATASTREAM
/*!
\class QStandardItemModel
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index e88301e..8cb2e55 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1662,10 +1662,9 @@ void QTableWidgetPrivate::_q_emitCurrentItemChanged(const QModelIndex &current,
void QTableWidgetPrivate::_q_sort()
{
- Q_Q(QTableWidget);
if (sortingEnabled) {
- int column = q->horizontalHeader()->sortIndicatorSection();
- Qt::SortOrder order = q->horizontalHeader()->sortIndicatorOrder();
+ int column = horizontalHeader->sortIndicatorSection();
+ Qt::SortOrder order = horizontalHeader->sortIndicatorOrder();
model()->sort(column, order);
}
}
@@ -1673,11 +1672,10 @@ void QTableWidgetPrivate::_q_sort()
void QTableWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight)
{
- Q_Q(QTableWidget);
if (sortingEnabled && topLeft.isValid() && bottomRight.isValid()) {
- int column = q->horizontalHeader()->sortIndicatorSection();
+ int column = horizontalHeader->sortIndicatorSection();
if (column >= topLeft.column() && column <= bottomRight.column()) {
- Qt::SortOrder order = q->horizontalHeader()->sortIndicatorOrder();
+ Qt::SortOrder order = horizontalHeader->sortIndicatorOrder();
model()->ensureSorted(column, order, topLeft.row(), bottomRight.row());
}
}
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 6103225..1c87580 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -577,7 +577,7 @@ void QTreeModel::sort(int column, Qt::SortOrder order)
if (column < 0 || column >= columnCount())
return;
- //layoutAboutToBeChanged and layoutChanged will be called by sortChildren
+ //layoutAboutToBeChanged and layoutChanged will be called by sortChildren
rootItem->sortChildren(column, order, true);
}
@@ -695,6 +695,29 @@ bool QTreeModel::itemGreaterThan(const QPair<QTreeWidgetItem*,int> &left,
}
/*!
+ \internal
+
+ Returns true if the type of the variant \a value
+ can be casted as double.
+*/
+bool QTreeModel::canConvertToDouble(const QVariant &value)
+{
+ switch (value.type()) {
+ case QVariant::Bool:
+ case QVariant::Int:
+ case QVariant::UInt:
+ case QVariant::LongLong:
+ case QVariant::ULongLong:
+ case QVariant::Double:
+ case QVariant::Char:
+ return true;
+ default:
+ return false;
+ }
+ return false;
+}
+
+/*!
\internal
*/
QList<QTreeWidgetItem*>::iterator QTreeModel::sortedInsertionIterator(
@@ -1787,7 +1810,11 @@ QVariant QTreeWidgetItem::data(int column, int role) const
bool QTreeWidgetItem::operator<(const QTreeWidgetItem &other) const
{
int column = view ? view->sortColumn() : 0;
- return text(column) < other.text(column);
+ const QVariant v1 = data(column, Qt::DisplayRole);
+ const QVariant v2 = other.data(column, Qt::DisplayRole);
+ if (QTreeModel::canConvertToDouble(v1) && QTreeModel::canConvertToDouble(v2))
+ return v1.toDouble() < v2.toDouble();
+ return v1.toString() < v2.toString();
}
#ifndef QT_NO_DATASTREAM
@@ -1827,6 +1854,7 @@ void QTreeWidgetItem::write(QDataStream &out) const
{
out << values << d->display;
}
+#endif // QT_NO_DATASTREAM
/*!
\since 4.1
@@ -1863,8 +1891,6 @@ QTreeWidgetItem &QTreeWidgetItem::operator=(const QTreeWidgetItem &other)
return *this;
}
-#endif // QT_NO_DATASTREAM
-
/*!
Appends the \a child item to the list of children.
@@ -2075,7 +2101,7 @@ void QTreeWidgetItemPrivate::sortChildren(int column, Qt::SortOrder order, bool
if (climb) {
QList<QTreeWidgetItem*>::iterator it = q->children.begin();
for (; it != q->children.end(); ++it) {
- //here we call the private object's method to avoid emitting
+ //here we call the private object's method to avoid emitting
//the layoutAboutToBeChanged and layoutChanged signals
(*it)->d->sortChildren(column, order, climb);
}
diff --git a/src/gui/itemviews/qtreewidget_p.h b/src/gui/itemviews/qtreewidget_p.h
index a089cf5..96f734d 100644
--- a/src/gui/itemviews/qtreewidget_p.h
+++ b/src/gui/itemviews/qtreewidget_p.h
@@ -116,6 +116,7 @@ public:
const QPair<QTreeWidgetItem*,int> &right);
static bool itemGreaterThan(const QPair<QTreeWidgetItem*,int> &left,
const QPair<QTreeWidgetItem*,int> &right);
+ static bool canConvertToDouble(const QVariant &value);
static QList<QTreeWidgetItem*>::iterator sortedInsertionIterator(
const QList<QTreeWidgetItem*>::iterator &begin,
const QList<QTreeWidgetItem*>::iterator &end,
diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp
index b2afbd0..051b6a6 100644
--- a/src/gui/kernel/qaction.cpp
+++ b/src/gui/kernel/qaction.cpp
@@ -76,7 +76,7 @@ static QString qt_strippedText(QString s)
s.remove(i-1,1);
}
return s.trimmed();
-};
+}
QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0),
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index a9424db..4923d23 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -405,7 +405,7 @@ QPalette *QApplicationPrivate::set_pal = 0; // default palette set by pro
QGraphicsSystem *QApplicationPrivate::graphics_system = 0; // default graphics system
QString QApplicationPrivate::graphics_system_name; // graphics system id - for delayed initialization
-Q_GLOBAL_STATIC(QMutex, applicationFontMutex);
+Q_GLOBAL_STATIC(QMutex, applicationFontMutex)
QFont *QApplicationPrivate::app_font = 0; // default application font
QFont *QApplicationPrivate::sys_font = 0; // default system font
QFont *QApplicationPrivate::set_font = 0; // default font set by programmer
@@ -838,9 +838,11 @@ void QApplicationPrivate::initialize()
// trigger registering of QVariant's GUI types
extern int qRegisterGuiVariant();
qRegisterGuiVariant();
+#ifndef QT_NO_STATEMACHINE
// trigger registering of QStateMachine's GUI types
extern int qRegisterGuiStateMachine();
qRegisterGuiStateMachine();
+#endif
is_app_running = true; // no longer starting up
@@ -1062,9 +1064,11 @@ QApplication::~QApplication()
QApplicationPrivate::fade_tooltip = false;
QApplicationPrivate::widgetCount = false;
+#ifndef QT_NO_STATEMACHINE
// trigger unregistering of QStateMachine's GUI types
extern int qUnregisterGuiStateMachine();
qUnregisterGuiStateMachine();
+#endif
// trigger unregistering of QVariant's GUI types
extern int qUnregisterGuiVariant();
qUnregisterGuiVariant();
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index d5fa9ea..6a592e4 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -154,6 +154,10 @@
#define kThemeBrushAlternatePrimaryHighlightColor -5
#endif
+#define kCMDeviceUnregisteredNotification CFSTR("CMDeviceUnregisteredNotification")
+#define kCMDefaultDeviceNotification CFSTR("CMDefaultDeviceNotification")
+#define kCMDeviceProfilesNotification CFSTR("CMDeviceProfilesNotification")
+#define kCMDefaultDeviceProfileNotification CFSTR("CMDefaultDeviceProfileNotification")
QT_BEGIN_NAMESPACE
@@ -1040,11 +1044,29 @@ void qt_release_app_proc_handler()
#endif
}
+void qt_color_profile_changed(CFNotificationCenterRef, void *, CFStringRef, const void *,
+ CFDictionaryRef)
+{
+ QCoreGraphicsPaintEngine::cleanUpMacColorSpaces();
+}
/* platform specific implementations */
void qt_init(QApplicationPrivate *priv, int)
{
if (qt_is_gui_used) {
CGDisplayRegisterReconfigurationCallback(qt_mac_display_change_callbk, 0);
+ CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();
+ CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
+ kCMDeviceUnregisteredNotification, 0,
+ CFNotificationSuspensionBehaviorDeliverImmediately);
+ CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
+ kCMDefaultDeviceNotification, 0,
+ CFNotificationSuspensionBehaviorDeliverImmediately);
+ CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
+ kCMDeviceProfilesNotification, 0,
+ CFNotificationSuspensionBehaviorDeliverImmediately);
+ CFNotificationCenterAddObserver(center, qApp, qt_color_profile_changed,
+ kCMDefaultDeviceProfileNotification, 0,
+ CFNotificationSuspensionBehaviorDeliverImmediately);
ProcessSerialNumber psn;
if (GetCurrentProcess(&psn) == noErr) {
// Jambi needs to transform itself since most people aren't "used"
@@ -1224,6 +1246,12 @@ void qt_release_apple_event_handler()
void qt_cleanup()
{
CGDisplayRemoveReconfigurationCallback(qt_mac_display_change_callbk, 0);
+ CFNotificationCenterRef center = CFNotificationCenterGetDistributedCenter();
+ CFNotificationCenterRemoveObserver(center, qApp, kCMDeviceUnregisteredNotification, 0);
+ CFNotificationCenterRemoveObserver(center, qApp, kCMDefaultDeviceNotification, 0);
+ CFNotificationCenterRemoveObserver(center, qApp, kCMDeviceProfilesNotification, 0);
+ CFNotificationCenterRemoveObserver(center, qApp, kCMDefaultDeviceProfileNotification, 0);
+
#ifndef QT_MAC_USE_COCOA
qt_release_app_proc_handler();
if (app_proc_handlerUPP) {
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 7e97784..b21eb36 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -625,6 +625,13 @@ static void qt_set_windows_font_resources()
static void qt_win_read_cleartype_settings()
{
+#ifdef Q_OS_WINCE
+ UINT result;
+ BOOL ok;
+ ok = SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &result, 0);
+ if (ok)
+ qt_cleartype_enabled = result;
+#else
QT_WA({
UINT result;
BOOL ok;
@@ -638,6 +645,7 @@ static void qt_win_read_cleartype_settings()
if (ok)
qt_cleartype_enabled = (result == FE_FONTSMOOTHINGCLEARTYPE);
});
+#endif
}
@@ -1408,6 +1416,7 @@ static bool qt_is_translatable_mouse_event(UINT message)
return (message >= WM_MOUSEFIRST && message <= WM_MOUSELAST ||
message >= WM_XBUTTONDOWN && message <= WM_XBUTTONDBLCLK)
&& message != WM_MOUSEWHEEL
+ && message != WM_MOUSEHWHEEL
#ifndef Q_WS_WINCE
|| message >= WM_NCMOUSEMOVE && message <= WM_NCMBUTTONDBLCLK
@@ -1758,6 +1767,7 @@ LRESULT CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam
break;
case WM_MOUSEWHEEL:
+ case WM_MOUSEHWHEEL:
result = widget->translateWheelEvent(msg);
break;
@@ -2657,6 +2667,7 @@ bool qt_try_modal(QWidget *widget, MSG *msg, int& ret)
#endif
if ((type >= WM_MOUSEFIRST && type <= WM_MOUSELAST) ||
type == WM_MOUSEWHEEL || type == (int)WM95_MOUSEWHEEL ||
+ type == WM_MOUSEHWHEEL ||
type == WM_MOUSELEAVE ||
(type >= WM_KEYFIRST && type <= WM_KEYLAST)
#ifndef Q_WS_WINCE
@@ -3268,12 +3279,12 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
state = translateButtonState(GET_KEYSTATE_WPARAM(msg.wParam), 0, 0);
int delta;
- if (msg.message == WM_MOUSEWHEEL)
+ if (msg.message == WM_MOUSEWHEEL || msg.message == WM_MOUSEHWHEEL)
delta = (short) HIWORD (msg.wParam);
else
delta = (int) msg.wParam;
- Qt::Orientation orient = (state&Qt::AltModifier
+ Qt::Orientation orient = (msg.message == WM_MOUSEHWHEEL || state&Qt::AltModifier
#if 0
// disabled for now - Trenton's one-wheel mouse makes trouble...
// "delta" for usual wheels is +-120. +-240 seems to indicate
@@ -3287,6 +3298,13 @@ bool QETWidget::translateWheelEvent(const MSG &msg)
#endif
) ? Qt::Horizontal : Qt::Vertical;
+ // according to the MSDN documentation on WM_MOUSEHWHEEL:
+ // a positive value indicates that the wheel was rotated to the right;
+ // a negative value indicates that the wheel was rotated to the left.
+ // Qt defines this value as the exact opposite, so we have to flip the value!
+ if (msg.message == WM_MOUSEHWHEEL)
+ delta = -delta;
+
QPoint globalPos;
globalPos.rx() = (short)LOWORD (msg.lParam);
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index 1473421..8ebea19 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -157,6 +157,8 @@ static const char * x11_atomnames = {
"WM_TAKE_FOCUS\0"
"_NET_WM_PING\0"
"_NET_WM_CONTEXT_HELP\0"
+ "_NET_WM_SYNC_REQUEST\0"
+ "_NET_WM_SYNC_REQUEST_COUNTER\0"
// ICCCM window state
"WM_STATE\0"
@@ -508,6 +510,7 @@ static Bool qt_xfixes_scanner(Display*, XEvent *event, XPointer arg)
class QETWidget : public QWidget // event translator widget
{
public:
+ QWidgetPrivate* d_func() { return QWidget::d_func(); }
bool translateMouseEvent(const XEvent *);
void translatePaintEvent(const XEvent *);
bool translateConfigEvent(const XEvent *);
@@ -718,6 +721,44 @@ static int qt_xio_errhandler(Display *)
}
#endif
+#ifndef QT_NO_XSYNC
+struct qt_sync_request_event_data
+{
+ WId window;
+};
+
+#if defined(Q_C_CALLBACKS)
+extern "C" {
+#endif
+
+static Bool qt_sync_request_scanner(Display*, XEvent *event, XPointer arg)
+{
+ qt_sync_request_event_data *data =
+ reinterpret_cast<qt_sync_request_event_data*>(arg);
+ if (event->type == ClientMessage &&
+ event->xany.window == data->window &&
+ event->xclient.message_type == ATOM(WM_PROTOCOLS) &&
+ (Atom)event->xclient.data.l[0] == ATOM(_NET_WM_SYNC_REQUEST)) {
+ QWidget *w = QWidget::find(event->xany.window);
+ if (QTLWExtra *tlw = ((QETWidget*)w)->d_func()->maybeTopData()) {
+ const ulong timestamp = (const ulong) event->xclient.data.l[1];
+ if (timestamp > X11->time)
+ X11->time = timestamp;
+ if (timestamp == CurrentTime || timestamp > tlw->syncRequestTimestamp) {
+ tlw->syncRequestTimestamp = timestamp;
+ tlw->newCounterValueLo = event->xclient.data.l[2];
+ tlw->newCounterValueHi = event->xclient.data.l[3];
+ }
+ }
+ return true;
+ }
+ return false;
+}
+
+#if defined(Q_C_CALLBACKS)
+}
+#endif
+#endif // QT_NO_XSYNC
static void qt_x11_create_intern_atoms()
{
@@ -2090,6 +2131,13 @@ void qt_init(QApplicationPrivate *priv, int,
#endif // QT_RUNTIME_XCURSOR
#endif // QT_NO_XCURSOR
+#ifndef QT_NO_XSYNC
+ int xsync_evbase, xsync_errbase;
+ int major, minor;
+ if (XSyncQueryExtension(X11->display, &xsync_evbase, &xsync_errbase))
+ XSyncInitialize(X11->display, &major, &minor);
+#endif // QT_NO_XSYNC
+
#ifndef QT_NO_XINERAMA
#ifdef QT_RUNTIME_XINERAMA
X11->ptrXineramaQueryExtension = 0;
@@ -3116,6 +3164,19 @@ int QApplication::x11ClientMessage(QWidget* w, XEvent* event, bool passive_only)
XSendEvent(event->xclient.display, event->xclient.window,
False, SubstructureNotifyMask|SubstructureRedirectMask, event);
}
+#ifndef QT_NO_XSYNC
+ } else if (a == ATOM(_NET_WM_SYNC_REQUEST)) {
+ const ulong timestamp = (const ulong) event->xclient.data.l[1];
+ if (timestamp > X11->time)
+ X11->time = timestamp;
+ if (QTLWExtra *tlw = w->d_func()->maybeTopData()) {
+ if (timestamp == CurrentTime || timestamp > tlw->syncRequestTimestamp) {
+ tlw->syncRequestTimestamp = timestamp;
+ tlw->newCounterValueLo = event->xclient.data.l[2];
+ tlw->newCounterValueHi = event->xclient.data.l[3];
+ }
+ }
+#endif
}
} else if (event->xclient.message_type == ATOM(_QT_SCROLL_DONE)) {
widget->translateScrollDoneEvent(event);
@@ -4144,7 +4205,9 @@ bool QETWidget::translateMouseEvent(const XEvent *event)
|| ((nextEvent.type == EnterNotify || nextEvent.type == LeaveNotify)
&& qt_button_down == this)
|| (nextEvent.type == ClientMessage
- && nextEvent.xclient.message_type == ATOM(_QT_SCROLL_DONE))) {
+ && (nextEvent.xclient.message_type == ATOM(_QT_SCROLL_DONE) ||
+ (nextEvent.xclient.message_type == ATOM(WM_PROTOCOLS) &&
+ (Atom)nextEvent.xclient.data.l[0] == ATOM(_NET_WM_SYNC_REQUEST))))) {
qApp->x11ProcessEvent(&nextEvent);
continue;
} else if (nextEvent.type != MotionNotify ||
@@ -5200,6 +5263,14 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
otherEvent.xconfigure.border_width;
}
}
+#ifndef QT_NO_XSYNC
+ qt_sync_request_event_data sync_event;
+ sync_event.window = internalWinId();
+ for (XEvent ev;;) {
+ if (!XCheckIfEvent(X11->display, &ev, &qt_sync_request_scanner, (XPointer)&sync_event))
+ break;
+ }
+#endif // QT_NO_XSYNC
}
QRect cr (geometry());
@@ -5285,6 +5356,20 @@ bool QETWidget::translateConfigEvent(const XEvent *event)
if (d->extra && d->extra->topextra)
d->extra->topextra->inTopLevelResize = false;
}
+#ifndef QT_NO_XSYNC
+ if (QTLWExtra *tlwExtra = d->maybeTopData()) {
+ if (tlwExtra->newCounterValueLo != 0 || tlwExtra->newCounterValueHi != 0) {
+ XSyncValue value;
+ XSyncIntsToValue(&value,
+ tlwExtra->newCounterValueLo,
+ tlwExtra->newCounterValueHi);
+
+ XSyncSetCounter(X11->display, tlwExtra->syncUpdateCounter, value);
+ tlwExtra->newCounterValueHi = 0;
+ tlwExtra->newCounterValueLo = 0;
+ }
+ }
+#endif
return true;
}
diff --git a/src/gui/kernel/qlayout.cpp b/src/gui/kernel/qlayout.cpp
index 4463aab..0a233d5 100644
--- a/src/gui/kernel/qlayout.cpp
+++ b/src/gui/kernel/qlayout.cpp
@@ -1583,8 +1583,6 @@ QDataStream &operator>>(QDataStream &stream, QSizePolicy &policy)
{
return stream >> policy.data;
}
-
-#endif
-
+#endif // QT_NO_DATASTREAM
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qpalette.cpp b/src/gui/kernel/qpalette.cpp
index 6541510..18a2142 100644
--- a/src/gui/kernel/qpalette.cpp
+++ b/src/gui/kernel/qpalette.cpp
@@ -125,7 +125,7 @@ QDataStream &operator>>(QDataStream &s, QColorGroup &g)
{
return qt_stream_in_qcolorgroup(s, g);
}
-#endif
+#endif // QT_NO_DATASTREAM
/*!
Constructs a palette with the specified \a active, \a disabled and
@@ -158,7 +158,7 @@ void QPalette::setColorGroup(ColorGroup cg, const QColorGroup &g)
g.brush(LinkVisited), g.brush(ToolTipBase), g.brush(ToolTipText));
}
-#endif
+#endif // QT3_SUPPORT
/*!
\fn const QColor &QPalette::color(ColorRole role) const
diff --git a/src/gui/kernel/qsizepolicy.h b/src/gui/kernel/qsizepolicy.h
index 652fda1..32b3b4f 100644
--- a/src/gui/kernel/qsizepolicy.h
+++ b/src/gui/kernel/qsizepolicy.h
@@ -203,9 +203,11 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QSizePolicy::ControlTypes)
+#ifndef QT_NO_DATASTREAM
// implemented in qlayout.cpp
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QSizePolicy &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QSizePolicy &);
+#endif
inline void QSizePolicy::transpose() {
Policy hData = horizontalPolicy();
diff --git a/src/gui/kernel/qt_x11_p.h b/src/gui/kernel/qt_x11_p.h
index b9ace9d..21bb550 100644
--- a/src/gui/kernel/qt_x11_p.h
+++ b/src/gui/kernel/qt_x11_p.h
@@ -154,6 +154,10 @@ extern "C" {
# include <X11/extensions/Xrender.h>
#endif // QT_NO_XRENDER
+#ifndef QT_NO_XSYNC
+# include "X11/extensions/sync.h"
+#endif
+
// #define QT_NO_XKB
#ifndef QT_NO_XKB
# include <X11/XKBlib.h>
@@ -514,6 +518,8 @@ struct QX11Data
WM_TAKE_FOCUS,
_NET_WM_PING,
_NET_WM_CONTEXT_HELP,
+ _NET_WM_SYNC_REQUEST,
+ _NET_WM_SYNC_REQUEST_COUNTER,
// ICCCM window state
WM_STATE,
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index d436ffb..6026821 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -5674,15 +5674,10 @@ void QWidget::setFocus(Qt::FocusReason reason)
w = w->isWindow() ? 0 : w->parentWidget();
}
} else {
- while (w && w->isVisible()) {
+ while (w) {
w->d_func()->focus_child = f;
w = w->isWindow() ? 0 : w->parentWidget();
}
- // a special case, if there is an invisible parent, notify him
- // about the focus_child widget, so that if it becomes
- // visible, the focus widget will be respected.
- if (w)
- w->d_func()->focus_child = f;
}
#ifndef QT_NO_GRAPHICSVIEW
@@ -5757,8 +5752,9 @@ void QWidget::setFocus(Qt::FocusReason reason)
void QWidget::clearFocus()
{
QWidget *w = this;
- while (w && w->d_func()->focus_child == this) {
- w->d_func()->focus_child = 0;
+ while (w) {
+ if (w->d_func()->focus_child == this)
+ w->d_func()->focus_child = 0;
w = w->parentWidget();
}
#ifndef QT_NO_GRAPHICSVIEW
@@ -6734,10 +6730,6 @@ void QWidgetPrivate::show_helper()
if (QApplicationPrivate::hidden_focus_widget == q) {
QApplicationPrivate::hidden_focus_widget = 0;
q->setFocus(Qt::OtherFocusReason);
- } else if (focus_child) {
- // if we are shown and there is an explicit focus child widget
- // set, respect it by giving him focus.
- focus_child->setFocus(Qt::OtherFocusReason);
}
// Process events when showing a Qt::SplashScreen widget before the event loop
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index f389bfd..f5a8c5f 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -1304,11 +1304,8 @@ OSStatus QWidgetPrivate::qt_widget_event(EventHandlerCallRef er, EventRef event,
if(part == kControlFocusNoPart){
if (widget->hasFocus())
QApplicationPrivate::setFocusWidget(0, Qt::OtherFocusReason);
- } else if (widget->focusPolicy() != Qt::NoFocus) {
+ } else
widget->setFocus();
- } else {
- handled_event = false;
- }
}
if(!HIObjectIsOfClass((HIObjectRef)hiview, kObjectQWidget))
CallNextEventHandler(er, event);
@@ -3593,11 +3590,15 @@ void QWidgetPrivate::raise_sys()
}
} else {
// Cocoa doesn't really have an idea of Z-ordering, but you can
- // fake it by changing the order of it.
+ // fake it by changing the order of it. But beware, removing an
+ // NSView will also remove it as the first responder. So we re-set
+ // the first responder just in case:
NSView *view = qt_mac_nativeview_for(q);
NSView *parentView = [view superview];
+ NSResponder *firstResponder = [[view window] firstResponder];
[view removeFromSuperview];
[parentView addSubview:view];
+ [[view window] makeFirstResponder:firstResponder];
}
#else
if(q->isWindow()) {
@@ -3635,6 +3636,7 @@ void QWidgetPrivate::lower_sys()
NSArray *tmpViews = [parentView subviews];
NSMutableArray *subviews = [[NSMutableArray alloc] initWithCapacity:[tmpViews count]];
[subviews addObjectsFromArray:tmpViews];
+ NSResponder *firstResponder = [[myview window] firstResponder];
// Implicit assumption that myViewIndex is included in subviews, that's why I'm not checking
// myViewIndex.
NSUInteger index = 0;
@@ -3654,6 +3656,7 @@ void QWidgetPrivate::lower_sys()
for (NSView *subview in subviews)
[parentView addSubview:subview];
[subviews release];
+ [[myview window] makeFirstResponder:firstResponder];
}
#else
if(q->isWindow()) {
diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h
index bf4f091..ff194f7 100644
--- a/src/gui/kernel/qwidget_p.h
+++ b/src/gui/kernel/qwidget_p.h
@@ -131,6 +131,10 @@ struct QTLWExtra {
uint embedded : 1;
// *************************** Platform specific values (bit fields first) **********
+#ifndef QT_NO_XSYNC
+ int newCounterValueHi : 32;
+ uint newCounterValueLo : 32;
+#endif
#if defined(Q_WS_X11) // <----------------------------------------------------------- X11
uint spont_unmapped: 1; // window was spontaneously unmapped
uint dnd : 1; // DND properties installed
@@ -156,6 +160,10 @@ struct QTLWExtra {
QWSManager *qwsManager;
#endif
#endif
+#ifndef QT_NO_XSYNC
+ WId syncUpdateCounter;
+ ulong syncRequestTimestamp;
+#endif
};
struct QWExtra {
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 0f341fd..ea79329 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -1845,7 +1845,8 @@ void QWidgetPrivate::setMask_sys(const QRegion &region)
OffsetRgn(wr, offset.x(), offset.y());
Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));
- SetWindowRgn(data.winid, wr, true);
+ if (!SetWindowRgn(data.winid, wr, true))
+ DeleteObject(wr);
}
void QWidgetPrivate::updateFrameStrut()
diff --git a/src/gui/kernel/qwidget_x11.cpp b/src/gui/kernel/qwidget_x11.cpp
index 4e34045..8159f8e 100644
--- a/src/gui/kernel/qwidget_x11.cpp
+++ b/src/gui/kernel/qwidget_x11.cpp
@@ -754,11 +754,14 @@ void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyO
qBound(1, data.crect.width(), XCOORD_MAX),
qBound(1, data.crect.height(), XCOORD_MAX));
XStoreName(dpy, id, appName.data());
- Atom protocols[4];
+ Atom protocols[5];
int n = 0;
protocols[n++] = ATOM(WM_DELETE_WINDOW); // support del window protocol
protocols[n++] = ATOM(WM_TAKE_FOCUS); // support take focus window protocol
protocols[n++] = ATOM(_NET_WM_PING); // support _NET_WM_PING protocol
+#ifndef QT_NO_XSYNC
+ protocols[n++] = ATOM(_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol
+#endif // QT_NO_XSYNC
if (flags & Qt::WindowContextHelpButtonHint)
protocols[n++] = ATOM(_NET_WM_CONTEXT_HELP);
XSetWMProtocols(dpy, id, protocols, n);
@@ -1877,6 +1880,23 @@ void QWidgetPrivate::show_sys()
if (setUserTime)
qt_net_update_user_time(q, userTime);
+#ifndef QT_NO_XSYNC
+ if (!topData()->syncUpdateCounter) {
+ XSyncValue value;
+ XSyncIntToValue(&value, 0);
+ topData()->syncUpdateCounter = XSyncCreateCounter(X11->display, value);
+
+ XChangeProperty(X11->display, q->internalWinId(),
+ ATOM(_NET_WM_SYNC_REQUEST_COUNTER),
+ XA_CARDINAL,
+ 32, PropModeReplace,
+ (uchar *) &topData()->syncUpdateCounter, 1);
+
+ topData()->newCounterValueHi = 0;
+ topData()->newCounterValueLo = 0;
+ }
+#endif
+
if (!topData()->embedded
&& (topData()->validWMState || topData()->waitingForMapNotify)
&& !q->isMinimized()) {
@@ -2687,6 +2707,12 @@ void QWidgetPrivate::createTLSysExtra()
extra->topextra->waitingForMapNotify = 0;
extra->topextra->parentWinId = 0;
extra->topextra->userTimeWindow = 0;
+#ifndef QT_NO_XSYNC
+ extra->topextra->syncUpdateCounter = 0;
+ extra->topextra->syncRequestTimestamp = 0;
+ extra->topextra->newCounterValueHi = 0;
+ extra->topextra->newCounterValueLo = 0;
+#endif
}
void QWidgetPrivate::deleteTLSysExtra()
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index b1fe3aa..fa833db 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -2116,9 +2116,7 @@ QDataStream &operator>>(QDataStream &stream, QColor &color)
return stream;
}
-#endif
-
-
+#endif // QT_NO_DATASTREAM
/*****************************************************************************
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index bbe1a76..0d1da54 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -7225,13 +7225,13 @@ inline void qt_rectfill_template(QRasterBuffer *rasterBuffer,
QT_RECTFILL(quint32)
QT_RECTFILL(quint16)
QT_RECTFILL(qargb8565)
-QT_RECTFILL(qrgb666);
-QT_RECTFILL(qargb6666);
+QT_RECTFILL(qrgb666)
+QT_RECTFILL(qargb6666)
QT_RECTFILL(qrgb555)
QT_RECTFILL(qargb8555)
QT_RECTFILL(qrgb888)
-QT_RECTFILL(qrgb444);
-QT_RECTFILL(qargb4444);
+QT_RECTFILL(qrgb444)
+QT_RECTFILL(qargb4444)
#undef QT_RECTFILL
diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h
index 2e49615..c89d97a 100644
--- a/src/gui/painting/qfixed_p.h
+++ b/src/gui/painting/qfixed_p.h
@@ -181,8 +181,10 @@ inline bool operator<(int i, const QFixed &f) { return (i<<6) < f.value(); }
inline bool operator>(const QFixed &f, int i) { return f.value() > (i<<6); }
inline bool operator>(int i, const QFixed &f) { return (i<<6) > f.value(); }
+#ifndef QT_NO_DEBUG_STREAM
inline QDebug &operator<<(QDebug &dbg, const QFixed &f)
{ return dbg << f.toReal(); }
+#endif
struct QFixedPoint {
QFixed x;
diff --git a/src/gui/painting/qmatrix.h b/src/gui/painting/qmatrix.h
index 1e5fbb4..1df2395 100644
--- a/src/gui/painting/qmatrix.h
+++ b/src/gui/painting/qmatrix.h
@@ -169,8 +169,10 @@ inline bool QMatrix::isIdentity() const
QMatrix stream functions
*****************************************************************************/
+#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QMatrix &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &);
+#endif
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &);
diff --git a/src/gui/painting/qpaintengine_mac_p.h b/src/gui/painting/qpaintengine_mac_p.h
index 298c145..9b85800 100644
--- a/src/gui/painting/qpaintengine_mac_p.h
+++ b/src/gui/painting/qpaintengine_mac_p.h
@@ -233,6 +233,8 @@ protected:
friend class QMacPrintEngine;
friend class QMacPrintEnginePrivate;
friend void qt_mac_display_change_callbk(CGDirectDisplayID, CGDisplayChangeSummaryFlags, void *);
+ friend void qt_color_profile_changed(CFNotificationCenterRef center, void *,
+ CFStringRef , const void *, CFDictionaryRef);
QCoreGraphicsPaintEngine(QPaintEnginePrivate &dptr);
private:
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 30c454c..0810bb9 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -1058,7 +1058,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
int d = x + iw - cx2;
iw -= d;
}
- if (iw < 0)
+ if (iw <= 0)
return;
// adapt the y paremeters...
@@ -1075,7 +1075,7 @@ void QRasterPaintEnginePrivate::drawImage(const QPointF &pt,
int d = y + ih - cy2;
ih -= d;
}
- if (ih < 0)
+ if (ih <= 0)
return;
// call the blend function...
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 9cc9683..2e6d593 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -1826,9 +1826,10 @@ Q_GUI_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const Q
const int h = rect.height();
QImage im;
- if ((QSysInfo::ByteOrder == QSysInfo::BigEndian
- && ((ImageByteOrder(X11->display) == LSBFirst) || bgr_layout))
- || (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian))
+ int image_byte_order = ImageByteOrder(X11->display);
+ if ((QSysInfo::ByteOrder == QSysInfo::BigEndian && ((image_byte_order == LSBFirst) || bgr_layout))
+ || (image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)
+ || (image_byte_order == LSBFirst && bgr_layout))
{
im = image.copy(rect);
const int iw = im.bytesPerLine() / 4;
@@ -1836,19 +1837,21 @@ Q_GUI_EXPORT void qt_x11_drawImage(const QRect &rect, const QPoint &pos, const Q
for (int i=0; i < h; i++) {
uint *p = data;
uint *end = p + w;
- if (bgr_layout && ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
+ if (bgr_layout && image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
while (p < end) {
*p = ((*p << 8) & 0xffffff00) | ((*p >> 24) & 0x000000ff);
p++;
}
- } else if ((ImageByteOrder(X11->display) == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)
- || (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
+ } else if ((image_byte_order == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ || (image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
while (p < end) {
*p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000)
| ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff);
p++;
}
- } else if (ImageByteOrder(X11->display) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) {
+ } else if ((image_byte_order == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)
+ || (image_byte_order == LSBFirst && bgr_layout))
+ {
while (p < end) {
*p = ((*p << 16) & 0x00ff0000) | ((*p >> 16) & 0x000000ff)
| ((*p ) & 0xff00ff00);
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 28f9220..3cf5ff9 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -138,6 +138,76 @@ QPaintEngineExPrivate::~QPaintEngineExPrivate()
}
+void QPaintEngineExPrivate::replayClipOperations()
+{
+ Q_Q(QPaintEngineEx);
+
+ QPainter *p = q->painter();
+ if (!p || !p->d_ptr)
+ return;
+
+ QPainterPrivate *pp = p->d_ptr;
+ QList<QPainterClipInfo> clipInfo = pp->state->clipInfo;
+
+ QTransform transform = q->state()->matrix;
+
+ QTransform redirection;
+ redirection.translate(-q->state()->redirection_offset.x(), -q->state()->redirection_offset.y());
+
+ for (int i = 0; i < clipInfo.size(); ++i) {
+ const QPainterClipInfo &info = clipInfo.at(i);
+
+ QTransform combined = info.matrix * redirection;
+
+ if (combined != q->state()->matrix) {
+ q->state()->matrix = combined;
+ q->transformChanged();
+ }
+
+ switch (info.clipType) {
+ case QPainterClipInfo::RegionClip:
+ q->clip(info.region, info.operation);
+ break;
+ case QPainterClipInfo::PathClip:
+ q->clip(info.path, info.operation);
+ break;
+ case QPainterClipInfo::RectClip:
+ q->clip(info.rect, info.operation);
+ break;
+ case QPainterClipInfo::RectFClip: {
+ qreal right = info.rectf.x() + info.rectf.width();
+ qreal bottom = info.rectf.y() + info.rectf.height();
+ qreal pts[] = { info.rectf.x(), info.rectf.y(),
+ right, info.rectf.y(),
+ right, bottom,
+ info.rectf.x(), bottom };
+ QVectorPath vp(pts, 4, 0, QVectorPath::RectangleHint);
+ q->clip(vp, info.operation);
+ break;
+ }
+ }
+ }
+
+ if (transform != q->state()->matrix) {
+ q->state()->matrix = transform;
+ q->transformChanged();
+ }
+}
+
+
+bool QPaintEngineExPrivate::hasClipOperations() const
+{
+ Q_Q(const QPaintEngineEx);
+
+ QPainter *p = q->painter();
+ if (!p || !p->d_ptr)
+ return false;
+
+ QPainterPrivate *pp = p->d_ptr;
+ QList<QPainterClipInfo> clipInfo = pp->state->clipInfo;
+
+ return !clipInfo.isEmpty();
+}
/*******************************************************************************
*
@@ -244,13 +314,18 @@ static void qpaintengineex_cubicTo(qreal c1x, qreal c1y, qreal c2x, qreal c2y, q
((StrokeHandler *) data)->types.add(QPainterPath::CurveToDataElement);
}
+QPaintEngineEx::QPaintEngineEx()
+ : QPaintEngine(*new QPaintEngineExPrivate, AllFeatures)
+{
+ extended = true;
+}
+
QPaintEngineEx::QPaintEngineEx(QPaintEngineExPrivate &data)
: QPaintEngine(data, AllFeatures)
{
extended = true;
}
-
QPainterState *QPaintEngineEx::createState(QPainterState *orig) const
{
if (!orig)
@@ -483,6 +558,9 @@ void QPaintEngineEx::clip(const QRect &r, Qt::ClipOperation op)
void QPaintEngineEx::clip(const QRegion &region, Qt::ClipOperation op)
{
+ if (region.numRects() == 1)
+ clip(region.boundingRect(), op);
+
QVector<QRect> rects = region.rects();
if (rects.size() <= 32) {
qreal pts[2*32*4];
diff --git a/src/gui/painting/qpaintengineex_p.h b/src/gui/painting/qpaintengineex_p.h
index 1c55242..3f64260 100644
--- a/src/gui/painting/qpaintengineex_p.h
+++ b/src/gui/painting/qpaintengineex_p.h
@@ -139,27 +139,13 @@ public:
QDebug Q_GUI_EXPORT &operator<<(QDebug &, const QVectorPath &path);
#endif
-class Q_GUI_EXPORT QPaintEngineExPrivate : public QPaintEnginePrivate
-{
-public:
- QPaintEngineExPrivate();
- ~QPaintEngineExPrivate();
-
- QStroker stroker;
- QDashStroker dasher;
- StrokeHandler *strokeHandler;
- QStrokerOps *activeStroker;
- QPen strokerPen;
-};
-
class QPixmapFilter;
class Q_GUI_EXPORT QPaintEngineEx : public QPaintEngine
{
Q_DECLARE_PRIVATE(QPaintEngineEx)
public:
- inline QPaintEngineEx()
- : QPaintEngine(*new QPaintEngineExPrivate, AllFeatures) { extended = true; }
+ QPaintEngineEx();
virtual QPainterState *createState(QPainterState *orig) const;
@@ -224,6 +210,22 @@ protected:
QPaintEngineEx(QPaintEngineExPrivate &data);
};
+class Q_GUI_EXPORT QPaintEngineExPrivate : public QPaintEnginePrivate
+{
+ Q_DECLARE_PUBLIC(QPaintEngineEx)
+public:
+ QPaintEngineExPrivate();
+ ~QPaintEngineExPrivate();
+
+ void replayClipOperations();
+ bool hasClipOperations() const;
+
+ QStroker stroker;
+ QDashStroker dasher;
+ StrokeHandler *strokeHandler;
+ QStrokerOps *activeStroker;
+ QPen strokerPen;
+};
inline uint QVectorPath::polygonFlags(QPaintEngine::PolygonDrawMode mode) {
switch (mode) {
diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h
index f3df7a3..78cd713 100644
--- a/src/gui/painting/qpainter.h
+++ b/src/gui/painting/qpainter.h
@@ -507,6 +507,7 @@ private:
friend class QFontEngineXLFD;
friend class QWSManager;
friend class QPaintEngine;
+ friend class QPaintEngineExPrivate;
friend class QOpenGLPaintEngine;
friend class QX11PaintEngine;
friend class QX11PaintEnginePrivate;
diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h
index 258b25a..6c8821a 100644
--- a/src/gui/painting/qpainter_p.h
+++ b/src/gui/painting/qpainter_p.h
@@ -92,8 +92,8 @@ inline Qt::PenJoinStyle qpen_joinStyle(const QPen &p) { return data_ptr(p)->join
// QBrush inline functions...
inline QBrush::DataPtr &data_ptr(const QBrush &p) { return const_cast<QBrush &>(p).data_ptr(); }
inline bool qbrush_fast_equals(const QBrush &a, const QBrush &b) { return data_ptr(a) == data_ptr(b); }
-inline Qt::BrushStyle qbrush_style(const QBrush &b) { return data_ptr(b)->style; };
-inline const QColor &qbrush_color(const QBrush &b) { return data_ptr(b)->color; };
+inline Qt::BrushStyle qbrush_style(const QBrush &b) { return data_ptr(b)->style; }
+inline const QColor &qbrush_color(const QBrush &b) { return data_ptr(b)->color; }
inline bool qbrush_has_transform(const QBrush &b) { return data_ptr(b)->transform.type() > QTransform::TxNone; }
class QPainterClipInfo
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index bd91dfc..e1bb317 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -2366,7 +2366,7 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p)
p.d_func()->dirtyControlBounds = true;
return s;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*******************************************************************************
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index 1d45ca1..7d92c0c 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -158,7 +158,7 @@ namespace QPdf {
QByteArray stripSpecialCharacters(const QByteArray &string);
-};
+}
class QPdfPage : public QPdf::ByteStream
diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp
index 769c095..b79c288 100644
--- a/src/gui/painting/qpolygon.cpp
+++ b/src/gui/painting/qpolygon.cpp
@@ -742,7 +742,7 @@ QDataStream &operator>>(QDataStream &s, QPolygon &a)
QVector<QPoint> &v = a;
return s >> v;
}
-#endif
+#endif // QT_NO_DATASTREAM
/*****************************************************************************
QPolygonF stream functions
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index cb5be75..689c091 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -121,7 +121,7 @@ protected:
};
-class Q_GUI_EXPORT QImageTextureGlyphCache : public QTextureGlyphCache
+class QImageTextureGlyphCache : public QTextureGlyphCache
{
public:
QImageTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index aac7c31..a5002ca 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -332,8 +332,10 @@ inline QTransform &QTransform::operator-=(qreal num)
}
/****** stream functions *******************/
+#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTransform &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTransform &);
+#endif
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug, const QTransform &);
diff --git a/src/gui/painting/qvectorpath_p.h b/src/gui/painting/qvectorpath_p.h
index 2713cda..2602a3d 100644
--- a/src/gui/painting/qvectorpath_p.h
+++ b/src/gui/painting/qvectorpath_p.h
@@ -94,7 +94,7 @@ public:
// Shape rendering specifiers...
OddEvenFill = 0x1000,
WindingFill = 0x2000,
- ImplicitClose = 0x4000,
+ ImplicitClose = 0x4000
};
// ### Falcon: introduca a struct XY for points so lars is not so confused...
diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp
index 3e7b015..6d0d155 100644
--- a/src/gui/painting/qwindowsurface_raster.cpp
+++ b/src/gui/painting/qwindowsurface_raster.cpp
@@ -229,7 +229,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi
{
const QImage &src = d->image->image;
br = br.intersected(src.rect());
- if (src.format() != QImage::Format_RGB32) {
+ if (src.format() != QImage::Format_RGB32 || widget->x11Info().depth() < 24) {
QX11PixmapData *data = new QX11PixmapData(QPixmapData::PixmapType);
data->xinfo = widget->x11Info();
data->fromImage(src, Qt::AutoColor);
diff --git a/src/gui/statemachine/qbasickeyeventtransition.cpp b/src/gui/statemachine/qbasickeyeventtransition.cpp
index f7f1eb6..61362b2 100644
--- a/src/gui/statemachine/qbasickeyeventtransition.cpp
+++ b/src/gui/statemachine/qbasickeyeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qbasickeyeventtransition_p.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
#include <qdebug.h>
#include <private/qabstracttransition_p.h>
@@ -201,3 +204,5 @@ void QBasicKeyEventTransition::onTransition(QEvent *)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qbasickeyeventtransition_p.h b/src/gui/statemachine/qbasickeyeventtransition_p.h
index 39fa6ad..aef1f99 100644
--- a/src/gui/statemachine/qbasickeyeventtransition_p.h
+++ b/src/gui/statemachine/qbasickeyeventtransition_p.h
@@ -54,6 +54,9 @@
//
#include <QtCore/qabstracttransition.h>
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
QT_BEGIN_NAMESPACE
@@ -90,4 +93,6 @@ private:
QT_END_NAMESPACE
+#endif //QT_NO_STATEMACHINE
+
#endif
diff --git a/src/gui/statemachine/qbasicmouseeventtransition.cpp b/src/gui/statemachine/qbasicmouseeventtransition.cpp
index 20dd792..0304e28 100644
--- a/src/gui/statemachine/qbasicmouseeventtransition.cpp
+++ b/src/gui/statemachine/qbasicmouseeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qbasicmouseeventtransition_p.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
#include <QtGui/qpainterpath.h>
#include <qdebug.h>
@@ -206,3 +209,5 @@ void QBasicMouseEventTransition::onTransition(QEvent *)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qbasicmouseeventtransition_p.h b/src/gui/statemachine/qbasicmouseeventtransition_p.h
index 6c0afe4..ed0022a 100644
--- a/src/gui/statemachine/qbasicmouseeventtransition_p.h
+++ b/src/gui/statemachine/qbasicmouseeventtransition_p.h
@@ -54,6 +54,9 @@
//
#include <QtCore/qabstracttransition.h>
+
+#ifndef QT_NO_STATEMACHINE
+
#include <QtGui/qevent.h>
QT_BEGIN_NAMESPACE
@@ -93,6 +96,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
+#endif //QT_NO_STATEMACHINE
#endif
diff --git a/src/gui/statemachine/qguistatemachine.cpp b/src/gui/statemachine/qguistatemachine.cpp
index 612e43e..69155a9 100644
--- a/src/gui/statemachine/qguistatemachine.cpp
+++ b/src/gui/statemachine/qguistatemachine.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include <QtCore/qstatemachine.h>
+
+#ifndef QT_NO_STATEMACHINE
+
#include <private/qstatemachine_p.h>
#include <QtGui/qevent.h>
#include <QtGui/qgraphicssceneevent.h>
@@ -557,3 +560,5 @@ int qUnregisterGuiStateMachine()
Q_DESTRUCTOR_FUNCTION(qUnregisterGuiStateMachine)
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qkeyeventtransition.cpp b/src/gui/statemachine/qkeyeventtransition.cpp
index f803711..fee9f81 100644
--- a/src/gui/statemachine/qkeyeventtransition.cpp
+++ b/src/gui/statemachine/qkeyeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qkeyeventtransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qbasickeyeventtransition_p.h"
#include <QtCore/qwrappedevent.h>
#include <private/qeventtransition_p.h>
@@ -184,3 +187,5 @@ void QKeyEventTransition::onTransition(QEvent *event)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qkeyeventtransition.h b/src/gui/statemachine/qkeyeventtransition.h
index d9c7760..c9e06f5 100644
--- a/src/gui/statemachine/qkeyeventtransition.h
+++ b/src/gui/statemachine/qkeyeventtransition.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+#ifndef QT_NO_STATEMACHINE
+
class QKeyEventTransitionPrivate;
class Q_GUI_EXPORT QKeyEventTransition : public QEventTransition
{
@@ -80,6 +82,8 @@ private:
Q_DECLARE_PRIVATE(QKeyEventTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/statemachine/qmouseeventtransition.cpp b/src/gui/statemachine/qmouseeventtransition.cpp
index e4e18eb..6ae3d36 100644
--- a/src/gui/statemachine/qmouseeventtransition.cpp
+++ b/src/gui/statemachine/qmouseeventtransition.cpp
@@ -40,6 +40,9 @@
****************************************************************************/
#include "qmouseeventtransition.h"
+
+#ifndef QT_NO_STATEMACHINE
+
#include "qbasicmouseeventtransition_p.h"
#include <QtCore/qwrappedevent.h>
#include <QtGui/qpainterpath.h>
@@ -214,3 +217,5 @@ void QMouseEventTransition::onTransition(QEvent *event)
}
QT_END_NAMESPACE
+
+#endif //QT_NO_STATEMACHINE
diff --git a/src/gui/statemachine/qmouseeventtransition.h b/src/gui/statemachine/qmouseeventtransition.h
index 9c7af5b..557b2c3 100644
--- a/src/gui/statemachine/qmouseeventtransition.h
+++ b/src/gui/statemachine/qmouseeventtransition.h
@@ -50,6 +50,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
+#ifndef QT_NO_STATEMACHINE
+
class QMouseEventTransitionPrivate;
class QPainterPath;
class Q_GUI_EXPORT QMouseEventTransition : public QEventTransition
@@ -85,6 +87,8 @@ private:
Q_DECLARE_PRIVATE(QMouseEventTransition)
};
+#endif //QT_NO_STATEMACHINE
+
QT_END_NAMESPACE
QT_END_HEADER
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index 5c37794..805cd05 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -1664,7 +1664,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
}
painter->fillRect(r, gradient);
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(r.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, r.width(), r.height());
@@ -1683,8 +1683,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
cachePainter.drawLine(pixmapRect.topRight() + QPoint(-1, 3), pixmapRect.bottomRight() + QPoint(-1, -3)); cachePainter.setPen(QPen(option->palette.light().color()));
cachePainter.drawLine(pixmapRect.topRight() + QPoint(0, 3), pixmapRect.bottomRight() + QPoint(0, -3)); }
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(r.topLeft(), cache);
}
@@ -2438,7 +2437,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
QPixmap cache;
QString pixmapName = QStyleHelper::uniqueName(QLatin1String("spinbox"), spinBox, spinBox->rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(spinBox->rect.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height());
@@ -2655,8 +2654,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
cachePainter.fillRect(downRect.adjusted(1, 0, 0, 0), disabledColor);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(spinBox->rect.topLeft(), cache);
}
@@ -3187,7 +3185,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
if (isEnabled)
pixmapName += QLatin1String("-enabled");
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(comboBox->rect.size());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
@@ -3307,15 +3305,15 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
}
}
// Draw the focus rect
- if ((focus && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) {
+ if (focus && !comboBox->editable
+ && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) {
QStyleOptionFocusRect focus;
focus.rect = subControlRect(CC_ComboBox, &comboBoxCopy, SC_ComboBoxEditField, widget)
.adjusted(0, 2, option->direction == Qt::RightToLeft ? 1 : -1, -2);
drawPrimitive(PE_FrameFocusRect, &focus, &cachePainter, widget);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(comboBox->rect.topLeft(), cache);
}
@@ -3406,7 +3404,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
QRect pixmapRect(0, 0, groove.width(), groove.height());
// draw background groove
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(pixmapRect.size());
cache.fill(Qt::transparent);
QPainter groovePainter(&cache);
@@ -3433,15 +3431,14 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
groovePainter.setBrush(gradient);
groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
painter->drawPixmap(groove.topLeft(), cache);
// draw blue groove highlight
QRect clipRect;
groovePixmapName += QLatin1String("_blue");
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(pixmapRect.size());
cache.fill(Qt::transparent);
QPainter groovePainter(&cache);
@@ -3460,8 +3457,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
groovePainter.setBrush(gradient);
groovePainter.drawRect(pixmapRect.adjusted(1, 1, -2, -2));
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
if (horizontal) {
if (slider->upsideDown)
@@ -3483,7 +3479,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
// draw handle
if ((option->subControls & SC_SliderHandle) ) {
QString handlePixmapName = QStyleHelper::uniqueName(QLatin1String("slider_handle"), option, handle.size());
- if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
+ if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
cache.fill(Qt::transparent);
QRect pixmapRect(0, 0, handle.width(), handle.height());
@@ -3564,8 +3560,7 @@ void QCleanlooksStyle::drawComplexControl(ComplexControl control, const QStyleOp
}
}
handlePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(handlePixmapName, cache);
+ QPixmapCache::insert(handlePixmapName, cache);
}
painter->drawPixmap(handle.topLeft(), cache);
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index 151dab0..ab81d97 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -176,7 +176,6 @@ public:
static const int groupBoxBottomMargin = 2; // space below the groupbox
static const int groupBoxTitleMargin = 6; // space between contents and title
static const int groupBoxTopMargin = 2;
-static bool UsePixmapCache = true;
// Get size of the arrow controls in a GtkSpinButton
static int spinboxArrowSize()
@@ -1427,7 +1426,7 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom
QGtk::gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL);
int xt = interiorFocus ? gtkToggleButton->style->xthickness : 0;
int yt = interiorFocus ? gtkToggleButton->style->ythickness : 0;
- if ((focus && (option->state & State_KeyboardFocusChange)))
+ if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget)))
gtkCachedPainter.paintFocus(gtkToggleButton, "button",
option->rect.adjusted(xt, yt, -xt, -yt),
option->state & State_Sunken ? GTK_STATE_ACTIVE : GTK_STATE_NORMAL,
diff --git a/src/gui/styles/qmacstyle_mac.mm b/src/gui/styles/qmacstyle_mac.mm
index 43efedf..99894ad 100644
--- a/src/gui/styles/qmacstyle_mac.mm
+++ b/src/gui/styles/qmacstyle_mac.mm
@@ -4339,7 +4339,19 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter
tdi.enableState = kThemeTrackDisabled;
else
tdi.enableState = kThemeTrackActive;
- HIThemeDrawTrack(&tdi, 0, cg, kHIThemeOrientationNormal);
+ HIThemeOrientation drawOrientation = kHIThemeOrientationNormal;
+ if (reverse) {
+ if (vertical) {
+ drawOrientation = kHIThemeOrientationInverted;
+ } else {
+ CGContextSaveGState(cg);
+ CGContextTranslateCTM(cg, pb->rect.width(), 0);
+ CGContextScaleCTM(cg, -1, 1);
+ }
+ }
+ HIThemeDrawTrack(&tdi, 0, cg, drawOrientation);
+ if (reverse && !vertical)
+ CGContextRestoreGState(cg);
}
break;
case CE_ProgressBarLabel:
diff --git a/src/gui/styles/qmotifstyle.cpp b/src/gui/styles/qmotifstyle.cpp
index be0e3eb..d6b8a7a 100644
--- a/src/gui/styles/qmotifstyle.cpp
+++ b/src/gui/styles/qmotifstyle.cpp
@@ -298,8 +298,11 @@ void QMotifStyle::unpolish(QWidget* widget)
{
QCommonStyle::unpolish(widget);
#ifndef QT_NO_PROGRESSBAR
- if (qobject_cast<QProgressBar *>(widget))
+ if (qobject_cast<QProgressBar *>(widget)) {
+ Q_D(QMotifStyle);
widget->removeEventFilter(this);
+ d->bars.removeAll(static_cast<QProgressBar*>(widget));
+ }
#endif
}
diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp
index 91ad64e..0a56213 100644
--- a/src/gui/styles/qplastiquestyle.cpp
+++ b/src/gui/styles/qplastiquestyle.cpp
@@ -43,7 +43,6 @@
#if !defined(QT_NO_STYLE_PLASTIQUE) || defined(QT_PLUGIN)
-static bool UsePixmapCache = true;
static const bool AnimateBusyProgressBar = true;
static const bool AnimateProgressBar = false;
// #define QPlastique_MaskButtons
@@ -491,7 +490,7 @@ static void qBrushSetAlphaF(QBrush *brush, qreal alpha)
QPixmap texture = brush->texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-alpha-%1-%2").arg(alpha).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -552,7 +551,7 @@ static QBrush qBrushLight(QBrush brush, int light)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-light-%1-%2").arg(light).arg(texture.cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -611,7 +610,7 @@ static QBrush qBrushDark(QBrush brush, int dark)
QPixmap texture = brush.texture();
QPixmap pixmap;
QString name = QString::fromLatin1("qbrushtexture-dark-%1-%2").arg(dark).arg(brush.texture().cacheKey());
- if (UsePixmapCache && !QPixmapCache::find(name, pixmap)) {
+ if (!QPixmapCache::find(name, pixmap)) {
QImage image = texture.toImage();
QRgb *rgb = reinterpret_cast<QRgb *>(image.bits());
int pixels = image.width() * image.height();
@@ -750,8 +749,7 @@ static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, con
QPainter *p = painter;
QRect r = rect;
- bool doPixmapCache = UsePixmapCache
- && painter->deviceTransform().isIdentity()
+ bool doPixmapCache = painter->deviceTransform().isIdentity()
&& painter->worldMatrix().isIdentity();
if (doPixmapCache && QPixmapCache::find(gradientName, cache)) {
painter->drawPixmap(rect, cache);
@@ -1006,8 +1004,6 @@ QPlastiqueStylePrivate::QPlastiqueStylePrivate() :
, progressBarAnimateTimer(0)
#endif
{
- if (!qgetenv("QT_STYLE_NO_PIXMAPCACHE").isNull())
- UsePixmapCache = false;
}
/*!
@@ -1517,7 +1513,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
}
#endif
QString pixmapName = uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(rect.size());
cache.fill(Qt::transparent);
QPainter cachePainter(&cache);
@@ -1547,8 +1543,7 @@ void QPlastiqueStyle::drawPrimitive(PrimitiveElement element, const QStyleOption
handle);
}
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(rect.topLeft(), cache);
break;
@@ -2786,7 +2781,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString progressBarName = uniqueName(QLatin1String("progressBarContents"),
option, rect.size());
QPixmap cache;
- if ((!UsePixmapCache || !QPixmapCache::find(progressBarName, cache)) && rect.height() > 7) {
+ if (!QPixmapCache::find(progressBarName, cache) && rect.height() > 7) {
QSize size = rect.size();
cache = QPixmap(QSize(size.width() - 6 + 30, size.height() - 6));
cache.fill(Qt::white);
@@ -2819,8 +2814,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
leftEdge += 10;
}
- if (UsePixmapCache)
- QPixmapCache::insert(progressBarName, cache);
+ QPixmapCache::insert(progressBarName, cache);
}
painter->setClipRect(progressBar.adjusted(1, 0, -1, -1));
@@ -2848,7 +2842,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
pixmapName += QString::number(- int(header->position));
pixmapName += QString::number(- int(header->orientation));
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -2892,8 +2886,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
@@ -3093,7 +3086,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
if ((option->state & State_Selected)) {
QPixmap cache;
QString pixmapName = uniqueName(QLatin1String("menubaritem"), option, option->rect.size());
- if (!UsePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
+ if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, option->rect.width(), option->rect.height());
@@ -3143,8 +3136,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
lines[1] = QLine(rect.right() - 1, rect.top() + 1, rect.right() - 1, rect.bottom() - 2);
cachePainter.drawLines(lines, 2);
cachePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(pixmapName, cache);
+ QPixmapCache::insert(pixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
} else {
@@ -3458,7 +3450,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString addLinePixmapName = uniqueName(QLatin1String("scrollbar_addline"), option, option->rect.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(addLinePixmapName, cache)) {
+ if (!QPixmapCache::find(addLinePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3517,8 +3509,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
addLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
addLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(addLinePixmapName, cache);
+ QPixmapCache::insert(addLinePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3536,7 +3527,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
groovePixmapName += QLatin1String("-addpage");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(groovePixmapName, cache)) {
+ if (!QPixmapCache::find(groovePixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(option->palette.background().color());
QPainter groovePainter(&cache);
@@ -3562,8 +3553,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
groovePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(groovePixmapName, cache);
+ QPixmapCache::insert(groovePixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3591,7 +3581,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
QString subLinePixmapName = uniqueName(QLatin1String("scrollbar_subline"), option, button1.size());
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(subLinePixmapName, cache)) {
+ if (!QPixmapCache::find(subLinePixmapName, cache)) {
cache = QPixmap(button1.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3651,8 +3641,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
subLinePainter.drawImage(QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
}
subLinePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(subLinePixmapName, cache);
+ QPixmapCache::insert(subLinePixmapName, cache);
}
painter->drawPixmap(button1.topLeft(), cache);
painter->drawPixmap(button2.topLeft(), cache);
@@ -3670,7 +3659,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
sliderPixmapName += QLatin1String("-horizontal");
QPixmap cache;
- if (!UsePixmapCache || !QPixmapCache::find(sliderPixmapName, cache)) {
+ if (!QPixmapCache::find(sliderPixmapName, cache)) {
cache = QPixmap(option->rect.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, cache.width(), cache.height());
@@ -3741,8 +3730,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op
}
sliderPainter.end();
// insert the slider into the cache
- if (UsePixmapCache)
- QPixmapCache::insert(sliderPixmapName, cache);
+ QPixmapCache::insert(sliderPixmapName, cache);
}
painter->drawPixmap(option->rect.topLeft(), cache);
}
@@ -3892,7 +3880,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
if ((option->activeSubControls & SC_SliderHandle) && (option->state & State_Sunken))
handlePixmapName += QLatin1String("-sunken");
- if (!UsePixmapCache || !QPixmapCache::find(handlePixmapName, cache)) {
+ if (!QPixmapCache::find(handlePixmapName, cache)) {
cache = QPixmap(handle.size());
cache.fill(Qt::white);
QRect pixmapRect(0, 0, handle.width(), handle.height());
@@ -3975,8 +3963,7 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
handlePainter.drawImage(pixmapRect, image);
handlePainter.end();
- if (UsePixmapCache)
- QPixmapCache::insert(handlePixmapName, cache);
+ QPixmapCache::insert(handlePixmapName, cache);
}
painter->drawPixmap(handle.topLeft(), cache);
@@ -4581,7 +4568,8 @@ void QPlastiqueStyle::drawComplexControl(ComplexControl control, const QStyleOpt
}
// Draw the focus rect
- if (((option->state & State_HasFocus) && (option->state & State_KeyboardFocusChange)) && !comboBox->editable) {
+ if ((option->state & State_HasFocus) && !comboBox->editable
+ && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) {
QStyleOptionFocusRect focus;
focus.rect = subControlRect(CC_ComboBox, option, SC_ComboBoxEditField, widget)
.adjusted(-2, 0, 2, 0);
diff --git a/src/gui/styles/qstyle_p.h b/src/gui/styles/qstyle_p.h
index 848bad6..154321a 100644
--- a/src/gui/styles/qstyle_p.h
+++ b/src/gui/styles/qstyle_p.h
@@ -77,7 +77,7 @@ public:
QPainter *p = painter; \
QString unique = uniqueName((a), option, option->rect.size()); \
int txType = painter->deviceTransform().type() | painter->worldTransform().type(); \
- bool doPixmapCache = UsePixmapCache && txType <= QTransform::TxTranslate; \
+ bool doPixmapCache = txType <= QTransform::TxTranslate; \
if (doPixmapCache && QPixmapCache::find(unique, internalPixmapCache)) { \
painter->drawPixmap(option->rect.topLeft(), internalPixmapCache); \
} else { \
diff --git a/src/gui/styles/qstylehelper.cpp b/src/gui/styles/qstylehelper.cpp
index 69f8cd2..20de892 100644
--- a/src/gui/styles/qstylehelper.cpp
+++ b/src/gui/styles/qstylehelper.cpp
@@ -51,7 +51,6 @@
QT_BEGIN_NAMESPACE
namespace QStyleHelper {
-const bool UsePixmapCache = true;
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
{
diff --git a/src/gui/styles/qstylehelper_p.h b/src/gui/styles/qstylehelper_p.h
index 5385d9f..ef6e66c 100644
--- a/src/gui/styles/qstylehelper_p.h
+++ b/src/gui/styles/qstylehelper_p.h
@@ -66,7 +66,6 @@ class QStyleOption;
namespace QStyleHelper
{
- extern const bool UsePixmapCache;
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size);
#ifndef QT_NO_DIAL
qreal angle(const QPointF &p1, const QPointF &p2);
diff --git a/src/gui/text/qcssparser.cpp b/src/gui/text/qcssparser.cpp
index 0494b72..a05e5a1 100644
--- a/src/gui/text/qcssparser.cpp
+++ b/src/gui/text/qcssparser.cpp
@@ -57,46 +57,6 @@ QT_BEGIN_NAMESPACE
using namespace QCss;
-const char *Scanner::tokenName(QCss::TokenType t)
-{
- switch (t) {
- case NONE: return "NONE";
- case S: return "S";
- case CDO: return "CDO";
- case CDC: return "CDC";
- case INCLUDES: return "INCLUDES";
- case DASHMATCH: return "DASHMATCH";
- case LBRACE: return "LBRACE";
- case PLUS: return "PLUS";
- case GREATER: return "GREATER";
- case COMMA: return "COMMA";
- case STRING: return "STRING";
- case INVALID: return "INVALID";
- case IDENT: return "IDENT";
- case HASH: return "HASH";
- case ATKEYWORD_SYM: return "ATKEYWORD_SYM";
- case EXCLAMATION_SYM: return "EXCLAMATION_SYM";
- case LENGTH: return "LENGTH";
- case PERCENTAGE: return "PERCENTAGE";
- case NUMBER: return "NUMBER";
- case FUNCTION: return "FUNCTION";
- case COLON: return "COLON";
- case SEMICOLON: return "SEMICOLON";
- case RBRACE: return "RBRACE";
- case SLASH: return "SLASH";
- case MINUS: return "MINUS";
- case DOT: return "DOT";
- case STAR: return "STAR";
- case LBRACKET: return "LBRACKET";
- case RBRACKET: return "RBRACKET";
- case EQUAL: return "EQUAL";
- case LPAREN: return "LPAREN";
- case RPAREN: return "RPAREN";
- case OR: return "OR";
- }
- return "";
-}
-
struct QCssKnownValue
{
const char *name;
@@ -279,7 +239,7 @@ static const QCssKnownValue values[NumKnownValues - 1] = {
};
//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,
+static const short 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 };
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index 72bd637..81f306d 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -731,7 +731,6 @@ class Q_AUTOTEST_EXPORT Scanner
public:
static QString preprocess(const QString &input, bool *hasEscapeSequences = 0);
static void scan(const QString &preprocessedInput, QVector<Symbol> *symbols);
- static const char *tokenName(TokenType t);
};
class Q_GUI_EXPORT Parser
diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp
index 605a7dd..8f67cec 100644
--- a/src/gui/text/qfontdatabase_x11.cpp
+++ b/src/gui/text/qfontdatabase_x11.cpp
@@ -392,7 +392,7 @@ int qt_mib_for_xlfd_encoding(const char *encoding)
int id = qt_xlfd_encoding_id(encoding);
if (id != -1) return xlfd_encoding[id].mib;
return 0;
-};
+}
int qt_encoding_id_for_mib(int mib)
{
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 6e8adcf..79e341a 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -70,12 +70,6 @@ static inline bool qtransform_equals_no_translate(const QTransform &a, const QTr
}
}
-
-
-QFontEngineGlyphCache::~QFontEngineGlyphCache()
-{
-}
-
// Harfbuzz helper functions
static HB_Bool hb_stringToGlyphs(HB_Font font, const HB_UChar16 *string, hb_uint32 length, HB_Glyph *glyphs, hb_uint32 *numGlyphs, HB_Bool rightToLeft)
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 0f8d81c..3ef9d5f 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -93,7 +93,6 @@ struct QGlyphLayout;
class Q_GUI_EXPORT QFontEngine : public QObject
{
- Q_OBJECT
public:
enum Type {
Box,
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index 002e670..4d3633b 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -1333,9 +1333,10 @@ bool QFontEngineWin::getSfntTableData(uint tag, uchar *buffer, uint *length) con
# define CLEARTYPE_QUALITY 5
#endif
+extern bool qt_cleartype_enabled;
QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin,
- const QTransform &t)
+ const QTransform &t, QImage::Format mask_format)
{
glyph_metrics_t gm = boundingBox(glyph);
@@ -1408,7 +1409,11 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
QNativeImage *ni = new QNativeImage(iw + 2 * margin + 4,
ih + 2 * margin + 4,
- QNativeImage::systemFormat(), true);
+ QNativeImage::systemFormat(), !qt_cleartype_enabled);
+
+ /*If cleartype is enabled we use the standard system format even on Windows CE
+ and not the special textbuffer format we have to use if cleartype is disabled*/
+
ni->image.fill(0xffffffff);
HDC hdc = ni->hdc;
@@ -1437,7 +1442,6 @@ QNativeImage *QFontEngineWin::drawGDIGlyph(HFONT font, glyph_t glyph, int margin
}
-extern bool qt_cleartype_enabled;
extern uint qt_pow_gamma[256];
QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
@@ -1448,8 +1452,12 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
lf.lfQuality = ANTIALIASED_QUALITY;
font = CreateFontIndirectW(&lf);
}
+ QImage::Format mask_format = QNativeImage::systemFormat();
+#ifndef Q_OS_WINCE
+ mask_format = QImage::Format_RGB32;
+#endif
- QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform);
+ QNativeImage *mask = drawGDIGlyph(font, glyph, 0, xform, mask_format);
if (mask == 0)
return QImage();
@@ -1466,22 +1474,20 @@ QImage QFontEngineWin::alphaMapForGlyph(glyph_t glyph, const QTransform &xform)
// Alpha channel of the ni.image pixels...
for (int y=0; y<mask->height(); ++y) {
uchar *dest = indexed.scanLine(y);
- if (mask->systemFormat() == QImage::Format_RGB16) {
+ if (mask->image.format() == QImage::Format_RGB16) {
const qint16 *src = (qint16 *) ((const QImage &) mask->image).scanLine(y);
- for (int x=0; x<mask->width(); ++x) {
-#ifdef Q_OS_WINCE
+ for (int x=0; x<mask->width(); ++x)
dest[x] = 255 - qGray(src[x]);
-#else
- dest[x] = 255 - (qt_pow_gamma[qGray(src[x])] * 255. / 2047.);
-#endif
- }
} else {
const uint *src = (uint *) ((const QImage &) mask->image).scanLine(y);
for (int x=0; x<mask->width(); ++x) {
#ifdef Q_OS_WINCE
dest[x] = 255 - qGray(src[x]);
#else
- dest[x] = 255 - (qt_pow_gamma[qGray(src[x])] * 255. / 2047.);
+ if (QNativeImage::systemFormat() == QImage::Format_RGB16)
+ dest[x] = 255 - qGray(src[x]);
+ else
+ dest[x] = 255 - (qt_pow_gamma[qGray(src[x])] * 255. / 2047.);
#endif
}
}
@@ -1507,7 +1513,7 @@ QImage QFontEngineWin::alphaRGBMapForGlyph(glyph_t glyph, int margin, const QTra
SystemParametersInfo(SPI_GETFONTSMOOTHINGCONTRAST, 0, &contrast, 0);
SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, (void *) 1000, 0);
- QNativeImage *mask = drawGDIGlyph(font, glyph, margin, t);
+ QNativeImage *mask = drawGDIGlyph(font, glyph, margin, t, QImage::Format_RGB32);
SystemParametersInfo(SPI_SETFONTSMOOTHINGCONTRAST, 0, (void *) contrast, 0);
if (mask == 0)
diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h
index 6f37e91..f78bc6a 100644
--- a/src/gui/text/qfontengine_win_p.h
+++ b/src/gui/text/qfontengine_win_p.h
@@ -138,7 +138,8 @@ public:
mutable int designAdvancesSize;
private:
- QNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform);
+ QNativeImage *drawGDIGlyph(HFONT font, glyph_t, int margin, const QTransform &xform,
+ QImage::Format mask_format);
};
diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h
index 8589cc6..ca67e3f 100644
--- a/src/gui/text/qfontengineglyphcache_p.h
+++ b/src/gui/text/qfontengineglyphcache_p.h
@@ -72,7 +72,7 @@
QT_BEGIN_NAMESPACE
-class Q_GUI_EXPORT QFontEngineGlyphCache
+class QFontEngineGlyphCache
{
public:
QFontEngineGlyphCache(const QTransform &matrix) : m_transform(matrix) { }
@@ -83,7 +83,7 @@ public:
Raster_Mono
};
- virtual ~QFontEngineGlyphCache();
+ virtual ~QFontEngineGlyphCache() { }
QTransform m_transform;
};
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index e1da4be..7700c14 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -193,6 +193,8 @@ QTextDocumentPrivate::QTextDocumentPrivate()
undoEnabled = true;
inContentsChange = false;
+ inEdit = false;
+
defaultTextOption.setTabStop(80); // same as in qtextengine.cpp
defaultTextOption.setWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
@@ -439,6 +441,7 @@ void QTextDocumentPrivate::insert(int pos, int strPos, int strLength, int format
Q_ASSERT(pos >= 0 && pos < fragments.length());
Q_ASSERT(formats.format(format).isCharFormat());
+ beginEdit();
insert_string(pos, strPos, strLength, format, QTextUndoCommand::MoveCursor);
if (undoEnabled) {
int b = blocks.findNode(pos);
@@ -564,6 +567,7 @@ void QTextDocumentPrivate::move(int pos, int to, int length, QTextUndoCommand::O
if (pos == to)
return;
+ beginEdit();
const bool needsInsert = to != -1;
#if !defined(QT_NO_DEBUG)
@@ -1106,6 +1110,8 @@ void QTextDocumentPrivate::finishEdit()
if (editBlock)
return;
+ inEdit = false;
+
if (framesDirty)
scan_frames(docChangeFrom, docChangeOldLength, docChangeLength);
@@ -1175,7 +1181,7 @@ void QTextDocumentPrivate::adjustDocumentChangesAndCursors(int from, int addedOr
for (int i = 0; i < cursors.size(); ++i) {
QTextCursorPrivate *curs = cursors.at(i);
if (curs->adjustPosition(from, addedOrRemoved, op) == QTextCursorPrivate::CursorMoved) {
- if (editBlock) {
+ if (editBlock || inEdit) {
if (!changedCursors.contains(curs))
changedCursors.append(curs);
} else {
diff --git a/src/gui/text/qtextdocument_p.h b/src/gui/text/qtextdocument_p.h
index d754ff0..e10e7ae 100644
--- a/src/gui/text/qtextdocument_p.h
+++ b/src/gui/text/qtextdocument_p.h
@@ -202,6 +202,7 @@ public:
inline void beginEditBlock() { editBlock++; }
void joinPreviousEditBlock();
void endEditBlock();
+ inline void beginEdit() { inEdit = true; }
void finishEdit();
inline bool isInEditBlock() const { return editBlock; }
void enableUndoRedo(bool enable);
@@ -335,8 +336,9 @@ public:
QCss::StyleSheet parsedDefaultStyleSheet;
#endif
int maximumBlockCount;
- bool needsEnsureMaximumBlockCount;
- bool inContentsChange;
+ uint needsEnsureMaximumBlockCount : 1;
+ uint inContentsChange : 1;
+ uint inEdit : 1; // between beginEdit() and finishEdit()
QSizeF pageSize;
QString title;
QString url;
diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp
index 38ac4ca..d93f084 100644
--- a/src/gui/text/qtextformat.cpp
+++ b/src/gui/text/qtextformat.cpp
@@ -142,6 +142,7 @@ QTextLength::operator QVariant() const
return QVariant(QVariant::TextLength, this);
}
+#ifndef QT_NO_DATASTREAM
QDataStream &operator<<(QDataStream &stream, const QTextLength &length)
{
return stream << qint32(length.lengthType) << double(length.fixedValueOrPercentage);
@@ -156,6 +157,7 @@ QDataStream &operator>>(QDataStream &stream, QTextLength &length)
length.lengthType = QTextLength::Type(type);
return stream;
}
+#endif // QT_NO_DATASTREAM
class QTextFormatPrivate : public QSharedData
{
@@ -374,6 +376,7 @@ void QTextFormatPrivate::recalcFont() const
fontDirty = false;
}
+#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &stream, const QTextFormat &fmt)
{
stream << fmt.format_type << fmt.properties();
@@ -396,6 +399,7 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &stream, QTextFormat &fmt)
return stream;
}
+#endif // QT_NO_DATASTREAM
/*!
\class QTextFormat
diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h
index 8eaeeb1..96c0739 100644
--- a/src/gui/text/qtextformat.h
+++ b/src/gui/text/qtextformat.h
@@ -76,8 +76,10 @@ class QTextCursor;
class QTextDocument;
class QTextLength;
+#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &);
+#endif
class Q_GUI_EXPORT QTextLength
{
@@ -119,8 +121,10 @@ private:
inline QTextLength::QTextLength(Type atype, qreal avalue)
: lengthType(atype), fixedValueOrPercentage(avalue) {}
+#ifndef QT_NO_DATASTREAM
Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextFormat &);
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextFormat &);
+#endif
class Q_GUI_EXPORT QTextFormat
{
diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp
index ee743dc..76c59c3 100644
--- a/src/gui/text/qtexthtmlparser.cpp
+++ b/src/gui/text/qtexthtmlparser.cpp
@@ -343,7 +343,7 @@ static QChar resolveEntity(const QString &entity)
return e->code;
}
-static const uint windowsLatin1ExtendedCharacters[0xA0 - 0x80] = {
+static const ushort windowsLatin1ExtendedCharacters[0xA0 - 0x80] = {
0x20ac, // 0x80
0x0081, // 0x81 direct mapping
0x201a, // 0x82
diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp
index 0449cba..a8aa11c 100644
--- a/src/gui/util/qdesktopservices_win.cpp
+++ b/src/gui/util/qdesktopservices_win.cpp
@@ -98,32 +98,35 @@ static bool launchWebBrowser(const QUrl &url)
{
if (url.scheme() == QLatin1String("mailto")) {
//Retrieve the commandline for the default mail client
- //the key used below is the command line for the mailto: shell command
+ //the default key used below is the command line for the mailto: shell command
DWORD bufferSize = 2 * MAX_PATH;
long returnValue = -1;
QString command;
HKEY handle;
LONG res;
- QT_WA ({
- res = RegOpenKeyExW(HKEY_CLASSES_ROOT, L"mailto\\Shell\\Open\\Command", 0, KEY_READ, &handle);
- if (res != ERROR_SUCCESS)
- return false;
-
- wchar_t keyValue[2 * MAX_PATH] = {0};
- returnValue = RegQueryValueExW(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
- if (!returnValue)
- command = QString::fromRawData((QChar*)keyValue, bufferSize);
- }, {
- res = RegOpenKeyExA(HKEY_CLASSES_ROOT, "mailto\\Shell\\Open\\Command", 0, KEY_READ, &handle);
- if (res != ERROR_SUCCESS)
- return false;
-
- char keyValue[2 * MAX_PATH] = {0};
- returnValue = RegQueryValueExA(handle, "", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
+ wchar_t keyValue[2 * MAX_PATH] = {0};
+ QString keyName(QLatin1String("mailto"));
+
+ //Check if user has set preference, otherwise use default.
+ res = RegOpenKeyExW(HKEY_CURRENT_USER,
+ L"Software\\Microsoft\\Windows\\Shell\\Associations\\UrlAssociations\\mailto\\UserChoice",
+ 0, KEY_READ, &handle);
+ if (res == ERROR_SUCCESS) {
+ returnValue = RegQueryValueEx(handle, L"Progid", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
if (!returnValue)
- command = QString::fromLocal8Bit(keyValue);
- });
+ keyName = QString::fromUtf16((const ushort*)keyValue);
+ RegCloseKey(handle);
+ }
+ keyName += QLatin1String("\\Shell\\Open\\Command");
+ res = RegOpenKeyExW(HKEY_CLASSES_ROOT, (const wchar_t*)keyName.utf16(), 0, KEY_READ, &handle);
+ if (res != ERROR_SUCCESS)
+ return false;
+
+ bufferSize = 2 * MAX_PATH;
+ returnValue = RegQueryValueExW(handle, L"", 0, 0, reinterpret_cast<unsigned char*>(keyValue), &bufferSize);
+ if (!returnValue)
+ command = QString::fromRawData((QChar*)keyValue, bufferSize);
RegCloseKey(handle);
if(returnValue)
@@ -145,19 +148,11 @@ static bool launchWebBrowser(const QUrl &url)
//start the process
PROCESS_INFORMATION pi;
ZeroMemory(&pi, sizeof(pi));
- QT_WA ({
- STARTUPINFO si;
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
-
- returnValue = CreateProcess(NULL, (TCHAR*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- }, {
- STARTUPINFOA si;
- ZeroMemory(&si, sizeof(si));
- si.cb = sizeof(si);
+ STARTUPINFO si;
+ ZeroMemory(&si, sizeof(si));
+ si.cb = sizeof(si);
- returnValue = CreateProcessA(NULL, command.toLocal8Bit().data(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
- });
+ returnValue = CreateProcess(NULL, (TCHAR*)command.utf16(), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
if (!returnValue)
return false;
@@ -170,12 +165,12 @@ static bool launchWebBrowser(const QUrl &url)
if (!url.isValid())
return false;
+ if (url.scheme().isEmpty())
+ return openDocument(url);
+
quintptr returnValue;
- QT_WA ({
- returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *) QString::fromUtf8(url.toEncoded().constData()).utf16(), 0, 0, SW_SHOWNORMAL);
- } , {
- returnValue = (quintptr)ShellExecuteA(0, 0, url.toEncoded().constData(), 0, 0, SW_SHOWNORMAL);
- });
+ returnValue = (quintptr)ShellExecute(0, 0, (TCHAR *) QString::fromUtf8(url.toEncoded().constData()).utf16(),
+ 0, 0, SW_SHOWNORMAL);
return (returnValue > 32);
}
diff --git a/src/gui/widgets/qmainwindowlayout_p.h b/src/gui/widgets/qmainwindowlayout_p.h
index 1159aac..24a58a6 100644
--- a/src/gui/widgets/qmainwindowlayout_p.h
+++ b/src/gui/widgets/qmainwindowlayout_p.h
@@ -341,34 +341,4 @@ QT_END_NAMESPACE
#endif // QT_NO_MAINWINDOW
-QT_BEGIN_NAMESPACE
-static inline int pick(Qt::Orientation o, const QPoint &pos)
-{ return o == Qt::Horizontal ? pos.x() : pos.y(); }
-
-static inline int pick(Qt::Orientation o, const QSize &size)
-{ return o == Qt::Horizontal ? size.width() : size.height(); }
-
-static inline int &rpick(Qt::Orientation o, QPoint &pos)
-{ return o == Qt::Horizontal ? pos.rx() : pos.ry(); }
-
-static inline int &rpick(Qt::Orientation o, QSize &size)
-{ return o == Qt::Horizontal ? size.rwidth() : size.rheight(); }
-
-static inline QSizePolicy::Policy pick(Qt::Orientation o, const QSizePolicy &policy)
-{ return o == Qt::Horizontal ? policy.horizontalPolicy() : policy.verticalPolicy(); }
-
-static inline int perp(Qt::Orientation o, const QPoint &pos)
-{ return o == Qt::Vertical ? pos.x() : pos.y(); }
-
-static inline int perp(Qt::Orientation o, const QSize &size)
-{ return o == Qt::Vertical ? size.width() : size.height(); }
-
-static inline int &rperp(Qt::Orientation o, QPoint &pos)
-{ return o == Qt::Vertical ? pos.rx() : pos.ry(); }
-
-static inline int &rperp(Qt::Orientation o, QSize &size)
-{ return o == Qt::Vertical ? size.rwidth() : size.rheight(); }
-
-QT_END_NAMESPACE
-
#endif // QDYNAMICMAINWINDOWLAYOUT_P_H
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 786633c..67656b4 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -907,8 +907,6 @@ static NSMenuItem *qt_mac_menu_merge_action(OSMenuRef merge, QMacMenuAction *act
}
}
- if ([ret tag] != 0)
- ret = 0; // already taken
#endif
return ret;
}
@@ -1168,15 +1166,15 @@ QMenuPrivate::QMacMenuPrivate::addAction(QMacMenuAction *action, QMacMenuAction
GetMenuItemAttributes(action->menu, itemCount , &testattr);
if (mergedItems.contains(action->command)
&& (testattr & kMenuItemAttrSeparator)) {
- InsertMenuItemTextWithCFString(action->menu, 0, qMax(itemCount - 1, 0), attr, action->command);
- index = itemCount;
- } else {
- MenuItemIndex tmpIndex;
- AppendMenuItemTextWithCFString(action->menu, 0, attr, action->command, &tmpIndex);
- index = tmpIndex;
- if (mergedItems.contains(action->command))
- AppendMenuItemTextWithCFString(action->menu, 0, kMenuItemAttrSeparator, 0, &tmpIndex);
- }
+ InsertMenuItemTextWithCFString(action->menu, 0, qMax(itemCount - 1, 0), attr, action->command);
+ index = itemCount;
+ } else {
+ MenuItemIndex tmpIndex;
+ AppendMenuItemTextWithCFString(action->menu, 0, attr, action->command, &tmpIndex);
+ index = tmpIndex;
+ if (mergedItems.contains(action->command))
+ AppendMenuItemTextWithCFString(action->menu, 0, kMenuItemAttrSeparator, 0, &tmpIndex);
+ }
#else
[menu addItem:newItem];
#endif
@@ -1477,11 +1475,18 @@ QMenuPrivate::QMacMenuPrivate::removeAction(QMacMenuAction *action)
DeleteMenuItem(action->menu, qt_mac_menu_find_action(action->menu, action));
#else
QMacCocoaAutoReleasePool pool;
- QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
- if (action->menuItem == [loader quitMenuItem] || action->menuItem == [loader preferencesMenuItem])
- [action->menuItem setEnabled:false];
- else
+ if (action->merged) {
+ if (reinterpret_cast<QAction *>([action->menuItem tag]) == action->action) {
+ QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
+ [action->menuItem setEnabled:false];
+ if (action->menuItem != [loader quitMenuItem]
+ && action->menuItem != [loader preferencesMenuItem]) {
+ [[action->menuItem menu] removeItem:action->menuItem];
+ }
+ }
+ } else {
[[action->menuItem menu] removeItem:action->menuItem];
+ }
#endif
actionItems.removeAll(action);
}
@@ -1936,6 +1941,23 @@ bool QMenuBar::macUpdateMenuBar()
[loader ensureAppMenuInMenu:menu];
[NSApp setMainMenu:menu];
syncMenuBarItemsVisiblity(mb->d_func()->mac_menubar);
+
+ if (OSMenuRef tmpMerge = QMenuPrivate::mergeMenuHash.value(menu)) {
+ if (QMenuMergeList *mergeList
+ = QMenuPrivate::mergeMenuItemsHash.value(tmpMerge)) {
+ const int mergeListSize = mergeList->size();
+
+ for (int i = 0; i < mergeListSize; ++i) {
+ const QMenuMergeItem &mergeItem = mergeList->at(i);
+ // Ideally we would call QMenuPrivate::syncAction, but that requires finding
+ // the original QMen and likely doing more work than we need.
+ // For example, enabled is handled below.
+ [mergeItem.menuItem setTag:reinterpret_cast<long>(
+ static_cast<QAction *>(mergeItem.action->action))];
+ [mergeItem.menuItem setHidden:!(mergeItem.action->action->isVisible())];
+ }
+ }
+ }
#endif
QWidget *modalWidget = qApp->activeModalWidget();
if (mb != menubars()->value(modalWidget)) {
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index f317742..af11aa7 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -444,7 +444,7 @@ QPlainTextEditControl::QPlainTextEditControl(QPlainTextEdit *parent)
void QPlainTextEditPrivate::_q_cursorPositionChanged()
{
pageUpDownLastCursorYIsValid = false;
-};
+}
void QPlainTextEditPrivate::_q_verticalScrollbarActionTriggered(int action) {
if (action == QAbstractSlider::SliderPageStepAdd) {
@@ -1756,7 +1756,7 @@ void QPlainTextEdit::paintEvent(QPaintEvent *e)
QTextBlock block = firstVisibleBlock();
qreal maximumWidth = document()->documentLayout()->documentSize().width();
-
+
// keep right margin clean from full-width selection
int maxX = offset.x() + qMax((qreal)viewportRect.width(), maximumWidth)
- document()->documentMargin();
diff --git a/src/gui/widgets/qprogressbar.cpp b/src/gui/widgets/qprogressbar.cpp
index 804220d..adc3582 100644
--- a/src/gui/widgets/qprogressbar.cpp
+++ b/src/gui/widgets/qprogressbar.cpp
@@ -349,6 +349,8 @@ void QProgressBar::setRange(int minimum, int maximum)
\property QProgressBar::textVisible
\brief whether the current completed percentage should be displayed
+ This property may be ignored by the style (e.g., QMacStyle never draws the text).
+
\sa textDirection
*/
void QProgressBar::setTextVisible(bool visible)
diff --git a/src/gui/widgets/qstatusbar.cpp b/src/gui/widgets/qstatusbar.cpp
index 3829bcb..a248346 100644
--- a/src/gui/widgets/qstatusbar.cpp
+++ b/src/gui/widgets/qstatusbar.cpp
@@ -728,7 +728,7 @@ void QStatusBar::paintEvent(QPaintEvent *event)
QStatusBarPrivate::SBItem* item = d->items.at(i);
if (item && item->w->isVisible() && (!haveMessage || item->p)) {
QRect ir = item->w->geometry().adjusted(-2, -1, 2, 1);
- if (event->rect().contains(ir)) {
+ if (event->rect().intersects(ir)) {
QStyleOption opt(0);
opt.rect = ir;
opt.palette = palette();
diff --git a/src/gui/widgets/qtoolbararealayout.cpp b/src/gui/widgets/qtoolbararealayout.cpp
index 49f4a9e..240d059 100644
--- a/src/gui/widgets/qtoolbararealayout.cpp
+++ b/src/gui/widgets/qtoolbararealayout.cpp
@@ -113,7 +113,7 @@ QSize QToolBarAreaLayoutLine::sizeHint() const
continue;
QSize sh = item.sizeHint();
- a += pick(o, sh) + item.extraSpace;
+ a += item.preferredSize > 0 ? item.preferredSize : pick(o, sh);
b = qMax(b, perp(o, sh));
}
@@ -163,12 +163,17 @@ void QToolBarAreaLayoutLine::fitLayout()
int itemMin = pick(o, item.minimumSize());
int itemHint = pick(o, item.sizeHint());
//we ensure the extraspace is not too low
- item.extraSpace = qMax(itemMin - itemHint, item.extraSpace);
- itemHint += item.extraSpace;
- int itemExtra = qMin(itemHint - itemMin, extra);
+ item.size = qMax(item.size, itemHint);
+ if (item.preferredSize > 0) {
+ //preferredSize would be the default size
+ item.size = item.preferredSize;
+ }
+
+ //the extraspace is the space above the item minimum sizehint
+ int extraSpace = qMin(item.size - itemMin, extra);
+ item.size = itemMin + extraSpace; //that is the real size
- item.size = itemMin + itemExtra;
- extra -= itemExtra;
+ extra -= extraSpace;
last = i;
}
@@ -395,17 +400,15 @@ void QToolBarAreaLayoutInfo::removeToolBarBreak(QToolBar *before)
void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos)
{
- if (dirty) {
+ if (dirty)
fitLayout();
- }
dirty = true;
- if (o == Qt::Vertical) {
+ if (o == Qt::Vertical)
pos -= rect.top();
- }
- //here we actually update the extraSpace for the line containing the toolbar so that we move it
+ //here we actually update the preferredSize for the line containing the toolbar so that we move it
for (int j = 0; j < lines.count(); ++j) {
QToolBarAreaLayoutLine &line = lines[j];
@@ -432,22 +435,21 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos)
newPos = qMin(pos, maxPos);
}
- //let's update the previous extra space
+ //extra is the number of pixels to add to the previous toolbar
int extra = newPos - current.pos;
- if (qAbs(previous.extraSpace + extra) < QApplication::startDragDistance()) {
+ //we check if the previous is near its size hint
+ //in which case we try to stick to it
+ if (qAbs(pick(o, previous.sizeHint()) - (previous.size + extra)) < QApplication::startDragDistance()) {
//we stick to the default space
extra = 0;
}
//update for the current item
- current.extraSpace -= extra;
- //this ensures the toolbars to be pushed to the right when necessary
- current.extraSpace = qMax(pick(o,current.minimumSize())- pick(o,current.sizeHint()), current.extraSpace);
-
- if (extra >= 0) {
- previous.extraSpace += extra;
+ current.extendSize(line.o, -extra);
+ if (extra >= 0) {
+ previous.extendSize(line.o, extra);
} else {
//we need to push the toolbars on the left starting with previous
extra = -extra; // we just need to know the number of pixels
@@ -455,13 +457,13 @@ void QToolBarAreaLayoutInfo::moveToolBar(QToolBar *toolbar, int pos)
for(int l = previousIndex; l >=0; --l) {
QToolBarAreaLayoutItem &item = line.toolBarItems[l];
if (!item.skip()) {
- const int minExtraSpace = pick(o, item.minimumSize()) - pick(o, item.sizeHint());
- const int margin = item.extraSpace - minExtraSpace;
+ const int minPreferredSize = pick(o, item.minimumSize());
+ const int margin = item.size - minPreferredSize;
if (margin < extra) {
- item.extraSpace = minExtraSpace;
+ item.resize(line.o, minPreferredSize);
extra -= margin;
} else {
- item.extraSpace -= extra;
+ item.extendSize(line.o, -extra);
extra = 0;
}
}
@@ -536,13 +538,22 @@ bool QToolBarAreaLayoutInfo::insertGap(QList<int> path, QLayoutItem *item)
gap_item.gap = true;
gap_item.widgetItem = item;
- //update the previous item's extra space
+ //update the previous item's preferred size
for(int p = k - 1 ; p >= 0; --p) {
QToolBarAreaLayoutItem &previous = line.toolBarItems[p];
if (!previous.skip()) {
//we found the previous one
- gap_item.extraSpace = qMax(0, previous.extraSpace - pick(o, gap_item.sizeHint()));
- previous.extraSpace = qMin(previous.extraSpace, 0);
+ int previousSizeHint = pick(line.o, previous.sizeHint());
+ int previousExtraSpace = previous.size - previousSizeHint;
+
+ if (previousExtraSpace > 0) {
+ //in this case we reset the space
+ previous.preferredSize = -1;
+ previous.size = previousSizeHint;
+
+ gap_item.resize(o, previousExtraSpace);
+ }
+
break;
}
}
@@ -1132,15 +1143,22 @@ QLayoutItem *QToolBarAreaLayout::unplug(QList<int> path, QToolBarAreaLayout *oth
//update the leading space here
QToolBarAreaLayoutInfo &info = docks[path.at(0)];
QToolBarAreaLayoutLine &line = info.lines[path.at(1)];
- if (item.extraSpace != 0) {
+ if (item.size != pick(line.o, item.realSizeHint())) {
+ //the item doesn't have its default size
+ //so we'll give this to the next item
int newExtraSpace = 0;
+ //let's iterate over the siblings of the current item that pare placed before it
+ //we need to find just the one before
for (int i = path.at(2) - 1; i >= 0; --i) {
QToolBarAreaLayoutItem &previous = line.toolBarItems[i];
if (!previous.skip()) {
+ //we need to check if it has a previous element and a next one
+ //the previous will get its size changed
for (int j = path.at(2) + 1; j < line.toolBarItems.count(); ++j) {
const QToolBarAreaLayoutItem &next = line.toolBarItems.at(j);
if (!next.skip()) {
- newExtraSpace = previous.extraSpace = next.pos - previous.pos - pick(line.o, previous.sizeHint());
+ newExtraSpace = next.pos - previous.pos - pick(line.o, previous.sizeHint());
+ previous.resize(line.o, next.pos - previous.pos);
}
break;
}
@@ -1154,7 +1172,7 @@ QLayoutItem *QToolBarAreaLayout::unplug(QList<int> path, QToolBarAreaLayout *oth
for (int i = path.at(2) - 1; i >= 0; --i) {
QToolBarAreaLayoutItem &previous = line.toolBarItems[i];
if (!previous.skip()) {
- previous.extraSpace = newExtraSpace;
+ previous.resize(line.o, pick(line.o, previous.sizeHint()) + newExtraSpace);
break;
}
}
@@ -1162,7 +1180,6 @@ QLayoutItem *QToolBarAreaLayout::unplug(QList<int> path, QToolBarAreaLayout *oth
}
}
-
Q_ASSERT(!item.gap);
item.gap = true;
return item.widgetItem;
@@ -1253,8 +1270,8 @@ void QToolBarAreaLayout::saveState(QDataStream &stream) const
}
stream << shownOrientation;
stream << item.pos;
- //if extraSpace is 0 the item has its "normal" size, so no need to store the size (we store -1)
- stream << (item.extraSpace == 0 ? -1 : (pick(line.o, item.realSizeHint()) + item.extraSpace));
+ //we store the preferred size. If the use rdidn't resize the toolbars it will be -1
+ stream << item.preferredSize;
uint geom0, geom1;
packRect(&geom0, &geom1, widget->geometry(), widget->isWindow());
@@ -1339,10 +1356,7 @@ bool QToolBarAreaLayout::restoreState(QDataStream &stream, const QList<QToolBar*
toolBar->setVisible(shown & 1);
toolBar->d_func()->setWindowState(floating, true, rect);
- //if it is -1, it means we should use the default size
- item.extraSpace = (item.size == -1) ? 0 : item.size - pick(line.o, item.realSizeHint());
-
-
+ item.preferredSize = item.size;
line.toolBarItems.append(item);
}
}
diff --git a/src/gui/widgets/qtoolbararealayout_p.h b/src/gui/widgets/qtoolbararealayout_p.h
index 574e366..5662ffc 100644
--- a/src/gui/widgets/qtoolbararealayout_p.h
+++ b/src/gui/widgets/qtoolbararealayout_p.h
@@ -59,6 +59,33 @@
QT_BEGIN_NAMESPACE
+static inline int pick(Qt::Orientation o, const QPoint &pos)
+{ return o == Qt::Horizontal ? pos.x() : pos.y(); }
+
+static inline int pick(Qt::Orientation o, const QSize &size)
+{ return o == Qt::Horizontal ? size.width() : size.height(); }
+
+static inline int &rpick(Qt::Orientation o, QPoint &pos)
+{ return o == Qt::Horizontal ? pos.rx() : pos.ry(); }
+
+static inline int &rpick(Qt::Orientation o, QSize &size)
+{ return o == Qt::Horizontal ? size.rwidth() : size.rheight(); }
+
+static inline QSizePolicy::Policy pick(Qt::Orientation o, const QSizePolicy &policy)
+{ return o == Qt::Horizontal ? policy.horizontalPolicy() : policy.verticalPolicy(); }
+
+static inline int perp(Qt::Orientation o, const QPoint &pos)
+{ return o == Qt::Vertical ? pos.x() : pos.y(); }
+
+static inline int perp(Qt::Orientation o, const QSize &size)
+{ return o == Qt::Vertical ? size.width() : size.height(); }
+
+static inline int &rperp(Qt::Orientation o, QPoint &pos)
+{ return o == Qt::Vertical ? pos.rx() : pos.ry(); }
+
+static inline int &rperp(Qt::Orientation o, QSize &size)
+{ return o == Qt::Vertical ? size.rwidth() : size.rheight(); }
+
#ifndef QT_NO_TOOLBAR
class QToolBar;
@@ -70,17 +97,41 @@ class QToolBarAreaLayoutItem
{
public:
QToolBarAreaLayoutItem(QLayoutItem *item = 0)
- : widgetItem(item), pos(0), size(-1), extraSpace(0), gap(false) {}
+ : widgetItem(item), pos(0), size(-1), preferredSize(-1), gap(false) {}
bool skip() const;
QSize minimumSize() const;
QSize sizeHint() const;
- QSize realSizeHint() const;
+ QSize realSizeHint() const;
+
+ void resize(Qt::Orientation o, int newSize)
+ {
+ newSize = qMax(pick(o, minimumSize()), newSize);
+ int sizeh = pick(o, sizeHint());
+ if (newSize == sizeh) {
+ preferredSize = -1;
+ size = sizeh;
+ } else {
+ preferredSize = newSize;
+ }
+ }
+
+ void extendSize(Qt::Orientation o, int extent)
+ {
+ int newSize = qMax(pick(o, minimumSize()), (preferredSize > 0 ? preferredSize : size) + extent);
+ int sizeh = pick(o, sizeHint());
+ if (newSize == sizeh) {
+ preferredSize = -1;
+ size = sizeh;
+ } else {
+ preferredSize = newSize;
+ }
+ }
QLayoutItem *widgetItem;
int pos;
int size;
- int extraSpace;
+ int preferredSize;
bool gap;
};
diff --git a/src/gui/widgets/qvalidator.cpp b/src/gui/widgets/qvalidator.cpp
index 3aca13d..0a7c43c 100644
--- a/src/gui/widgets/qvalidator.cpp
+++ b/src/gui/widgets/qvalidator.cpp
@@ -370,7 +370,7 @@ static int numDigits(qlonglong n)
if (n == 0)
return 1;
return (int)log10(double(n)) + 1;
-};
+}
static qlonglong pow10(int exp)
{
diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp
index bd364cb..7517000 100644
--- a/src/network/access/qnetworkaccesshttpbackend.cpp
+++ b/src/network/access/qnetworkaccesshttpbackend.cpp
@@ -212,6 +212,7 @@ QNetworkAccessHttpBackendFactory::create(QNetworkAccessManager::Operation op,
case QNetworkAccessManager::PostOperation:
case QNetworkAccessManager::HeadOperation:
case QNetworkAccessManager::PutOperation:
+ case QNetworkAccessManager::DeleteOperation:
break;
default:
@@ -244,6 +245,10 @@ static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const
code = QNetworkReply::ContentNotFoundError;
break;
+ case 405: // Method Not Allowed
+ code = QNetworkReply::ContentOperationNotPermittedError;
+ break;
+
case 407:
code = QNetworkReply::ProxyAuthenticationRequiredError;
break;
@@ -485,6 +490,11 @@ void QNetworkAccessHttpBackend::postRequest()
httpRequest.setUploadByteDevice(createUploadByteDevice());
break;
+ case QNetworkAccessManager::DeleteOperation:
+ invalidateCache();
+ httpRequest.setOperation(QHttpNetworkRequest::Delete);
+ break;
+
default:
break; // can't happen
}
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index bf06ede..024f191 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -148,6 +148,9 @@ static void ensureInitialized()
\value PostOperation send the contents of an HTML form for
processing via HTTP POST (created with post())
+ \value DeleteOperation delete contents operation (created with
+ deleteResource())
+
\omitvalue UnknownOperation
\sa QNetworkReply::operation()
@@ -555,7 +558,7 @@ QNetworkReply *QNetworkAccessManager::head(const QNetworkRequest &request)
a new QNetworkReply object opened for reading which emits its
QIODevice::readyRead() signal whenever new data arrives.
- \sa post(), put()
+ \sa post(), put(), deleteResource()
*/
QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request)
{
@@ -577,7 +580,7 @@ QNetworkReply *QNetworkAccessManager::get(const QNetworkRequest &request)
Note: sending a POST request on protocols other than HTTP and
HTTPS is undefined and will probably fail.
- \sa get(), put()
+ \sa get(), put(), deleteResource()
*/
QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, QIODevice *data)
{
@@ -642,6 +645,20 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, const
}
/*!
+ \since 4.6
+
+ This function is used to send a request to delete the resource
+ identified by the URL of \a request.
+ This feature is currently available for HTTP only, performing an HTTP DELETE request.
+
+ \sa get(), post(), put()
+*/
+QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &request)
+{
+ return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request));
+}
+
+/*!
Returns a new QNetworkReply object to handle the operation \a op
and request \a req. The device \a outgoingData is always 0 for Get and
Head requests, but is the value passed to post() and put() in
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index 4fe218e..79f512c 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -74,6 +74,7 @@ public:
GetOperation,
PutOperation,
PostOperation,
+ DeleteOperation,
UnknownOperation = 0
};
@@ -100,6 +101,7 @@ public:
QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data);
QNetworkReply *put(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data);
+ QNetworkReply *deleteResource(const QNetworkRequest &request);
Q_SIGNALS:
#ifndef QT_NO_NETWORKPROXY
diff --git a/src/network/kernel/qauthenticator.cpp b/src/network/kernel/qauthenticator.cpp
index b672765..cae3024 100644
--- a/src/network/kernel/qauthenticator.cpp
+++ b/src/network/kernel/qauthenticator.cpp
@@ -46,6 +46,7 @@
#include <qbytearray.h>
#include <qcryptographichash.h>
#include <qhttp.h>
+#include <qiodevice.h>
#include <qdatastream.h>
#include <qendian.h>
#include <qstring.h>
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index fd3a85a..a5fd60e 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -324,7 +324,7 @@ QList<QNetworkProxy> QGlobalNetworkProxy::proxyForQuery(const QNetworkProxyQuery
return result;
}
-Q_GLOBAL_STATIC(QGlobalNetworkProxy, globalNetworkProxy);
+Q_GLOBAL_STATIC(QGlobalNetworkProxy, globalNetworkProxy)
namespace {
template<bool> struct StaticAssertTest;
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 39c9284..ace3bc5 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -144,7 +144,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
- 0, // default attributes
+ FILE_FLAG_OVERLAPPED,
NULL); // no template file
}, {
localSocket = CreateFileA(
@@ -153,7 +153,7 @@ void QLocalSocket::connectToServer(const QString &name, OpenMode openMode)
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
- 0, // default attributes
+ FILE_FLAG_OVERLAPPED,
NULL); // no template file
});
if (localSocket != INVALID_HANDLE_VALUE)
diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp
index b08d7b0..8c6cd31 100644
--- a/src/network/socket/qnativesocketengine_win.cpp
+++ b/src/network/socket/qnativesocketengine_win.cpp
@@ -570,6 +570,11 @@ bool QNativeSocketEnginePrivate::nativeConnect(const QHostAddress &address, quin
socketState = QAbstractSocket::UnconnectedState;
break;
}
+ if (value == WSAEHOSTUNREACH) {
+ setError(QAbstractSocket::NetworkError, HostUnreachableErrorString);
+ socketState = QAbstractSocket::UnconnectedState;
+ break;
+ }
}
// fall through
}
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 16033b6..0a049b8 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -480,7 +480,7 @@ QSslSocket::SslMode QSslSocket::mode() const
Returns true if the socket is encrypted; otherwise, false is returned.
An encrypted socket encrypts all data that is written by calling write()
- or putChar() before the data is written to the network, and descrypts all
+ or putChar() before the data is written to the network, and decrypts all
incoming data as the data is received from the network, before you call
read(), readLine() or getChar().
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
index ea57fdf..5c541d0 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager.cpp
@@ -157,6 +157,7 @@ QGLEngineShaderManager::QGLEngineShaderManager(QGLContext* context)
simpleShaderProg->addShader(compiledShaders[PositionOnlyVertexShader]);
simpleShaderProg->addShader(compiledShaders[MainFragmentShader]);
simpleShaderProg->addShader(compiledShaders[ShockingPinkSrcFragmentShader]);
+ simpleShaderProg->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
simpleShaderProg->link();
if (!simpleShaderProg->isLinked()) {
qCritical() << "Errors linking simple shader:"
@@ -444,7 +445,7 @@ bool QGLEngineShaderManager::useCorrectShaderProg()
requiredProgram.program->addShader(requiredProgram.compositionFragShader);
// We have to bind the vertex attribute names before the program is linked:
- requiredProgram.program->bindAttributeLocation("inputVertex", QT_VERTEX_COORDS_ATTR);
+ requiredProgram.program->bindAttributeLocation("vertexCoordsArray", QT_VERTEX_COORDS_ATTR);
if (useTextureCoords)
requiredProgram.program->bindAttributeLocation("textureCoordArray", QT_TEXTURE_COORDS_ATTR);
diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
index 9bc81ef..afbc918 100644
--- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h
@@ -257,7 +257,7 @@ static const GLuint QT_TEXTURE_COORDS_ATTR = 1;
class QGLEngineShaderManager : public QObject
{
- Q_OBJECT;
+ Q_OBJECT
public:
QGLEngineShaderManager(QGLContext* context);
~QGLEngineShaderManager();
@@ -352,7 +352,7 @@ public:
*/
#if defined (QT_DEBUG)
- Q_ENUMS(ShaderName);
+ Q_ENUMS(ShaderName)
#endif
diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
index 920d0bc..70cc67e 100644
--- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h
+++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h
@@ -84,16 +84,20 @@ static const char* const qglslMainWithTexCoordsVertexShader = "\
static const char* const qglslPositionOnlyVertexShader = "\
attribute highp vec4 vertexCoordsArray;\
uniform highp mat4 pmvMatrix;\
+ uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
+ gl_Position.z = depth;\
}";
static const char* const qglslUntransformedPositionVertexShader = "\
attribute highp vec4 vertexCoordsArray;\
+ uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = vertexCoordsArray;\
+ gl_Position.z = depth;\
}";
// Pattern Brush - This assumes the texture size is 8x8 and thus, the inverted size is 0.125
@@ -104,9 +108,11 @@ static const char* const qglslPositionWithPatternBrushVertexShader = "\
uniform mediump vec2 invertedTextureSize; \
uniform mediump mat3 brushTransform; \
varying mediump vec2 patternTexCoords; \
+ uniform highp float depth;\
void setPosition(void) { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ gl_Position.z = depth;\
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -136,9 +142,11 @@ static const char* const qglslPositionWithLinearGradientBrushVertexShader = "\
uniform highp vec3 linearData; \
uniform highp mat3 brushTransform; \
varying mediump float index ; \
+ uniform highp float depth;\
void setPosition() { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ gl_Position.z = depth;\
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -166,10 +174,12 @@ static const char* const qglslPositionWithConicalGradientBrushVertexShader = "\
uniform mediump vec2 halfViewportSize; \
uniform highp mat3 brushTransform; \
varying highp vec2 A; \
+ uniform highp float depth;\
void setPosition(void)\
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -205,10 +215,12 @@ static const char* const qglslPositionWithRadialGradientBrushVertexShader = "\
uniform highp vec2 fmp; \
varying highp float b; \
varying highp vec2 A; \
+ uniform highp float depth;\
void setPosition(void) \
{\
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
@@ -242,9 +254,11 @@ static const char* const qglslPositionWithTextureBrushVertexShader = "\
uniform mediump vec2 invertedTextureSize; \
uniform mediump mat3 brushTransform; \
varying mediump vec2 brushTextureCoords; \
+ uniform highp float depth;\
void setPosition(void) { \
gl_Position = pmvMatrix * vertexCoordsArray;\
gl_Position.xy = gl_Position.xy / gl_Position.w; \
+ gl_Position.z = depth; \
mediump vec2 viewportCoords = (gl_Position.xy + 1.0) * halfViewportSize; \
mediump vec3 hTexCoords = brushTransform * vec3(viewportCoords, 1); \
mediump float invertedHTexCoordsZ = 1.0 / hTexCoords.z; \
diff --git a/src/opengl/gl2paintengineex/qglgradientcache_p.h b/src/opengl/gl2paintengineex/qglgradientcache_p.h
index 9bf58c7..f088359 100644
--- a/src/opengl/gl2paintengineex/qglgradientcache_p.h
+++ b/src/opengl/gl2paintengineex/qglgradientcache_p.h
@@ -52,7 +52,7 @@
#include <QMultiHash>
#include <QObject>
-#include <QtOpenGL>
+#include <QtOpenGL/QtOpenGL>
QT_BEGIN_NAMESPACE
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 868adcf..bdea187 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -183,8 +183,8 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height)
pex->transferMode(BrushDrawingMode);
- glDisable(GL_SCISSOR_TEST);
glDisable(GL_DEPTH_TEST);
+ glDisable(GL_SCISSOR_TEST);
glViewport(0, 0, oldWidth, oldHeight);
@@ -217,7 +217,7 @@ void QGLTextureGlyphCache::resizeTextureData(int width, int height)
glBindFramebuffer(GL_FRAMEBUFFER_EXT, ctx->d_ptr->current_fbo);
glViewport(0, 0, pex->width, pex->height);
- pex->updateDepthClip();
+ pex->updateDepthScissorTest();
}
void QGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph)
@@ -297,6 +297,11 @@ void QGL2PaintEngineExPrivate::useSimpleShader()
shaderManager->simpleProgram()->setUniformValue("pmvMatrix", pmvMatrix);
simpleShaderMatrixUniformDirty = false;
}
+
+ if (simpleShaderDepthUniformDirty) {
+ shaderManager->simpleProgram()->setUniformValue("depth", (GLfloat)q->state()->currentDepth);
+ simpleShaderDepthUniformDirty = false;
+ }
}
@@ -709,6 +714,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
if (path.shape() == QVectorPath::RectangleHint) {
QGLRect rect(points[0].x(), points[0].y(), points[2].x(), points[2].y());
prepareForDraw(currentBrush->isOpaque());
+
composite(rect);
}
else if (path.shape() == QVectorPath::EllipseHint) {
@@ -726,12 +732,14 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
// Stencil the brush onto the dest buffer
glStencilFunc(GL_NOTEQUAL, 0, 0xFFFF); // Pass if stencil buff value != 0
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+
glEnable(GL_STENCIL_TEST);
prepareForDraw(currentBrush->isOpaque());
composite(vertexCoordinateArray.boundingRect());
glDisable(GL_STENCIL_TEST);
- cleanStencilBuffer(vertexCoordinateArray.boundingRect());
+ glStencilMask(0);
}
}
@@ -739,17 +747,17 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path)
void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill)
{
// qDebug("QGL2PaintEngineExPrivate::fillStencilWithVertexArray()");
- if (stencilBuferDirty) {
+ glStencilMask(0xFFFF); // Enable stencil writes
+
+ if (stencilBufferDirty) {
// Clear the stencil buffer to zeros
glDisable(GL_STENCIL_TEST);
- glStencilMask(0xFFFF); // Enable writing to stencil buffer, otherwise glClear wont do anything.
glClearStencil(0); // Clear to zero
glClear(GL_STENCIL_BUFFER_BIT);
- stencilBuferDirty = false;
+ stencilBufferDirty = false;
}
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes
- glStencilMask(0xFFFF); // Enable stencil writes
glStencilFunc(GL_ALWAYS, 0, 0xFFFF); // Always pass the stencil test
// Setup the stencil op:
@@ -759,7 +767,7 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve
} else
glStencilOp(GL_KEEP, GL_KEEP, GL_INVERT); // Simply invert the stencil bit
- // No point in using a fancy gradiant shader for writing into the stencil buffer!
+ // No point in using a fancy gradient shader for writing into the stencil buffer!
useSimpleShader();
glEnable(GL_STENCIL_TEST); // For some reason, this has to happen _after_ the simple shader is use()'d
@@ -770,41 +778,6 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve
// Enable color writes & disable stencil writes
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glStencilMask(0);
-}
-
-void QGL2PaintEngineExPrivate::cleanStencilBuffer(const QGLRect& area)
-{
-// qDebug("QGL2PaintEngineExPrivate::cleanStencilBuffer()");
- useSimpleShader();
-
- GLfloat rectVerts[] = {
- area.left, area.top,
- area.left, area.bottom,
- area.right, area.bottom,
- area.right, area.top
- };
-
- glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
- glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, rectVerts);
-
- glEnable(GL_STENCIL_TEST);
- glStencilFunc(GL_ALWAYS, 0, 0xFFFF); // Always pass the stencil test
-
- glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); // Disable color writes
- glStencilMask(0xFFFF); // Enable writing to stencil buffer
- glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); // Write 0's to stencil buffer
-
- glDisable(GL_BLEND);
-
- glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-
- glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR);
-
- // Enable color writes & disable stencil writes
- glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
- glStencilMask(0);
- glDisable(GL_STENCIL_TEST);
}
void QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
@@ -843,6 +816,7 @@ void QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
// The shader program has changed so mark all uniforms as dirty:
brushUniformsDirty = true;
shaderMatrixUniformDirty = true;
+ depthUniformDirty = true;
}
if (brushUniformsDirty && mode != ImageDrawingMode)
@@ -853,6 +827,11 @@ void QGL2PaintEngineExPrivate::prepareForDraw(bool srcPixelsAreOpaque)
shaderMatrixUniformDirty = false;
}
+ if (depthUniformDirty) {
+ shaderManager->currentProgram()->setUniformValue("depth", (GLfloat)q->state()->currentDepth);
+ depthUniformDirty = false;
+ }
+
if (useGlobalOpacityUniform)
shaderManager->currentProgram()->setUniformValue("globalOpacity", (GLfloat)q->state()->opacity);
}
@@ -1062,7 +1041,6 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(const QPointF &p, const QTextIte
matrix.translate(p.x(), p.y());
ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
-
QFontEngineGlyphCache::Type glyphType = ti.fontEngine->glyphFormat >= 0
? QFontEngineGlyphCache::Type(ti.fontEngine->glyphFormat)
: QFontEngineGlyphCache::Raster_A8;
@@ -1146,6 +1124,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
}
d->ctx->d_ptr->active_engine = this;
+ d->last_created_state = 0;
d->drawable.makeCurrent();
QSize sz = d->drawable.size();
@@ -1172,12 +1151,16 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->brushUniformsDirty = true;
d->matrixDirty = true;
d->compositionModeDirty = true;
- d->stencilBuferDirty = true;
+ d->stencilBufferDirty = true;
+ d->simpleShaderDepthUniformDirty = true;
+ d->depthUniformDirty = true;
d->use_system_clip = !systemClip().isEmpty();
glDisable(GL_DEPTH_TEST);
glDisable(GL_SCISSOR_TEST);
+ glDepthFunc(GL_LEQUAL);
+ glDepthMask(false);
QGLPixmapData *source = d->drawable.copyOnBegin();
if (d->drawable.context()->d_func()->clear_on_painter_begin && d->drawable.autoFillBackground()) {
@@ -1201,7 +1184,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev)
d->drawTexture(QRectF(rect), QRectF(rect), rect.size(), true);
}
- updateClipRegion(QRegion(), Qt::NoClip);
+ d->systemStateChanged();
return true;
}
@@ -1245,260 +1228,297 @@ void QGL2PaintEngineEx::ensureActive()
ctx->d_ptr->active_engine = this;
glDisable(GL_DEPTH_TEST);
- glDisable(GL_SCISSOR_TEST);
glViewport(0, 0, d->width, d->height);
+
setState(state());
- d->updateDepthClip();
}
}
+void QGL2PaintEngineExPrivate::updateDepthScissorTest()
+{
+ Q_Q(QGL2PaintEngineEx);
+ if (q->state()->depthTestEnabled)
+ glEnable(GL_DEPTH_TEST);
+ else
+ glDisable(GL_DEPTH_TEST);
-/////////////////////////////////// State/Clipping stolen from QOpenGLPaintEngine //////////////////////////////////////////
+ if (q->state()->scissorTestEnabled)
+ glEnable(GL_SCISSOR_TEST);
+ else
+ glDisable(GL_SCISSOR_TEST);
+}
void QGL2PaintEngineEx::clipEnabledChanged()
{
Q_D(QGL2PaintEngineEx);
- d->updateDepthClip();
+ d->simpleShaderDepthUniformDirty = true;
+ d->depthUniformDirty = true;
+
+ if (painter()->hasClipping()) {
+ d->regenerateDepthClip();
+ } else {
+ if (d->use_system_clip) {
+ state()->currentDepth = -0.5f;
+ } else {
+ glDisable(GL_DEPTH_TEST);
+ state()->depthTestEnabled = false;
+ }
+ }
}
-void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
+void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, float depth)
{
-// qDebug("QGL2PaintEngineEx::clip()");
- const qreal *points = path.points();
- const QPainterPath::ElementType *types = path.elements();
- if (!types && path.shape() == QVectorPath::RectangleHint) {
- QRectF r(points[0], points[1], points[4]-points[0], points[5]-points[1]);
- updateClipRegion(QRegion(r.toRect()), op);
- return;
- }
+ transferMode(BrushDrawingMode);
- QPainterPath p;
- if (types) {
- int id = 0;
- for (int i=0; i<path.elementCount(); ++i) {
- switch(types[i]) {
- case QPainterPath::MoveToElement:
- p.moveTo(QPointF(points[id], points[id+1]));
- id+=2;
- break;
- case QPainterPath::LineToElement:
- p.lineTo(QPointF(points[id], points[id+1]));
- id+=2;
- break;
- case QPainterPath::CurveToElement: {
- QPointF p1(points[id], points[id+1]);
- QPointF p2(points[id+2], points[id+3]);
- QPointF p3(points[id+4], points[id+5]);
- p.cubicTo(p1, p2, p3);
- id+=6;
- break;
- }
- case QPainterPath::CurveToDataElement:
- ;
- break;
- }
- }
- } else if (!path.isEmpty()) {
- p.moveTo(QPointF(points[0], points[1]));
- int id = 2;
- for (int i=1; i<path.elementCount(); ++i) {
- p.lineTo(QPointF(points[id], points[id+1]));
- id+=2;
- }
+ if (matrixDirty)
+ updateMatrix();
+
+ if (q->state()->needsDepthBufferClear) {
+ glDepthMask(true);
+ glClearDepth(0.5);
+ glClear(GL_DEPTH_BUFFER_BIT);
+ q->state()->needsDepthBufferClear = false;
+ glDepthMask(false);
}
- if (path.hints() & QVectorPath::WindingFill)
- p.setFillRule(Qt::WindingFill);
- updateClipRegion(QRegion(p.toFillPolygon().toPolygon(), p.fillRule()), op);
- return;
+ if (path.isEmpty())
+ return;
+
+ glDisable(GL_BLEND);
+ glDepthMask(false);
+
+ vertexCoordinateArray.clear();
+ vertexCoordinateArray.addPath(path, inverseScale);
+
+ glDepthMask(GL_FALSE);
+ fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill());
+
+ // Stencil the clip onto the clip buffer
+ glColorMask(false, false, false, false);
+ glDepthMask(true);
+
+ shaderManager->simpleProgram()->setUniformValue("depth", depth);
+ simpleShaderDepthUniformDirty = true;
+
+ glEnable(GL_DEPTH_TEST);
+ glDepthFunc(GL_ALWAYS);
+
+ glStencilFunc(GL_NOTEQUAL, 0, 0xFFFF); // Pass if stencil buff value != 0
+ glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
+
+ glEnable(GL_STENCIL_TEST);
+ composite(vertexCoordinateArray.boundingRect());
+ glDisable(GL_STENCIL_TEST);
+
+ glStencilMask(0);
+
+ glColorMask(true, true, true, true);
+ glDepthMask(false);
}
-void QGL2PaintEngineEx::updateClipRegion(const QRegion &clipRegion, Qt::ClipOperation op)
+void QGL2PaintEngineEx::clip(const QVectorPath &path, Qt::ClipOperation op)
{
-// qDebug("QGL2PaintEngineEx::updateClipRegion()");
+// qDebug("QGL2PaintEngineEx::clip()");
Q_D(QGL2PaintEngineEx);
- QRegion sysClip = systemClip();
- if (op == Qt::NoClip && !d->use_system_clip) {
- state()->hasClipping = false;
- state()->clipRegion = QRegion();
- d->updateDepthClip();
- return;
- }
+ if (op == Qt::ReplaceClip && !d->hasClipOperations())
+ op = Qt::IntersectClip;
- bool isScreenClip = false;
- if (!d->use_system_clip) {
- QVector<QRect> untransformedRects = clipRegion.rects();
+ if (!path.isEmpty() && op == Qt::IntersectClip && (path.hints() & QVectorPath::RectangleHint)) {
+ const QPointF* const points = reinterpret_cast<const QPointF*>(path.points());
+ QRectF rect(points[0], points[2]);
- if (untransformedRects.size() == 1) {
- QPainterPath path;
- path.addRect(untransformedRects[0]);
- //path = d->matrix.map(path);
- path = state()->matrix.map(path);
-
-// if (path.contains(QRectF(QPointF(), d->drawable.size())))
-// isScreenClip = true;
- if (path.contains(QRectF(0.0, 0.0, d->width, d->height)))
- isScreenClip = true;
+ if (state()->matrix.type() <= QTransform::TxScale) {
+ rect = state()->matrix.mapRect(rect);
+
+ if (d->use_system_clip && rect.contains(d->systemClip.boundingRect())
+ || rect.contains(QRect(0, 0, d->width, d->height)))
+ return;
}
}
-// QRegion region = isScreenClip ? QRegion() : clipRegion * d->matrix;
- QRegion region = isScreenClip ? QRegion() : clipRegion * state()->matrix;
switch (op) {
case Qt::NoClip:
- if (!d->use_system_clip)
- break;
- state()->clipRegion = sysClip;
+ if (d->use_system_clip) {
+ glEnable(GL_DEPTH_TEST);
+ state()->depthTestEnabled = true;
+ state()->currentDepth = -0.5;
+ } else {
+ glDisable(GL_DEPTH_TEST);
+ state()->depthTestEnabled = false;
+ }
+ state()->canRestoreClip = false;
break;
case Qt::IntersectClip:
- if (isScreenClip)
- return;
- if (state()->hasClipping) {
- state()->clipRegion &= region;
- break;
- }
- // fall through
+ state()->maxDepth = (1.0f + state()->maxDepth) * 0.5;
+ d->writeClip(path, state()->maxDepth);
+ state()->currentDepth = 1.5 * state()->maxDepth - 0.5f;
+ state()->depthTestEnabled = true;
+ break;
case Qt::ReplaceClip:
- if (d->use_system_clip && !sysClip.isEmpty())
- state()->clipRegion = region & sysClip;
- else
- state()->clipRegion = region;
+ d->systemStateChanged();
+ state()->maxDepth = 0.5f;
+ glDepthFunc(GL_ALWAYS);
+ d->writeClip(path, state()->maxDepth);
+ state()->currentDepth = 0.25f;
+ state()->canRestoreClip = false;
+ state()->depthTestEnabled = true;
break;
case Qt::UniteClip:
- state()->clipRegion |= region;
- if (d->use_system_clip && !sysClip.isEmpty())
- state()->clipRegion &= sysClip;
- break;
- default:
+ glDepthFunc(GL_ALWAYS);
+ d->writeClip(path, state()->maxDepth);
+ state()->canRestoreClip = false;
+ state()->depthTestEnabled = true;
break;
}
- if (isScreenClip) {
- state()->hasClipping = false;
- state()->clipRegion = QRegion();
- } else {
- state()->hasClipping = op != Qt::NoClip || d->use_system_clip;
+ glDepthFunc(GL_LEQUAL);
+ if (state()->depthTestEnabled) {
+ glEnable(GL_DEPTH_TEST);
+ d->simpleShaderDepthUniformDirty = true;
+ d->depthUniformDirty = true;
}
-
- d->updateDepthClip();
}
-void QGL2PaintEngineExPrivate::systemStateChanged()
+void QGL2PaintEngineExPrivate::regenerateDepthClip()
{
- Q_Q(QGL2PaintEngineEx);
- use_system_clip = !systemClip.isEmpty();
-
- if (q->painter()->hasClipping())
- q->updateClipRegion(q->painter()->clipRegion(), Qt::ReplaceClip);
- else
- q->updateClipRegion(QRegion(), Qt::NoClip);
+ systemStateChanged();
+ replayClipOperations();
}
-void QGL2PaintEngineExPrivate::updateDepthClip()
+void QGL2PaintEngineExPrivate::systemStateChanged()
{
-// qDebug("QGL2PaintEngineExPrivate::updateDepthClip()");
-
Q_Q(QGL2PaintEngineEx);
+ use_system_clip = !systemClip.isEmpty();
- q->ensureActive();
glDisable(GL_DEPTH_TEST);
+ q->state()->depthTestEnabled = false;
+ q->state()->scissorTestEnabled = false;
+ q->state()->needsDepthBufferClear = true;
+
glDisable(GL_SCISSOR_TEST);
- if (!q->state()->hasClipping)
- return;
+ q->state()->currentDepth = -0.5f;
+ q->state()->maxDepth = 0.5f;
- const QVector<QRect> rects = q->state()->clipEnabled ? q->state()->clipRegion.rects() : q->systemClip().rects();
- if (rects.size() == 1) {
- QRect fastClip = rects.at(0);
+ if (use_system_clip) {
+ QRect bounds = systemClip.boundingRect();
+ if (systemClip.numRects() == 1
+ && bounds == QRect(0, 0, width, height))
+ {
+ q->state()->needsDepthBufferClear = true;
+ } else {
+ glEnable(GL_SCISSOR_TEST);
- glEnable(GL_SCISSOR_TEST);
+ const int left = bounds.left();
+ const int width = bounds.width();
+ const int bottom = height - (bounds.top() + bounds.height());
+ const int height = bounds.height();
- const int left = fastClip.left();
- const int width = fastClip.width();
- const int bottom = height - (fastClip.bottom() + 1);
- const int height = fastClip.height();
+ glScissor(left, bottom, width, height);
- glScissor(left, bottom, width, height);
- return;
- }
+ QTransform transform = q->state()->matrix;
+ q->state()->matrix = QTransform();
+ q->transformChanged();
- glClearDepth(0x0);
- glDepthMask(true);
- glClear(GL_DEPTH_BUFFER_BIT);
- glClearDepth(0x1);
+ q->state()->needsDepthBufferClear = false;
- glEnable(GL_SCISSOR_TEST);
- for (int i = 0; i < rects.size(); ++i) {
- QRect rect = rects.at(i);
+ glDepthMask(true);
- const int left = rect.left();
- const int width = rect.width();
- const int bottom = height - (rect.bottom() + 1);
- const int height = rect.height();
+ glClearDepth(0);
+ glClear(GL_DEPTH_BUFFER_BIT);
- glScissor(left, bottom, width, height);
+ QPainterPath path;
+ path.addRegion(systemClip);
- glClear(GL_DEPTH_BUFFER_BIT);
- }
- glDisable(GL_SCISSOR_TEST);
+ glDepthFunc(GL_ALWAYS);
+ writeClip(qtVectorPathForPath(path), 0.0f);
+ glDepthFunc(GL_LEQUAL);
- glDepthMask(false);
- glDepthFunc(GL_LEQUAL);
- glEnable(GL_DEPTH_TEST);
-}
+ glEnable(GL_DEPTH_TEST);
+ q->state()->depthTestEnabled = true;
+ q->state()->scissorTestEnabled = true;
+ q->state()->matrix = transform;
+ q->transformChanged();
+ }
+ q->state()->currentDepth = -0.5f;
+ simpleShaderDepthUniformDirty = true;
+ depthUniformDirty = true;
+ }
+}
void QGL2PaintEngineEx::setState(QPainterState *new_state)
{
-// qDebug("QGL2PaintEngineEx::setState()");
+ // qDebug("QGL2PaintEngineEx::setState()");
Q_D(QGL2PaintEngineEx);
QOpenGL2PaintEngineState *s = static_cast<QOpenGL2PaintEngineState *>(new_state);
-
QOpenGL2PaintEngineState *old_state = state();
- const bool needsDepthClipUpdate = !old_state
- || s->clipEnabled != old_state->clipEnabled
- || (s->clipEnabled && s->clipRegion != old_state->clipRegion);
QPaintEngineEx::setState(s);
- if (needsDepthClipUpdate)
- d->updateDepthClip();
+ if (s == d->last_created_state) {
+ d->last_created_state = 0;
+ return;
+ }
d->matrixDirty = true;
d->compositionModeDirty = true;
d->brushTextureDirty = true;
d->brushUniformsDirty = true;
+ d->simpleShaderDepthUniformDirty = true;
+ d->depthUniformDirty = true;
d->simpleShaderMatrixUniformDirty = true;
d->shaderMatrixUniformDirty = true;
+
+ if (old_state && old_state != s && old_state->canRestoreClip) {
+ d->updateDepthScissorTest();
+ glDepthMask(false);
+ glDepthFunc(GL_LEQUAL);
+ s->maxDepth = old_state->maxDepth;
+ } else {
+ d->regenerateDepthClip();
+ }
}
QPainterState *QGL2PaintEngineEx::createState(QPainterState *orig) const
{
+ Q_D(const QGL2PaintEngineEx);
+
QOpenGL2PaintEngineState *s;
if (!orig)
s = new QOpenGL2PaintEngineState();
else
s = new QOpenGL2PaintEngineState(*static_cast<QOpenGL2PaintEngineState *>(orig));
+ d->last_created_state = s;
return s;
}
QOpenGL2PaintEngineState::QOpenGL2PaintEngineState(QOpenGL2PaintEngineState &other)
: QPainterState(other)
{
- clipRegion = other.clipRegion;
- hasClipping = other.hasClipping;
+ needsDepthBufferClear = other.needsDepthBufferClear;
+ depthTestEnabled = other.depthTestEnabled;
+ scissorTestEnabled = other.scissorTestEnabled;
+ currentDepth = other.currentDepth;
+ maxDepth = other.maxDepth;
+ canRestoreClip = other.canRestoreClip;
}
QOpenGL2PaintEngineState::QOpenGL2PaintEngineState()
{
- hasClipping = false;
+ needsDepthBufferClear = true;
+ depthTestEnabled = false;
+ scissorTestEnabled = false;
+ currentDepth = -0.5f;
+ maxDepth = 0.5f;
+ canRestoreClip = true;
}
QOpenGL2PaintEngineState::~QOpenGL2PaintEngineState()
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
index 7213474..db39ced 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h
@@ -77,8 +77,15 @@ public:
QOpenGL2PaintEngineState();
~QOpenGL2PaintEngineState();
- QRegion clipRegion;
- bool hasClipping;
+ bool needsDepthBufferClear;
+ qreal depthBufferClearValue;
+
+ bool depthTestEnabled;
+ bool scissorTestEnabled;
+ qreal currentDepth;
+ qreal maxDepth;
+
+ bool canRestoreClip;
};
@@ -116,7 +123,6 @@ public:
Type type() const { return OpenGL; }
- // State stuff is just for clipping and ripped off from QGLPaintEngine
void setState(QPainterState *s);
QPainterState *createState(QPainterState *orig) const;
inline QOpenGL2PaintEngineState *state() {
@@ -125,7 +131,6 @@ public:
inline const QOpenGL2PaintEngineState *state() const {
return static_cast<const QOpenGL2PaintEngineState *>(QPaintEngineEx::state());
}
- void updateClipRegion(const QRegion &clipRegion, Qt::ClipOperation op);
virtual void sync();
private:
@@ -169,7 +174,6 @@ public:
// ^ Composites the bounding rect onto dest buffer
void fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill);
// ^ Calls drawVertexArrays to render into stencil buffer
- void cleanStencilBuffer(const QGLRect& area);
void prepareForDraw(bool srcPixelsAreOpaque);
@@ -180,9 +184,10 @@ public:
QGLDrawable drawable;
int width, height;
QGLContext *ctx;
-
EngineMode mode;
+ mutable QOpenGL2PaintEngineState *last_created_state;
+
// Dirty flags
bool matrixDirty; // Implies matrix uniforms are also dirty
bool compositionModeDirty;
@@ -190,7 +195,9 @@ public:
bool brushUniformsDirty;
bool simpleShaderMatrixUniformDirty;
bool shaderMatrixUniformDirty;
- bool stencilBuferDirty;
+ bool stencilBufferDirty;
+ bool depthUniformDirty;
+ bool simpleShaderDepthUniformDirty;
const QBrush* currentBrush; // May not be the state's brush!
@@ -206,8 +213,9 @@ public:
QGLEngineShaderManager* shaderManager;
- // Clipping & state stuff stolen from QOpenGLPaintEngine:
- void updateDepthClip();
+ void writeClip(const QVectorPath &path, float depth);
+ void updateDepthScissorTest();
+ void regenerateDepthClip();
void systemStateChanged();
uint use_system_clip : 1;
};
diff --git a/src/opengl/qegl.cpp b/src/opengl/qegl.cpp
index f1ae4ed..290f77c 100644
--- a/src/opengl/qegl.cpp
+++ b/src/opengl/qegl.cpp
@@ -413,12 +413,18 @@ int QEglProperties::value(int name) const
case EGL_RED_SIZE: return 0;
case EGL_GREEN_SIZE: return 0;
case EGL_BLUE_SIZE: return 0;
- case EGL_LUMINANCE_SIZE: return 0;
case EGL_ALPHA_SIZE: return 0;
+#if defined(EGL_LUMINANCE_SIZE)
+ case EGL_LUMINANCE_SIZE: return 0;
+#endif
+#if defined(EGL_ALPHA_MASK_SIZE)
case EGL_ALPHA_MASK_SIZE: return 0;
+#endif
case EGL_BIND_TO_TEXTURE_RGB: return EGL_DONT_CARE;
case EGL_BIND_TO_TEXTURE_RGBA: return EGL_DONT_CARE;
+#if defined(EGL_COLOR_BUFFER_TYPE)
case EGL_COLOR_BUFFER_TYPE: return EGL_RGB_BUFFER;
+#endif
case EGL_CONFIG_CAVEAT: return EGL_DONT_CARE;
case EGL_CONFIG_ID: return EGL_DONT_CARE;
case EGL_DEPTH_SIZE: return 0;
@@ -427,7 +433,9 @@ int QEglProperties::value(int name) const
case EGL_NATIVE_VISUAL_TYPE: return EGL_DONT_CARE;
case EGL_MAX_SWAP_INTERVAL: return EGL_DONT_CARE;
case EGL_MIN_SWAP_INTERVAL: return EGL_DONT_CARE;
+#if defined(EGL_RENDERABLE_TYPE)
case EGL_RENDERABLE_TYPE: return EGL_OPENGL_ES_BIT;
+#endif
case EGL_SAMPLE_BUFFERS: return 0;
case EGL_SAMPLES: return 0;
case EGL_STENCIL_SIZE: return 0;
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 60039eb..146d088 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -65,12 +65,19 @@
#include "qimage.h"
#include "qgl_p.h"
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
#include "gl2paintengineex/qpaintengineex_opengl2_p.h"
+#endif
#ifndef QT_OPENGL_ES_2
#include <private/qpaintengine_opengl_p.h>
#endif
+#ifdef Q_WS_QWS
+#include <private/qglpaintdevice_qws_p.h>
+#include <private/qglwindowsurface_qws_p.h>
+#endif
+
#include <qglpixelbuffer.h>
#include <qglframebufferobject.h>
@@ -1456,7 +1463,7 @@ struct DDSFormat {
#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
#endif
-Q_GLOBAL_STATIC(QGLShareRegister, _qgl_share_reg);
+Q_GLOBAL_STATIC(QGLShareRegister, _qgl_share_reg)
Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg()
{
return _qgl_share_reg();
@@ -2609,7 +2616,7 @@ const QGLContext* QGLContext::currentContext()
*/
/*! \fn int QGLContext::choosePixelFormat(void* dummyPfd, HDC pdc)
-
+
\bold{Win32 only:} This virtual function chooses a pixel format
that matches the OpenGL \link setFormat() format\endlink.
Reimplement this function in a subclass if you need a custom
@@ -2623,7 +2630,7 @@ const QGLContext* QGLContext::currentContext()
*/
/*! \fn void *QGLContext::chooseVisual()
-
+
\bold{X11 only:} This virtual function tries to find a visual that
matches the format, reducing the demands if the original request
cannot be met.
@@ -4354,7 +4361,7 @@ void QGLWidgetPrivate::initContext(QGLContext *context, const QGLWidget* shareWi
}
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
-Q_GLOBAL_STATIC(QString, qt_gl_lib_name);
+Q_GLOBAL_STATIC(QString, qt_gl_lib_name)
Q_OPENGL_EXPORT void qt_set_gl_library_name(const QString& name)
{
@@ -4428,7 +4435,11 @@ void QGLDrawable::swapBuffers()
void QGLDrawable::makeCurrent()
{
previous_fbo = 0;
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
if (!pixmapData && !fbo) {
+#else
+ if (!fbo) {
+#endif
QGLContext *ctx = context();
previous_fbo = ctx->d_ptr->current_fbo;
ctx->d_ptr->current_fbo = 0;
@@ -4561,8 +4572,10 @@ QColor QGLDrawable::backgroundColor() const
{
if (widget)
return widget->palette().brush(widget->backgroundRole()).color();
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
else if (pixmapData)
return pixmapData->fillColor();
+#endif
return QApplication::palette().brush(QPalette::Background).color();
}
@@ -4590,8 +4603,10 @@ bool QGLDrawable::autoFillBackground() const
{
if (widget)
return widget->autoFillBackground();
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
else if (pixmapData)
return pixmapData->needsFill();
+#endif
else
return false;
}
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index b3523d4..4af8598 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -428,8 +428,7 @@ private:
extern Q_OPENGL_EXPORT QGLShareRegister* qgl_share_reg();
#ifdef Q_WS_QWS
-class QOpenGLPaintEngine;
-extern QOpenGLPaintEngine* qt_qgl_paint_engine();
+extern QPaintEngine* qt_qgl_paint_engine();
extern EGLDisplay qt_qgl_egl_display();
#endif
diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp
index 28a50bd..da61634 100644
--- a/src/opengl/qgl_x11.cpp
+++ b/src/opengl/qgl_x11.cpp
@@ -129,7 +129,7 @@ struct QGLCMapCleanupHandler {
CMapEntryHash *cmap_hash;
GLCMapHash *qglcmap_hash;
};
-Q_GLOBAL_STATIC(QGLCMapCleanupHandler, cmap_handler);
+Q_GLOBAL_STATIC(QGLCMapCleanupHandler, cmap_handler)
static void cleanup_cmaps()
{
diff --git a/src/opengl/qglextensions.cpp b/src/opengl/qglextensions.cpp
index 3c198fb..10ca613 100644
--- a/src/opengl/qglextensions.cpp
+++ b/src/opengl/qglextensions.cpp
@@ -337,6 +337,9 @@ bool qt_resolve_version_2_0_functions(QGLContext *ctx)
if (!qt_resolve_version_1_3_functions(ctx))
gl2supported = false;
+ if (!qt_resolve_framebufferobject_extensions(ctx))
+ gl2supported = false;
+
if (glStencilOpSeparate)
return gl2supported;
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 3e7ca0a..fb16107 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -43,7 +43,9 @@
#include <qdebug.h>
#include <private/qgl_p.h>
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
#include <private/qpaintengineex_opengl2_p.h>
+#endif
#ifndef QT_OPENGL_ES_2
#include <private/qpaintengine_opengl_p.h>
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 483856a..9b7a506 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -76,7 +76,11 @@
\sa {opengl/pbuffers}{Pbuffers Example}
*/
+#include <QtCore/qglobal.h>
+
+#if !defined(QT_OPENGL_ES_1) && !defined(QT_OPENGL_ES_1_CL)
#include <private/qpaintengineex_opengl2_p.h>
+#endif
#include <qglpixelbuffer.h>
#include <private/qglpixelbuffer_p.h>
diff --git a/src/opengl/qglshaderprogram.h b/src/opengl/qglshaderprogram.h
index ab30c32..06bff42 100644
--- a/src/opengl/qglshaderprogram.h
+++ b/src/opengl/qglshaderprogram.h
@@ -103,7 +103,7 @@ private:
friend class QGLShaderProgram;
- Q_DISABLE_COPY(QGLShader);
+ Q_DISABLE_COPY(QGLShader)
};
class QGLShaderProgramPrivate;
@@ -279,7 +279,7 @@ public:
private:
QGLShaderProgramPrivate *d;
- Q_DISABLE_COPY(QGLShaderProgram);
+ Q_DISABLE_COPY(QGLShaderProgram)
bool init();
};
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 8d94c8b..98c406b 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -389,6 +389,11 @@ QPaintEngine* QGLPixmapData::paintEngine() const
sz.setWidth(qMax(m_width, qRound(sz.width() * 1.5)));
if (sz.height() < m_height)
sz.setHeight(qMax(m_height, qRound(sz.height() * 1.5)));
+
+ // wasting too much space?
+ if (sz.width() * sz.height() > m_width * m_height * 2.5)
+ sz = QSize(m_width, m_height);
+
delete textureBufferStack.at(currentTextureBuffer).fbo;
textureBufferStack[currentTextureBuffer] =
createTextureBuffer(sz, textureBufferStack.at(currentTextureBuffer).engine);
diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h
index ecf0bf8..d4b54d4 100644
--- a/src/opengl/util/fragmentprograms_p.h
+++ b/src/opengl/util/fragmentprograms_p.h
@@ -71,7 +71,7 @@ enum FragmentVariable {
VAR_FMP2_M_RADIUS2,
VAR_FMP,
VAR_INV_MATRIX_M0,
- VAR_ANGLE,
+ VAR_ANGLE
};
enum FragmentBrushType {
@@ -80,7 +80,7 @@ enum FragmentBrushType {
FRAGMENT_PROGRAM_BRUSH_CONICAL,
FRAGMENT_PROGRAM_BRUSH_LINEAR,
FRAGMENT_PROGRAM_BRUSH_TEXTURE,
- FRAGMENT_PROGRAM_BRUSH_PATTERN,
+ FRAGMENT_PROGRAM_BRUSH_PATTERN
};
enum FragmentCompositionModeType {
@@ -109,12 +109,12 @@ enum FragmentCompositionModeType {
COMPOSITION_MODES_DIFFERENCE_NOMASK,
COMPOSITION_MODES_EXCLUSION_NOMASK,
COMPOSITION_MODE_BLEND_MODE_MASK,
- COMPOSITION_MODE_BLEND_MODE_NOMASK,
+ COMPOSITION_MODE_BLEND_MODE_NOMASK
};
enum FragmentMaskType {
FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA,
- FRAGMENT_PROGRAM_MASK_ELLIPSE_AA,
+ FRAGMENT_PROGRAM_MASK_ELLIPSE_AA
};
static const unsigned int num_fragment_variables = 19;
diff --git a/src/opengl/util/generator.cpp b/src/opengl/util/generator.cpp
index dac5a2d..430ced1 100644
--- a/src/opengl/util/generator.cpp
+++ b/src/opengl/util/generator.cpp
@@ -48,6 +48,7 @@
#include <QTextStream>
#include <QtDebug>
+#include <cstdlib>
QT_BEGIN_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index dba1b51..18754f5 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -202,11 +202,12 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
}
IDirectFBSurface *src = static_cast<const QDirectFBPixmapData*>(data)->directFBSurface();
- const bool hasAlpha = data->hasAlphaChannel();
- format = (hasAlpha
+ alpha = data->hasAlphaChannel();
+ format = (alpha
? QDirectFBScreen::instance()->alphaPixmapFormat()
: QDirectFBScreen::instance()->pixelFormat());
+
dfbSurface = screen->createDFBSurface(rect.size(), format,
QDirectFBScreen::TrackSurface);
if (!dfbSurface) {
@@ -215,7 +216,7 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
return;
}
- if (hasAlpha) {
+ if (alpha) {
dfbSurface->Clear(dfbSurface, 0, 0, 0, 0);
dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL);
} else {
diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
index 6d0bc1f..088ef97 100644
--- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp
+++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp
@@ -781,7 +781,8 @@ static bool read_jpeg_image(QIODevice *device, QImage *outImage,
#ifndef QT_NO_IMAGE_SMOOTHSCALE
// If high quality not required, shrink image during decompression
- if (scaledSize.isValid() && quality < HIGH_QUALITY_THRESHOLD && !params.contains(QLatin1String("GetHeaderInformation")) ) {
+ if (scaledSize.isValid() && !scaledSize.isEmpty() && quality < HIGH_QUALITY_THRESHOLD
+ && !params.contains(QLatin1String("GetHeaderInformation")) ) {
cinfo.scale_denom = qMin(cinfo.image_width / scaledSize.width(),
cinfo.image_width / scaledSize.height());
if (cinfo.scale_denom < 2) {
diff --git a/src/plugins/imageformats/tiff/qtiffhandler.cpp b/src/plugins/imageformats/tiff/qtiffhandler.cpp
index 77dfeb3..791aeaa 100644
--- a/src/plugins/imageformats/tiff/qtiffhandler.cpp
+++ b/src/plugins/imageformats/tiff/qtiffhandler.cpp
@@ -131,58 +131,138 @@ bool QTiffHandler::read(QImage *image)
if (!canRead())
return false;
- TIFF *tiff = TIFFClientOpen("foo",
- "r",
- this,
- qtiffReadProc,
- qtiffWriteProc,
- qtiffSeekProc,
- qtiffCloseProc,
- qtiffSizeProc,
- qtiffMapProc,
- qtiffUnmapProc);
-
- if (tiff) {
- uint32 width = 0;
- uint32 height = 0;
- TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width);
- TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height);
- if (image->size() != QSize(width, height) || image->format() != QImage::Format_ARGB32)
- *image = QImage(width, height, QImage::Format_ARGB32);
+ TIFF *const tiff = TIFFClientOpen("foo",
+ "r",
+ this,
+ qtiffReadProc,
+ qtiffWriteProc,
+ qtiffSeekProc,
+ qtiffCloseProc,
+ qtiffSizeProc,
+ qtiffMapProc,
+ qtiffUnmapProc);
+
+ if (!tiff) {
+ return false;
+ }
+ uint32 width;
+ uint32 height;
+ uint16 photometric;
+ if (!TIFFGetField(tiff, TIFFTAG_IMAGEWIDTH, &width)
+ || !TIFFGetField(tiff, TIFFTAG_IMAGELENGTH, &height)
+ || !TIFFGetField(tiff, TIFFTAG_PHOTOMETRIC, &photometric)) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ if (photometric == PHOTOMETRIC_MINISBLACK || photometric == PHOTOMETRIC_MINISWHITE) {
+ if (image->size() != QSize(width, height) || image->format() != QImage::Format_Mono)
+ *image = QImage(width, height, QImage::Format_Mono);
+ QVector<QRgb> colortable(2);
+ if (photometric == PHOTOMETRIC_MINISBLACK) {
+ colortable[0] = 0xff000000;
+ colortable[1] = 0xffffffff;
+ } else {
+ colortable[0] = 0xffffffff;
+ colortable[1] = 0xff000000;
+ }
+ image->setColorTable(colortable);
+
if (!image->isNull()) {
- if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(image->bits()), ORIENTATION_TOPLEFT, 0)) {
- uint16 resUnit = RESUNIT_NONE;
- float resX = 0;
- float resY = 0;
- TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit);
- TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX);
- TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY);
- switch(resUnit) {
- case RESUNIT_CENTIMETER:
- image->setDotsPerMeterX(qRound(resX * 100));
- image->setDotsPerMeterY(qRound(resY * 100));
- break;
- case RESUNIT_INCH:
- image->setDotsPerMeterX(qRound(resX * (100 / 2.54)));
- image->setDotsPerMeterY(qRound(resY * (100 / 2.54)));
- break;
- default:
- // do nothing as defaults have already
- // been set within the QImage class
- break;
+ for (uint32 y=0; y<height; ++y) {
+ if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
+ TIFFClose(tiff);
+ return false;
+ }
+ }
+ }
+ } else {
+ uint16 bitPerSample;
+ if (!TIFFGetField(tiff, TIFFTAG_BITSPERSAMPLE, &bitPerSample)) {
+ TIFFClose(tiff);
+ return false;
+ }
+ if (photometric == PHOTOMETRIC_PALETTE && bitPerSample == 8) {
+ if (image->size() != QSize(width, height) || image->format() != QImage::Format_Indexed8)
+ *image = QImage(width, height, QImage::Format_Indexed8);
+ if (!image->isNull()) {
+ // create the color table
+ const uint16 tableSize = 256;
+ uint16 *redTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
+ uint16 *greenTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
+ uint16 *blueTable = static_cast<uint16 *>(qMalloc(tableSize * sizeof(uint16)));
+ if (!redTable || !greenTable || !blueTable) {
+ TIFFClose(tiff);
+ return false;
+ }
+ if (!TIFFGetField(tiff, TIFFTAG_COLORMAP, &redTable, &greenTable, &blueTable)) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ QVector<QRgb> qtColorTable(tableSize);
+ for (int i = 0; i<tableSize ;++i) {
+ const int red = redTable[i] / 257;
+ const int green = greenTable[i] / 257;
+ const int blue = blueTable[i] / 257;
+ qtColorTable[i] = qRgb(red, green, blue);
+
+ }
+
+ image->setColorTable(qtColorTable);
+ for (uint32 y=0; y<height; ++y) {
+ if (TIFFReadScanline(tiff, image->scanLine(y), y, 0) < 0) {
+ TIFFClose(tiff);
+ return false;
+ }
+ }
+
+ // free redTable, greenTable and greenTable done by libtiff
+ }
+ } else {
+ if (image->size() != QSize(width, height) || image->format() != QImage::Format_ARGB32)
+ *image = QImage(width, height, QImage::Format_ARGB32);
+ if (!image->isNull()) {
+ if (TIFFReadRGBAImageOriented(tiff, width, height, reinterpret_cast<uint32 *>(image->bits()), ORIENTATION_TOPLEFT, 0)) {
+ for (uint32 y=0; y<height; ++y)
+ convert32BitOrder(image->scanLine(y), width);
+ } else {
+ TIFFClose(tiff);
+ return false;
}
- for (uint32 y=0; y<height; ++y)
- convert32BitOrder(image->scanLine(y), width);
- } else {
- *image = QImage();
}
}
- TIFFClose(tiff);
}
- if (image->isNull())
+ if (image->isNull()) {
+ TIFFClose(tiff);
return false;
+ }
+
+ float resX = 0;
+ float resY = 0;
+ uint16 resUnit = RESUNIT_NONE;
+ if (TIFFGetField(tiff, TIFFTAG_RESOLUTIONUNIT, &resUnit)
+ && TIFFGetField(tiff, TIFFTAG_XRESOLUTION, &resX)
+ && TIFFGetField(tiff, TIFFTAG_YRESOLUTION, &resY)) {
+
+ switch(resUnit) {
+ case RESUNIT_CENTIMETER:
+ image->setDotsPerMeterX(qRound(resX * 100));
+ image->setDotsPerMeterY(qRound(resY * 100));
+ break;
+ case RESUNIT_INCH:
+ image->setDotsPerMeterX(qRound(resX * (100 / 2.54)));
+ image->setDotsPerMeterY(qRound(resY * (100 / 2.54)));
+ break;
+ default:
+ // do nothing as defaults have already
+ // been set within the QImage class
+ break;
+ }
+ }
+ TIFFClose(tiff);
return true;
}
@@ -191,48 +271,145 @@ bool QTiffHandler::write(const QImage &image)
if (!device()->isWritable())
return false;
- TIFF *tiff = TIFFClientOpen("foo",
- "w",
- this,
- qtiffReadProc,
- qtiffWriteProc,
- qtiffSeekProc,
- qtiffCloseProc,
- qtiffSizeProc,
- qtiffMapProc,
- qtiffUnmapProc);
-
- if (tiff) {
- int width = image.width();
- int height = image.height();
- int depth = 32;
-
- if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, width)
- || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, height)
- || !TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
- || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
- || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, depth/8)
- || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)
- || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+ TIFF *const tiff = TIFFClientOpen("foo",
+ "w",
+ this,
+ qtiffReadProc,
+ qtiffWriteProc,
+ qtiffSeekProc,
+ qtiffCloseProc,
+ qtiffSizeProc,
+ qtiffMapProc,
+ qtiffUnmapProc);
+ if (!tiff)
+ return false;
+
+ const int width = image.width();
+ const int height = image.height();
+
+ if (!TIFFSetField(tiff, TIFFTAG_IMAGEWIDTH, width)
+ || !TIFFSetField(tiff, TIFFTAG_IMAGELENGTH, height)
+ || !TIFFSetField(tiff, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG)) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ // set the resolution
+ bool resolutionSet = false;
+ const int dotPerMeterX = image.dotsPerMeterX();
+ const int dotPerMeterY = image.dotsPerMeterY();
+ if ((dotPerMeterX % 100) == 0
+ && (dotPerMeterY % 100) == 0) {
+ resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER)
+ && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, dotPerMeterX/100.0)
+ && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, dotPerMeterY/100.0);
+ } else {
+ resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH)
+ && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, static_cast<float>(image.logicalDpiX()))
+ && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, static_cast<float>(image.logicalDpiY()));
+ }
+ if (!resolutionSet) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ // configure image depth
+ const QImage::Format format = image.format();
+ if (format == QImage::Format_Mono || format == QImage::Format_MonoLSB) {
+ uint16 photometric = PHOTOMETRIC_MINISBLACK;
+ if (image.colorTable().at(0) == 0xffffffff)
+ photometric = PHOTOMETRIC_MINISWHITE;
+ if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, photometric)
+ || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_CCITTRLE)) {
TIFFClose(tiff);
return false;
}
- // set the resolution
- bool resolutionSet = false;
- const int dotPerMeterX = image.dotsPerMeterX();
- const int dotPerMeterY = image.dotsPerMeterY();
- if ((dotPerMeterX % 100) == 0
- && (dotPerMeterY % 100) == 0) {
- resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_CENTIMETER)
- && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, dotPerMeterX/100.0)
- && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, dotPerMeterY/100.0);
- } else {
- resolutionSet = TIFFSetField(tiff, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH)
- && TIFFSetField(tiff, TIFFTAG_XRESOLUTION, static_cast<float>(image.logicalDpiX()))
- && TIFFSetField(tiff, TIFFTAG_YRESOLUTION, static_cast<float>(image.logicalDpiY()));
+ // try to do the conversion in chunks no greater than 16 MB
+ int chunks = (width * height / (1024 * 1024 * 16)) + 1;
+ int chunkHeight = qMax(height / chunks, 1);
+
+ int y = 0;
+ while (y < height) {
+ QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y)).convertToFormat(QImage::Format_Mono);
+
+ int chunkStart = y;
+ int chunkEnd = y + chunk.height();
+ while (y < chunkEnd) {
+ if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
+ TIFFClose(tiff);
+ return false;
+ }
+ ++y;
+ }
+ }
+ TIFFClose(tiff);
+ } else if (format == QImage::Format_Indexed8) {
+ if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_PALETTE)
+ || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_PACKBITS)
+ || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
+ TIFFClose(tiff);
+ return false;
+ }
+ //// write the color table
+ // allocate the color tables
+ uint16 *redTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ uint16 *greenTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ uint16 *blueTable = static_cast<uint16 *>(qMalloc(256 * sizeof(uint16)));
+ if (!redTable || !greenTable || !blueTable) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ // set the color table
+ const QVector<QRgb> colorTable = image.colorTable();
+
+ const int tableSize = colorTable.size();
+ Q_ASSERT(tableSize <= 256);
+ for (int i = 0; i<tableSize; ++i) {
+ const QRgb color = colorTable.at(i);
+ redTable[i] = qRed(color) * 257;
+ greenTable[i] = qGreen(color) * 257;
+ blueTable[i] = qBlue(color) * 257;
+ }
+
+ const bool setColorTableSuccess = TIFFSetField(tiff, TIFFTAG_COLORMAP, redTable, greenTable, blueTable);
+
+ qFree(redTable);
+ qFree(greenTable);
+ qFree(blueTable);
+
+ if (!setColorTableSuccess) {
+ TIFFClose(tiff);
+ return false;
+ }
+
+ //// write the data
+ // try to do the conversion in chunks no greater than 16 MB
+ int chunks = (width * height/ (1024 * 1024 * 16)) + 1;
+ int chunkHeight = qMax(height / chunks, 1);
+
+ int y = 0;
+ while (y < height) {
+ QImage chunk = image.copy(0, y, width, qMin(chunkHeight, height - y));
+
+ int chunkStart = y;
+ int chunkEnd = y + chunk.height();
+ while (y < chunkEnd) {
+ if (TIFFWriteScanline(tiff, reinterpret_cast<uint32 *>(chunk.scanLine(y - chunkStart)), y) != 1) {
+ TIFFClose(tiff);
+ return false;
+ }
+ ++y;
+ }
}
- if (!resolutionSet) {
+ TIFFClose(tiff);
+
+ } else {
+ if (!TIFFSetField(tiff, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_RGB)
+ || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_LZW)
+ || !TIFFSetField(tiff, TIFFTAG_SAMPLESPERPIXEL, 4)
+ || !TIFFSetField(tiff, TIFFTAG_BITSPERSAMPLE, 8)) {
TIFFClose(tiff);
return false;
}
@@ -260,9 +437,8 @@ bool QTiffHandler::write(const QImage &image)
}
}
TIFFClose(tiff);
- } else {
- return false;
}
+
return true;
}
diff --git a/src/qt3support/widgets/q3action.cpp b/src/qt3support/widgets/q3action.cpp
index 311212a..caca47b 100644
--- a/src/qt3support/widgets/q3action.cpp
+++ b/src/qt3support/widgets/q3action.cpp
@@ -415,7 +415,7 @@ static QString qt_stripMenuText(QString s)
s.remove(QLatin1String("..."));
s.remove(QLatin1Char('&'));
return s.trimmed();
-};
+}
/*!
Constructs an action called \a name with parent \a parent.
diff --git a/src/script/qscriptextqobject.cpp b/src/script/qscriptextqobject.cpp
index 4522807..47c04d4 100644
--- a/src/script/qscriptextqobject.cpp
+++ b/src/script/qscriptextqobject.cpp
@@ -1667,12 +1667,27 @@ void QScript::QObjectConnectionManager::execute(int slotIndex, void **argv)
activation_data->m_members[i].object(nameId, i,
QScriptValue::Undeletable
| QScriptValue::SkipInEnumeration);
+ QScriptValueImpl actual;
if (i < argc) {
- int argType = QMetaType::type(parameterTypes.at(i));
- activation_data->m_values[i] = eng->create(argType, argv[i + 1]);
+ void *arg = argv[i + 1];
+ QByteArray typeName = parameterTypes.at(i);
+ int argType = QMetaType::type(typeName);
+ if (!argType) {
+ if (typeName == "QVariant") {
+ actual = eng->valueFromVariant(*reinterpret_cast<QVariant*>(arg));
+ } else {
+ qWarning("QScriptEngine: Unable to handle unregistered datatype '%s' "
+ "when invoking handler of signal %s::%s",
+ typeName.constData(), meta->className(), method.signature());
+ actual = eng->undefinedValue();
+ }
+ } else {
+ actual = eng->create(argType, arg);
+ }
} else {
- activation_data->m_values[i] = eng->undefinedValue();
+ actual = eng->undefinedValue();
}
+ activation_data->m_values[i] = actual;
}
QScriptValueImpl senderObject;
@@ -1883,8 +1898,6 @@ void QScript::QtFunction::execute(QScriptContextPrivate *context)
return;
}
- QScriptValueImpl result = eng_p->undefinedValue();
-
const QMetaObject *meta = qobj->metaObject();
QObject *thisQObject = context->thisObject().toQObject();
diff --git a/src/script/qscriptsyntaxchecker_p.h b/src/script/qscriptsyntaxchecker_p.h
index 0c02d24..18f0611 100644
--- a/src/script/qscriptsyntaxchecker_p.h
+++ b/src/script/qscriptsyntaxchecker_p.h
@@ -71,7 +71,7 @@ public:
enum State {
Error,
Intermediate,
- Valid,
+ Valid
};
struct Result {
diff --git a/src/script/qscriptvalue.cpp b/src/script/qscriptvalue.cpp
index a253985..f72d1db 100644
--- a/src/script/qscriptvalue.cpp
+++ b/src/script/qscriptvalue.cpp
@@ -904,6 +904,7 @@ qsreal QScriptValue::toInteger() const
\row \o QObject Object \o A QVariant containing a pointer to the QObject.
\row \o Date Object \o A QVariant containing the date value (toDateTime()).
\row \o RegExp Object \o A QVariant containing the regular expression value (toRegExp()).
+ \row \o Array Object \o The array is converted to a QVariantList.
\row \o Object \o If the value is primitive, then the result is converted to a QVariant according to the above rules; otherwise, an invalid QVariant is returned.
\endtable
diff --git a/src/script/qscriptvalueimpl.cpp b/src/script/qscriptvalueimpl.cpp
index a890839..7c7b711 100644
--- a/src/script/qscriptvalueimpl.cpp
+++ b/src/script/qscriptvalueimpl.cpp
@@ -339,6 +339,8 @@ QVariant QScriptValueImpl::toVariant() const
if (isQObject())
return qVariantFromValue(toQObject());
#endif
+ if (isArray())
+ return QScriptEnginePrivate::variantListFromArray(*this);
QScriptValueImpl v = engine()->toPrimitive(*this);
if (!v.isObject())
diff --git a/src/script/qscriptvalueimplfwd_p.h b/src/script/qscriptvalueimplfwd_p.h
index 059842e..aa0c86f 100644
--- a/src/script/qscriptvalueimplfwd_p.h
+++ b/src/script/qscriptvalueimplfwd_p.h
@@ -77,7 +77,7 @@ class QScriptEnginePrivate;
namespace QScript
{
class Member;
-};
+}
class QScriptValueImpl
{
diff --git a/src/testlib/qbenchmark_p.h b/src/testlib/qbenchmark_p.h
index b6340f8..f3cd094 100644
--- a/src/testlib/qbenchmark_p.h
+++ b/src/testlib/qbenchmark_p.h
@@ -55,7 +55,7 @@
#include <QtCore/qglobal.h>
-#if defined(Q_OS_LINUX) && !defined(QT_NO_PROCESS)
+#if (defined(Q_OS_LINUX) || defined Q_OS_MAC) && !defined(QT_NO_PROCESS)
#define QTESTLIB_USE_VALGRIND
#else
#undef QTESTLIB_USE_VALGRIND
diff --git a/src/testlib/qtestbasicstreamer.h b/src/testlib/qtestbasicstreamer.h
index 527b1d4..61cdfd5 100644
--- a/src/testlib/qtestbasicstreamer.h
+++ b/src/testlib/qtestbasicstreamer.h
@@ -44,8 +44,12 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement;
class QTestElementAttribute;
class QTestLogger;
@@ -81,4 +85,6 @@ class QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 041f2db..af0df3e 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1469,7 +1469,7 @@ int QTest::qExec(QObject *testObject, int argc, char **argv)
#ifdef Q_OS_WIN
chartLocation += QLatin1String("/../tools/qtestlib/chart/release/chart.exe");
#else
- chartLocation += QLatin1String("/../tools/qtestlib/chart/chart");
+ chartLocation += QLatin1String("/../tools/qtestlib/chart/chart");
#endif
if (QFile::exists(chartLocation)) {
QProcess p;
@@ -1801,8 +1801,8 @@ COMPARE_IMPL2(quint64, %llu)
#endif
COMPARE_IMPL2(bool, %d)
COMPARE_IMPL2(char, %c)
-COMPARE_IMPL2(float, %g);
-COMPARE_IMPL2(double, %lg);
+COMPARE_IMPL2(float, %g)
+COMPARE_IMPL2(double, %lg)
/*! \internal
*/
diff --git a/src/testlib/qtestcoreelement.h b/src/testlib/qtestcoreelement.h
index 4cf8fcb..907041f 100644
--- a/src/testlib/qtestcoreelement.h
+++ b/src/testlib/qtestcoreelement.h
@@ -42,11 +42,15 @@
#ifndef QTESTCOREELEMENT_H
#define QTESTCOREELEMENT_H
-#include "qtestcorelist.h"
-#include "qtestelementattribute.h"
+#include <QtTest/qtestcorelist.h>
+#include <QtTest/qtestelementattribute.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
template <class ElementType>
class QTestCoreElement: public QTestCoreList<ElementType>
{
@@ -163,4 +167,6 @@ const QTestElementAttribute *QTestCoreElement<ElementType>::attribute(QTest::Att
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestcorelist.h b/src/testlib/qtestcorelist.h
index 686e157..9983b27 100644
--- a/src/testlib/qtestcorelist.h
+++ b/src/testlib/qtestcorelist.h
@@ -44,8 +44,12 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
template <class T>
class QTestCoreList
{
@@ -127,4 +131,6 @@ int QTestCoreList<T>::count()
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestelement.h b/src/testlib/qtestelement.h
index c1932da..e75689a 100644
--- a/src/testlib/qtestelement.h
+++ b/src/testlib/qtestelement.h
@@ -42,10 +42,14 @@
#ifndef QTESTELEMENT_H
#define QTESTELEMENT_H
-#include "qtestcoreelement.h"
+#include <QtTest/qtestcoreelement.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement: public QTestCoreElement<QTestElement>
{
public:
@@ -66,4 +70,6 @@ class QTestElement: public QTestCoreElement<QTestElement>
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestelementattribute.h b/src/testlib/qtestelementattribute.h
index 261f3f7..944d9c0 100644
--- a/src/testlib/qtestelementattribute.h
+++ b/src/testlib/qtestelementattribute.h
@@ -42,10 +42,14 @@
#ifndef QTESTELEMENTATTRIBUTE_H
#define QTESTELEMENTATTRIBUTE_H
-#include "qtestcorelist.h"
+#include <QtTest/qtestcorelist.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
namespace QTest {
enum AttributeIndex
@@ -102,4 +106,6 @@ class QTestElementAttribute: public QTestCoreList<QTestElementAttribute>
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestfilelogger.h b/src/testlib/qtestfilelogger.h
index 892657d..f6a993d 100644
--- a/src/testlib/qtestfilelogger.h
+++ b/src/testlib/qtestfilelogger.h
@@ -44,8 +44,12 @@
#include <QtCore/qglobal.h>
+QT_BEGIN_HEADER
+
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestFileLogger
{
public:
@@ -58,4 +62,6 @@ class QTestFileLogger
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif // QTESTFILELOGGER_H
diff --git a/src/testlib/qtestlightxmlstreamer.h b/src/testlib/qtestlightxmlstreamer.h
index 382a14a..3f564a8 100644
--- a/src/testlib/qtestlightxmlstreamer.h
+++ b/src/testlib/qtestlightxmlstreamer.h
@@ -42,10 +42,14 @@
#ifndef QTESTLIGHTXMLSTREAMER_H
#define QTESTLIGHTXMLSTREAMER_H
-#include "qtestbasicstreamer.h"
+#include <QtTest/qtestbasicstreamer.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement;
class QTestElementAttribute;
@@ -63,4 +67,6 @@ class QTestLightXmlStreamer: public QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestresult.cpp b/src/testlib/qtestresult.cpp
index 39759b5..0f21378 100644
--- a/src/testlib/qtestresult.cpp
+++ b/src/testlib/qtestresult.cpp
@@ -68,7 +68,7 @@ namespace QTest
static const char *expectFailComment = 0;
static int expectFailMode = 0;
-};
+}
void QTestResult::reset()
{
diff --git a/src/testlib/qtestxmlstreamer.h b/src/testlib/qtestxmlstreamer.h
index 58544a4..814bffc 100644
--- a/src/testlib/qtestxmlstreamer.h
+++ b/src/testlib/qtestxmlstreamer.h
@@ -42,10 +42,14 @@
#ifndef QTESTXMLSTREAMER_H
#define QTESXMLSTREAMER_H
-#include "qtestbasicstreamer.h"
+#include <QtTest/qtestbasicstreamer.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestElement;
class QTestElementAttribute;
@@ -63,4 +67,6 @@ class QTestXmlStreamer: public QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/testlib/qtestxunitstreamer.h b/src/testlib/qtestxunitstreamer.h
index b4b82f0..0e48b2c 100644
--- a/src/testlib/qtestxunitstreamer.h
+++ b/src/testlib/qtestxunitstreamer.h
@@ -42,10 +42,14 @@
#ifndef QTESTXUNITSTREAMER_H
#define QTESTXUNITSTREAMER_H
-#include "qtestbasicstreamer.h"
+#include <QtTest/qtestbasicstreamer.h>
+
+QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
+QT_MODULE(Test)
+
class QTestLogger;
class QTestXunitStreamer: public QTestBasicStreamer
@@ -68,4 +72,6 @@ class QTestXunitStreamer: public QTestBasicStreamer
QT_END_NAMESPACE
+QT_END_HEADER
+
#endif
diff --git a/src/tools/moc/generator.cpp b/src/tools/moc/generator.cpp
index e94bb77..e4ad068 100644
--- a/src/tools/moc/generator.cpp
+++ b/src/tools/moc/generator.cpp
@@ -109,6 +109,14 @@ bool isVariantType(const char* type)
return qvariant_nameToType(type) != 0;
}
+/*!
+ Returns true if the type is qreal.
+*/
+static bool isQRealType(const char *type)
+{
+ return strcmp(type, "qreal") == 0;
+}
+
Generator::Generator(ClassDef *classDef, const QList<QByteArray> &metaTypes, FILE *outfile)
: out(outfile), cdef(classDef), metaTypes(metaTypes)
{
@@ -545,7 +553,7 @@ void Generator::generateProperties()
uint flags = Invalid;
if (!isVariantType(p.type)) {
flags |= EnumOrFlag;
- } else {
+ } else if (!isQRealType(p.type)) {
flags |= qvariant_nameToType(p.type) << 24;
}
if (!p.read.isEmpty())
@@ -589,10 +597,12 @@ void Generator::generateProperties()
if (p.notifyId != -1)
flags |= Notify;
- fprintf(out, " %4d, %4d, 0x%.8x,\n",
- strreg(p.name),
- strreg(p.type),
- flags);
+ fprintf(out, " %4d, %4d, ",
+ strreg(p.name),
+ strreg(p.type));
+ if (!(flags >> 24) && isQRealType(p.type))
+ fprintf(out, "(QMetaType::QReal << 24) | ");
+ fprintf(out, "0x%.8x,\n", flags);
}
if(cdef->notifyableProperties) {
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp
index 8ca2823..4629ac5 100644
--- a/src/tools/moc/moc.cpp
+++ b/src/tools/moc/moc.cpp
@@ -767,6 +767,8 @@ void Moc::generate(FILE *out)
if (classList.size() && classList.first().classname == "Qt")
fprintf(out, "#include <QtCore/qobject.h>\n");
+ fprintf(out, "#include <QtCore/qmetatype.h>\n");
+
fprintf(out, "#if !defined(Q_MOC_OUTPUT_REVISION)\n"
"#error \"The header file '%s' doesn't include <QObject>.\"\n", (const char *)fn);
fprintf(out, "#elif Q_MOC_OUTPUT_REVISION != %d\n", mocOutputRevision);
diff --git a/src/tools/moc/outputrevision.h b/src/tools/moc/outputrevision.h
index 1e1d640..f577f6c 100644
--- a/src/tools/moc/outputrevision.h
+++ b/src/tools/moc/outputrevision.h
@@ -43,6 +43,6 @@
#define OUTPUTREVISION_H
// if the output revision changes, you MUST change it in qobjectdefs.h too
-enum { mocOutputRevision = 61 }; // moc format output revision
+enum { mocOutputRevision = 62 }; // moc format output revision
#endif // OUTPUTREVISION_H