summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demos/browser/browser.pro2
-rw-r--r--demos/qtdemo/xml/examples.xml2
-rw-r--r--demos/sub-attaq/boat.cpp2
-rw-r--r--doc/src/examples/audiodevices.qdoc2
-rw-r--r--doc/src/examples/audioinput.qdoc2
-rw-r--r--doc/src/examples/audiooutput.qdoc2
-rw-r--r--doc/src/examples/videographicsitem.qdoc2
-rw-r--r--doc/src/examples/videowidget.qdoc30
-rw-r--r--doc/src/getting-started/examples.qdoc10
-rw-r--r--doc/src/howtos/openvg.qdoc4
-rw-r--r--examples/examples.pro3
-rw-r--r--examples/gestures/imageviewer/imagewidget.h2
-rw-r--r--examples/multimedia/audio/audio.pro10
-rw-r--r--examples/multimedia/audiodevices/audiodevices.cpp (renamed from examples/multimedia/audio/audiodevices/audiodevices.cpp)0
-rw-r--r--examples/multimedia/audiodevices/audiodevices.h (renamed from examples/multimedia/audio/audiodevices/audiodevices.h)0
-rw-r--r--examples/multimedia/audiodevices/audiodevices.pro (renamed from examples/multimedia/audio/audiodevices/audiodevices.pro)4
-rw-r--r--examples/multimedia/audiodevices/audiodevicesbase.ui (renamed from examples/multimedia/audio/audiodevices/audiodevicesbase.ui)0
-rw-r--r--examples/multimedia/audiodevices/main.cpp (renamed from examples/multimedia/audio/audiodevices/main.cpp)0
-rw-r--r--examples/multimedia/audioinput/audioinput.cpp (renamed from examples/multimedia/audio/audioinput/audioinput.cpp)0
-rw-r--r--examples/multimedia/audioinput/audioinput.h (renamed from examples/multimedia/audio/audioinput/audioinput.h)0
-rw-r--r--examples/multimedia/audioinput/audioinput.pro (renamed from examples/multimedia/audio/audioinput/audioinput.pro)4
-rw-r--r--examples/multimedia/audioinput/main.cpp (renamed from examples/multimedia/audio/audioinput/main.cpp)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp (renamed from examples/multimedia/audio/audiooutput/audiooutput.cpp)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.h (renamed from examples/multimedia/audio/audiooutput/audiooutput.h)0
-rw-r--r--examples/multimedia/audiooutput/audiooutput.pro (renamed from examples/multimedia/audio/audiooutput/audiooutput.pro)4
-rw-r--r--examples/multimedia/audiooutput/main.cpp (renamed from examples/multimedia/audio/audiooutput/main.cpp)0
-rw-r--r--examples/multimedia/multimedia.pro14
-rw-r--r--examples/multimedia/videographicsitem/main.cpp (renamed from examples/video/videographicsitem/main.cpp)0
-rw-r--r--examples/multimedia/videographicsitem/videographicsitem.pro (renamed from examples/video/videographicsitem/videographicsitem.pro)4
-rw-r--r--examples/multimedia/videographicsitem/videoitem.cpp (renamed from examples/video/videographicsitem/videoitem.cpp)0
-rw-r--r--examples/multimedia/videographicsitem/videoitem.h (renamed from examples/video/videographicsitem/videoitem.h)0
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.cpp (renamed from examples/video/videographicsitem/videoplayer.cpp)0
-rw-r--r--examples/multimedia/videographicsitem/videoplayer.h (renamed from examples/video/videographicsitem/videoplayer.h)0
-rw-r--r--examples/multimedia/videowidget/main.cpp (renamed from examples/video/videowidget/main.cpp)0
-rw-r--r--examples/multimedia/videowidget/videoplayer.cpp (renamed from examples/video/videowidget/videoplayer.cpp)0
-rw-r--r--examples/multimedia/videowidget/videoplayer.h (renamed from examples/video/videowidget/videoplayer.h)0
-rw-r--r--examples/multimedia/videowidget/videowidget.cpp (renamed from examples/video/videowidget/videowidget.cpp)0
-rw-r--r--examples/multimedia/videowidget/videowidget.h (renamed from examples/video/videowidget/videowidget.h)0
-rw-r--r--examples/multimedia/videowidget/videowidget.pro (renamed from examples/video/videowidget/videowidget.pro)6
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.cpp (renamed from examples/video/videowidget/videowidgetsurface.cpp)0
-rw-r--r--examples/multimedia/videowidget/videowidgetsurface.h (renamed from examples/video/videowidget/videowidgetsurface.h)0
-rw-r--r--examples/opengl/pbuffers/cube.h2
-rw-r--r--examples/opengl/pbuffers/glwidget.h2
-rw-r--r--examples/video/video.pro6
-rw-r--r--src/corelib/io/qsettings.cpp24
-rw-r--r--src/corelib/io/qurl.cpp9
-rw-r--r--src/corelib/kernel/qobject.cpp5
-rw-r--r--src/gui/egl/qegl_qws.cpp3
-rw-r--r--src/gui/embedded/directfb.pri2
-rw-r--r--src/gui/image/qiconloader.cpp6
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp4
-rw-r--r--src/gui/itemviews/qtableview.cpp3
-rw-r--r--src/gui/itemviews/qtablewidget.cpp2
-rw-r--r--src/gui/itemviews/qtreewidget.cpp2
-rw-r--r--src/gui/kernel/qapplication_s60.cpp144
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm27
-rw-r--r--src/gui/kernel/qgesture.h8
-rw-r--r--src/gui/widgets/qmenu_mac.mm4
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp12
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h1
-rw-r--r--src/network/ssl/qsslsocket.cpp7
-rw-r--r--src/opengl/opengl.pro4
-rw-r--r--src/opengl/qgl.cpp1
-rw-r--r--src/opengl/qgl_qws.cpp3
-rw-r--r--src/opengl/qglpaintdevice_p.h2
-rw-r--r--src/opengl/qglpaintdevice_qws.cpp85
-rw-r--r--src/opengl/qglpaintdevice_qws_p.h86
-rw-r--r--src/opengl/qglwindowsurface_qws.cpp1
-rw-r--r--src/opengl/qpaintengine_opengl.cpp1
-rw-r--r--src/openvg/qpaintengine_vg.cpp3
-rw-r--r--src/openvg/qpixmapfilter_vg.cpp86
-rw-r--r--src/openvg/qpixmapfilter_vg_p.h5
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp77
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h11
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c10
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h3
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h1
-rw-r--r--src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c14
-rw-r--r--src/plugins/gfxdrivers/powervr/README5
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp67
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h9
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp54
-rw-r--r--src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h8
-rw-r--r--src/qt3support/widgets/q3combobox.cpp3
-rw-r--r--src/qt3support/widgets/q3toolbar.cpp2
-rw-r--r--tests/auto/qabstractitemview/tst_qabstractitemview.cpp45
-rw-r--r--tests/auto/qbuttongroup/tst_qbuttongroup.cpp11
-rw-r--r--tests/auto/qfiledialog/tst_qfiledialog.cpp867
-rw-r--r--tests/auto/qfiledialog2/qfiledialog2.pro27
-rw-r--r--tests/auto/qfiledialog2/tst_qfiledialog2.cpp1006
-rw-r--r--tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp22
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp20
-rw-r--r--tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp2
-rw-r--r--tests/auto/qgraphicsview/tst_qgraphicsview.cpp6
-rw-r--r--tests/auto/qheaderview/tst_qheaderview.cpp2
-rw-r--r--tests/auto/qtableview/tst_qtableview.cpp47
-rw-r--r--tests/auto/qtablewidget/tst_qtablewidget.cpp21
-rw-r--r--tests/auto/qtreewidget/tst_qtreewidget.cpp39
-rw-r--r--tests/auto/qurl/tst_qurl.cpp8
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp17
-rw-r--r--translations/designer_pl.ts2
-rw-r--r--translations/linguist_pl.ts16
-rw-r--r--translations/qt_pl.ts10
104 files changed, 1761 insertions, 1332 deletions
diff --git a/demos/browser/browser.pro b/demos/browser/browser.pro
index 6c5f0057fc..a42aa601fb 100644
--- a/demos/browser/browser.pro
+++ b/demos/browser/browser.pro
@@ -3,7 +3,7 @@ TARGET = browser
QT += webkit network
CONFIG += qt warn_on
-contains(QT_BUILD_PARTS, tools):!symbian:!embedded: CONFIG += uitools
+contains(QT_BUILD_PARTS, tools):!embedded: CONFIG += uitools
else: DEFINES += QT_NO_UITOOLS
release:DEFINES+=QT_NO_DEBUG_OUTPUT QT_NO_WARNING_OUTPUT
diff --git a/demos/qtdemo/xml/examples.xml b/demos/qtdemo/xml/examples.xml
index 2c31484b1a..83bd200511 100644
--- a/demos/qtdemo/xml/examples.xml
+++ b/demos/qtdemo/xml/examples.xml
@@ -154,7 +154,7 @@
<category dirname="phonon" name="Phonon">
<example filename="qmusicplayer" name="Music Player" />
</category>
- <category dirname="multimedia/audio" name="Multimedia">
+ <category dirname="multimedia" name="Multimedia">
<example filename="audiodevices" name="Audio Devices" />
<example filename="audiooutput" name="Audio Output" />
<example filename="audioinput" name="Audio Input" />
diff --git a/demos/sub-attaq/boat.cpp b/demos/sub-attaq/boat.cpp
index 3b1bac7620..cb40329788 100644
--- a/demos/sub-attaq/boat.cpp
+++ b/demos/sub-attaq/boat.cpp
@@ -87,7 +87,7 @@ Boat::Boat() : PixmapItem(QString("boat"), GraphicsScene::Big),
speed(0), bombsAlreadyLaunched(0), direction(Boat::None), movementAnimation(0)
{
setZValue(4);
- setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsFocusable);
+ setFlags(QGraphicsItem::ItemIsFocusable);
//The movement animation used to animate the boat
movementAnimation = new QPropertyAnimation(this, "pos");
diff --git a/doc/src/examples/audiodevices.qdoc b/doc/src/examples/audiodevices.qdoc
index 0d0932ea33..1505846174 100644
--- a/doc/src/examples/audiodevices.qdoc
+++ b/doc/src/examples/audiodevices.qdoc
@@ -40,7 +40,7 @@
****************************************************************************/
/*!
- \example multimedia/audio/audiodevices
+ \example multimedia/audiodevices
\title Audio Devices Example
The Audio Devices example demonstrates the basic use of QAudioDeviceInfo class
diff --git a/doc/src/examples/audioinput.qdoc b/doc/src/examples/audioinput.qdoc
index ac44d75374..8553e92fe3 100644
--- a/doc/src/examples/audioinput.qdoc
+++ b/doc/src/examples/audioinput.qdoc
@@ -40,7 +40,7 @@
****************************************************************************/
/*!
- \example multimedia/audio/audioinput
+ \example multimedia/audioinput
\title AudioInput Example
The Audio Input example demonstrates the basic use of QAudioInput class
diff --git a/doc/src/examples/audiooutput.qdoc b/doc/src/examples/audiooutput.qdoc
index 2ed6ce4f94..58b8ea9e61 100644
--- a/doc/src/examples/audiooutput.qdoc
+++ b/doc/src/examples/audiooutput.qdoc
@@ -40,7 +40,7 @@
****************************************************************************/
/*!
- \example multimedia/audio/audiooutput
+ \example multimedia/audiooutput
\title Audio Output Example
The Audio Output example demonstrates the basic use of the QAudioOutput class
diff --git a/doc/src/examples/videographicsitem.qdoc b/doc/src/examples/videographicsitem.qdoc
index ce24f097c5..e1cb6edacd 100644
--- a/doc/src/examples/videographicsitem.qdoc
+++ b/doc/src/examples/videographicsitem.qdoc
@@ -40,7 +40,7 @@
****************************************************************************/
/*!
- \example video/videographicsitem
+ \example multimedia/videographicsitem
\title Video Graphics Item Example
The Video Graphics Item example shows how to implement a QGraphicsItem that displays video on a
diff --git a/doc/src/examples/videowidget.qdoc b/doc/src/examples/videowidget.qdoc
index 1b214d27f9..4223c1fb95 100644
--- a/doc/src/examples/videowidget.qdoc
+++ b/doc/src/examples/videowidget.qdoc
@@ -40,7 +40,7 @@
****************************************************************************/
/*!
- \example video/videowidget
+ \example multimedia/videowidget
\title Video Widget Example
The Video Widget example shows how to implement a video widget using
@@ -50,7 +50,7 @@
\section1 VideoWidgetSurface Class Definition
- \snippet examples/video/videowidget/videowidgetsurface.h 0
+ \snippet examples/multimedia/videowidget/videowidgetsurface.h 0
The VideoWidgetSurface class inherits QAbstractVideoSurface and paints
video frames on a QWidget. This is a separate class to VideoWidget as both
@@ -62,7 +62,7 @@
\section1 VideoWidgetSurface Class Implementation
- \snippet examples/video/videowidget/videowidgetsurface.cpp 0
+ \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 0
From the supportedPixelFormats() function we return a list of pixel formats
the surface can paint. The order of the list hints at which formats are
@@ -74,7 +74,7 @@
return any pixel formats if handleType is not
QAbstractVideoBuffer::NoHandle.
- \snippet examples/video/videowidget/videowidgetsurface.cpp 1
+ \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 1
In isFormatSupported() we test if the frame type of a surface format maps
to a valid QImage format, that the frame size is not empty, and the handle
@@ -85,7 +85,7 @@
that the size is not empty so a reimplementation wasn't strictly necessary
in this case.
- \snippet examples/video/videowidget/videowidgetsurface.cpp 2
+ \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 2
To start our surface we'll extract the image format and size from the
selected video format and save it for use in the paint() function. If the
@@ -94,7 +94,7 @@
by calling QAbstractVideoSurface::start(). Finally since the video size may
have changed we'll trigger an update of the widget, and video geometry.
- \snippet examples/video/videowidget/videowidgetsurface.cpp 5
+ \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 5
The updateVideoRect() function calculates the region within the widget the
video occupies. The \l {QVideoSurfaceFormat::sizeHint()}{size hint} of the
@@ -105,7 +105,7 @@
size in the center of the widget. Otherwise we shrink the size maintaining
the aspect ratio so that it does fit.
- \snippet examples/video/videowidget/videowidgetsurface.cpp 4
+ \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 4
We can't paint from outside a paint event, so when a new frame is received
in present() we save a reference to it and force an immediate repaint of
@@ -118,7 +118,7 @@
\l {QAbstractVideoSurface::UnsupportedFormatError}{UnsupportedFormatError}
on our surface and stop it immediately.
- \snippet examples/video/videowidget/videowidgetsurface.cpp 6
+ \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 6
The paint() function is called by the video widget to paint the current
video frame. Before we draw the frame first we'll check the format for
@@ -128,7 +128,7 @@
construct a new QImage from the current video frame, and draw it to the
the widget.
- \snippet examples/video/videowidget/videowidgetsurface.cpp 3
+ \snippet examples/multimedia/videowidget/videowidgetsurface.cpp 3
When the surface is stopped we need to release the current frame and
invalidate the video region. Then we confirm the surface has been
@@ -141,7 +141,7 @@
The VideoWidget class uses the VideoWidgetSurface class to implement a
video widget.
- \snippet examples/video/videowidget/videowidget.h 0
+ \snippet examples/multimedia/videowidget/videowidget.h 0
The VideoWidget QWidget implementation is minimal with just the sizeHint(),
paintEvent(), and resizeEvent() functions in addition to the constructor,
@@ -149,7 +149,7 @@
\section1 VideoWidget Class Implementation
- \snippet examples/video/videowidget/videowidget.cpp 0
+ \snippet examples/multimedia/videowidget/videowidget.cpp 0
In the VideoWidget constructor we set some flags to speed up re-paints a
little. Setting the Qt::WA_NoSystemBackground flag and disabling automatic
@@ -162,17 +162,17 @@
Finally we construct an instance of the VideoWidgetSurface class.
- \snippet examples/video/videowidget/videowidget.cpp 1
+ \snippet examples/multimedia/videowidget/videowidget.cpp 1
In the destructor we simply delete the VideoWidgetSurface instance.
- \snippet examples/video/videowidget/videowidget.cpp 2
+ \snippet examples/multimedia/videowidget/videowidget.cpp 2
We get the size hint for the widget from the video format of the surface
which is calculated from viewport and pixel aspect ratio of the video
format.
- \snippet examples/video/videowidget/videowidget.cpp 3
+ \snippet examples/multimedia/videowidget/videowidget.cpp 3
When the video widget receives a paint event we first check if the surface
is started, if not then we simply fill the widget with the background
@@ -180,7 +180,7 @@
by the paint region, before calling paint on the video surface to draw the
current frame.
- \snippet examples/video/videowidget/videowidget.cpp 4
+ \snippet examples/multimedia/videowidget/videowidget.cpp 4
The resizeEvent() function is reimplemented to trigger an update of the
video region when the widget is resized.
diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc
index d72f816faa..d6ade228ef 100644
--- a/doc/src/getting-started/examples.qdoc
+++ b/doc/src/getting-started/examples.qdoc
@@ -806,16 +806,16 @@
Audio API in Qt applications.
\list
- \o \l{multimedia/audio/audiodevices}{Audio Devices}
- \o \l{multimedia/audio/audiooutput}{Audio Output}
- \o \l{multimedia/audio/audioinput}{Audio Input}
+ \o \l{multimedia/audiodevices}{Audio Devices}
+ \o \l{multimedia/audiooutput}{Audio Output}
+ \o \l{multimedia/audioinput}{Audio Input}
\endlist
\section1 Video Output
\list
- \o \l{video/videowidget}{Video Widget}\raisedaster
- \o \l{video/videographicsitem}{Video Graphics Item}
+ \o \l{multimedia/videowidget}{Video Widget}\raisedaster
+ \o \l{multimedia/videographicsitem}{Video Graphics Item}
\endlist
\section1 Phonon
diff --git a/doc/src/howtos/openvg.qdoc b/doc/src/howtos/openvg.qdoc
index 42d2357789..5de2e22a1c 100644
--- a/doc/src/howtos/openvg.qdoc
+++ b/doc/src/howtos/openvg.qdoc
@@ -292,8 +292,8 @@
\section2 Pixmap filters
- Convolution, colorize, and drop shadow filters are accelerated using
- OpenVG operations.
+ Convolution, colorize, drop shadow, and blur filters are accelerated
+ using OpenVG operations.
\section1 Known issues
diff --git a/examples/examples.pro b/examples/examples.pro
index 7acd67b817..d11e36bf68 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -39,8 +39,7 @@ symbian: SUBDIRS = \
xml
contains(QT_CONFIG, multimedia) {
- SUBDIRS += video
- !static: SUBDIRS += multimedia
+ SUBDIRS += multimedia
}
contains(QT_CONFIG, script): SUBDIRS += script
diff --git a/examples/gestures/imageviewer/imagewidget.h b/examples/gestures/imageviewer/imagewidget.h
index e05a67a803..7b91fbf26e 100644
--- a/examples/gestures/imageviewer/imagewidget.h
+++ b/examples/gestures/imageviewer/imagewidget.h
@@ -46,10 +46,12 @@
#include <QImage>
#include <QtGui>
+QT_BEGIN_NAMESPACE
class QGestureEvent;
class QPanGesture;
class QPinchGesture;
class QSwipeGesture;
+QT_END_NAMESPACE
class ImageWidget : public QWidget
{
diff --git a/examples/multimedia/audio/audio.pro b/examples/multimedia/audio/audio.pro
deleted file mode 100644
index c64bb34c66..0000000000
--- a/examples/multimedia/audio/audio.pro
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE = subdirs
-SUBDIRS = audioinput \
- audiooutput \
- audiodevices
-
-# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
-sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS audio.pro README
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio
-INSTALLS += target sources
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.cpp b/examples/multimedia/audiodevices/audiodevices.cpp
index 419860518b..419860518b 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.cpp
+++ b/examples/multimedia/audiodevices/audiodevices.cpp
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.h b/examples/multimedia/audiodevices/audiodevices.h
index 5fe5547d03..5fe5547d03 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.h
+++ b/examples/multimedia/audiodevices/audiodevices.h
diff --git a/examples/multimedia/audio/audiodevices/audiodevices.pro b/examples/multimedia/audiodevices/audiodevices.pro
index 173aa8f43b..232da098b8 100644
--- a/examples/multimedia/audio/audiodevices/audiodevices.pro
+++ b/examples/multimedia/audiodevices/audiodevices.pro
@@ -6,9 +6,9 @@ FORMS += audiodevicesbase.ui
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiodevices.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiodevices
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiodevices
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui b/examples/multimedia/audiodevices/audiodevicesbase.ui
index 52073389ab..52073389ab 100644
--- a/examples/multimedia/audio/audiodevices/audiodevicesbase.ui
+++ b/examples/multimedia/audiodevices/audiodevicesbase.ui
diff --git a/examples/multimedia/audio/audiodevices/main.cpp b/examples/multimedia/audiodevices/main.cpp
index d5ddd4f2f5..d5ddd4f2f5 100644
--- a/examples/multimedia/audio/audiodevices/main.cpp
+++ b/examples/multimedia/audiodevices/main.cpp
diff --git a/examples/multimedia/audio/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp
index 05723aea0c..05723aea0c 100644
--- a/examples/multimedia/audio/audioinput/audioinput.cpp
+++ b/examples/multimedia/audioinput/audioinput.cpp
diff --git a/examples/multimedia/audio/audioinput/audioinput.h b/examples/multimedia/audioinput/audioinput.h
index 14e1bacba8..14e1bacba8 100644
--- a/examples/multimedia/audio/audioinput/audioinput.h
+++ b/examples/multimedia/audioinput/audioinput.h
diff --git a/examples/multimedia/audio/audioinput/audioinput.pro b/examples/multimedia/audioinput/audioinput.pro
index 0d6198de86..a54d452d8a 100644
--- a/examples/multimedia/audio/audioinput/audioinput.pro
+++ b/examples/multimedia/audioinput/audioinput.pro
@@ -5,9 +5,9 @@ SOURCES = audioinput.cpp \
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audioinput.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audioinput
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audioinput
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audioinput/main.cpp b/examples/multimedia/audioinput/main.cpp
index d7e9c6c802..d7e9c6c802 100644
--- a/examples/multimedia/audio/audioinput/main.cpp
+++ b/examples/multimedia/audioinput/main.cpp
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index 9e532cdef7..9e532cdef7 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h
index 6c07a3a6e1..6c07a3a6e1 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.h
+++ b/examples/multimedia/audiooutput/audiooutput.h
diff --git a/examples/multimedia/audio/audiooutput/audiooutput.pro b/examples/multimedia/audiooutput/audiooutput.pro
index b43763cf00..26f68fe3b2 100644
--- a/examples/multimedia/audio/audiooutput/audiooutput.pro
+++ b/examples/multimedia/audiooutput/audiooutput.pro
@@ -5,9 +5,9 @@ SOURCES = audiooutput.cpp \
QT += multimedia
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput
sources.files = $$SOURCES *.h $$RESOURCES $$FORMS audiooutput.pro
-sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audio/audiooutput
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/audiooutput
INSTALLS += target sources
symbian {
diff --git a/examples/multimedia/audio/audiooutput/main.cpp b/examples/multimedia/audiooutput/main.cpp
index 79ec99eb64..79ec99eb64 100644
--- a/examples/multimedia/audio/audiooutput/main.cpp
+++ b/examples/multimedia/audiooutput/main.cpp
diff --git a/examples/multimedia/multimedia.pro b/examples/multimedia/multimedia.pro
index ac78b15b47..4a764f2151 100644
--- a/examples/multimedia/multimedia.pro
+++ b/examples/multimedia/multimedia.pro
@@ -1,5 +1,15 @@
-TEMPLATE = subdirs
-SUBDIRS = audio
+TEMPLATE = subdirs
+
+!static {
+ SUBDIRS += \
+ audiodevices \
+ audioinput \
+ audiooutput
+}
+
+SUBDIRS += \
+ videographicsitem \
+ videowidget
# install
target.path = $$[QT_INSTALL_EXAMPLES]/multimedia
diff --git a/examples/video/videographicsitem/main.cpp b/examples/multimedia/videographicsitem/main.cpp
index 3bf4c6d67c..3bf4c6d67c 100644
--- a/examples/video/videographicsitem/main.cpp
+++ b/examples/multimedia/videographicsitem/main.cpp
diff --git a/examples/video/videographicsitem/videographicsitem.pro b/examples/multimedia/videographicsitem/videographicsitem.pro
index d79c3fb275..7c118ccd60 100644
--- a/examples/video/videographicsitem/videographicsitem.pro
+++ b/examples/multimedia/videographicsitem/videographicsitem.pro
@@ -10,9 +10,9 @@ SOURCES += main.cpp \
videoitem.cpp
# install
-target.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem
sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
-sources.path = $$[QT_INSTALL_EXAMPLES]/video/videographicsitem
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videographicsitem
INSTALLS += target sources
symbian {
diff --git a/examples/video/videographicsitem/videoitem.cpp b/examples/multimedia/videographicsitem/videoitem.cpp
index c95e33591b..c95e33591b 100644
--- a/examples/video/videographicsitem/videoitem.cpp
+++ b/examples/multimedia/videographicsitem/videoitem.cpp
diff --git a/examples/video/videographicsitem/videoitem.h b/examples/multimedia/videographicsitem/videoitem.h
index 96f578acdd..96f578acdd 100644
--- a/examples/video/videographicsitem/videoitem.h
+++ b/examples/multimedia/videographicsitem/videoitem.h
diff --git a/examples/video/videographicsitem/videoplayer.cpp b/examples/multimedia/videographicsitem/videoplayer.cpp
index 83644db7d5..83644db7d5 100644
--- a/examples/video/videographicsitem/videoplayer.cpp
+++ b/examples/multimedia/videographicsitem/videoplayer.cpp
diff --git a/examples/video/videographicsitem/videoplayer.h b/examples/multimedia/videographicsitem/videoplayer.h
index 8e73e4ccf1..8e73e4ccf1 100644
--- a/examples/video/videographicsitem/videoplayer.h
+++ b/examples/multimedia/videographicsitem/videoplayer.h
diff --git a/examples/video/videowidget/main.cpp b/examples/multimedia/videowidget/main.cpp
index f5edf73e4f..f5edf73e4f 100644
--- a/examples/video/videowidget/main.cpp
+++ b/examples/multimedia/videowidget/main.cpp
diff --git a/examples/video/videowidget/videoplayer.cpp b/examples/multimedia/videowidget/videoplayer.cpp
index ed24714994..ed24714994 100644
--- a/examples/video/videowidget/videoplayer.cpp
+++ b/examples/multimedia/videowidget/videoplayer.cpp
diff --git a/examples/video/videowidget/videoplayer.h b/examples/multimedia/videowidget/videoplayer.h
index 65474152f2..65474152f2 100644
--- a/examples/video/videowidget/videoplayer.h
+++ b/examples/multimedia/videowidget/videoplayer.h
diff --git a/examples/video/videowidget/videowidget.cpp b/examples/multimedia/videowidget/videowidget.cpp
index 80688e1998..80688e1998 100644
--- a/examples/video/videowidget/videowidget.cpp
+++ b/examples/multimedia/videowidget/videowidget.cpp
diff --git a/examples/video/videowidget/videowidget.h b/examples/multimedia/videowidget/videowidget.h
index 8c343bf0c7..8c343bf0c7 100644
--- a/examples/video/videowidget/videowidget.h
+++ b/examples/multimedia/videowidget/videowidget.h
diff --git a/examples/video/videowidget/videowidget.pro b/examples/multimedia/videowidget/videowidget.pro
index 4a1d717c5f..3f93745584 100644
--- a/examples/video/videowidget/videowidget.pro
+++ b/examples/multimedia/videowidget/videowidget.pro
@@ -13,6 +13,12 @@ SOURCES = \
videowidget.cpp \
videowidgetsurface.cpp
+# install
+target.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget
+sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES *.pro *.png images
+sources.path = $$[QT_INSTALL_EXAMPLES]/multimedia/videowidget
+INSTALLS += target sources
+
symbian {
TARGET.UID3 = 0xA000D7C3
include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
diff --git a/examples/video/videowidget/videowidgetsurface.cpp b/examples/multimedia/videowidget/videowidgetsurface.cpp
index ec9b8b5600..ec9b8b5600 100644
--- a/examples/video/videowidget/videowidgetsurface.cpp
+++ b/examples/multimedia/videowidget/videowidgetsurface.cpp
diff --git a/examples/video/videowidget/videowidgetsurface.h b/examples/multimedia/videowidget/videowidgetsurface.h
index 83439d303e..83439d303e 100644
--- a/examples/video/videowidget/videowidgetsurface.h
+++ b/examples/multimedia/videowidget/videowidgetsurface.h
diff --git a/examples/opengl/pbuffers/cube.h b/examples/opengl/pbuffers/cube.h
index c882f1f672..f17299fd4b 100644
--- a/examples/opengl/pbuffers/cube.h
+++ b/examples/opengl/pbuffers/cube.h
@@ -48,7 +48,9 @@
#include <QtGui/qvector3d.h>
#include <QtGui/qvector2d.h>
+QT_BEGIN_NAMESPACE
class QPropertyAnimation;
+QT_END_NAMESPACE
class Geometry
{
diff --git a/examples/opengl/pbuffers/glwidget.h b/examples/opengl/pbuffers/glwidget.h
index c019abef98..1b46bfdf54 100644
--- a/examples/opengl/pbuffers/glwidget.h
+++ b/examples/opengl/pbuffers/glwidget.h
@@ -47,7 +47,9 @@
class Geometry;
class Cube;
class Tile;
+QT_BEGIN_NAMESPACE
class QGLPixelBuffer;
+QT_END_NAMESPACE
class GLWidget : public QGLWidget
{
diff --git a/examples/video/video.pro b/examples/video/video.pro
deleted file mode 100644
index f0b63b6d00..0000000000
--- a/examples/video/video.pro
+++ /dev/null
@@ -1,6 +0,0 @@
-TEMPLATE = subdirs
-
-SUBDIRS += \
- videographicsitem \
- videowidget
-
diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp
index 1fd2165d9c..a1c9833368 100644
--- a/src/corelib/io/qsettings.cpp
+++ b/src/corelib/io/qsettings.cpp
@@ -2565,8 +2565,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
Example:
\snippet doc/src/snippets/code/src_corelib_io_qsettings.cpp 10
- The scope is QSettings::UserScope and the format is
- QSettings::NativeFormat.
+ The scope is set to QSettings::UserScope, and the format is
+ set to QSettings::NativeFormat (i.e. calling setDefaultFormat()
+ before calling this constructor has no effect).
\sa setDefaultFormat(), {Fallback Mechanism}
*/
@@ -2583,11 +2584,12 @@ QSettings::QSettings(const QString &organization, const QString &application, QO
If \a scope is QSettings::UserScope, the QSettings object searches
user-specific settings first, before it searches system-wide
- settings as a fallback. If \a scope is
- QSettings::SystemScope, the QSettings object ignores user-specific
- settings and provides access to system-wide settings.
+ settings as a fallback. If \a scope is QSettings::SystemScope, the
+ QSettings object ignores user-specific settings and provides
+ access to system-wide settings.
- The storage format is QSettings::NativeFormat.
+ The storage format is set to QSettings::NativeFormat (i.e. calling
+ setDefaultFormat() before calling this constructor has no effect).
If no application name is given, the QSettings object will
only access the organization-wide \l{Fallback Mechanism}{locations}.
@@ -2668,6 +2670,8 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent)
The scope is QSettings::UserScope and the format is
defaultFormat() (QSettings::NativeFormat by default).
+ Use setDefaultFormat() before calling this constructor
+ to change the default format used by this constructor.
The code
@@ -3352,10 +3356,12 @@ QVariant QSettings::value(const QString &key, const QVariant &defaultValue) cons
/*!
\since 4.4
- Sets the default file format to the given \a format, used for storing
- settings for the QSettings(QObject *) constructor.
+ Sets the default file format to the given \a format, which is used
+ for storing settings for the QSettings(QObject *) constructor.
- If no default format is set, QSettings::NativeFormat is used.
+ If no default format is set, QSettings::NativeFormat is used. See
+ the documentation for the QSettings constructor you are using to
+ see if that constructor will ignore this function.
\sa format()
*/
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 22d0019220..6001d9d2f7 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3874,10 +3874,15 @@ QByteArray QUrlPrivate::toEncoded(QUrl::FormattingOptions options) const
}
}
- if (host.startsWith(QLatin1Char('[')))
+ if (host.startsWith(QLatin1Char('['))) {
url += host.toLatin1();
- else
+ } else if (host.contains(QLatin1Char(':'))) {
+ url += '[';
+ url += host.toLatin1();
+ url += ']';
+ } else {
url += QUrl::toAce(host);
+ }
if (!(options & QUrl::RemovePort) && port != -1) {
url += ':';
url += QString::number(port).toAscii();
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index a8120cf008..7be19b3f2b 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -3332,6 +3332,7 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
QObjectConnectionListVector *connectionLists = sender->d_func()->connectionLists;
if (!connectionLists) {
+ locker.unlock();
if (qt_signal_spy_callback_set.signal_end_callback != 0)
qt_signal_spy_callback_set.signal_end_callback(sender, signal_absolute_index);
return;
@@ -3401,11 +3402,11 @@ void QMetaObject::activate(QObject *sender, const QMetaObject *m, int local_sign
}
#endif
- locker.relock();
-
if (qt_signal_spy_callback_set.slot_end_callback != 0)
qt_signal_spy_callback_set.slot_end_callback(receiver, method);
+ locker.relock();
+
QObjectPrivate::resetCurrentSender(receiver, &currentSender, previousSender);
if (connectionLists->orphaned)
diff --git a/src/gui/egl/qegl_qws.cpp b/src/gui/egl/qegl_qws.cpp
index 590b6660b3..df1179aac5 100644
--- a/src/gui/egl/qegl_qws.cpp
+++ b/src/gui/egl/qegl_qws.cpp
@@ -83,7 +83,8 @@ static QScreen *screenForDevice(QPaintDevice *device)
screenNumber = 0;
screen = screen->subScreens()[screenNumber];
}
- while (screen->classId() == QScreen::ProxyClass) {
+ while (screen->classId() == QScreen::ProxyClass ||
+ screen->classId() == QScreen::TransformedClass) {
screen = static_cast<QProxyScreen *>(screen)->screen();
}
return screen;
diff --git a/src/gui/embedded/directfb.pri b/src/gui/embedded/directfb.pri
index fa4dd682dc..84253b5683 100644
--- a/src/gui/embedded/directfb.pri
+++ b/src/gui/embedded/directfb.pri
@@ -1,7 +1,7 @@
# These defines might be necessary if your DirectFB driver doesn't
# support all of the DirectFB API.
#
-#DEFINES += QT_NO_DIRECTFB_SUBSURFACE
+#DEFINES += QT_DIRECTFB_SUBSURFACE
#DEFINES += QT_DIRECTFB_WINDOW_AS_CURSOR
#DEFINES += QT_NO_DIRECTFB_IMAGEPROVIDER
#DEFINES += QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index 5412e11ce1..46c54317e9 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -78,6 +78,8 @@ static QString fallbackTheme()
return X11->desktopVersion >= 4
? QString::fromLatin1("oxygen")
: QString::fromLatin1("crystalsvg");
+ } else {
+ return QLatin1String("hicolor");
}
#endif
return QString();
@@ -87,6 +89,8 @@ QIconLoader::QIconLoader() :
m_themeKey(1), m_supportsSvg(false)
{
m_systemTheme = qt_guiPlatformPlugin()->systemIconThemeName();
+ if (m_systemTheme.isEmpty())
+ m_systemTheme = fallbackTheme();
QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid,
QLatin1String("/iconengines"),
@@ -107,6 +111,8 @@ void QIconLoader::updateSystemTheme()
// Only change if this is not explicitly set by the user
if (m_userTheme.isEmpty()) {
QString theme = qt_guiPlatformPlugin()->systemIconThemeName();
+ if (theme.isEmpty())
+ theme = fallbackTheme();
if (theme != m_systemTheme) {
m_systemTheme = theme;
invalidateKey();
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 268e78ea38..d91cedd18f 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1697,7 +1697,7 @@ void QAbstractItemView::mouseMoveEvent(QMouseEvent *event)
if ((event->buttons() & Qt::LeftButton) && d->selectionAllowed(index) && d->selectionModel) {
setState(DragSelectingState);
QItemSelectionModel::SelectionFlags command = selectionCommand(index, event);
- if (command.testFlag(QItemSelectionModel::Toggle)) {
+ if (d->ctrlDragSelectionFlag != QItemSelectionModel::NoUpdate && command.testFlag(QItemSelectionModel::Toggle)) {
command &= ~QItemSelectionModel::Toggle;
command |= d->ctrlDragSelectionFlag;
}
@@ -3029,7 +3029,7 @@ void QAbstractItemView::update(const QModelIndex &index)
//this test is important for peformance reason
//For example in dataChanged we simply update all the cells without checking
//it can be a major bottleneck to update rects that aren't even part of the viewport
- if (d->viewport->geometry().intersects(rect))
+ if (d->viewport->rect().intersects(rect))
d->viewport->update(rect);
}
}
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp
index 2d98258894..a610b737d8 100644
--- a/src/gui/itemviews/qtableview.cpp
+++ b/src/gui/itemviews/qtableview.cpp
@@ -1117,6 +1117,9 @@ void QTableView::setHorizontalHeader(QHeaderView *header)
connect(d->horizontalHeader, SIGNAL(sectionHandleDoubleClicked(int)),
this, SLOT(resizeColumnToContents(int)));
connect(d->horizontalHeader, SIGNAL(geometriesChanged()), this, SLOT(updateGeometries()));
+
+ //update the sorting enabled states on the new header
+ setSortingEnabled(d->sortingEnabled);
}
/*!
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index a0864984f0..21c4e0a1b1 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -571,6 +571,8 @@ void QTableModel::ensureSorted(int column, Qt::SortOrder order,
colItems.remove(oldRow);
vit = sortedInsertionIterator(vit, colItems.end(), order, item);
int newRow = qMax((int)(vit - colItems.begin()), 0);
+ if ((newRow < oldRow) && !(*item < *colItems.at(oldRow - 1)) && !(*colItems.at(oldRow - 1) < *item))
+ newRow = oldRow;
vit = colItems.insert(vit, item);
if (newRow != oldRow) {
changed = true;
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index 06342d8e4b..040c498716 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -623,7 +623,7 @@ void QTreeModel::ensureSorted(int column, Qt::SortOrder order,
lit = sortedInsertionIterator(lit, lst.end(), order, item);
int newRow = qMax(lit - lst.begin(), 0);
- if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1)))
+ if ((newRow < oldRow) && !(*item < *lst.at(oldRow - 1)) && !(*lst.at(oldRow - 1) < *item ))
newRow = oldRow;
lit = lst.insert(lit, item);
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index c55d6e0339..cb9dda4518 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -464,12 +464,47 @@ void QSymbianControl::HandlePointerEventL(const TPointerEvent& pEvent)
QT_TRYCATCH_LEAVING(HandlePointerEvent(pEvent));
}
+typedef QPair<QWidget*,QMouseEvent> Event;
+
+/*
+ * Helper function called by HandlePointerEvent - separated to keep that function readable
+ */
+static void generateEnterLeaveEvents(QList<Event> &events, QWidget *widgetUnderPointer,
+ QPoint globalPos, Qt::MouseButton button, Qt::KeyboardModifiers modifiers)
+{
+ //moved to another widget, create enter and leave events
+ if (S60->lastPointerEventTarget) {
+ QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal(
+ S60->lastCursorPos), S60->lastCursorPos, button, QApplicationPrivate::mouse_buttons,
+ modifiers);
+ events.append(Event(S60->lastPointerEventTarget, mEventLeave));
+ }
+ if (widgetUnderPointer) {
+ QMouseEvent mEventEnter(QEvent::Enter, widgetUnderPointer->mapFromGlobal(globalPos),
+ globalPos, button, QApplicationPrivate::mouse_buttons, modifiers);
+
+ events.append(Event(widgetUnderPointer, mEventEnter));
+#ifndef QT_NO_CURSOR
+ S60->curWin = widgetUnderPointer->effectiveWinId();
+ if (!QApplication::overrideCursor()) {
+#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
+ if (S60->brokenPointerCursors)
+ qt_symbian_set_pointer_sprite(widgetUnderPointer->cursor());
+ else
+#endif
+ qt_symbian_setWindowCursor(widgetUnderPointer->cursor(), S60->curWin);
+ }
+#endif
+ }
+}
+
+
void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
{
- //### refactor me, getting too complex
QMouseEvent::Type type;
Qt::MouseButton button;
mapS60MouseEventTypeToQt(&type, &button, &pEvent);
+ Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers);
if (m_previousEventLongTap)
if (type == QEvent::MouseButtonRelease){
@@ -481,79 +516,76 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
return;
// store events for later sending/saving
- QWidget *alienWidget;
- typedef QPair<QWidget*,QMouseEvent> Event;
QList<Event > events;
QPoint widgetPos = QPoint(pEvent.iPosition.iX, pEvent.iPosition.iY);
TPoint controlScreenPos = PositionRelativeToScreen();
QPoint globalPos = QPoint(controlScreenPos.iX, controlScreenPos.iY) + widgetPos;
- if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove)
- {
- // get the widget where the event happened
- alienWidget = qwidget->childAt(widgetPos);
- if (!alienWidget)
- alienWidget = qwidget;
- S60->mousePressTarget = alienWidget;
+ // widgets interested in the event
+ QWidget *widgetUnderPointer = qwidget->childAt(widgetPos);
+ if (!widgetUnderPointer)
+ widgetUnderPointer = qwidget; //i.e. this container widget
+
+ QWidget *widgetWithMouseGrab = QWidget::mouseGrabber();
+
+ // handle auto grab of pointer when pressing / releasing
+ if (!widgetWithMouseGrab && type == QEvent::MouseButtonPress) {
+ //if previously auto-grabbed, generate a fake mouse release (platform bug: mouse release event was lost)
+ if (S60->mousePressTarget) {
+ QMouseEvent mEvent(QEvent::MouseButtonRelease, S60->mousePressTarget->mapFromGlobal(globalPos), globalPos,
+ button, QApplicationPrivate::mouse_buttons, modifiers);
+ events.append(Event(S60->mousePressTarget,mEvent));
+ }
+ //auto grab the mouse
+ widgetWithMouseGrab = S60->mousePressTarget = widgetUnderPointer;
+ widgetWithMouseGrab->grabMouse();
+ }
+ if (widgetWithMouseGrab && widgetWithMouseGrab == S60->mousePressTarget && type == QEvent::MouseButtonRelease) {
+ //release the auto grab - note this release event still goes to the autograb widget
+ S60->mousePressTarget = 0;
+ widgetWithMouseGrab->releaseMouse();
}
- alienWidget = S60->mousePressTarget;
+ QWidget *widgetToReceiveMouseEvent;
+ if (widgetWithMouseGrab)
+ widgetToReceiveMouseEvent = widgetWithMouseGrab;
+ else
+ widgetToReceiveMouseEvent = widgetUnderPointer;
- if (alienWidget != S60->lastPointerEventTarget)
- if (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove)
- {
- //moved to another widget, create enter and leave events
- if (S60->lastPointerEventTarget)
- {
- QMouseEvent mEventLeave(QEvent::Leave, S60->lastPointerEventTarget->mapFromGlobal(S60->lastCursorPos), S60->lastCursorPos,
- button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers));
- events.append(Event(S60->lastPointerEventTarget,mEventLeave));
- }
- if (alienWidget) {
- QMouseEvent mEventEnter(QEvent::Enter, alienWidget->mapFromGlobal(globalPos),
- globalPos, button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(
- pEvent.iModifiers));
+ //queue QEvent::Enter and QEvent::Leave, if the pointer has moved
+ if (widgetUnderPointer != S60->lastPointerEventTarget && (type == QEvent::MouseButtonPress || type == QEvent::MouseButtonDblClick || type == QEvent::MouseMove))
+ generateEnterLeaveEvents(events, widgetUnderPointer, globalPos, button, modifiers);
- events.append(Event(alienWidget, mEventEnter));
-#ifndef QT_NO_CURSOR
- S60->curWin = alienWidget->effectiveWinId();
- if (!QApplication::overrideCursor()) {
-#ifndef Q_SYMBIAN_FIXED_POINTER_CURSORS
- if (S60->brokenPointerCursors)
- qt_symbian_set_pointer_sprite(alienWidget->cursor());
- else
-#endif
- qt_symbian_setWindowCursor(alienWidget->cursor(), S60->curWin);
- }
-#endif
- }
- }
+ //save global state
S60->lastCursorPos = globalPos;
+ S60->lastPointerEventPos = widgetPos;
+ S60->lastPointerEventTarget = widgetUnderPointer;
+
#if !defined(QT_NO_CURSOR) && !defined(Q_SYMBIAN_FIXED_POINTER_CURSORS)
if (S60->brokenPointerCursors)
qt_symbian_move_cursor_sprite();
#endif
- S60->lastPointerEventPos = widgetPos;
- S60->lastPointerEventTarget = alienWidget;
- if (alienWidget)
- {
- QMouseEvent mEvent(type, alienWidget->mapFromGlobal(globalPos), globalPos,
- button, QApplicationPrivate::mouse_buttons, mapToQtModifiers(pEvent.iModifiers));
- events.append(Event(alienWidget,mEvent));
- QEventDispatcherS60 *dispatcher;
- // It is theoretically possible for someone to install a different event dispatcher.
- if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(alienWidget->d_func()->threadData->eventDispatcher)) != 0) {
- if (dispatcher->excludeUserInputEvents()) {
- for (int i=0;i < events.count();++i)
- {
- Event next = events[i];
- dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second));
- }
- return;
+
+ //queue this event.
+ Q_ASSERT(widgetToReceiveMouseEvent);
+ QMouseEvent mEvent(type, widgetToReceiveMouseEvent->mapFromGlobal(globalPos), globalPos,
+ button, QApplicationPrivate::mouse_buttons, modifiers);
+ events.append(Event(widgetToReceiveMouseEvent,mEvent));
+ QEventDispatcherS60 *dispatcher;
+ // It is theoretically possible for someone to install a different event dispatcher.
+ if ((dispatcher = qobject_cast<QEventDispatcherS60 *>(widgetToReceiveMouseEvent->d_func()->threadData->eventDispatcher)) != 0) {
+ if (dispatcher->excludeUserInputEvents()) {
+ for (int i=0;i < events.count();++i)
+ {
+ Event next = events[i];
+ dispatcher->saveInputEvent(this, next.first, new QMouseEvent(next.second));
}
+ return;
}
}
+
+ //send events in the queue
for (int i=0;i < events.count();++i)
{
Event next = events[i];
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index b1c5fc5485..4c2a14a033 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -1066,7 +1066,10 @@ extern "C" {
sendToPopup = true;
}
- if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)) {
+ if (widgetToGetKey->testAttribute(Qt::WA_InputMethodEnabled)
+ && !(widgetToGetKey->inputMethodHints() & Qt::ImhDigitsOnly
+ || widgetToGetKey->inputMethodHints() & Qt::ImhFormattedNumbersOnly
+ || widgetToGetKey->inputMethodHints() & Qt::ImhHiddenText)) {
[qt_mac_nativeview_for(widgetToGetKey) interpretKeyEvents:[NSArray arrayWithObject: theEvent]];
}
if (sendKeyEvents && !composing) {
@@ -1420,29 +1423,29 @@ Qt::DropAction QDragManager::drag(QDrag *o)
// convert the image to NSImage.
NSImage *image = (NSImage *)qt_mac_create_nsimage(pix);
[image retain];
- DnDParams *dndParams = [QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];
+ DnDParams dndParams = *[QT_MANGLE_NAMESPACE(QCocoaView) currentMouseEvent];
// save supported actions
- [dndParams->view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];
- NSPoint imageLoc = {dndParams->localPoint.x - hotspot.x(),
- dndParams->localPoint.y + pix.height() - hotspot.y()};
+ [dndParams.view setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];
+ NSPoint imageLoc = {dndParams.localPoint.x - hotspot.x(),
+ dndParams.localPoint.y + pix.height() - hotspot.y()};
NSSize mouseOffset = {0.0, 0.0};
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- NSPoint windowPoint = [dndParams->theEvent locationInWindow];
+ NSPoint windowPoint = [dndParams.theEvent locationInWindow];
dragPrivate()->executed_action = Qt::ActionMask;
// do the drag
- [dndParams->view retain];
- [dndParams->view dragImage:image
+ [dndParams.view retain];
+ [dndParams.view dragImage:image
at:imageLoc
offset:mouseOffset
- event:dndParams->theEvent
+ event:dndParams.theEvent
pasteboard:pboard
- source:dndParams->view
+ source:dndParams.view
slideBack:YES];
- [dndParams->view release];
+ [dndParams.view release];
[image release];
dragPrivate()->executed_action = Qt::IgnoreAction;
object = 0;
- Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams->performedAction));
+ Qt::DropAction performedAction(qt_mac_mapNSDragOperation(dndParams.performedAction));
// do post drag processing, if required.
if(performedAction != Qt::IgnoreAction) {
// check if the receiver points us to a file location.
diff --git a/src/gui/kernel/qgesture.h b/src/gui/kernel/qgesture.h
index 00348190c4..02eb526096 100644
--- a/src/gui/kernel/qgesture.h
+++ b/src/gui/kernel/qgesture.h
@@ -51,12 +51,12 @@
QT_BEGIN_HEADER
+Q_DECLARE_METATYPE(Qt::GestureState)
+
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-Q_DECLARE_METATYPE(Qt::GestureState)
-
class QGesturePrivate;
class Q_GUI_EXPORT QGesture : public QObject
{
@@ -180,8 +180,12 @@ public:
friend class QPinchGestureRecognizer;
};
+QT_END_NAMESPACE
+
Q_DECLARE_METATYPE(QPinchGesture::WhatChanged)
+QT_BEGIN_NAMESPACE
+
class QSwipeGesturePrivate;
class Q_GUI_EXPORT QSwipeGesture : public QGesture
{
diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm
index 4fc3d3d589..cee38ee925 100644
--- a/src/gui/widgets/qmenu_mac.mm
+++ b/src/gui/widgets/qmenu_mac.mm
@@ -1425,7 +1425,7 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action)
SetMenuItemProperty(data.submenuHandle, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused);
#else
NSMenu *subMenu = static_cast<NSMenu *>(action->action->menu()->macMenu());
- if ([subMenu supermenu] != nil) {
+ if ([subMenu supermenu] && [subMenu supermenu] != [item menu]) {
// The menu is already a sub-menu of another one. Cocoa will throw an exception,
// in such cases. For the time being, a new QMenu with same set of actions is the
// only workaround.
@@ -1718,7 +1718,7 @@ QMenuBarPrivate::QMacMenuBarPrivate::syncAction(QMacMenuAction *action)
GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused);
SetMenuItemProperty(submenu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused);
#else
- if ([submenu supermenu] != nil)
+ if ([submenu supermenu] && [submenu supermenu] != [item menu])
return;
else
[item setSubmenu:submenu];
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index 81fac5743d..6962ab3b19 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -105,6 +105,9 @@ void QHttpNetworkConnectionChannel::init()
QObject::connect(sslSocket, SIGNAL(sslErrors(const QList<QSslError>&)),
this, SLOT(_q_sslErrors(const QList<QSslError>&)),
Qt::DirectConnection);
+ QObject::connect(sslSocket, SIGNAL(encryptedBytesWritten(qint64)),
+ this, SLOT(_q_encryptedBytesWritten(qint64)),
+ Qt::DirectConnection);
}
#endif
}
@@ -881,6 +884,15 @@ void QHttpNetworkConnectionChannel::_q_sslErrors(const QList<QSslError> &errors)
//QNetworkReply::NetworkError errorCode = QNetworkReply::ProtocolFailure;
emit connection->sslErrors(errors);
}
+
+void QHttpNetworkConnectionChannel::_q_encryptedBytesWritten(qint64 bytes)
+{
+ Q_UNUSED(bytes);
+ // bytes have been written to the socket. write even more of them :)
+ if (isSocketWriting())
+ sendRequest();
+ // otherwise we do nothing
+}
#endif
QT_END_NAMESPACE
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 1d1153e9f5..127a431ed0 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -180,6 +180,7 @@ public:
#ifndef QT_NO_OPENSSL
void _q_encrypted(); // start sending request (https)
void _q_sslErrors(const QList<QSslError> &errors); // ssl errors from the socket
+ void _q_encryptedBytesWritten(qint64 bytes); // proceed sending
#endif
};
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 0e9cb4f39a..a5732fb09f 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -149,6 +149,13 @@
This product includes software developed by the OpenSSL Project
for use in the OpenSSL Toolkit (\l{http://www.openssl.org/}).
+ \note Be aware of the difference between the bytesWritten() signal and
+ the encryptedBytesWritten() signal. For a QTcpSocket, bytesWritten()
+ will get emitted as soon as data has been written to the TCP socket.
+ For a QSslSocket, bytesWritten() will get emitted when the data
+ is being encrypted and encryptedBytesWritten()
+ will get emitted as soon as data has been written to the TCP socket.
+
\sa QSslCertificate, QSslCipher, QSslError
*/
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index d4347253d4..e561932a02 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -126,14 +126,12 @@ wince*: {
embedded {
SOURCES += qgl_qws.cpp \
- qglpaintdevice_qws.cpp \
qglpixelbuffer_egl.cpp \
qglscreen_qws.cpp \
qglwindowsurface_qws.cpp \
qgl_egl.cpp
- HEADERS += qglpaintdevice_qws_p.h \
- qglscreen_qws.h \
+ HEADERS += qglscreen_qws.h \
qglwindowsurface_qws_p.h \
qgl_egl_p.h
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 5e00b1195b..0d00f594fa 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -76,7 +76,6 @@
#endif
#ifdef Q_WS_QWS
-#include <private/qglpaintdevice_qws_p.h>
#include <private/qglwindowsurface_qws_p.h>
#endif
diff --git a/src/opengl/qgl_qws.cpp b/src/opengl/qgl_qws.cpp
index bb23acef7d..5e59975c34 100644
--- a/src/opengl/qgl_qws.cpp
+++ b/src/opengl/qgl_qws.cpp
@@ -73,7 +73,8 @@ static QGLScreen *glScreenForDevice(QPaintDevice *device)
screenNumber = 0;
screen = screen->subScreens()[screenNumber];
}
- while (screen->classId() == QScreen::ProxyClass) {
+ while (screen->classId() == QScreen::ProxyClass ||
+ screen->classId() == QScreen::TransformedClass) {
screen = static_cast<QProxyScreen *>(screen)->screen();
}
if (screen->classId() == QScreen::GLClass)
diff --git a/src/opengl/qglpaintdevice_p.h b/src/opengl/qglpaintdevice_p.h
index 1e7ba8dd4a..63ba5da45d 100644
--- a/src/opengl/qglpaintdevice_p.h
+++ b/src/opengl/qglpaintdevice_p.h
@@ -60,7 +60,7 @@
QT_BEGIN_NAMESPACE
-class QGLPaintDevice : public QPaintDevice
+class Q_OPENGL_EXPORT QGLPaintDevice : public QPaintDevice
{
public:
QGLPaintDevice();
diff --git a/src/opengl/qglpaintdevice_qws.cpp b/src/opengl/qglpaintdevice_qws.cpp
deleted file mode 100644
index 1512278d79..0000000000
--- a/src/opengl/qglpaintdevice_qws.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qglpaintdevice_qws_p.h>
-#include <private/qgl_p.h>
-#include <private/qpaintengine_opengl_p.h>
-#include <private/qglwindowsurface_qws_p.h>
-
-QT_BEGIN_NAMESPACE
-
-class QWSGLPaintDevicePrivate
-{
-public:
- QWidget *widget;
-};
-
-QWSGLPaintDevice::QWSGLPaintDevice(QWidget *widget) :
- d_ptr(new QWSGLPaintDevicePrivate)
-{
- Q_D(QWSGLPaintDevice);
- d->widget = widget;
-}
-
-QWSGLPaintDevice::~QWSGLPaintDevice()
-{
-}
-
-QPaintEngine* QWSGLPaintDevice::paintEngine() const
-{
- return qt_qgl_paint_engine();
-}
-
-int QWSGLPaintDevice::metric(PaintDeviceMetric m) const
-{
- Q_D(const QWSGLPaintDevice);
- Q_ASSERT(d->widget);
-
- return qt_paint_device_metric(d->widget, m);
-}
-
-QWSGLWindowSurface* QWSGLPaintDevice::windowSurface() const
-{
- Q_D(const QWSGLPaintDevice);
- return static_cast<QWSGLWindowSurface*>(d->widget->windowSurface());
-}
-
-QT_END_NAMESPACE
diff --git a/src/opengl/qglpaintdevice_qws_p.h b/src/opengl/qglpaintdevice_qws_p.h
deleted file mode 100644
index 6dc9d31ed4..0000000000
--- a/src/opengl/qglpaintdevice_qws_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the QtOpenGL module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-**
-**
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QWSGLPAINTDEVICE_GL_P_H
-#define QWSGLPAINTDEVICE_GL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of the QGLWindowSurface class. This header file may change from
-// version to version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qscopedpointer.h>
-#include <QPaintDevice>
-
-QT_BEGIN_NAMESPACE
-
-class QWidget;
-class QWSGLWindowSurface;
-class QWSGLPaintDevicePrivate;
-
-class Q_OPENGL_EXPORT QWSGLPaintDevice : public QPaintDevice
-{
- Q_DECLARE_PRIVATE(QWSGLPaintDevice)
-public:
- QWSGLPaintDevice(QWidget *widget);
- ~QWSGLPaintDevice();
-
- QPaintEngine *paintEngine() const;
-
- int metric(PaintDeviceMetric m) const;
-
- QWSGLWindowSurface *windowSurface() const;
-
-private:
- friend class QWSGLWindowSurface;
- QScopedPointer<QWSGLPaintDevicePrivate> d_ptr;
-};
-
-
-QT_END_NAMESPACE
-
-#endif // QWSGLPAINTDEVICE_GL_P_H
diff --git a/src/opengl/qglwindowsurface_qws.cpp b/src/opengl/qglwindowsurface_qws.cpp
index 6bf32570b9..5041cb9d91 100644
--- a/src/opengl/qglwindowsurface_qws.cpp
+++ b/src/opengl/qglwindowsurface_qws.cpp
@@ -43,7 +43,6 @@
#include <QtGui/QWidget>
#include <QtOpenGL/QGLWidget>
#include "private/qglwindowsurface_qws_p.h"
-#include "private/qglpaintdevice_qws_p.h"
#include "private/qpaintengine_opengl_p.h"
QT_BEGIN_NAMESPACE
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 3e4a8e73d9..1a11476fb4 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -66,7 +66,6 @@
#include "util/fragmentprograms_p.h"
#ifdef Q_WS_QWS
-#include "private/qglpaintdevice_qws_p.h"
#include "private/qglwindowsurface_qws_p.h"
#include "qwsmanager_qws.h"
#include "private/qwsmanager_p.h"
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index e0c99d7d2a..fdd61ea812 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -3328,9 +3328,6 @@ QPixmapFilter *QVGPaintEngine::pixmapFilter(int type, const QPixmapFilter *proto
d->convolutionFilter.reset(new QVGPixmapConvolutionFilter);
return d->convolutionFilter.data();
case QPixmapFilter::ColorizeFilter:
- // Strength parameter does not work with current implementation.
- if ((static_cast<const QPixmapColorizeFilter *>(prototype))->strength() != 1.0f)
- break;
if (!d->colorizeFilter)
d->colorizeFilter.reset(new QVGPixmapColorizeFilter);
return d->colorizeFilter.data();
diff --git a/src/openvg/qpixmapfilter_vg.cpp b/src/openvg/qpixmapfilter_vg.cpp
index 613f4eaf0b..3305bbb695 100644
--- a/src/openvg/qpixmapfilter_vg.cpp
+++ b/src/openvg/qpixmapfilter_vg.cpp
@@ -123,8 +123,7 @@ void QVGPixmapConvolutionFilter::draw
}
QVGPixmapColorizeFilter::QVGPixmapColorizeFilter()
- : QPixmapColorizeFilter(),
- firstTime(true)
+ : QPixmapColorizeFilter()
{
}
@@ -136,7 +135,7 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const
{
if (src.pixmapData()->classId() != QPixmapData::OpenVGClass) {
// The pixmap data is not an instance of QVGPixmapData, so fall
- // back to the default convolution filter implementation.
+ // back to the default colorize filter implementation.
QPixmapColorizeFilter::draw(painter, dest, src, srcRect);
return;
}
@@ -154,50 +153,45 @@ void QVGPixmapColorizeFilter::draw(QPainter *painter, const QPointF &dest, const
if (dstImage == VG_INVALID_HANDLE)
return;
- // Recompute the color matrix if the color has changed.
+ // Determine the weights for the matrix from the color and strength.
QColor c = color();
- if (c != prevColor || firstTime) {
- prevColor = c;
-
- // Determine the weights for the matrix from the color.
- VGfloat weights[3];
- VGfloat invweights[3];
- VGfloat alpha = c.alphaF();
- weights[0] = c.redF() * alpha;
- weights[1] = c.greenF() * alpha;
- weights[2] = c.blueF() * alpha;
- invweights[0] = 1.0f - weights[0];
- invweights[1] = 1.0f - weights[1];
- invweights[2] = 1.0f - weights[2];
-
- // Grayscale weights.
- static const VGfloat redGray = 11.0f / 32.0f;
- static const VGfloat greenGray = 16.0f / 32.0f;
- static const VGfloat blueGray = 1.0f - (redGray + greenGray);
-
- matrix[0][0] = redGray * invweights[0];
- matrix[0][1] = redGray * invweights[1];
- matrix[0][2] = redGray * invweights[2];
- matrix[0][3] = 0.0f;
- matrix[1][0] = greenGray * invweights[0];
- matrix[1][1] = greenGray * invweights[1];
- matrix[1][2] = greenGray * invweights[2];
- matrix[1][3] = 0.0f;
- matrix[2][0] = blueGray * invweights[0];
- matrix[2][1] = blueGray * invweights[1];
- matrix[2][2] = blueGray * invweights[2];
- matrix[2][3] = 0.0f;
- matrix[3][0] = 0.0f;
- matrix[3][1] = 0.0f;
- matrix[3][2] = 0.0f;
- matrix[3][3] = 1.0f;
- matrix[4][0] = weights[0];
- matrix[4][1] = weights[1];
- matrix[4][2] = weights[2];
- matrix[4][3] = 0.0f;
- }
-
- firstTime = false;
+ VGfloat strength = this->strength();
+ VGfloat weights[3];
+ VGfloat invweights[3];
+ VGfloat alpha = c.alphaF();
+ weights[0] = c.redF() * alpha;
+ weights[1] = c.greenF() * alpha;
+ weights[2] = c.blueF() * alpha;
+ invweights[0] = (1.0f - weights[0]) * strength;
+ invweights[1] = (1.0f - weights[1]) * strength;
+ invweights[2] = (1.0f - weights[2]) * strength;
+
+ // Grayscale weights.
+ static const VGfloat redGray = 11.0f / 32.0f;
+ static const VGfloat greenGray = 16.0f / 32.0f;
+ static const VGfloat blueGray = 1.0f - (redGray + greenGray);
+
+ VGfloat matrix[5][4];
+ matrix[0][0] = redGray * invweights[0] + (1.0f - strength);
+ matrix[0][1] = redGray * invweights[1];
+ matrix[0][2] = redGray * invweights[2];
+ matrix[0][3] = 0.0f;
+ matrix[1][0] = greenGray * invweights[0];
+ matrix[1][1] = greenGray * invweights[1] + (1.0f - strength);
+ matrix[1][2] = greenGray * invweights[2];
+ matrix[1][3] = 0.0f;
+ matrix[2][0] = blueGray * invweights[0];
+ matrix[2][1] = blueGray * invweights[1];
+ matrix[2][2] = blueGray * invweights[2] + (1.0f - strength);
+ matrix[2][3] = 0.0f;
+ matrix[3][0] = 0.0f;
+ matrix[3][1] = 0.0f;
+ matrix[3][2] = 0.0f;
+ matrix[3][3] = 1.0f;
+ matrix[4][0] = weights[0] * strength;
+ matrix[4][1] = weights[1] * strength;
+ matrix[4][2] = weights[2] * strength;
+ matrix[4][3] = 0.0f;
vgColorMatrix(dstImage, srcImage, matrix[0]);
diff --git a/src/openvg/qpixmapfilter_vg_p.h b/src/openvg/qpixmapfilter_vg_p.h
index 58111ec2f8..f79b6c2cd3 100644
--- a/src/openvg/qpixmapfilter_vg_p.h
+++ b/src/openvg/qpixmapfilter_vg_p.h
@@ -79,11 +79,6 @@ public:
~QVGPixmapColorizeFilter();
void draw(QPainter *painter, const QPointF &dest, const QPixmap &src, const QRectF &srcRect) const;
-
-private:
- mutable VGfloat matrix[5][4];
- mutable QColor prevColor;
- mutable bool firstTime;
};
class Q_OPENVG_EXPORT QVGPixmapDropShadowFilter : public QPixmapDropShadowFilter
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
index 8662df6229..57b1950232 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbmouse.cpp
@@ -207,7 +207,7 @@ void QDirectFBMouseHandlerPrivate::readMouseData()
int wheel = 0;
if (input.type == DIET_AXISMOTION) {
-#ifdef QT_NO_DIRECTFB_LAYER
+#if defined(QT_NO_DIRECTFB_LAYER) || defined(QT_DIRECTFB_WINDOW_AS_CURSOR)
if (input.flags & DIEF_AXISABS) {
switch (input.axis) {
case DIAI_X: x = input.axisabs; break;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index 0f7a6de9ce..449bc0d1fd 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -99,8 +99,11 @@ public:
qint64 cursorImageKey;
QDirectFBScreen *q;
+ static QDirectFBScreen *instance;
};
+QDirectFBScreen *QDirectFBScreenPrivate::instance = 0;
+
QDirectFBScreenPrivate::QDirectFBScreenPrivate(QDirectFBScreen *qptr)
: QWSGraphicsSystem(qptr), dfb(0), flipFlags(DSFLIP_NONE),
directFBFlags(QDirectFBScreen::NoFlags), alphaPixmapFormat(QImage::Format_Invalid),
@@ -802,13 +805,21 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty)
QDirectFBScreen::QDirectFBScreen(int display_id)
: QScreen(display_id, DirectFBClass), d_ptr(new QDirectFBScreenPrivate(this))
{
+ QDirectFBScreenPrivate::instance = this;
}
QDirectFBScreen::~QDirectFBScreen()
{
+ if (QDirectFBScreenPrivate::instance == this)
+ QDirectFBScreenPrivate::instance = 0;
delete d_ptr;
}
+QDirectFBScreen *QDirectFBScreen::instance()
+{
+ return QDirectFBScreenPrivate::instance;
+}
+
int QDirectFBScreen::depth(DFBSurfacePixelFormat format)
{
switch (format) {
@@ -1050,6 +1061,26 @@ static inline bool setIntOption(const QStringList &arguments, const QString &var
return false;
}
+static inline QColor colorFromName(const QString &name)
+{
+ QRegExp rx("#([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])");
+ rx.setCaseSensitivity(Qt::CaseInsensitive);
+ if (rx.exactMatch(name)) {
+ Q_ASSERT(rx.numCaptures() == 4);
+ int ints[4];
+ int i;
+ for (i=0; i<4; ++i) {
+ bool ok;
+ ints[i] = rx.cap(i + 1).toUInt(&ok, 16);
+ if (!ok || ints[i] > 255)
+ break;
+ }
+ if (i == 4)
+ return QColor(ints[0], ints[1], ints[2], ints[3]);
+ }
+ return QColor(name);
+}
+
bool QDirectFBScreen::connect(const QString &displaySpec)
{
DFBResult result = DFB_OK;
@@ -1282,18 +1313,50 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#endif
#ifdef QT_DIRECTFB_WM
surface->Release(surface);
+ QColor backgroundColor;
#else
- QRegExp backgroundColorRegExp(QLatin1String("bgcolor=?(.+)"));
+ QColor &backgroundColor = d_ptr->backgroundColor;
+#endif
+
+ QRegExp backgroundColorRegExp(QLatin1String("bgcolor=(.+)"));
backgroundColorRegExp.setCaseSensitivity(Qt::CaseInsensitive);
if (displayArgs.indexOf(backgroundColorRegExp) != -1) {
- d_ptr->backgroundColor.setNamedColor(backgroundColorRegExp.cap(1));
+ backgroundColor = colorFromName(backgroundColorRegExp.cap(1));
}
- if (!d_ptr->backgroundColor.isValid())
- d_ptr->backgroundColor = Qt::green;
- d_ptr->primarySurface->Clear(d_ptr->primarySurface, d_ptr->backgroundColor.red(),
- d_ptr->backgroundColor.green(), d_ptr->backgroundColor.blue(),
- d_ptr->backgroundColor.alpha());
+#ifdef QT_NO_DIRECTFB_WM
+ if (!backgroundColor.isValid())
+ backgroundColor = Qt::green;
+ d_ptr->primarySurface->Clear(d_ptr->primarySurface, backgroundColor.red(),
+ backgroundColor.green(), backgroundColor.blue(),
+ backgroundColor.alpha());
d_ptr->primarySurface->Flip(d_ptr->primarySurface, 0, d_ptr->flipFlags);
+#else
+ if (backgroundColor.isValid()) {
+ DFBResult result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_ADMINISTRATIVE);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreen::connect "
+ "Unable to set cooperative level", result);
+ }
+ result = d_ptr->dfbLayer->SetBackgroundColor(d_ptr->dfbLayer, backgroundColor.red(), backgroundColor.green(),
+ backgroundColor.blue(), backgroundColor.alpha());
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::connect: "
+ "Unable to set background color", result);
+ }
+
+ result = d_ptr->dfbLayer->SetBackgroundMode(d_ptr->dfbLayer, DLBM_COLOR);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreenCursor::connect: "
+ "Unable to set background mode", result);
+ }
+
+ result = d_ptr->dfbLayer->SetCooperativeLevel(d_ptr->dfbLayer, DLSCL_SHARED);
+ if (result != DFB_OK) {
+ DirectFBError("QDirectFBScreen::connect "
+ "Unable to set cooperative level", result);
+ }
+
+ }
#endif
return true;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 5e8c5c654f..0520cdc944 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -54,8 +54,8 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
-#if !defined QT_NO_DIRECTFB_SUBSURFACE && !defined QT_DIRECTFB_SUBSURFACE
-#define QT_DIRECTFB_SUBSURFACE
+#if !defined QT_DIRECTFB_SUBSURFACE && !defined QT_NO_DIRECTFB_SUBSURFACE
+#define QT_NO_DIRECTFB_SUBSURFACE
#endif
#if !defined QT_NO_DIRECTFB_LAYER && !defined QT_DIRECTFB_LAYER
#define QT_DIRECTFB_LAYER
@@ -163,12 +163,7 @@ public:
QWSWindowSurface *createSurface(QWidget *widget) const;
QWSWindowSurface *createSurface(const QString &key) const;
- static inline QDirectFBScreen *instance() {
- QScreen *inst = QScreen::instance();
- Q_ASSERT(!inst || inst->classId() == QScreen::DirectFBClass);
- return static_cast<QDirectFBScreen*>(inst);
- }
-
+ static QDirectFBScreen *instance();
void waitIdle();
IDirectFBSurface *surfaceForWidget(const QWidget *widget, QRect *rect) const;
#ifdef QT_DIRECTFB_SUBSURFACE
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
index ac9dc8d834..c1b655a5b1 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c
@@ -617,6 +617,16 @@ void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect)
*rect = drawable->rect;
}
+void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle)
+{
+ if (drawable->rotationAngle != angle) {
+ drawable->rotationAngle = angle;
+
+ /* Force the buffers to be recreated if the rotation angle changes */
+ pvrQwsInvalidateBuffers(drawable);
+ }
+}
+
int pvrQwsGetStride(PvrQwsDrawable *drawable)
{
if (drawable->backBuffersValid)
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
index 952ff6ff52..b9e035f084 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.h
@@ -126,6 +126,9 @@ void pvrQwsSetGeometry(PvrQwsDrawable *drawable, const PvrQwsRect *rect);
/* Get the current geometry for a drawable */
void pvrQwsGetGeometry(PvrQwsDrawable *drawable, PvrQwsRect *rect);
+/* Set the rotation angle in degrees */
+void pvrQwsSetRotation(PvrQwsDrawable *drawable, int angle);
+
/* Get the line stride for a drawable. Returns zero if the buffers
are not allocated or have been invalidated */
int pvrQwsGetStride(PvrQwsDrawable *drawable);
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
index cf80a90b1c..dcd4e4fbc8 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable_p.h
@@ -114,6 +114,7 @@ struct _PvrQwsDrawable
int isFullScreen;
int strideBytes;
int stridePixels;
+ int rotationAngle;
PvrQwsSwapFunction swapFunction;
void *userData;
PvrQwsDrawable *nextWinId;
diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
index 253f39f11e..28b22518ab 100644
--- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
+++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c
@@ -132,6 +132,16 @@ static WSEGLError wseglCloseDisplay(WSEGLDisplayHandle display)
return WSEGL_SUCCESS;
}
+static WSEGLRotationAngle wseglRotationValue(int degrees)
+{
+ switch (degrees) {
+ case 90: return WSEGL_ROTATE_90;
+ case 180: return WSEGL_ROTATE_180;
+ case 270: return WSEGL_ROTATE_270;
+ default: return WSEGL_ROTATE_0;
+ }
+}
+
/* Create the WSEGL drawable version of a native window */
static WSEGLError wseglCreateWindowDrawable
(WSEGLDisplayHandle display, WSEGLConfig *config,
@@ -152,7 +162,7 @@ static WSEGLError wseglCreateWindowDrawable
*drawable = (WSEGLDrawableHandle)screen;
if (!pvrQwsAllocBuffers(screen))
return WSEGL_OUT_OF_MEMORY;
- *rotationAngle = WSEGL_ROTATE_0;
+ *rotationAngle = wseglRotationValue(screen->rotationAngle);
return WSEGL_SUCCESS;
}
@@ -163,7 +173,7 @@ static WSEGLError wseglCreateWindowDrawable
/* The drawable is ready to go */
*drawable = (WSEGLDrawableHandle)draw;
- *rotationAngle = WSEGL_ROTATE_0;
+ *rotationAngle = wseglRotationValue(draw->rotationAngle);
if (!pvrQwsAllocBuffers(draw))
return WSEGL_OUT_OF_MEMORY;
return WSEGL_SUCCESS;
diff --git a/src/plugins/gfxdrivers/powervr/README b/src/plugins/gfxdrivers/powervr/README
index 4dce87f830..322a6b2e01 100644
--- a/src/plugins/gfxdrivers/powervr/README
+++ b/src/plugins/gfxdrivers/powervr/README
@@ -51,6 +51,11 @@ on the device with:
hellogl_es -qws
+The driver also supports screen rotation if Qt is configured with the
+-qt-gfx-transformed option and the QWS_DISPLAY variable is wrapped in a
+"Transformed" declaration:
+
+ Transformed:powervr:mmWidth40:mmHeight54:Rot90:0
Know Issues:
* A QGLWidget may not have window decorations if it is a top-level window.
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
index 61f2225082..1dec9eacac 100644
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
+++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.cpp
@@ -44,6 +44,9 @@
#include "pvrqwsdrawable_p.h"
#include <QRegExp>
#include <qwindowsystem_qws.h>
+#ifndef QT_NO_QWS_TRANSFORMED
+#include <qscreentransformed_qws.h>
+#endif
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/kd.h>
@@ -62,6 +65,7 @@ PvrEglScreen::PvrEglScreen(int displayId)
ttyfd = -1;
doGraphicsMode = true;
oldKdMode = KD_TEXT;
+ parent = 0;
// Make sure that the EGL layer is initialized and the drivers loaded.
EGLDisplay dpy = eglGetDisplay((EGLNativeDisplayType)EGL_DEFAULT_DISPLAY);
@@ -192,7 +196,7 @@ bool PvrEglScreen::hasOpenGL()
QWSWindowSurface* PvrEglScreen::createSurface(QWidget *widget) const
{
if (qobject_cast<QGLWidget*>(widget))
- return new PvrEglWindowSurface(widget, (QScreen *)this, displayId);
+ return new PvrEglWindowSurface(widget, (PvrEglScreen *)this, displayId);
return QScreen::createSurface(widget);
}
@@ -206,6 +210,67 @@ QWSWindowSurface* PvrEglScreen::createSurface(const QString &key) const
}
//![1]
+#ifndef QT_NO_QWS_TRANSFORMED
+
+static const QScreen *parentScreen
+ (const QScreen *current, const QScreen *lookingFor)
+{
+ if (!current)
+ return 0;
+ switch (current->classId()) {
+ case QScreen::ProxyClass:
+ case QScreen::TransformedClass: {
+ const QScreen *child =
+ static_cast<const QProxyScreen *>(current)->screen();
+ if (child == lookingFor)
+ return current;
+ else
+ return parentScreen(child, lookingFor);
+ }
+ // Not reached.
+
+ case QScreen::MultiClass: {
+ QList<QScreen *> screens = current->subScreens();
+ foreach (QScreen *screen, screens) {
+ if (screen == lookingFor)
+ return current;
+ const QScreen *parent = parentScreen(screen, lookingFor);
+ if (parent)
+ return parent;
+ }
+ }
+ break;
+
+ default: break;
+ }
+ return 0;
+}
+
+int PvrEglScreen::transformation() const
+{
+ // We need to search for our parent screen, which is assumed to be
+ // "Transformed". If it isn't, then there is no transformation.
+ // There is no direct method to get the parent screen so we need
+ // to search every screen until we find ourselves.
+ if (!parent && qt_screen != this)
+ parent = parentScreen(qt_screen, this);
+ if (!parent)
+ return 0;
+ if (parent->classId() != QScreen::TransformedClass)
+ return 0;
+ return 90 * static_cast<const QTransformedScreen *>(parent)
+ ->transformation();
+}
+
+#else
+
+int PvrEglScreen::transformation() const
+{
+ return 0;
+}
+
+#endif
+
void PvrEglScreen::sync()
{
// Put code here to synchronize 2D and 3D operations if necessary.
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h
index 8bf42c7fc6..5769e7025c 100644
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h
+++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglscreen.h
@@ -46,16 +46,18 @@
#include <QGLScreen>
#include "pvrqwsdrawable.h"
+class PvrEglScreen;
+
class PvrEglScreenSurfaceFunctions : public QGLScreenSurfaceFunctions
{
public:
- PvrEglScreenSurfaceFunctions(QScreen *s, int screenNum)
+ PvrEglScreenSurfaceFunctions(PvrEglScreen *s, int screenNum)
: screen(s), displayId(screenNum) {}
bool createNativeWindow(QWidget *widget, EGLNativeWindowType *native);
private:
- QScreen *screen;
+ PvrEglScreen *screen;
int displayId;
};
@@ -80,6 +82,8 @@ public:
QWSWindowSurface* createSurface(QWidget *widget) const;
QWSWindowSurface* createSurface(const QString &key) const;
+ int transformation() const;
+
private:
void sync();
void openTty();
@@ -89,6 +93,7 @@ private:
int ttyfd, oldKdMode;
QString ttyDevice;
bool doGraphicsMode;
+ mutable const QScreen *parent;
};
#endif
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
index 2c5ac21711..4a3787f537 100644
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp
@@ -46,7 +46,7 @@
#include <QWSDisplay>
PvrEglWindowSurface::PvrEglWindowSurface
- (QWidget *widget, QScreen *screen, int screenNum)
+ (QWidget *widget, PvrEglScreen *screen, int screenNum)
: QWSGLWindowSurface(widget)
{
setSurfaceFlags(QWSWindowSurface::Opaque);
@@ -63,6 +63,7 @@ PvrEglWindowSurface::PvrEglWindowSurface
pvrRect.y = pos.y();
pvrRect.width = size.width();
pvrRect.height = size.height();
+ transformRects(&pvrRect, 1);
// Try to recover a previous PvrQwsDrawable object for the widget
// if there is one. This can happen when a PvrEglWindowSurface
@@ -75,6 +76,7 @@ PvrEglWindowSurface::PvrEglWindowSurface
pvrQwsSetGeometry(drawable, &pvrRect);
else
drawable = pvrQwsCreateWindow(screenNum, (long)widget, &pvrRect);
+ pvrQwsSetRotation(drawable, screen->transformation());
}
PvrEglWindowSurface::PvrEglWindowSurface()
@@ -113,7 +115,9 @@ void PvrEglWindowSurface::setGeometry(const QRect &rect)
pvrRect.y = rect.y();
pvrRect.width = rect.width();
pvrRect.height = rect.height();
+ transformRects(&pvrRect, 1);
pvrQwsSetGeometry(drawable, &pvrRect);
+ pvrQwsSetRotation(drawable, screen->transformation());
}
QWSGLWindowSurface::setGeometry(rect);
}
@@ -127,7 +131,9 @@ bool PvrEglWindowSurface::move(const QPoint &offset)
pvrRect.y = rect.y();
pvrRect.width = rect.width();
pvrRect.height = rect.height();
+ transformRects(&pvrRect, 1);
pvrQwsSetGeometry(drawable, &pvrRect);
+ pvrQwsSetRotation(drawable, screen->transformation());
}
return QWSGLWindowSurface::move(offset);
}
@@ -200,7 +206,9 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id)
pvrRect.y = rect.y();
pvrRect.width = rect.width();
pvrRect.height = rect.height();
+ transformRects(&pvrRect, 1);
pvrQwsSetVisibleRegion(drawable, &pvrRect, 1);
+ pvrQwsSetRotation(drawable, screen->transformation());
if (!pvrQwsSwapBuffers(drawable, 1))
screen->solidFill(QColor(0, 0, 0), region);
} else {
@@ -213,9 +221,53 @@ void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id)
pvrRects[index].width = rect.width();
pvrRects[index].height = rect.height();
}
+ transformRects(pvrRects, rects.size());
pvrQwsSetVisibleRegion(drawable, pvrRects, rects.size());
+ pvrQwsSetRotation(drawable, screen->transformation());
if (!pvrQwsSwapBuffers(drawable, 1))
screen->solidFill(QColor(0, 0, 0), region);
delete [] pvrRects;
}
}
+
+void PvrEglWindowSurface::transformRects(PvrQwsRect *rects, int count) const
+{
+ switch (screen->transformation()) {
+ case 0: break;
+
+ case 90:
+ {
+ for (int index = 0; index < count; ++index) {
+ int x = rects[index].y;
+ int y = screen->height() - (rects[index].x + rects[index].width);
+ rects[index].x = x;
+ rects[index].y = y;
+ qSwap(rects[index].width, rects[index].height);
+ }
+ }
+ break;
+
+ case 180:
+ {
+ for (int index = 0; index < count; ++index) {
+ int x = screen->width() - (rects[index].x + rects[index].width);
+ int y = screen->height() - (rects[index].y + rects[index].height);
+ rects[index].x = x;
+ rects[index].y = y;
+ }
+ }
+ break;
+
+ case 270:
+ {
+ for (int index = 0; index < count; ++index) {
+ int x = screen->width() - (rects[index].y + rects[index].height);
+ int y = rects[index].x;
+ rects[index].x = x;
+ rects[index].y = y;
+ qSwap(rects[index].width, rects[index].height);
+ }
+ }
+ break;
+ }
+}
diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h
index 58a5fb2361..b0a161c235 100644
--- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h
+++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h
@@ -45,12 +45,12 @@
#include <private/qglwindowsurface_qws_p.h>
#include "pvrqwsdrawable.h"
-class QScreen;
+class PvrEglScreen;
class PvrEglWindowSurface : public QWSGLWindowSurface
{
public:
- PvrEglWindowSurface(QWidget *widget, QScreen *screen, int screenNum);
+ PvrEglWindowSurface(QWidget *widget, PvrEglScreen *screen, int screenNum);
PvrEglWindowSurface();
~PvrEglWindowSurface();
@@ -76,8 +76,10 @@ public:
private:
QWidget *widget;
PvrQwsDrawable *drawable;
- QScreen *screen;
+ PvrEglScreen *screen;
QPaintDevice *pdevice;
+
+ void transformRects(PvrQwsRect *rects, int count) const;
};
#endif
diff --git a/src/qt3support/widgets/q3combobox.cpp b/src/qt3support/widgets/q3combobox.cpp
index 9e7fd77969..2aee4ace65 100644
--- a/src/qt3support/widgets/q3combobox.cpp
+++ b/src/qt3support/widgets/q3combobox.cpp
@@ -2234,7 +2234,8 @@ bool Q3ComboBox::autoCompletion() const
return d->useCompletion;
}
-/*!\reimp
+/*!
+ \internal
*/
void Q3ComboBox::styleChange( QStyle& s )
{
diff --git a/src/qt3support/widgets/q3toolbar.cpp b/src/qt3support/widgets/q3toolbar.cpp
index dbe3afdb3d..00ff47ba81 100644
--- a/src/qt3support/widgets/q3toolbar.cpp
+++ b/src/qt3support/widgets/q3toolbar.cpp
@@ -422,7 +422,7 @@ void Q3ToolBar::addSeparator()
}
/*!
- \internal
+ \internal
*/
void Q3ToolBar::styleChange(QStyle &oldStyle)
diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
index d6911d2d8e..db840f45fe 100644
--- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
+++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp
@@ -223,6 +223,7 @@ private slots:
void task257481_emptyEditor();
void shiftArrowSelectionAfterScrolling();
void shiftSelectionAfterRubberbandSelection();
+ void ctrlRubberbandSelection();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -1388,5 +1389,49 @@ void tst_QAbstractItemView::shiftSelectionAfterRubberbandSelection()
QVERIFY(selected.contains(index2));
}
+void tst_QAbstractItemView::ctrlRubberbandSelection()
+{
+ QStandardItemModel model;
+ for (int i=0; i<3; ++i) {
+ QStandardItem *item = new QStandardItem(QString("%1").arg(i));
+ model.setItem(i, 0, item);
+ }
+
+ QListView view;
+ view.setFixedSize(150, 450);
+ view.setFlow(QListView::LeftToRight);
+ view.setGridSize(QSize(100, 100));
+ view.setSelectionMode(QListView::ExtendedSelection);
+ view.setViewMode(QListView::IconMode);
+ view.setModel(&model);
+ view.show();
+ QTest::qWait(30);
+
+ QModelIndex index1 = model.index(1, 0);
+ QModelIndex index2 = model.index(2, 0);
+
+ // Select item 1
+ view.setCurrentIndex(index1);
+ QModelIndexList selected = view.selectionModel()->selectedIndexes();
+ QCOMPARE(selected.count(), 1);
+ QVERIFY(selected.contains(index1));
+
+ // Now press control and draw a rubberband around items 1 and 2.
+ // The mouse move event has to be created manually because the QTest framework does not
+ // contain a function for mouse moves with buttons pressed.
+ QPoint pressPos = view.visualRect(index1).topLeft() - QPoint(1, 1);
+ QPoint releasePos = view.visualRect(index2).bottomRight() + QPoint(1, 1);
+ QTest::mousePress(view.viewport(), Qt::LeftButton, Qt::ControlModifier, pressPos);
+ QMouseEvent moveEvent(QEvent::MouseMove, releasePos, Qt::NoButton, Qt::LeftButton, Qt::ControlModifier);
+ bool moveEventReceived = qApp->notify(view.viewport(), &moveEvent);
+ QVERIFY(moveEventReceived);
+ QTest::mouseRelease(view.viewport(), Qt::LeftButton, Qt::ControlModifier, releasePos);
+
+ // Verify that item 2 is selected now
+ selected = view.selectionModel()->selectedIndexes();
+ QCOMPARE(selected.count(), 1);
+ QVERIFY(selected.contains(index2));
+}
+
QTEST_MAIN(tst_QAbstractItemView)
#include "tst_qabstractitemview.moc"
diff --git a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
index a19f8650c4..8b0335c376 100644
--- a/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
+++ b/tests/auto/qbuttongroup/tst_qbuttongroup.cpp
@@ -128,14 +128,15 @@ void tst_QButtonGroup::cleanup()
{
}
+QT_BEGIN_NAMESPACE
+extern bool Q_GUI_EXPORT qt_tab_all_widgets;
+QT_END_NAMESPACE
+
+
void tst_QButtonGroup::arrowKeyNavigation()
{
-#ifdef Q_WS_MAC
- QSettings appleSettings(QLatin1String("apple.com"));
- QVariant appleValue = appleSettings.value(QLatin1String("AppleKeyboardUIMode"), 0);
- if (!(appleValue.toInt() & 0x2))
+ if (!qt_tab_all_widgets)
QSKIP("This test requires full keyboard control to be enabled.", SkipAll);
-#endif
QDialog dlg(0);
QHBoxLayout layout(&dlg);
diff --git a/tests/auto/qfiledialog/tst_qfiledialog.cpp b/tests/auto/qfiledialog/tst_qfiledialog.cpp
index dc2ca61e0f..2f9410bf65 100644
--- a/tests/auto/qfiledialog/tst_qfiledialog.cpp
+++ b/tests/auto/qfiledialog/tst_qfiledialog.cpp
@@ -140,36 +140,6 @@ private slots:
void clearLineEdit();
void enableChooseButton();
void hooks();
- void listRoot();
- void heapCorruption();
- void deleteDirAndFiles();
- void filter();
- void showNameFilterDetails();
- void unc();
- void emptyUncPath();
-
- void task178897_minimumSize();
- void task180459_lastDirectory_data();
- void task180459_lastDirectory();
- void task227304_proxyOnFileDialog();
- void task227930_correctNavigationKeyboardBehavior();
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- void task226366_lowerCaseHardDriveWindows();
-#endif
- void task233037_selectingDirectory();
- void task235069_hideOnEscape();
- void task236402_dontWatchDeletedDir();
- void task203703_returnProperSeparator();
- void task228844_ensurePreviousSorting();
- void task239706_editableFilterCombo();
- void task218353_relativePaths();
- void task251321_sideBarHiddenEntries();
- void task251341_sideBarRemoveEntries();
- void task254490_selectFileMultipleTimes();
- void task257579_sideBarWithNonCleanUrls();
- void task259105_filtersCornerCases();
-
- void QTBUG4419_lineEditSelectAll();
private:
QByteArray userSettings;
@@ -1345,842 +1315,5 @@ void tst_QFiledialog::hooks()
QCOMPARE(QFileDialog::getSaveFileName(), QString("saveName"));
}
-void tst_QFiledialog::listRoot()
-{
-#if defined QT_BUILD_INTERNAL
- QFileInfoGatherer::fetchedRoot = false;
- QString dir(QDir::currentPath());
- QNonNativeFileDialog fd(0, QString(), dir);
- fd.show();
- QCOMPARE(QFileInfoGatherer::fetchedRoot,false);
- fd.setDirectory("");
- QTest::qWait(500);
- QCOMPARE(QFileInfoGatherer::fetchedRoot,true);
-#endif
-}
-
-void tst_QFiledialog::heapCorruption()
-{
- QVector<QNonNativeFileDialog*> dialogs;
- for (int i=0; i < 10; i++) {
- QNonNativeFileDialog *f = new QNonNativeFileDialog(NULL);
- dialogs << f;
- }
- qDeleteAll(dialogs);
-}
-
-struct FriendlyQFileDialog : public QFileDialog
-{
- friend class tst_QFileDialog;
- Q_DECLARE_PRIVATE(QFileDialog)
-};
-
-
-void tst_QFiledialog::deleteDirAndFiles()
-{
-#if defined QT_BUILD_INTERNAL
- QString tempPath = QDir::tempPath() + '/' + "QFileDialogTestDir4FullDelete";
- QDir dir;
- QVERIFY(dir.mkpath(tempPath + "/foo"));
- QVERIFY(dir.mkpath(tempPath + "/foo/B"));
- QVERIFY(dir.mkpath(tempPath + "/foo/B"));
- QVERIFY(dir.mkpath(tempPath + "/foo/c"));
- QVERIFY(dir.mkpath(tempPath + "/bar"));
- QFile(tempPath + "/foo/a");
- QTemporaryFile *t;
- t = new QTemporaryFile(tempPath + "/foo/aXXXXXX");
- t->setAutoRemove(false);
- t->open();
- t->close();
- delete t;
-
- t = new QTemporaryFile(tempPath + "/foo/B/yXXXXXX");
- t->setAutoRemove(false);
- t->open();
- t->close();
- delete t;
- FriendlyQFileDialog fd;
- fd.setOption(QFileDialog::DontUseNativeDialog);
- fd.d_func()->removeDirectory(tempPath);
- QFileInfo info(tempPath);
- QTest::qWait(2000);
- QVERIFY(!info.exists());
-#endif
-}
-
-void tst_QFiledialog::filter()
-{
- QNonNativeFileDialog fd;
- QAction *hiddenAction = qFindChild<QAction*>(&fd, "qt_show_hidden_action");
- QVERIFY(hiddenAction);
- QVERIFY(hiddenAction->isEnabled());
- QVERIFY(!hiddenAction->isChecked());
- QDir::Filters filter = fd.filter();
- filter |= QDir::Hidden;
- fd.setFilter(filter);
- QVERIFY(hiddenAction->isChecked());
-}
-
-void tst_QFiledialog::showNameFilterDetails()
-{
- QNonNativeFileDialog fd;
- QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
- QVERIFY(filters);
- QVERIFY(fd.isNameFilterDetailsVisible());
-
-
- QStringList filterChoices;
- filterChoices << "Image files (*.png *.xpm *.jpg)"
- << "Text files (*.txt)"
- << "Any files (*.*)";
- fd.setFilters(filterChoices);
-
- fd.setNameFilterDetailsVisible(false);
- QCOMPARE(filters->itemText(0), QString("Image files"));
- QCOMPARE(filters->itemText(1), QString("Text files"));
- QCOMPARE(filters->itemText(2), QString("Any files"));
-
- fd.setNameFilterDetailsVisible(true);
- QCOMPARE(filters->itemText(0), filterChoices.at(0));
- QCOMPARE(filters->itemText(1), filterChoices.at(1));
- QCOMPARE(filters->itemText(2), filterChoices.at(2));
-}
-
-void tst_QFiledialog::unc()
-{
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- // Only test UNC on Windows./
- QString dir("\\\\" + QtNetworkSettings::winServerName() + "\\testsharewritable");
-#else
- QString dir(QDir::currentPath());
-#endif
- QVERIFY(QFile::exists(dir));
- QNonNativeFileDialog fd(0, QString(), dir);
- QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
- QVERIFY(model);
- QCOMPARE(model->index(fd.directory().absolutePath()), model->index(dir));
-}
-
-void tst_QFiledialog::emptyUncPath()
-{
- QNonNativeFileDialog fd;
- fd.show();
- QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
- QVERIFY(lineEdit);
- // press 'keys' for the input
- for (int i = 0; i < 3 ; ++i)
- QTest::keyPress(lineEdit, Qt::Key_Backslash);
- QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
- QVERIFY(model);
-}
-
-void tst_QFiledialog::task178897_minimumSize()
-{
- QNonNativeFileDialog fd;
- QStringList history = fd.history();
- history << QDir::toNativeSeparators("/verylongdirectory/"
- "aaaaaaaaaabbbbbbbbcccccccccccddddddddddddddeeeeeeeeeeeeffffffffffgggtggggggggghhhhhhhhiiiiiijjjk");
- fd.setHistory(history);
- fd.show();
-
- QSize ms = fd.layout()->minimumSize();
- QVERIFY(ms.width() < 400);
-}
-
-void tst_QFiledialog::task180459_lastDirectory_data()
-{
- QTest::addColumn<QString>("path");
- QTest::addColumn<QString>("directory");
- QTest::addColumn<bool>("isEnabled");
- QTest::addColumn<QString>("result");
-
- QTest::newRow("path+file") << QDir::homePath() + QDir::separator() + "foo"
- << QDir::homePath() << true
- << QDir::homePath() + QDir::separator() + "foo" ;
- QTest::newRow("no path") << ""
- << QDir::tempPath() << false << QString();
- QTest::newRow("file") << "foo"
- << QDir::currentPath() << true
- << QDir::currentPath() + QDir::separator() + "foo" ;
- QTest::newRow("path") << QDir::homePath()
- << QDir::homePath() << false << QString();
- QTest::newRow("path not existing") << "/usr/bin/foo/bar/foo/foo.txt"
- << QDir::tempPath() << true
- << QDir::tempPath() + QDir::separator() + "foo.txt";
-
-}
-
-void tst_QFiledialog::task180459_lastDirectory()
-{
- //first visit the temp directory and close the dialog
- QNonNativeFileDialog *dlg = new QNonNativeFileDialog(0, "", QDir::tempPath());
- QFileSystemModel *model = qFindChild<QFileSystemModel*>(dlg, "qt_filesystem_model");
- QVERIFY(model);
- QCOMPARE(model->index(QDir::tempPath()), model->index(dlg->directory().absolutePath()));
- delete dlg;
-
- QFETCH(QString, path);
- QFETCH(QString, directory);
- QFETCH(bool, isEnabled);
- QFETCH(QString, result);
-
- dlg = new QNonNativeFileDialog(0, "", path);
- model = qFindChild<QFileSystemModel*>(dlg, "qt_filesystem_model");
- QVERIFY(model);
- dlg->setAcceptMode(QFileDialog::AcceptSave);
- QCOMPARE(model->index(dlg->directory().absolutePath()), model->index(directory));
-
- QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(dlg, "buttonBox");
- QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
- QVERIFY(button);
- QCOMPARE(button->isEnabled(), isEnabled);
- if (isEnabled)
- QCOMPARE(model->index(result), model->index(dlg->selectedFiles().first()));
-
- delete dlg;
-}
-
-
-
-class FilterDirModel : public QSortFilterProxyModel
-{
-
-public:
- FilterDirModel(QString root, QObject* parent=0):QSortFilterProxyModel(parent), m_root(root)
- {}
- ~FilterDirModel()
- {};
-
-protected:
- bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
- {
- QModelIndex parentIndex;
- parentIndex = source_parent;
-
- QString path;
- path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString();
-
- do {
- path = parentIndex.data(Qt::DisplayRole).toString() + "/" + path;
- parentIndex = parentIndex.parent();
- } while(parentIndex.isValid());
-
- QFileInfo info(path);
- if (info.isDir() && (QDir(path) != m_root))
- return false;
- return true;
- }
-
-
-private:
- QDir m_root;
-
-
-};
-
-class sortProxy : public QSortFilterProxyModel
-{
-public:
- sortProxy(QObject *parent) : QSortFilterProxyModel(parent)
- {
- }
-protected:
- virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const
- {
- QFileSystemModel * const model = qobject_cast<QFileSystemModel *>(sourceModel());
- const QFileInfo leftInfo(model->fileInfo(left));
- const QFileInfo rightInfo(model->fileInfo(right));
-
- if (leftInfo.isDir() == rightInfo.isDir())
- return(leftInfo.filePath().compare(rightInfo.filePath(),Qt::CaseInsensitive) < 0);
- else if (leftInfo.isDir())
- return(false);
- else
- return(true);
- }
-};
-
-class CrashDialog : public QNonNativeFileDialog
-{
- Q_OBJECT
-
-public:
- CrashDialog(QWidget *parent, const QString &caption, const
-QString &dir, const QString &filter)
- : QNonNativeFileDialog(parent, caption, dir, filter)
- {
- sortProxy *proxyModel = new sortProxy(this);
- setProxyModel(proxyModel);
- }
-};
-
-void tst_QFiledialog::task227304_proxyOnFileDialog()
-{
-#if defined QT_BUILD_INTERNAL
- QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0);
- fd.setProxyModel(new FilterDirModel(QDir::currentPath()));
- fd.show();
- QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
- QTest::qWait(200);
- QTest::keyClick(edit, Qt::Key_T);
- QTest::keyClick(edit, Qt::Key_S);
- QTest::qWait(200);
- QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
-
- CrashDialog *dialog = new CrashDialog(0, QString("crash dialog test"), QDir::homePath(), QString("*") );
- dialog->setFileMode(QFileDialog::ExistingFile);
- dialog->show();
-
- QListView *list = qFindChild<QListView*>(dialog, "listView");
- QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Down);
- QTest::keyClick(list, Qt::Key_Return);
- QTest::qWait(200);
-
- dialog->close();
- fd.close();
-
- QNonNativeFileDialog fd2(0, "I should not crash with a proxy", QDir::tempPath(), 0);
- QSortFilterProxyModel *pm = new QSortFilterProxyModel;
- fd2.setProxyModel(pm);
- fd2.show();
- QSidebar *sidebar = qFindChild<QSidebar*>(&fd2, "sidebar");
- sidebar->setFocus();
- sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath()));
- QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
- QTest::qWait(250);
- //We shouldn't crash
-#endif
-}
-
-void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior()
-{
- QDir current = QDir::currentPath();
- current.mkdir("test");
- current.cd("test");
- QFile file("test/out.txt");
- QFile file2("test/out2.txt");
- QVERIFY(file.open(QIODevice::WriteOnly | QIODevice::Text));
- QVERIFY(file2.open(QIODevice::WriteOnly | QIODevice::Text));
- current.cdUp();
- current.mkdir("test2");
- QNonNativeFileDialog fd;
- fd.setViewMode(QFileDialog::List);
- fd.setDirectory(current.absolutePath());
- fd.show();
- QListView *list = qFindChild<QListView*>(&fd, "listView");
- QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Down);
- QTest::keyClick(list, Qt::Key_Return);
- QTest::qWait(200);
- QTest::mouseClick(list->viewport(), Qt::LeftButton,0);
- QTest::keyClick(list, Qt::Key_Down);
- QTest::keyClick(list, Qt::Key_Backspace);
- QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Down);
- QTest::keyClick(list, Qt::Key_Down);
- QTest::keyClick(list, Qt::Key_Return);
- QTest::qWait(200);
- QCOMPARE(fd.isVisible(), true);
- QTest::qWait(200);
- file.close();
- file2.close();
- file.remove();
- file2.remove();
- current.rmdir("test");
- current.rmdir("test2");
-}
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
-void tst_QFiledialog::task226366_lowerCaseHardDriveWindows()
-{
- QNonNativeFileDialog fd;
- fd.setDirectory(QDir::root().path());
- fd.show();
- QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
- QToolButton *buttonParent = qFindChild<QToolButton*>(&fd, "toParentButton");
- QTest::qWait(200);
- QTest::mouseClick(buttonParent, Qt::LeftButton,0,QPoint(0,0));
- QTest::qWait(2000);
- QTest::keyClick(edit, Qt::Key_C);
- QTest::qWait(200);
- QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
- QTest::qWait(200);
- QCOMPARE(edit->text(), QString("C:"));
- QTest::qWait(2000);
- //i clear my previous selection in the completer
- QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
- edit->clear();
- QTest::keyClick(edit, (char)(Qt::Key_C | Qt::SHIFT));
- QTest::qWait(200);
- QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
- QCOMPARE(edit->text(), QString("C:"));
-}
-#endif
-
-void tst_QFiledialog::task233037_selectingDirectory()
-{
- QDir current = QDir::currentPath();
- current.mkdir("test");
- QNonNativeFileDialog fd;
- fd.setViewMode(QFileDialog::List);
- fd.setDirectory(current.absolutePath());
- fd.setAcceptMode( QFileDialog::AcceptSave);
- fd.show();
- QListView *list = qFindChild<QListView*>(&fd, "listView");
- QTest::qWait(3000); // Wait for sort to settle (I need a signal).
-#ifdef QT_KEYPAD_NAVIGATION
- list->setEditFocus(true);
-#endif
- QTest::keyClick(list, Qt::Key_Down);
- QTest::qWait(100);
- QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
- QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
- QVERIFY(button);
- QCOMPARE(button->isEnabled(), true);
- current.rmdir("test");
-}
-
-void tst_QFiledialog::task235069_hideOnEscape()
-{
- QDir current = QDir::currentPath();
- QNonNativeFileDialog fd;
- fd.setViewMode(QFileDialog::List);
- fd.setDirectory(current.absolutePath());
- fd.setAcceptMode( QFileDialog::AcceptSave);
- fd.show();
- QListView *list = qFindChild<QListView*>(&fd, "listView");
- list->setFocus();
- QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Escape);
- QCOMPARE(fd.isVisible(), false);
- QNonNativeFileDialog fd2;
- fd2.setDirectory(current.absolutePath());
- fd2.setAcceptMode( QFileDialog::AcceptSave);
- fd2.show();
- QLineEdit *edit = qFindChild<QLineEdit*>(&fd2, "fileNameEdit");
- QTest::keyClick(edit, Qt::Key_Escape);
- QCOMPARE(fd2.isVisible(), false);
-}
-
-void tst_QFiledialog::task236402_dontWatchDeletedDir()
-{
-#if defined QT_BUILD_INTERNAL
- //THIS TEST SHOULD NOT DISPLAY WARNINGS
- QDir current = QDir::currentPath();
- //make sure it is the first on the list
- current.mkdir("aaaaaaaaaa");
- FriendlyQFileDialog fd;
- fd.setViewMode(QFileDialog::List);
- fd.setDirectory(current.absolutePath());
- fd.setAcceptMode( QFileDialog::AcceptSave);
- fd.show();
- QListView *list = qFindChild<QListView*>(&fd, "listView");
- list->setFocus();
- QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Return);
- QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Backspace);
- QTest::keyClick(list, Qt::Key_Down);
- QTest::qWait(200);
- fd.d_func()->removeDirectory(current.absolutePath() + "/aaaaaaaaaa/");
- QTest::qWait(1000);
-#endif
-}
-
-void tst_QFiledialog::task203703_returnProperSeparator()
-{
- QDir current = QDir::currentPath();
- current.mkdir("aaaaaaaaaaaaaaaaaa");
- QNonNativeFileDialog fd;
- fd.setDirectory(current.absolutePath());
- fd.setViewMode(QFileDialog::List);
- fd.setFileMode(QFileDialog::Directory);
- fd.show();
- QTest::qWait(500);
- QListView *list = qFindChild<QListView*>(&fd, "listView");
- list->setFocus();
- QTest::qWait(200);
- QTest::keyClick(list, Qt::Key_Return);
- QTest::qWait(1000);
- QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
- QPushButton *button = buttonBox->button(QDialogButtonBox::Cancel);
- QTest::keyClick(button, Qt::Key_Return);
- QTest::qWait(500);
- QString result = fd.selectedFiles().first();
- QVERIFY(result.at(result.count() - 1) != '/');
- QVERIFY(!result.contains('\\'));
- current.rmdir("aaaaaaaaaaaaaaaaaa");
-}
-
-void tst_QFiledialog::task228844_ensurePreviousSorting()
-{
- QDir current = QDir::currentPath();
- current.mkdir("aaaaaaaaaaaaaaaaaa");
- current.cd("aaaaaaaaaaaaaaaaaa");
- current.mkdir("a");
- current.mkdir("b");
- current.mkdir("c");
- current.mkdir("d");
- current.mkdir("e");
- current.mkdir("f");
- current.mkdir("g");
- QTemporaryFile *tempFile = new QTemporaryFile(current.absolutePath() + "/rXXXXXX");
- tempFile->open();
- current.cdUp();
-
- QNonNativeFileDialog fd;
- fd.setDirectory(current.absolutePath());
- fd.setViewMode(QFileDialog::Detail);
- fd.show();
- QTest::qWait(500);
- QTreeView *tree = qFindChild<QTreeView*>(&fd, "treeView");
- tree->header()->setSortIndicator(3,Qt::DescendingOrder);
- QTest::qWait(200);
- QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
- QPushButton *button = buttonBox->button(QDialogButtonBox::Open);
- QTest::mouseClick(button, Qt::LeftButton);
- QTest::qWait(500);
-
- QNonNativeFileDialog fd2;
- fd2.setFileMode(QFileDialog::Directory);
- fd2.restoreState(fd.saveState());
- current.cd("aaaaaaaaaaaaaaaaaa");
- fd2.setDirectory(current.absolutePath());
- fd2.show();
- QTest::qWait(500);
- QTreeView *tree2 = qFindChild<QTreeView*>(&fd2, "treeView");
- tree2->setFocus();
-
- QCOMPARE(tree2->rootIndex().data(QFileSystemModel::FilePathRole).toString(),current.absolutePath());
-
- QDialogButtonBox *buttonBox2 = qFindChild<QDialogButtonBox*>(&fd2, "buttonBox");
- QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open);
- fd2.selectFile("g");
- QTest::mouseClick(button2, Qt::LeftButton);
- QTest::qWait(500);
-
- QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g"));
-
- QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName());
- fd3.restoreState(fd.saveState());
- fd3.setFileMode(QFileDialog::Directory);
- fd3.show();
- QTest::qWait(500);
- QTreeView *tree3 = qFindChild<QTreeView*>(&fd3, "treeView");
- tree3->setFocus();
-
- QCOMPARE(tree3->rootIndex().data(QFileSystemModel::FilePathRole).toString(), current.absolutePath());
-
- QDialogButtonBox *buttonBox3 = qFindChild<QDialogButtonBox*>(&fd3, "buttonBox");
- QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open);
- QTest::mouseClick(button3, Qt::LeftButton);
- QTest::qWait(500);
-
- QCOMPARE(fd3.selectedFiles().first(), tempFile->fileName());
-
- current.cd("aaaaaaaaaaaaaaaaaa");
- current.rmdir("a");
- current.rmdir("b");
- current.rmdir("c");
- current.rmdir("d");
- current.rmdir("e");
- current.rmdir("f");
- current.rmdir("g");
- tempFile->close();
- delete tempFile;
- current.cdUp();
- current.rmdir("aaaaaaaaaaaaaaaaaa");
-}
-
-
-void tst_QFiledialog::task239706_editableFilterCombo()
-{
- QNonNativeFileDialog d;
- d.setNameFilter("*.cpp *.h");
-
- d.show();
- QTest::qWait(500);
-
- QList<QComboBox *> comboList = d.findChildren<QComboBox *>();
- QComboBox *filterCombo = 0;
- foreach (QComboBox *combo, comboList) {
- if (combo->objectName() == QString("fileTypeCombo")) {
- filterCombo = combo;
- break;
- }
- }
- Q_ASSERT(filterCombo);
- filterCombo->setEditable(true);
- QTest::mouseClick(filterCombo, Qt::LeftButton);
- QTest::keyPress(filterCombo, Qt::Key_X);
- QTest::keyPress(filterCombo, Qt::Key_Enter); // should not trigger assertion failure
-}
-
-void tst_QFiledialog::task218353_relativePaths()
-{
- QDir appDir = QDir::current();
- QVERIFY(appDir.cdUp() != false);
- QNonNativeFileDialog d(0, "TestDialog", "..");
- QCOMPARE(d.directory().absolutePath(), appDir.absolutePath());
-
- d.setDirectory(appDir.absolutePath() + QLatin1String("/non-existing-directory/../another-non-existing-dir/../"));
- QCOMPARE(d.directory().absolutePath(), appDir.absolutePath());
-
- QDir::current().mkdir("test");
- appDir = QDir::current();
- d.setDirectory(appDir.absolutePath() + QLatin1String("/test/../test/../"));
- QCOMPARE(d.directory().absolutePath(), appDir.absolutePath());
- appDir.rmdir("test");
-}
-
-void tst_QFiledialog::task251321_sideBarHiddenEntries()
-{
-#if defined QT_BUILD_INTERNAL
- QNonNativeFileDialog fd;
-
- QDir current = QDir::currentPath();
- current.mkdir(".hidden");
- QDir hiddenDir = QDir(".hidden");
- hiddenDir.mkdir("subdir");
- QDir hiddenSubDir = QDir(".hidden/subdir");
- hiddenSubDir.mkdir("happy");
- hiddenSubDir.mkdir("happy2");
-
- QList<QUrl> urls;
- urls << QUrl::fromLocalFile(hiddenSubDir.absolutePath());
- fd.setSidebarUrls(urls);
- fd.show();
- QTest::qWait(250);
-
- QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
- sidebar->setFocus();
- sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
- QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
- QTest::qWait(250);
-
- QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
- QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2);
-
- hiddenSubDir.rmdir("happy2");
- hiddenSubDir.rmdir("happy");
- hiddenDir.rmdir("subdir");
- current.rmdir(".hidden");
-#endif
-}
-
-#if defined QT_BUILD_INTERNAL
-class MyQSideBar : public QSidebar
-{
-public :
- MyQSideBar(QWidget *parent = 0) : QSidebar(parent)
- {}
-
- void removeSelection() {
- QList<QModelIndex> idxs = selectionModel()->selectedIndexes();
- QList<QPersistentModelIndex> indexes;
- for (int i = 0; i < idxs.count(); i++)
- indexes.append(idxs.at(i));
-
- for (int i = 0; i < indexes.count(); ++i)
- if (!indexes.at(i).data(Qt::UserRole + 1).toUrl().path().isEmpty())
- model()->removeRow(indexes.at(i).row());
- }
-};
-#endif
-
-void tst_QFiledialog::task251341_sideBarRemoveEntries()
-{
-#if defined QT_BUILD_INTERNAL
- QNonNativeFileDialog fd;
-
- QDir current = QDir::currentPath();
- current.mkdir("testDir");
- QDir testSubDir = QDir("testDir");
-
- QList<QUrl> urls;
- urls << QUrl::fromLocalFile(testSubDir.absolutePath());
- urls << QUrl::fromLocalFile("NotFound");
- fd.setSidebarUrls(urls);
- fd.show();
- QTest::qWait(250);
-
- QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
- sidebar->setFocus();
- //We enter in the first bookmark
- sidebar->selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
- QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
- QTest::qWait(250);
-
- QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
- //There is no file
- QCOMPARE(model->rowCount(model->index(testSubDir.absolutePath())), 0);
- //Icon is not enabled QUrlModel::EnabledRole
- QVariant value = sidebar->model()->index(0, 0).data(Qt::UserRole + 2);
- QCOMPARE(qvariant_cast<bool>(value), true);
-
- sidebar->setFocus();
- //We enter in the second bookmark which is invalid
- sidebar->selectUrl(QUrl::fromLocalFile("NotFound"));
- QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
- QTest::qWait(250);
-
- //We fallback to root because the entry in the bookmark is invalid
- QCOMPARE(model->rowCount(model->index("NotFound")), model->rowCount(model->index(model->rootPath())));
- //Icon is not enabled QUrlModel::EnabledRole
- value = sidebar->model()->index(1, 0).data(Qt::UserRole + 2);
- QCOMPARE(qvariant_cast<bool>(value), false);
-
- MyQSideBar mySideBar;
- mySideBar.init(model, urls);
- mySideBar.show();
- mySideBar.selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
- QTest::qWait(1000);
- mySideBar.removeSelection();
-
- //We remove the first entry
- QList<QUrl> expected;
- expected << QUrl::fromLocalFile("NotFound");
- QCOMPARE(mySideBar.urls(), expected);
-
- mySideBar.selectUrl(QUrl::fromLocalFile("NotFound"));
- mySideBar.removeSelection();
-
- //We remove the second entry
- expected.clear();
- QCOMPARE(mySideBar.urls(), expected);
-
- current.rmdir("testDir");
-#endif
-}
-
-void tst_QFiledialog::task254490_selectFileMultipleTimes()
-{
- QString tempPath = QDir::tempPath();
- QTemporaryFile *t;
- t = new QTemporaryFile;
- t->open();
- QNonNativeFileDialog fd(0, "TestFileDialog");
-
- fd.setDirectory(tempPath);
- fd.setViewMode(QFileDialog::List);
- fd.setAcceptMode(QFileDialog::AcceptSave);
- fd.setFileMode(QFileDialog::AnyFile);
-
- //This should select the file in the QFileDialog
- fd.selectFile(t->fileName());
-
- //This should clear the selection and write it into the filename line edit
- fd.selectFile("new_file.txt");
-
- fd.show();
- QTest::qWait(250);
-
- QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
- QVERIFY(lineEdit);
- QCOMPARE(lineEdit->text(),QLatin1String("new_file.txt"));
- QListView *list = qFindChild<QListView*>(&fd, "listView");
- QVERIFY(list);
- QCOMPARE(list->selectionModel()->selectedRows(0).count(), 0);
-
- t->deleteLater();
-}
-
-void tst_QFiledialog::task257579_sideBarWithNonCleanUrls()
-{
-#if defined QT_BUILD_INTERNAL
- QDir tempDir = QDir::temp();
- QLatin1String dirname("autotest_task257579");
- tempDir.rmdir(dirname); //makes sure it doesn't exist any more
- QVERIFY(tempDir.mkdir(dirname));
- QString url = QString::fromLatin1("%1/%2/..").arg(tempDir.absolutePath()).arg(dirname);
- QNonNativeFileDialog fd;
- fd.setSidebarUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
- QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
- QCOMPARE(sidebar->urls().count(), 1);
- QVERIFY(sidebar->urls().first().toLocalFile() != url);
- QCOMPARE(sidebar->urls().first().toLocalFile(), QDir::cleanPath(url));
-
-#ifdef Q_OS_WIN
- QCOMPARE(sidebar->model()->index(0,0).data().toString().toLower(), tempDir.dirName().toLower());
-#else
- QCOMPARE(sidebar->model()->index(0,0).data().toString(), tempDir.dirName());
-#endif
-
- //all tests are finished, we can remove the temporary dir
- QVERIFY(tempDir.rmdir(dirname));
-#endif
-}
-
-void tst_QFiledialog::task259105_filtersCornerCases()
-{
- QNonNativeFileDialog fd(0, "TestFileDialog");
- fd.setNameFilter(QLatin1String("All Files! (*);;Text Files (*.txt)"));
- fd.setOption(QFileDialog::HideNameFilterDetails, true);
- fd.show();
- QTest::qWait(250);
-
- //Extensions are hidden
- QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
- QVERIFY(filters);
- QCOMPARE(filters->currentText(), QLatin1String("All Files!"));
- filters->setCurrentIndex(1);
- QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
-
- //We should have the full names
- fd.setOption(QFileDialog::HideNameFilterDetails, false);
- QTest::qWait(250);
- filters->setCurrentIndex(0);
- QCOMPARE(filters->currentText(), QLatin1String("All Files! (*)"));
- filters->setCurrentIndex(1);
- QCOMPARE(filters->currentText(), QLatin1String("Text Files (*.txt)"));
-
- //Corner case undocumented of the task
- fd.setNameFilter(QLatin1String("\352 (I like cheese) All Files! (*);;Text Files (*.txt)"));
- QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files! (*)"));
- filters->setCurrentIndex(1);
- QCOMPARE(filters->currentText(), QLatin1String("Text Files (*.txt)"));
-
- fd.setOption(QFileDialog::HideNameFilterDetails, true);
- filters->setCurrentIndex(0);
- QTest::qWait(500);
- QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files!"));
- filters->setCurrentIndex(1);
- QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
-
- fd.setOption(QFileDialog::HideNameFilterDetails, true);
- filters->setCurrentIndex(0);
- QTest::qWait(500);
- QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files!"));
- filters->setCurrentIndex(1);
- QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
-}
-
-void tst_QFiledialog::QTBUG4419_lineEditSelectAll()
-{
- QString tempPath = QDir::tempPath();
- QTemporaryFile *t;
- t = new QTemporaryFile;
- t->open();
- QNonNativeFileDialog fd(0, "TestFileDialog", t->fileName());
-
- fd.setDirectory(tempPath);
- fd.setViewMode(QFileDialog::List);
- fd.setAcceptMode(QFileDialog::AcceptSave);
- fd.setFileMode(QFileDialog::AnyFile);
-
- fd.show();
- QApplication::setActiveWindow(&fd);
- QTest::qWaitForWindowShown(&fd);
- QTRY_COMPARE(fd.isVisible(), true);
- QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
-
- QTest::qWait(250);
- QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
-
- QCOMPARE(tempPath + QChar('/') + lineEdit->text(), t->fileName());
- QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName());
-}
-
QTEST_MAIN(tst_QFiledialog)
#include "tst_qfiledialog.moc"
diff --git a/tests/auto/qfiledialog2/qfiledialog2.pro b/tests/auto/qfiledialog2/qfiledialog2.pro
new file mode 100644
index 0000000000..4ebf9775d8
--- /dev/null
+++ b/tests/auto/qfiledialog2/qfiledialog2.pro
@@ -0,0 +1,27 @@
+############################################################
+# Project file for autotest for file qfiledialog.h
+############################################################
+
+load(qttest_p4)
+
+SOURCES += tst_qfiledialog2.cpp
+
+wince*|symbian {
+ addFiles.sources = *.cpp
+ addFiles.path = .
+ filesInDir.sources = *.pro
+ filesInDir.path = someDir
+ DEPLOYMENT += addFiles filesInDir
+}
+
+symbian:TARGET.EPOCHEAPSIZE="0x100 0x1000000"
+symbian:HEADERS += ../../../include/qtgui/private/qfileinfogatherer_p.h
+
+wince* {
+ DEFINES += SRCDIR=\\\"./\\\"
+} else:symbian {
+ TARGET.UID3 = 0xE0340003
+ DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x",""))
+} else {
+ DEFINES += SRCDIR=\\\"$$PWD/\\\"
+}
diff --git a/tests/auto/qfiledialog2/tst_qfiledialog2.cpp b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
new file mode 100644
index 0000000000..18f94a9ef2
--- /dev/null
+++ b/tests/auto/qfiledialog2/tst_qfiledialog2.cpp
@@ -0,0 +1,1006 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include <QtTest/QtTest>
+
+#include <qcoreapplication.h>
+#include <qdebug.h>
+#include <qfiledialog.h>
+#include <qabstractitemdelegate.h>
+#include <qdirmodel.h>
+#include <qitemdelegate.h>
+#include <qlistview.h>
+#include <qcombobox.h>
+#include <qpushbutton.h>
+#include <qtoolbutton.h>
+#include <qtreeview.h>
+#include <qheaderview.h>
+#include <qcompleter.h>
+#include <qaction.h>
+#include <qdialogbuttonbox.h>
+#include <qsortfilterproxymodel.h>
+#include <qlineedit.h>
+#include <qlayout.h>
+#include "../../shared/util.h"
+#include "../../../src/gui/dialogs/qsidebar_p.h"
+#include "../../../src/gui/dialogs/qfilesystemmodel_p.h"
+#include "../../../src/gui/dialogs/qfiledialog_p.h"
+
+#include "../network-settings.h"
+
+//TESTED_CLASS=
+//TESTED_FILES=
+
+#if defined(Q_OS_SYMBIAN)
+# define STRINGIFY(x) #x
+# define TOSTRING(x) STRINGIFY(x)
+# define SRCDIR "C:/Private/" TOSTRING(SYMBIAN_SRCDIR_UID) "/"
+#endif
+
+class QNonNativeFileDialog : public QFileDialog
+{
+ Q_OBJECT
+public:
+ QNonNativeFileDialog(QWidget *parent = 0, const QString &caption = QString(), const QString &directory = QString(), const QString &filter = QString())
+ : QFileDialog(parent, caption, directory, filter)
+ {
+ setOption(QFileDialog::DontUseNativeDialog, true);
+ }
+};
+
+class tst_QFiledialog : public QObject
+{
+Q_OBJECT
+
+public:
+ tst_QFiledialog();
+ virtual ~tst_QFiledialog();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void listRoot();
+ void heapCorruption();
+ void deleteDirAndFiles();
+ void filter();
+ void showNameFilterDetails();
+ void unc();
+ void emptyUncPath();
+
+ void task178897_minimumSize();
+ void task180459_lastDirectory_data();
+ void task180459_lastDirectory();
+ void task227304_proxyOnFileDialog();
+ void task227930_correctNavigationKeyboardBehavior();
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ void task226366_lowerCaseHardDriveWindows();
+#endif
+ void task233037_selectingDirectory();
+ void task235069_hideOnEscape();
+ void task236402_dontWatchDeletedDir();
+ void task203703_returnProperSeparator();
+ void task228844_ensurePreviousSorting();
+ void task239706_editableFilterCombo();
+ void task218353_relativePaths();
+ void task251321_sideBarHiddenEntries();
+ void task251341_sideBarRemoveEntries();
+ void task254490_selectFileMultipleTimes();
+ void task257579_sideBarWithNonCleanUrls();
+ void task259105_filtersCornerCases();
+
+ void QTBUG4419_lineEditSelectAll();
+
+private:
+ QByteArray userSettings;
+};
+
+tst_QFiledialog::tst_QFiledialog()
+{
+}
+
+tst_QFiledialog::~tst_QFiledialog()
+{
+}
+
+void tst_QFiledialog::init()
+{
+ // Save the developers settings so they don't get mad when their sidebar folders are gone.
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ settings.beginGroup(QLatin1String("Qt"));
+ userSettings = settings.value(QLatin1String("filedialog")).toByteArray();
+ settings.remove(QLatin1String("filedialog"));
+
+ // populate it with some default settings
+ QNonNativeFileDialog fd;
+#if defined(Q_OS_WINCE)
+ QTest::qWait(1000);
+#endif
+}
+
+void tst_QFiledialog::cleanup()
+{
+ QSettings settings(QSettings::UserScope, QLatin1String("Trolltech"));
+ settings.beginGroup(QLatin1String("Qt"));
+ settings.setValue(QLatin1String("filedialog"), userSettings);
+}
+
+void tst_QFiledialog::listRoot()
+{
+#if defined QT_BUILD_INTERNAL
+ QFileInfoGatherer::fetchedRoot = false;
+ QString dir(QDir::currentPath());
+ QNonNativeFileDialog fd(0, QString(), dir);
+ fd.show();
+ QCOMPARE(QFileInfoGatherer::fetchedRoot,false);
+ fd.setDirectory("");
+ QTest::qWait(500);
+ QCOMPARE(QFileInfoGatherer::fetchedRoot,true);
+#endif
+}
+
+void tst_QFiledialog::heapCorruption()
+{
+ QVector<QNonNativeFileDialog*> dialogs;
+ for (int i=0; i < 10; i++) {
+ QNonNativeFileDialog *f = new QNonNativeFileDialog(NULL);
+ dialogs << f;
+ }
+ qDeleteAll(dialogs);
+}
+
+struct FriendlyQFileDialog : public QFileDialog
+{
+ friend class tst_QFileDialog;
+ Q_DECLARE_PRIVATE(QFileDialog)
+};
+
+
+void tst_QFiledialog::deleteDirAndFiles()
+{
+#if defined QT_BUILD_INTERNAL
+ QString tempPath = QDir::tempPath() + '/' + "QFileDialogTestDir4FullDelete";
+ QDir dir;
+ QVERIFY(dir.mkpath(tempPath + "/foo"));
+ QVERIFY(dir.mkpath(tempPath + "/foo/B"));
+ QVERIFY(dir.mkpath(tempPath + "/foo/B"));
+ QVERIFY(dir.mkpath(tempPath + "/foo/c"));
+ QVERIFY(dir.mkpath(tempPath + "/bar"));
+ QFile(tempPath + "/foo/a");
+ QTemporaryFile *t;
+ t = new QTemporaryFile(tempPath + "/foo/aXXXXXX");
+ t->setAutoRemove(false);
+ t->open();
+ t->close();
+ delete t;
+
+ t = new QTemporaryFile(tempPath + "/foo/B/yXXXXXX");
+ t->setAutoRemove(false);
+ t->open();
+ t->close();
+ delete t;
+ FriendlyQFileDialog fd;
+ fd.setOption(QFileDialog::DontUseNativeDialog);
+ fd.d_func()->removeDirectory(tempPath);
+ QFileInfo info(tempPath);
+ QTest::qWait(2000);
+ QVERIFY(!info.exists());
+#endif
+}
+
+void tst_QFiledialog::filter()
+{
+ QNonNativeFileDialog fd;
+ QAction *hiddenAction = qFindChild<QAction*>(&fd, "qt_show_hidden_action");
+ QVERIFY(hiddenAction);
+ QVERIFY(hiddenAction->isEnabled());
+ QVERIFY(!hiddenAction->isChecked());
+ QDir::Filters filter = fd.filter();
+ filter |= QDir::Hidden;
+ fd.setFilter(filter);
+ QVERIFY(hiddenAction->isChecked());
+}
+
+void tst_QFiledialog::showNameFilterDetails()
+{
+ QNonNativeFileDialog fd;
+ QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
+ QVERIFY(filters);
+ QVERIFY(fd.isNameFilterDetailsVisible());
+
+
+ QStringList filterChoices;
+ filterChoices << "Image files (*.png *.xpm *.jpg)"
+ << "Text files (*.txt)"
+ << "Any files (*.*)";
+ fd.setFilters(filterChoices);
+
+ fd.setNameFilterDetailsVisible(false);
+ QCOMPARE(filters->itemText(0), QString("Image files"));
+ QCOMPARE(filters->itemText(1), QString("Text files"));
+ QCOMPARE(filters->itemText(2), QString("Any files"));
+
+ fd.setNameFilterDetailsVisible(true);
+ QCOMPARE(filters->itemText(0), filterChoices.at(0));
+ QCOMPARE(filters->itemText(1), filterChoices.at(1));
+ QCOMPARE(filters->itemText(2), filterChoices.at(2));
+}
+
+void tst_QFiledialog::unc()
+{
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+ // Only test UNC on Windows./
+ QString dir("\\\\" + QtNetworkSettings::winServerName() + "\\testsharewritable");
+#else
+ QString dir(QDir::currentPath());
+#endif
+ QVERIFY(QFile::exists(dir));
+ QNonNativeFileDialog fd(0, QString(), dir);
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ QVERIFY(model);
+ QCOMPARE(model->index(fd.directory().absolutePath()), model->index(dir));
+}
+
+void tst_QFiledialog::emptyUncPath()
+{
+ QNonNativeFileDialog fd;
+ fd.show();
+ QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
+ QVERIFY(lineEdit);
+ // press 'keys' for the input
+ for (int i = 0; i < 3 ; ++i)
+ QTest::keyPress(lineEdit, Qt::Key_Backslash);
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ QVERIFY(model);
+}
+
+void tst_QFiledialog::task178897_minimumSize()
+{
+ QNonNativeFileDialog fd;
+ QStringList history = fd.history();
+ history << QDir::toNativeSeparators("/verylongdirectory/"
+ "aaaaaaaaaabbbbbbbbcccccccccccddddddddddddddeeeeeeeeeeeeffffffffffgggtggggggggghhhhhhhhiiiiiijjjk");
+ fd.setHistory(history);
+ fd.show();
+
+ QSize ms = fd.layout()->minimumSize();
+ QVERIFY(ms.width() < 400);
+}
+
+void tst_QFiledialog::task180459_lastDirectory_data()
+{
+ QTest::addColumn<QString>("path");
+ QTest::addColumn<QString>("directory");
+ QTest::addColumn<bool>("isEnabled");
+ QTest::addColumn<QString>("result");
+
+ QTest::newRow("path+file") << QDir::homePath() + QDir::separator() + "foo"
+ << QDir::homePath() << true
+ << QDir::homePath() + QDir::separator() + "foo" ;
+ QTest::newRow("no path") << ""
+ << QDir::tempPath() << false << QString();
+ QTest::newRow("file") << "foo"
+ << QDir::currentPath() << true
+ << QDir::currentPath() + QDir::separator() + "foo" ;
+ QTest::newRow("path") << QDir::homePath()
+ << QDir::homePath() << false << QString();
+ QTest::newRow("path not existing") << "/usr/bin/foo/bar/foo/foo.txt"
+ << QDir::tempPath() << true
+ << QDir::tempPath() + QDir::separator() + "foo.txt";
+
+}
+
+void tst_QFiledialog::task180459_lastDirectory()
+{
+ //first visit the temp directory and close the dialog
+ QNonNativeFileDialog *dlg = new QNonNativeFileDialog(0, "", QDir::tempPath());
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(dlg, "qt_filesystem_model");
+ QVERIFY(model);
+ QCOMPARE(model->index(QDir::tempPath()), model->index(dlg->directory().absolutePath()));
+ delete dlg;
+
+ QFETCH(QString, path);
+ QFETCH(QString, directory);
+ QFETCH(bool, isEnabled);
+ QFETCH(QString, result);
+
+ dlg = new QNonNativeFileDialog(0, "", path);
+ model = qFindChild<QFileSystemModel*>(dlg, "qt_filesystem_model");
+ QVERIFY(model);
+ dlg->setAcceptMode(QFileDialog::AcceptSave);
+ QCOMPARE(model->index(dlg->directory().absolutePath()), model->index(directory));
+
+ QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(dlg, "buttonBox");
+ QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
+ QVERIFY(button);
+ QCOMPARE(button->isEnabled(), isEnabled);
+ if (isEnabled)
+ QCOMPARE(model->index(result), model->index(dlg->selectedFiles().first()));
+
+ delete dlg;
+}
+
+
+
+class FilterDirModel : public QSortFilterProxyModel
+{
+
+public:
+ FilterDirModel(QString root, QObject* parent=0):QSortFilterProxyModel(parent), m_root(root)
+ {}
+ ~FilterDirModel()
+ {};
+
+protected:
+ bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
+ {
+ QModelIndex parentIndex;
+ parentIndex = source_parent;
+
+ QString path;
+ path = parentIndex.child(source_row,0).data(Qt::DisplayRole).toString();
+
+ do {
+ path = parentIndex.data(Qt::DisplayRole).toString() + "/" + path;
+ parentIndex = parentIndex.parent();
+ } while(parentIndex.isValid());
+
+ QFileInfo info(path);
+ if (info.isDir() && (QDir(path) != m_root))
+ return false;
+ return true;
+ }
+
+
+private:
+ QDir m_root;
+
+
+};
+
+class sortProxy : public QSortFilterProxyModel
+{
+public:
+ sortProxy(QObject *parent) : QSortFilterProxyModel(parent)
+ {
+ }
+protected:
+ virtual bool lessThan(const QModelIndex &left, const QModelIndex &right) const
+ {
+ QFileSystemModel * const model = qobject_cast<QFileSystemModel *>(sourceModel());
+ const QFileInfo leftInfo(model->fileInfo(left));
+ const QFileInfo rightInfo(model->fileInfo(right));
+
+ if (leftInfo.isDir() == rightInfo.isDir())
+ return(leftInfo.filePath().compare(rightInfo.filePath(),Qt::CaseInsensitive) < 0);
+ else if (leftInfo.isDir())
+ return(false);
+ else
+ return(true);
+ }
+};
+
+class CrashDialog : public QNonNativeFileDialog
+{
+ Q_OBJECT
+
+public:
+ CrashDialog(QWidget *parent, const QString &caption, const
+QString &dir, const QString &filter)
+ : QNonNativeFileDialog(parent, caption, dir, filter)
+ {
+ sortProxy *proxyModel = new sortProxy(this);
+ setProxyModel(proxyModel);
+ }
+};
+
+void tst_QFiledialog::task227304_proxyOnFileDialog()
+{
+#if defined QT_BUILD_INTERNAL
+ QNonNativeFileDialog fd(0, "", QDir::currentPath(), 0);
+ fd.setProxyModel(new FilterDirModel(QDir::currentPath()));
+ fd.show();
+ QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
+ QTest::qWait(200);
+ QTest::keyClick(edit, Qt::Key_T);
+ QTest::keyClick(edit, Qt::Key_S);
+ QTest::qWait(200);
+ QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
+
+ CrashDialog *dialog = new CrashDialog(0, QString("crash dialog test"), QDir::homePath(), QString("*") );
+ dialog->setFileMode(QFileDialog::ExistingFile);
+ dialog->show();
+
+ QListView *list = qFindChild<QListView*>(dialog, "listView");
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::keyClick(list, Qt::Key_Return);
+ QTest::qWait(200);
+
+ dialog->close();
+ fd.close();
+
+ QNonNativeFileDialog fd2(0, "I should not crash with a proxy", QDir::tempPath(), 0);
+ QSortFilterProxyModel *pm = new QSortFilterProxyModel;
+ fd2.setProxyModel(pm);
+ fd2.show();
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd2, "sidebar");
+ sidebar->setFocus();
+ sidebar->selectUrl(QUrl::fromLocalFile(QDir::homePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
+ QTest::qWait(250);
+ //We shouldn't crash
+#endif
+}
+
+void tst_QFiledialog::task227930_correctNavigationKeyboardBehavior()
+{
+ QDir current = QDir::currentPath();
+ current.mkdir("test");
+ current.cd("test");
+ QFile file("test/out.txt");
+ QFile file2("test/out2.txt");
+ QVERIFY(file.open(QIODevice::WriteOnly | QIODevice::Text));
+ QVERIFY(file2.open(QIODevice::WriteOnly | QIODevice::Text));
+ current.cdUp();
+ current.mkdir("test2");
+ QNonNativeFileDialog fd;
+ fd.setViewMode(QFileDialog::List);
+ fd.setDirectory(current.absolutePath());
+ fd.show();
+ QListView *list = qFindChild<QListView*>(&fd, "listView");
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::keyClick(list, Qt::Key_Return);
+ QTest::qWait(200);
+ QTest::mouseClick(list->viewport(), Qt::LeftButton,0);
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::keyClick(list, Qt::Key_Backspace);
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::keyClick(list, Qt::Key_Return);
+ QTest::qWait(200);
+ QCOMPARE(fd.isVisible(), true);
+ QTest::qWait(200);
+ file.close();
+ file2.close();
+ file.remove();
+ file2.remove();
+ current.rmdir("test");
+ current.rmdir("test2");
+}
+
+#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
+void tst_QFiledialog::task226366_lowerCaseHardDriveWindows()
+{
+ QNonNativeFileDialog fd;
+ fd.setDirectory(QDir::root().path());
+ fd.show();
+ QLineEdit *edit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
+ QToolButton *buttonParent = qFindChild<QToolButton*>(&fd, "toParentButton");
+ QTest::qWait(200);
+ QTest::mouseClick(buttonParent, Qt::LeftButton,0,QPoint(0,0));
+ QTest::qWait(2000);
+ QTest::keyClick(edit, Qt::Key_C);
+ QTest::qWait(200);
+ QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
+ QTest::qWait(200);
+ QCOMPARE(edit->text(), QString("C:"));
+ QTest::qWait(2000);
+ //i clear my previous selection in the completer
+ QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
+ edit->clear();
+ QTest::keyClick(edit, (char)(Qt::Key_C | Qt::SHIFT));
+ QTest::qWait(200);
+ QTest::keyClick(edit->completer()->popup(), Qt::Key_Down);
+ QCOMPARE(edit->text(), QString("C:"));
+}
+#endif
+
+void tst_QFiledialog::task233037_selectingDirectory()
+{
+ QDir current = QDir::currentPath();
+ current.mkdir("test");
+ QNonNativeFileDialog fd;
+ fd.setViewMode(QFileDialog::List);
+ fd.setDirectory(current.absolutePath());
+ fd.setAcceptMode( QFileDialog::AcceptSave);
+ fd.show();
+ QListView *list = qFindChild<QListView*>(&fd, "listView");
+ QTest::qWait(3000); // Wait for sort to settle (I need a signal).
+#ifdef QT_KEYPAD_NAVIGATION
+ list->setEditFocus(true);
+#endif
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::qWait(100);
+ QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
+ QPushButton *button = buttonBox->button(QDialogButtonBox::Save);
+ QVERIFY(button);
+ QCOMPARE(button->isEnabled(), true);
+ current.rmdir("test");
+}
+
+void tst_QFiledialog::task235069_hideOnEscape()
+{
+ QDir current = QDir::currentPath();
+ QNonNativeFileDialog fd;
+ fd.setViewMode(QFileDialog::List);
+ fd.setDirectory(current.absolutePath());
+ fd.setAcceptMode( QFileDialog::AcceptSave);
+ fd.show();
+ QListView *list = qFindChild<QListView*>(&fd, "listView");
+ list->setFocus();
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Escape);
+ QCOMPARE(fd.isVisible(), false);
+ QNonNativeFileDialog fd2;
+ fd2.setDirectory(current.absolutePath());
+ fd2.setAcceptMode( QFileDialog::AcceptSave);
+ fd2.show();
+ QLineEdit *edit = qFindChild<QLineEdit*>(&fd2, "fileNameEdit");
+ QTest::keyClick(edit, Qt::Key_Escape);
+ QCOMPARE(fd2.isVisible(), false);
+}
+
+void tst_QFiledialog::task236402_dontWatchDeletedDir()
+{
+#if defined QT_BUILD_INTERNAL
+ //THIS TEST SHOULD NOT DISPLAY WARNINGS
+ QDir current = QDir::currentPath();
+ //make sure it is the first on the list
+ current.mkdir("aaaaaaaaaa");
+ FriendlyQFileDialog fd;
+ fd.setViewMode(QFileDialog::List);
+ fd.setDirectory(current.absolutePath());
+ fd.setAcceptMode( QFileDialog::AcceptSave);
+ fd.show();
+ QListView *list = qFindChild<QListView*>(&fd, "listView");
+ list->setFocus();
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Return);
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Backspace);
+ QTest::keyClick(list, Qt::Key_Down);
+ QTest::qWait(200);
+ fd.d_func()->removeDirectory(current.absolutePath() + "/aaaaaaaaaa/");
+ QTest::qWait(1000);
+#endif
+}
+
+void tst_QFiledialog::task203703_returnProperSeparator()
+{
+ QDir current = QDir::currentPath();
+ current.mkdir("aaaaaaaaaaaaaaaaaa");
+ QNonNativeFileDialog fd;
+ fd.setDirectory(current.absolutePath());
+ fd.setViewMode(QFileDialog::List);
+ fd.setFileMode(QFileDialog::Directory);
+ fd.show();
+ QTest::qWait(500);
+ QListView *list = qFindChild<QListView*>(&fd, "listView");
+ list->setFocus();
+ QTest::qWait(200);
+ QTest::keyClick(list, Qt::Key_Return);
+ QTest::qWait(1000);
+ QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
+ QPushButton *button = buttonBox->button(QDialogButtonBox::Cancel);
+ QTest::keyClick(button, Qt::Key_Return);
+ QTest::qWait(500);
+ QString result = fd.selectedFiles().first();
+ QVERIFY(result.at(result.count() - 1) != '/');
+ QVERIFY(!result.contains('\\'));
+ current.rmdir("aaaaaaaaaaaaaaaaaa");
+}
+
+void tst_QFiledialog::task228844_ensurePreviousSorting()
+{
+ QDir current = QDir::currentPath();
+ current.mkdir("aaaaaaaaaaaaaaaaaa");
+ current.cd("aaaaaaaaaaaaaaaaaa");
+ current.mkdir("a");
+ current.mkdir("b");
+ current.mkdir("c");
+ current.mkdir("d");
+ current.mkdir("e");
+ current.mkdir("f");
+ current.mkdir("g");
+ QTemporaryFile *tempFile = new QTemporaryFile(current.absolutePath() + "/rXXXXXX");
+ tempFile->open();
+ current.cdUp();
+
+ QNonNativeFileDialog fd;
+ fd.setDirectory(current.absolutePath());
+ fd.setViewMode(QFileDialog::Detail);
+ fd.show();
+ QTest::qWait(500);
+ QTreeView *tree = qFindChild<QTreeView*>(&fd, "treeView");
+ tree->header()->setSortIndicator(3,Qt::DescendingOrder);
+ QTest::qWait(200);
+ QDialogButtonBox *buttonBox = qFindChild<QDialogButtonBox*>(&fd, "buttonBox");
+ QPushButton *button = buttonBox->button(QDialogButtonBox::Open);
+ QTest::mouseClick(button, Qt::LeftButton);
+ QTest::qWait(500);
+
+ QNonNativeFileDialog fd2;
+ fd2.setFileMode(QFileDialog::Directory);
+ fd2.restoreState(fd.saveState());
+ current.cd("aaaaaaaaaaaaaaaaaa");
+ fd2.setDirectory(current.absolutePath());
+ fd2.show();
+ QTest::qWait(500);
+ QTreeView *tree2 = qFindChild<QTreeView*>(&fd2, "treeView");
+ tree2->setFocus();
+
+ QCOMPARE(tree2->rootIndex().data(QFileSystemModel::FilePathRole).toString(),current.absolutePath());
+
+ QDialogButtonBox *buttonBox2 = qFindChild<QDialogButtonBox*>(&fd2, "buttonBox");
+ QPushButton *button2 = buttonBox2->button(QDialogButtonBox::Open);
+ fd2.selectFile("g");
+ QTest::mouseClick(button2, Qt::LeftButton);
+ QTest::qWait(500);
+
+ QCOMPARE(fd2.selectedFiles().first(), current.absolutePath() + QChar('/') + QLatin1String("g"));
+
+ QNonNativeFileDialog fd3(0, "This is a third file dialog", tempFile->fileName());
+ fd3.restoreState(fd.saveState());
+ fd3.setFileMode(QFileDialog::Directory);
+ fd3.show();
+ QTest::qWait(500);
+ QTreeView *tree3 = qFindChild<QTreeView*>(&fd3, "treeView");
+ tree3->setFocus();
+
+ QCOMPARE(tree3->rootIndex().data(QFileSystemModel::FilePathRole).toString(), current.absolutePath());
+
+ QDialogButtonBox *buttonBox3 = qFindChild<QDialogButtonBox*>(&fd3, "buttonBox");
+ QPushButton *button3 = buttonBox3->button(QDialogButtonBox::Open);
+ QTest::mouseClick(button3, Qt::LeftButton);
+ QTest::qWait(500);
+
+ QCOMPARE(fd3.selectedFiles().first(), tempFile->fileName());
+
+ current.cd("aaaaaaaaaaaaaaaaaa");
+ current.rmdir("a");
+ current.rmdir("b");
+ current.rmdir("c");
+ current.rmdir("d");
+ current.rmdir("e");
+ current.rmdir("f");
+ current.rmdir("g");
+ tempFile->close();
+ delete tempFile;
+ current.cdUp();
+ current.rmdir("aaaaaaaaaaaaaaaaaa");
+}
+
+
+void tst_QFiledialog::task239706_editableFilterCombo()
+{
+ QNonNativeFileDialog d;
+ d.setNameFilter("*.cpp *.h");
+
+ d.show();
+ QTest::qWait(500);
+
+ QList<QComboBox *> comboList = d.findChildren<QComboBox *>();
+ QComboBox *filterCombo = 0;
+ foreach (QComboBox *combo, comboList) {
+ if (combo->objectName() == QString("fileTypeCombo")) {
+ filterCombo = combo;
+ break;
+ }
+ }
+ Q_ASSERT(filterCombo);
+ filterCombo->setEditable(true);
+ QTest::mouseClick(filterCombo, Qt::LeftButton);
+ QTest::keyPress(filterCombo, Qt::Key_X);
+ QTest::keyPress(filterCombo, Qt::Key_Enter); // should not trigger assertion failure
+}
+
+void tst_QFiledialog::task218353_relativePaths()
+{
+ QDir appDir = QDir::current();
+ QVERIFY(appDir.cdUp() != false);
+ QNonNativeFileDialog d(0, "TestDialog", "..");
+ QCOMPARE(d.directory().absolutePath(), appDir.absolutePath());
+
+ d.setDirectory(appDir.absolutePath() + QLatin1String("/non-existing-directory/../another-non-existing-dir/../"));
+ QCOMPARE(d.directory().absolutePath(), appDir.absolutePath());
+
+ QDir::current().mkdir("test");
+ appDir = QDir::current();
+ d.setDirectory(appDir.absolutePath() + QLatin1String("/test/../test/../"));
+ QCOMPARE(d.directory().absolutePath(), appDir.absolutePath());
+ appDir.rmdir("test");
+}
+
+void tst_QFiledialog::task251321_sideBarHiddenEntries()
+{
+#if defined QT_BUILD_INTERNAL
+ QNonNativeFileDialog fd;
+
+ QDir current = QDir::currentPath();
+ current.mkdir(".hidden");
+ QDir hiddenDir = QDir(".hidden");
+ hiddenDir.mkdir("subdir");
+ QDir hiddenSubDir = QDir(".hidden/subdir");
+ hiddenSubDir.mkdir("happy");
+ hiddenSubDir.mkdir("happy2");
+
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile(hiddenSubDir.absolutePath());
+ fd.setSidebarUrls(urls);
+ fd.show();
+ QTest::qWait(250);
+
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ sidebar->setFocus();
+ sidebar->selectUrl(QUrl::fromLocalFile(hiddenSubDir.absolutePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
+ QTest::qWait(250);
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ QCOMPARE(model->rowCount(model->index(hiddenSubDir.absolutePath())), 2);
+
+ hiddenSubDir.rmdir("happy2");
+ hiddenSubDir.rmdir("happy");
+ hiddenDir.rmdir("subdir");
+ current.rmdir(".hidden");
+#endif
+}
+
+#if defined QT_BUILD_INTERNAL
+class MyQSideBar : public QSidebar
+{
+public :
+ MyQSideBar(QWidget *parent = 0) : QSidebar(parent)
+ {}
+
+ void removeSelection() {
+ QList<QModelIndex> idxs = selectionModel()->selectedIndexes();
+ QList<QPersistentModelIndex> indexes;
+ for (int i = 0; i < idxs.count(); i++)
+ indexes.append(idxs.at(i));
+
+ for (int i = 0; i < indexes.count(); ++i)
+ if (!indexes.at(i).data(Qt::UserRole + 1).toUrl().path().isEmpty())
+ model()->removeRow(indexes.at(i).row());
+ }
+};
+#endif
+
+void tst_QFiledialog::task251341_sideBarRemoveEntries()
+{
+#if defined QT_BUILD_INTERNAL
+ QNonNativeFileDialog fd;
+
+ QDir current = QDir::currentPath();
+ current.mkdir("testDir");
+ QDir testSubDir = QDir("testDir");
+
+ QList<QUrl> urls;
+ urls << QUrl::fromLocalFile(testSubDir.absolutePath());
+ urls << QUrl::fromLocalFile("NotFound");
+ fd.setSidebarUrls(urls);
+ fd.show();
+ QTest::qWait(250);
+
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ sidebar->setFocus();
+ //We enter in the first bookmark
+ sidebar->selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(0, 0)).center());
+ QTest::qWait(250);
+
+ QFileSystemModel *model = qFindChild<QFileSystemModel*>(&fd, "qt_filesystem_model");
+ //There is no file
+ QCOMPARE(model->rowCount(model->index(testSubDir.absolutePath())), 0);
+ //Icon is not enabled QUrlModel::EnabledRole
+ QVariant value = sidebar->model()->index(0, 0).data(Qt::UserRole + 2);
+ QCOMPARE(qvariant_cast<bool>(value), true);
+
+ sidebar->setFocus();
+ //We enter in the second bookmark which is invalid
+ sidebar->selectUrl(QUrl::fromLocalFile("NotFound"));
+ QTest::mouseClick(sidebar->viewport(), Qt::LeftButton, 0, sidebar->visualRect(sidebar->model()->index(1, 0)).center());
+ QTest::qWait(250);
+
+ //We fallback to root because the entry in the bookmark is invalid
+ QCOMPARE(model->rowCount(model->index("NotFound")), model->rowCount(model->index(model->rootPath())));
+ //Icon is not enabled QUrlModel::EnabledRole
+ value = sidebar->model()->index(1, 0).data(Qt::UserRole + 2);
+ QCOMPARE(qvariant_cast<bool>(value), false);
+
+ MyQSideBar mySideBar;
+ mySideBar.init(model, urls);
+ mySideBar.show();
+ mySideBar.selectUrl(QUrl::fromLocalFile(testSubDir.absolutePath()));
+ QTest::qWait(1000);
+ mySideBar.removeSelection();
+
+ //We remove the first entry
+ QList<QUrl> expected;
+ expected << QUrl::fromLocalFile("NotFound");
+ QCOMPARE(mySideBar.urls(), expected);
+
+ mySideBar.selectUrl(QUrl::fromLocalFile("NotFound"));
+ mySideBar.removeSelection();
+
+ //We remove the second entry
+ expected.clear();
+ QCOMPARE(mySideBar.urls(), expected);
+
+ current.rmdir("testDir");
+#endif
+}
+
+void tst_QFiledialog::task254490_selectFileMultipleTimes()
+{
+ QString tempPath = QDir::tempPath();
+ QTemporaryFile *t;
+ t = new QTemporaryFile;
+ t->open();
+ QNonNativeFileDialog fd(0, "TestFileDialog");
+
+ fd.setDirectory(tempPath);
+ fd.setViewMode(QFileDialog::List);
+ fd.setAcceptMode(QFileDialog::AcceptSave);
+ fd.setFileMode(QFileDialog::AnyFile);
+
+ //This should select the file in the QFileDialog
+ fd.selectFile(t->fileName());
+
+ //This should clear the selection and write it into the filename line edit
+ fd.selectFile("new_file.txt");
+
+ fd.show();
+ QTest::qWait(250);
+
+ QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
+ QVERIFY(lineEdit);
+ QCOMPARE(lineEdit->text(),QLatin1String("new_file.txt"));
+ QListView *list = qFindChild<QListView*>(&fd, "listView");
+ QVERIFY(list);
+ QCOMPARE(list->selectionModel()->selectedRows(0).count(), 0);
+
+ t->deleteLater();
+}
+
+void tst_QFiledialog::task257579_sideBarWithNonCleanUrls()
+{
+#if defined QT_BUILD_INTERNAL
+ QDir tempDir = QDir::temp();
+ QLatin1String dirname("autotest_task257579");
+ tempDir.rmdir(dirname); //makes sure it doesn't exist any more
+ QVERIFY(tempDir.mkdir(dirname));
+ QString url = QString::fromLatin1("%1/%2/..").arg(tempDir.absolutePath()).arg(dirname);
+ QNonNativeFileDialog fd;
+ fd.setSidebarUrls(QList<QUrl>() << QUrl::fromLocalFile(url));
+ QSidebar *sidebar = qFindChild<QSidebar*>(&fd, "sidebar");
+ QCOMPARE(sidebar->urls().count(), 1);
+ QVERIFY(sidebar->urls().first().toLocalFile() != url);
+ QCOMPARE(sidebar->urls().first().toLocalFile(), QDir::cleanPath(url));
+
+#ifdef Q_OS_WIN
+ QCOMPARE(sidebar->model()->index(0,0).data().toString().toLower(), tempDir.dirName().toLower());
+#else
+ QCOMPARE(sidebar->model()->index(0,0).data().toString(), tempDir.dirName());
+#endif
+
+ //all tests are finished, we can remove the temporary dir
+ QVERIFY(tempDir.rmdir(dirname));
+#endif
+}
+
+void tst_QFiledialog::task259105_filtersCornerCases()
+{
+ QNonNativeFileDialog fd(0, "TestFileDialog");
+ fd.setNameFilter(QLatin1String("All Files! (*);;Text Files (*.txt)"));
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ fd.show();
+ QTest::qWait(250);
+
+ //Extensions are hidden
+ QComboBox *filters = qFindChild<QComboBox*>(&fd, "fileTypeCombo");
+ QVERIFY(filters);
+ QCOMPARE(filters->currentText(), QLatin1String("All Files!"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
+
+ //We should have the full names
+ fd.setOption(QFileDialog::HideNameFilterDetails, false);
+ QTest::qWait(250);
+ filters->setCurrentIndex(0);
+ QCOMPARE(filters->currentText(), QLatin1String("All Files! (*)"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files (*.txt)"));
+
+ //Corner case undocumented of the task
+ fd.setNameFilter(QLatin1String("\352 (I like cheese) All Files! (*);;Text Files (*.txt)"));
+ QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files! (*)"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files (*.txt)"));
+
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ filters->setCurrentIndex(0);
+ QTest::qWait(500);
+ QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files!"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
+
+ fd.setOption(QFileDialog::HideNameFilterDetails, true);
+ filters->setCurrentIndex(0);
+ QTest::qWait(500);
+ QCOMPARE(filters->currentText(), QLatin1String("\352 (I like cheese) All Files!"));
+ filters->setCurrentIndex(1);
+ QCOMPARE(filters->currentText(), QLatin1String("Text Files"));
+}
+
+void tst_QFiledialog::QTBUG4419_lineEditSelectAll()
+{
+ QString tempPath = QDir::tempPath();
+ QTemporaryFile *t;
+ t = new QTemporaryFile;
+ t->open();
+ QNonNativeFileDialog fd(0, "TestFileDialog", t->fileName());
+
+ fd.setDirectory(tempPath);
+ fd.setViewMode(QFileDialog::List);
+ fd.setAcceptMode(QFileDialog::AcceptSave);
+ fd.setFileMode(QFileDialog::AnyFile);
+
+ fd.show();
+ QApplication::setActiveWindow(&fd);
+ QTest::qWaitForWindowShown(&fd);
+ QTRY_COMPARE(fd.isVisible(), true);
+ QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget*>(&fd));
+
+ QTest::qWait(250);
+ QLineEdit *lineEdit = qFindChild<QLineEdit*>(&fd, "fileNameEdit");
+
+ QCOMPARE(tempPath + QChar('/') + lineEdit->text(), t->fileName());
+ QCOMPARE(tempPath + QChar('/') + lineEdit->selectedText(), t->fileName());
+}
+
+QTEST_MAIN(tst_QFiledialog)
+#include "tst_qfiledialog2.moc"
diff --git a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
index 3b2435206b..f2d9017733 100644
--- a/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
+++ b/tests/auto/qfilesystemmodel/tst_qfilesystemmodel.cpp
@@ -806,21 +806,13 @@ void tst_QFileSystemModel::sort()
myModel->d_func()->disableRecursiveSort = true;
QDir dir(QDir::tempPath());
- dir.mkdir("sortTemp");
- dir.cd("sortTemp");
+ //initialize the randomness
+ qsrand(QDateTime::currentDateTime().toTime_t());
+ QString tempName = QLatin1String("sortTemp.") + QString::number(qrand());
+ dir.mkdir(tempName);
+ dir.cd(tempName);
QTRY_VERIFY(dir.exists());
- //To be sure we clean the dir if it was there before
- QDirIterator it(dir.absolutePath(), QDir::NoDotAndDotDot);
- while(it.hasNext())
- {
- it.next();
- QFileInfo info = it.fileInfo();
- if (info.isDir())
- dir.rmdir(info.fileName());
- else
- QFile::remove(info.absoluteFilePath());
- }
const QString dirPath = dir.absolutePath();
QVERIFY(dir.exists());
@@ -882,11 +874,11 @@ void tst_QFileSystemModel::sort()
delete myModel;
dir.setPath(QDir::tempPath());
- dir.cd("sortTemp");
+ dir.cd(tempName);
tempFile.remove();
tempFile2.remove();
dir.cdUp();
- dir.rmdir("sortTemp");
+ dir.rmdir(tempName);
}
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 49b76aca29..0a6f60ed20 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -82,6 +82,14 @@ Q_DECLARE_METATYPE(QRectF)
#define Q_CHECK_PAINTEVENTS
#endif
+#if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
+// On mac (cocoa) we always get full update.
+// So check that the expected region is contained inside the actual
+#define COMPARE_REGIONS(ACTUAL, EXPECTED) QVERIFY((EXPECTED).subtracted(ACTUAL).isEmpty())
+#else
+#define COMPARE_REGIONS QTRY_COMPARE
+#endif
+
static void sendMousePress(QGraphicsScene *scene, const QPointF &point, Qt::MouseButton button = Qt::LeftButton)
{
QGraphicsSceneMouseEvent event(QEvent::GraphicsSceneMousePress);
@@ -6290,7 +6298,7 @@ void tst_QGraphicsItem::opacityZeroUpdates()
QRegion expectedRegion = parentDeviceBoundingRect.adjusted(-2, -2, 2, 2);
expectedRegion += childDeviceBoundingRect.adjusted(-2, -2, 2, 2);
- QTRY_COMPARE(view.paintedRegion, expectedRegion);
+ COMPARE_REGIONS(view.paintedRegion, expectedRegion);
}
class StacksBehindParentHelper : public QGraphicsRectItem
@@ -7117,7 +7125,7 @@ void tst_QGraphicsItem::update()
qApp->processEvents();
QCOMPARE(item->repaints, 1);
QCOMPARE(view.repaints, 1);
- QCOMPARE(view.paintedRegion, expectedRegion + expectedRegion.translated(50, 50));
+ COMPARE_REGIONS(view.paintedRegion, expectedRegion + expectedRegion.translated(50, 50));
// Make sure moving a parent item triggers an update on the children
// (even though the parent itself is outside the viewport).
@@ -7392,7 +7400,7 @@ void tst_QGraphicsItem::moveItem()
QRegion expectedParentRegion = parentDeviceBoundingRect; // old position
parentDeviceBoundingRect.translate(20, 20);
expectedParentRegion += parentDeviceBoundingRect; // new position
- QCOMPARE(view.paintedRegion, expectedParentRegion);
+ COMPARE_REGIONS(view.paintedRegion, expectedParentRegion);
RESET_COUNTERS
@@ -7402,7 +7410,7 @@ void tst_QGraphicsItem::moveItem()
QCOMPARE(child->repaints, 1);
QCOMPARE(view.repaints, 1);
const QRegion expectedChildRegion = expectedParentRegion.translated(20, 20);
- QCOMPARE(view.paintedRegion, expectedChildRegion);
+ COMPARE_REGIONS(view.paintedRegion, expectedChildRegion);
RESET_COUNTERS
@@ -7413,7 +7421,7 @@ void tst_QGraphicsItem::moveItem()
QCOMPARE(grandChild->repaints, 1);
QCOMPARE(view.repaints, 1);
const QRegion expectedGrandChildRegion = expectedParentRegion.translated(40, 40);
- QCOMPARE(view.paintedRegion, expectedGrandChildRegion);
+ COMPARE_REGIONS(view.paintedRegion, expectedGrandChildRegion);
RESET_COUNTERS
@@ -7426,7 +7434,7 @@ void tst_QGraphicsItem::moveItem()
expectedParentRegion.translate(20, 20);
expectedParentRegion += expectedChildRegion.translated(20, 20);
expectedParentRegion += expectedGrandChildRegion.translated(20, 20);
- QCOMPARE(view.paintedRegion, expectedParentRegion);
+ COMPARE_REGIONS(view.paintedRegion, expectedParentRegion);
}
void tst_QGraphicsItem::sorting_data()
diff --git a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
index 58d7896a8d..013a0282ef 100644
--- a/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
+++ b/tests/auto/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp
@@ -1532,7 +1532,7 @@ void tst_QGraphicsProxyWidget::setWidget_simple()
// Properties
// QCOMPARE(proxy.focusPolicy(), lineEdit->focusPolicy());
- QCOMPARE(proxy.palette(), lineEdit->palette());
+ // QCOMPARE(proxy.palette(), lineEdit->palette());
#ifndef QT_NO_CURSOR
QCOMPARE(proxy.cursor().shape(), lineEdit->cursor().shape());
#endif
diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
index 8acaa72eb5..389200b9aa 100644
--- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
+++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp
@@ -2210,9 +2210,11 @@ void tst_QGraphicsView::viewportUpdateMode()
// The view gets two updates for the update scene updates.
QTRY_VERIFY(!view.lastUpdateRegions.isEmpty());
+#ifndef QT_MAC_USE_COCOA //cocoa doesn't support drawing regions
QCOMPARE(view.lastUpdateRegions.last().rects().size(), 2);
QCOMPARE(view.lastUpdateRegions.last().rects().at(0).size(), QSize(15, 15));
QCOMPARE(view.lastUpdateRegions.last().rects().at(1).size(), QSize(15, 15));
+#endif
// Set full update mode.
view.setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
@@ -3431,10 +3433,12 @@ void tst_QGraphicsView::exposeRegion()
// Make sure it triggers correct repaint on the view.
QTRY_COMPARE(view.lastUpdateRegions.size(), 1);
- QTRY_COMPARE(view.lastUpdateRegions.at(0), expectedExposeRegion);
+ COMPARE_REGIONS(view.lastUpdateRegions.at(0), expectedExposeRegion);
// Make sure the item didn't get any repaints.
+#ifndef QT_MAC_USE_COCOA
QCOMPARE(item->paints, 0);
+#endif
}
void tst_QGraphicsView::update_data()
diff --git a/tests/auto/qheaderview/tst_qheaderview.cpp b/tests/auto/qheaderview/tst_qheaderview.cpp
index 920231d83d..3286768972 100644
--- a/tests/auto/qheaderview/tst_qheaderview.cpp
+++ b/tests/auto/qheaderview/tst_qheaderview.cpp
@@ -1836,7 +1836,7 @@ void tst_QHeaderView::preserveHiddenSectionWidth()
model.insertRow(1);
view.showSection(2);
QCOMPARE(view.sectionSize(0), 100);
- QCOMPARE(view.sectionSize(1), 30);
+ QCOMPARE(view.sectionSize(1), view.defaultSectionSize());
QCOMPARE(view.sectionSize(2), 50);
}
diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp
index eab5a35657..d75cfa7ede 100644
--- a/tests/auto/qtableview/tst_qtableview.cpp
+++ b/tests/auto/qtableview/tst_qtableview.cpp
@@ -193,6 +193,7 @@ private slots:
void mouseWheel();
void addColumnWhileEditing();
+ void task234926_setHeaderSorting();
};
// Testing get/set functions
@@ -2702,6 +2703,7 @@ void tst_QTableView::indexAt()
QtTestTableView view;
view.show();
+ QTest::qWaitForWindowShown(&view);
//some styles change the scroll mode in their polish
view.setHorizontalScrollMode(QAbstractItemView::ScrollPerItem);
@@ -2717,9 +2719,10 @@ void tst_QTableView::indexAt()
for (int c = 0; c < columnCount; ++c)
view.setColumnWidth(c, columnWidth);
- QTest::qWait(0); // ### needed to pass the test
+ QTest::qWait(20);
view.horizontalScrollBar()->setValue(horizontalScroll);
view.verticalScrollBar()->setValue(verticalScroll);
+ QTest::qWait(20);
QModelIndex index = view.indexAt(QPoint(x, y));
QCOMPARE(index.row(), expectedRow);
@@ -3249,9 +3252,15 @@ void tst_QTableView::resizeToContents()
}
+QT_BEGIN_NAMESPACE
+extern bool Q_GUI_EXPORT qt_tab_all_widgets; // qapplication.cpp
+QT_END_NAMESPACE
void tst_QTableView::tabFocus()
{
+ if (!qt_tab_all_widgets)
+ QSKIP("This test requires full keyboard control to be enabled.", SkipAll);
+
// QTableView enables tabKeyNavigation by default, but you should be able
// to change focus on an empty table view, or on a table view that doesn't
// have this property set.
@@ -3774,5 +3783,41 @@ void tst_QTableView::task191545_dragSelectRows()
}
}
+void tst_QTableView::task234926_setHeaderSorting()
+{
+ QStringListModel model;
+ QStringList data;
+ data << "orange" << "apple" << "banana" << "lemon" << "pumpkin";
+ QStringList sortedDataA = data;
+ QStringList sortedDataD = data;
+ qSort(sortedDataA);
+ qSort(sortedDataD.begin(), sortedDataD.end(), qGreater<QString>());
+ model.setStringList(data);
+ QTableView view;
+ view.setModel(&model);
+// view.show();
+ QTest::qWait(20);
+ QCOMPARE(model.stringList(), data);
+ view.setSortingEnabled(true);
+ view.sortByColumn(0, Qt::AscendingOrder);
+ QApplication::processEvents();
+ QCOMPARE(model.stringList() , sortedDataA);
+
+ view.horizontalHeader()->setSortIndicator(0, Qt::DescendingOrder);
+ QApplication::processEvents();
+ QCOMPARE(model.stringList() , sortedDataD);
+
+ QHeaderView *h = new QHeaderView(Qt::Horizontal);
+ h->setModel(&model);
+ view.setHorizontalHeader(h);
+ h->setSortIndicator(0, Qt::AscendingOrder);
+ QApplication::processEvents();
+ QCOMPARE(model.stringList() , sortedDataA);
+
+ h->setSortIndicator(0, Qt::DescendingOrder);
+ QApplication::processEvents();
+ QCOMPARE(model.stringList() , sortedDataD);
+}
+
QTEST_MAIN(tst_QTableView)
#include "tst_qtableview.moc"
diff --git a/tests/auto/qtablewidget/tst_qtablewidget.cpp b/tests/auto/qtablewidget/tst_qtablewidget.cpp
index 5aa2d1d491..b85851f2b5 100644
--- a/tests/auto/qtablewidget/tst_qtablewidget.cpp
+++ b/tests/auto/qtablewidget/tst_qtablewidget.cpp
@@ -102,6 +102,7 @@ private slots:
void cellWidget();
void task231094();
void task219380_removeLastRow();
+ void task262056_sortDuplicate();
private:
QTableWidget *testWidget;
@@ -1474,6 +1475,26 @@ void tst_QTableWidget::task219380_removeLastRow()
QCOMPARE(testWidget->cellWidget(18, 0)->geometry(), testWidget->visualItemRect(&item));
}
+void tst_QTableWidget::task262056_sortDuplicate()
+{
+ testWidget->setColumnCount(2);
+ testWidget->setRowCount(8);
+ testWidget->setSortingEnabled(true);
+ QStringList items = (QStringList() << "AAA" << "BBB" << "CCC" << "CCC" << "DDD"\
+ << "EEE" << "FFF" << "GGG");
+ for (int i = 0; i<8; i++ ) {
+ QTableWidgetItem *twi = new QTableWidgetItem(items.at(i));
+ testWidget->setItem(i,0,twi);
+ testWidget->setItem(i,1,new QTableWidgetItem(QString("item %1").arg(i)));
+ }
+ testWidget->sortItems(0, Qt::AscendingOrder);
+ QSignalSpy layoutChangedSpy(testWidget->model(), SIGNAL(layoutChanged()));
+ testWidget->item(3,0)->setBackgroundColor(Qt::red);
+
+ QCOMPARE(layoutChangedSpy.count(),0);
+
+}
+
QTEST_MAIN(tst_QTableWidget)
#include "tst_qtablewidget.moc"
diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp
index 11c4543da0..6defd7bcd0 100644
--- a/tests/auto/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp
@@ -49,6 +49,9 @@
#include <qheaderview.h>
#include <qlineedit.h>
#include <QScrollBar>
+#include <QStyledItemDelegate>
+
+#include "../../shared/util.h"
//TESTED_CLASS=
@@ -163,6 +166,7 @@ private slots:
void task217309();
void setCurrentItemExpandsParent();
void task239150_editorWidth();
+ void setTextUpdate();
public slots:
void itemSelectionChanged();
@@ -3233,6 +3237,41 @@ void tst_QTreeWidget::task239150_editorWidth()
+void tst_QTreeWidget::setTextUpdate()
+{
+ QTreeWidget treeWidget;
+ treeWidget.setColumnCount(2);
+
+ class MyItemDelegate : public QStyledItemDelegate
+ {
+ public:
+ MyItemDelegate() : numPaints(0) { }
+ void paint(QPainter *painter,
+ const QStyleOptionViewItem &option, const QModelIndex &index) const
+ {
+ numPaints++;
+ QStyledItemDelegate::paint(painter, option, index);
+ }
+
+ mutable int numPaints;
+ } delegate;
+
+ treeWidget.setItemDelegate(&delegate);
+ treeWidget.show();
+ QStringList strList;
+ strList << "variable1" << "0";
+ QTreeWidgetItem *item = new QTreeWidgetItem(strList);
+ treeWidget.insertTopLevelItem(0, item);
+ QTest::qWait(50);
+ QTRY_VERIFY(delegate.numPaints > 0);
+ delegate.numPaints = 0;
+
+ item->setText(1, "42");
+ QApplication::processEvents();
+ QTRY_VERIFY(delegate.numPaints > 0);
+}
+
+
QTEST_MAIN(tst_QTreeWidget)
#include "tst_qtreewidget.moc"
diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp
index 026c30ede5..72c13bf3d9 100644
--- a/tests/auto/qurl/tst_qurl.cpp
+++ b/tests/auto/qurl/tst_qurl.cpp
@@ -137,6 +137,7 @@ private slots:
void ipv6();
void ipv6_2_data();
void ipv6_2();
+ void moreIpv6();
void toPercentEncoding_data();
void toPercentEncoding();
void isRelative_data();
@@ -2276,6 +2277,13 @@ void tst_QUrl::ipv6_2()
QCOMPARE(url.toString(), output);
}
+void tst_QUrl::moreIpv6()
+{
+ QUrl waba1("http://www.kde.org/cgi/test.cgi");
+ waba1.setHost("::ffff:129.144.52.38");
+ QCOMPARE(QString::fromLatin1(waba1.toEncoded()), QString::fromLatin1("http://[::ffff:129.144.52.38]/cgi/test.cgi"));
+}
+
void tst_QUrl::punycode_data()
{
QTest::addColumn<QString>("original");
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 055de517f3..758821bdbb 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -4668,9 +4668,6 @@ void tst_QWidget::update()
QCOMPARE(child.paintedRegion, child.visibleRegion());
QCOMPARE(w.numPaintEvents, 1);
QCOMPARE(w.visibleRegion(), QRegion(w.rect()));
-#ifdef QT_MAC_USE_COCOA
- QEXPECT_FAIL(0, "Cocoa compositor paints the content view", Continue);
-#endif
QCOMPARE(w.paintedRegion, child.visibleRegion().translated(childOffset));
w.reset();
@@ -5280,15 +5277,6 @@ void tst_QWidget::windowMoveResize()
// now hide
widget.hide();
QTest::qWait(10);
-#if defined (Q_WS_MAC) && defined(QT_MAC_USE_COCOA)
- QEXPECT_FAIL("130,100 0x200, flags 800",
- "Cocoa's Delegate sends a spurios move event when the window has a width of zero and non-zero height",
- Abort);
-
- QEXPECT_FAIL("130,100 0x200, flags 0",
- "Cocoa's Delegate sends a spurios move event when the window has a width of zero and non-zero height",
- Abort);
-#endif
QTRY_COMPARE(widget.pos(), rect.topLeft());
QTRY_COMPARE(widget.size(), rect.size());
@@ -7610,8 +7598,8 @@ void tst_QWidget::updateWhileMinimized()
UpdateWidget widget;
// Filter out activation change and focus events to avoid update() calls in QWidget.
widget.updateOnActivationChangeAndFocusIn = false;
- widget.show();
widget.reset();
+ widget.show();
QTest::qWaitForWindowShown(&widget);
QApplication::processEvents();
QTRY_VERIFY(widget.numPaintEvents > 0);
@@ -9411,7 +9399,8 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779()
QPixmap correct(main.size());
correct.fill(Qt::green);
- QTRY_COMPARE(QPixmap::grabWindow(main.winId()).toImage(), correct.toImage());
+ QTRY_COMPARE(QPixmap::grabWindow(main.winId()).toImage().convertToFormat(QImage::Format_RGB32),
+ correct.toImage().convertToFormat(QImage::Format_RGB32));
QApplication::restoreOverrideCursor();
}
diff --git a/translations/designer_pl.ts b/translations/designer_pl.ts
index 001b54a80b..0c196d891e 100644
--- a/translations/designer_pl.ts
+++ b/translations/designer_pl.ts
@@ -4709,7 +4709,7 @@ Czy chcesz nadpisać szablon?</translation>
<message>
<location line="+1"/>
<source>The file &quot;%1&quot; has changed outside Designer. Do you want to reload it?</source>
- <translation>Plik &quot;%1&quot; zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować?</translation>
+ <translation type="unfinished">Plik &quot;%1&quot; zmienił się na zewnątrz Designera. Czy chcesz go ponownie załadować?</translation>
</message>
</context>
<context>
diff --git a/translations/linguist_pl.ts b/translations/linguist_pl.ts
index 93b3a1d814..b59ebc34ff 100644
--- a/translations/linguist_pl.ts
+++ b/translations/linguist_pl.ts
@@ -1511,32 +1511,32 @@ Wszystkie pliki (*)</translation>
<message>
<location line="+30"/>
<source>Russian</source>
- <translation>Rosyjskie</translation>
+ <translation>rosyjski</translation>
</message>
<message>
<location line="+1"/>
<source>German</source>
- <translation>Niemieckie</translation>
+ <translation>niemiecki</translation>
</message>
<message>
<location line="+1"/>
<source>Japanese</source>
- <translation>Japońskie</translation>
+ <translation>japoński</translation>
</message>
<message>
<location line="+1"/>
<source>French</source>
- <translation>Francuskie</translation>
+ <translation>francuski</translation>
</message>
<message>
<location line="+1"/>
<source>Polish</source>
- <translation>Polskie</translation>
+ <translation>polski</translation>
</message>
<message>
<location line="+1"/>
<source>Chinese</source>
- <translation>Chińskie</translation>
+ <translation>chiński</translation>
</message>
<message>
<location line="+53"/>
@@ -1581,7 +1581,7 @@ Wszystkie pliki (*)</translation>
<message>
<location line="+232"/>
<source>%1 translation (%2)</source>
- <translation>%1 tłumaczenie (%2)</translation>
+ <translation>Tłumaczenie na język %1 (%2)</translation>
</message>
<message>
<location line="+9"/>
@@ -1591,7 +1591,7 @@ Wszystkie pliki (*)</translation>
<message>
<location line="+5"/>
<source>%1 translation</source>
- <translation>%1 tłumaczenie</translation>
+ <translation>Tłumaczenie na język %1</translation>
</message>
<message>
<location line="+1"/>
diff --git a/translations/qt_pl.ts b/translations/qt_pl.ts
index 8afb4850cf..424fd31149 100644
--- a/translations/qt_pl.ts
+++ b/translations/qt_pl.ts
@@ -8513,12 +8513,12 @@ Proszę wybrać inną nazwę pliku.</translation>
<location line="+5"/>
<location line="+24"/>
<source>Circular inheritance of base type %1.</source>
- <translation>Zapętlenie w dziedziczeniu podstawowego typu %1.</translation>
+ <translation>Cykliczne dziedziczenie podstawowego typu %1.</translation>
</message>
<message>
<location line="+11"/>
<source>Circular inheritance of union %1.</source>
- <translation>Zapętlenie w dziedziczeniu unii %1.</translation>
+ <translation>Cykliczne dziedziczenie unii %1.</translation>
</message>
<message>
<location line="+25"/>
@@ -9143,7 +9143,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+7"/>
<source>Fixed value constraint of element %1 differs from value constraint in base particle.</source>
- <translation>Ostateczne ograniczenie wartości elementu %1 różni się od ograniczenia wartości w podstawowym elemencie.</translation>
+ <translation>Ograniczenie stałej wartości elementu %1 różni się od ograniczenia wartości w podstawowym elemencie.</translation>
</message>
<message>
<location line="+7"/>
@@ -9793,7 +9793,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+6"/>
<source>Fixed value constrained not allowed if element is nillable.</source>
- <translation>Ograniczenie sztywnej wartości jest niedozwolone gdy element jest zerowalny.</translation>
+ <translation>Ograniczenie stałej wartości jest niedozwolone gdy element jest zerowalny.</translation>
</message>
<message>
<location line="+32"/>
@@ -9842,7 +9842,7 @@ Proszę wybrać inną nazwę pliku.</translation>
<message>
<location line="+18"/>
<source>Element %1 can not contain other elements, as it has a fixed content.</source>
- <translation>Element %1 nie może zawierać innych elementów ponieważ posiada on sztywną zawartość.</translation>
+ <translation>Element %1 nie może zawierać innych elementów ponieważ posiada on stałą zawartość.</translation>
</message>
<message>
<location line="+43"/>