summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Boddie <david.boddie@nokia.com>2010-12-14 13:01:13 (GMT)
committerDavid Boddie <david.boddie@nokia.com>2010-12-14 13:01:13 (GMT)
commit086a010a63895c6e6d178c1de9434483f11b2d34 (patch)
treebb2542f04438b42ae5c61b1c3a6330f011700474 /src/gui
parent0fe36ac832abf8f8d438b21fce0177b65b3bbf3a (diff)
parent5cb2226ddf96555417f08c9bfe35addfc93f6acd (diff)
downloadQt-086a010a63895c6e6d178c1de9434483f11b2d34.zip
Qt-086a010a63895c6e6d178c1de9434483f11b2d34.tar.gz
Qt-086a010a63895c6e6d178c1de9434483f11b2d34.tar.bz2
Merge branch 'qdoc-simplified' into mimir-simplified
Conflicts: tools/qdoc3/atom.h tools/qdoc3/qdoc3.pro
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/egl/qegl_x11.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp4
-rw-r--r--src/gui/image/qpnghandler.cpp81
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp9
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h3
-rw-r--r--src/gui/text/qtextcursor.cpp3
-rw-r--r--src/gui/widgets/qdockwidget.cpp17
7 files changed, 78 insertions, 43 deletions
diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp
index 15cc109..29415ed 100644
--- a/src/gui/egl/qegl_x11.cpp
+++ b/src/gui/egl/qegl_x11.cpp
@@ -165,8 +165,10 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config)
if (chosenVisualInfo) {
// Skip size checks if implementation supports non-matching visual
// and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444).
- if (QEgl::hasExtension("EGL_NV_post_convert_rounding"))
+ if (QEgl::hasExtension("EGL_NV_post_convert_rounding")) {
+ XFree(chosenVisualInfo);
return visualId;
+ }
int visualRedSize = countBits(chosenVisualInfo->red_mask);
int visualGreenSize = countBits(chosenVisualInfo->green_mask);
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index 539826b..1d1d257 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -56,9 +56,7 @@
Items that are anchored are automatically added to the layout, and if items
are removed, all their anchors will be automatically removed.
- \beginfloatleft
- \inlineimage simpleanchorlayout-example.png Using an anchor layout to align simple colored widgets.
- \endfloat
+ \figureleft{simpleanchorlayout-example.png}{Using an anchor layout to align simple colored widgets.}
Anchors are always set up between edges of an item, where the "center" is also considered to
be an edge. Consider the following example:
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 935aba0..1a78bae 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -82,6 +82,41 @@ QT_BEGIN_NAMESPACE
Never to grayscale.
*/
+class QPngHandlerPrivate
+{
+public:
+ enum State {
+ Ready,
+ ReadHeader,
+ ReadingEnd,
+ Error
+ };
+
+ QPngHandlerPrivate(QPngHandler *qq)
+ : gamma(0.0), quality(2), png_ptr(0), info_ptr(0),
+ end_info(0), row_pointers(0), state(Ready), q(qq)
+ { }
+
+ float gamma;
+ int quality;
+ QString description;
+
+ png_struct *png_ptr;
+ png_info *info_ptr;
+ png_info *end_info;
+ png_byte **row_pointers;
+
+ bool readPngHeader();
+ bool readPngImage(QImage *image);
+
+ QImage::Format readImageFormat();
+
+ State state;
+
+ QPngHandler *q;
+};
+
+
#if defined(Q_C_CALLBACKS)
extern "C" {
#endif
@@ -118,7 +153,16 @@ private:
static
void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
- QIODevice *in = (QIODevice *)png_get_io_ptr(png_ptr);
+ QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr);
+ QIODevice *in = d->q->device();
+
+ if (d->state == QPngHandlerPrivate::ReadingEnd && !in->isSequential() && (in->size() - in->pos()) < 4 && length == 4) {
+ // Workaround for certain malformed PNGs that lack the final crc bytes
+ uchar endcrc[4] = { 0xae, 0x42, 0x60, 0x82 };
+ qMemCopy(data, endcrc, 4);
+ in->seek(in->size());
+ return;
+ }
while (length) {
int nr = in->read((char*)data, length);
@@ -314,38 +358,6 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const
}
#endif
-class QPngHandlerPrivate
-{
-public:
- enum State {
- Ready,
- ReadHeader,
- Error
- };
-
- QPngHandlerPrivate(QPngHandler *qq)
- : gamma(0.0), quality(2), png_ptr(0), info_ptr(0),
- end_info(0), row_pointers(0), state(Ready), q(qq)
- { }
-
- float gamma;
- int quality;
- QString description;
-
- png_struct *png_ptr;
- png_info *info_ptr;
- png_info *end_info;
- png_byte **row_pointers;
-
- bool readPngHeader();
- bool readPngImage(QImage *image);
-
- QImage::Format readImageFormat();
-
- State state;
-
- QPngHandler *q;
-};
/*!
\internal
@@ -379,7 +391,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader()
return false;
}
- png_set_read_fn(png_ptr, q->device(), iod_read_fn);
+ png_set_read_fn(png_ptr, this, iod_read_fn);
png_read_info(png_ptr, info_ptr);
#ifndef QT_NO_IMAGE_TEXT
@@ -505,6 +517,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage)
}
#endif
+ state = ReadingEnd;
png_read_end(png_ptr, end_info);
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info);
delete [] row_pointers;
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index 0510b10..714d5de 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -268,6 +268,15 @@ void QEmulationPaintEngine::setState(QPainterState *s)
real_engine->setState(s);
}
+void QEmulationPaintEngine::beginNativePainting()
+{
+ real_engine->beginNativePainting();
+}
+
+void QEmulationPaintEngine::endNativePainting()
+{
+ real_engine->endNativePainting();
+}
void QEmulationPaintEngine::fillBGRect(const QRectF &r)
{
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index 5835f10..e283645 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -93,6 +93,9 @@ public:
virtual void setState(QPainterState *s);
+ virtual void beginNativePainting();
+ virtual void endNativePainting();
+
virtual uint flags() const {return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate;}
inline QPainterState *state() { return (QPainterState *)QPaintEngine::state; }
diff --git a/src/gui/text/qtextcursor.cpp b/src/gui/text/qtextcursor.cpp
index 769ab2f..f73cc4b 100644
--- a/src/gui/text/qtextcursor.cpp
+++ b/src/gui/text/qtextcursor.cpp
@@ -363,6 +363,9 @@ bool QTextCursorPrivate::movePosition(QTextCursor::MoveOperation op, QTextCursor
bool adjustX = true;
QTextBlock blockIt = block();
+ if (!blockIt.isValid())
+ return false;
+
if (op >= QTextCursor::Left && op <= QTextCursor::WordRight
&& blockIt.textDirection() == Qt::RightToLeft) {
if (op == QTextCursor::Left)
diff --git a/src/gui/widgets/qdockwidget.cpp b/src/gui/widgets/qdockwidget.cpp
index df9b171..0a6269d 100644
--- a/src/gui/widgets/qdockwidget.cpp
+++ b/src/gui/widgets/qdockwidget.cpp
@@ -1531,8 +1531,11 @@ QAction * QDockWidget::toggleViewAction() const
/*!
\since 4.3
+
Sets an arbitrary \a widget as the dock widget's title bar. If \a widget
- is 0, the title bar widget is removed, but not deleted.
+ is 0, any custom title bar widget previously set on the dock widget is
+ removed, but not deleted, and the default title bar will be used
+ instead.
If a title bar widget is set, QDockWidget will not use native window
decorations when it is floated.
@@ -1540,23 +1543,27 @@ QAction * QDockWidget::toggleViewAction() const
Here are some tips for implementing custom title bars:
\list
- \i Mouse events that are not explicitly handled by the title bar widget
+ \o Mouse events that are not explicitly handled by the title bar widget
must be ignored by calling QMouseEvent::ignore(). These events then
propagate to the QDockWidget parent, which handles them in the usual
manner, moving when the title bar is dragged, docking and undocking
when it is double-clicked, etc.
- \i When DockWidgetVerticalTitleBar is set on QDockWidget, the title
+ \o When DockWidgetVerticalTitleBar is set on QDockWidget, the title
bar widget is repositioned accordingly. In resizeEvent(), the title
bar should check what orientation it should assume:
\snippet doc/src/snippets/code/src_gui_widgets_qdockwidget.cpp 0
- \i The title bar widget must have a valid QWidget::sizeHint() and
+ \o The title bar widget must have a valid QWidget::sizeHint() and
QWidget::minimumSizeHint(). These functions should take into account
the current orientation of the title bar.
+
+ \o It is not possible to remove a title bar from a dock widget. However,
+ a similar effect can be achieved by setting a default constructed
+ QWidget as the title bar widget.
\endlist
- Using qobject_cast as shown above, the title bar widget has full access
+ Using qobject_cast() as shown above, the title bar widget has full access
to its parent QDockWidget. Hence it can perform such operations as docking
and hiding in response to user actions.