summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp2
-rw-r--r--src/gui/image/qjpeghandler.cpp1
-rw-r--r--src/gui/kernel/qevent.cpp10
-rw-r--r--src/gui/kernel/qguiapplication.cpp12
-rw-r--r--src/gui/kernel/qopenglcontext.cpp9
-rw-r--r--src/gui/kernel/qplatformtheme.h1
-rw-r--r--src/gui/kernel/qsurfaceformat.cpp12
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp477
-rw-r--r--src/gui/opengl/qopenglshaderprogram.cpp6
-rw-r--r--src/gui/opengl/qopengltextureblitter.cpp14
-rw-r--r--src/gui/opengl/qopengltextureglyphcache.cpp12
-rw-r--r--src/gui/painting/painting.pri4
-rw-r--r--src/gui/painting/qdrawhelper.cpp83
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp7
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h3
-rw-r--r--src/gui/painting/qpagedpaintdevice.cpp273
-rw-r--r--src/gui/painting/qpagedpaintdevice.h160
-rw-r--r--src/gui/painting/qpagedpaintdevice_p.h10
-rw-r--r--src/gui/painting/qpagelayout.cpp971
-rw-r--r--src/gui/painting/qpagelayout.h155
-rw-r--r--src/gui/painting/qpagesize.cpp1882
-rw-r--r--src/gui/painting/qpagesize.h311
-rw-r--r--src/gui/painting/qpaintengine_blitter.cpp3
-rw-r--r--src/gui/painting/qpainter.cpp2
-rw-r--r--src/gui/painting/qpdf.cpp104
-rw-r--r--src/gui/painting/qpdf_p.h39
-rw-r--r--src/gui/painting/qpdfwriter.cpp231
-rw-r--r--src/gui/painting/qpdfwriter.h12
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp40
-rw-r--r--src/gui/painting/qregion.cpp2
-rw-r--r--src/gui/text/qcssparser_p.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp91
-rw-r--r--src/gui/text/qfontengine_ft.cpp9
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp32
-rw-r--r--src/gui/text/qplatformfontdatabase.h2
-rw-r--r--src/gui/text/qstatictext.cpp3
-rw-r--r--src/gui/text/qtextengine.cpp4
-rw-r--r--src/gui/text/text.pri2
38 files changed, 4474 insertions, 519 deletions
diff --git a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
index 6a012879d4..144858816b 100644
--- a/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
+++ b/src/gui/doc/snippets/code/src_gui_painting_qpainter.cpp
@@ -207,7 +207,7 @@ QRectF source(0.0, 0.0, 70.0, 40.0);
QPixmap pixmap(":myPixmap.png");
QPainter(this);
-painter.drawPixmap(target, image, source);
+painter.drawPixmap(target, pixmap, source);
//! [16]
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index 22d82ba894..dfacf34097 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -856,7 +856,6 @@ bool QJpegHandlerPrivate::read(QImage *image)
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_neon(quint32 *dst, const uchar *src, int len);
Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_ssse3(quint32 *dst, const uchar *src, int len);
-Q_GUI_EXPORT void QT_FASTCALL qt_convert_rgb888_to_rgb32_avx(quint32 *dst, const uchar *src, int len);
extern "C" void qt_convert_rgb888_to_rgb32_mips_dspr2_asm(quint32 *dst, const uchar *src, int len);
QJpegHandler::QJpegHandler()
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index 295380a93c..92d9871dc5 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -4361,13 +4361,13 @@ void QTouchEvent::TouchPoint::setFlags(InfoFlags flags)
\ingroup events
\inmodule QtGui
- \brief The QScrollPrepareEvent class is send in preparation of a scrolling.
+ \brief The QScrollPrepareEvent class is sent in preparation of scrolling.
- The scroll prepare event is send before scrolling (usually by QScroller) is started.
+ The scroll prepare event is sent before scrolling (usually by QScroller) is started.
The object receiving this event should set viewportSize, maxContentPos and contentPos.
It also should accept this event to indicate that scrolling should be started.
- It is not guaranteed that a QScrollEvent will be send after an acceepted
+ It is not guaranteed that a QScrollEvent will be sent after an acceepted
QScrollPrepareEvent, e.g. in a case where the maximum content position is (0,0).
\sa QScrollEvent, QScroller
@@ -4462,9 +4462,9 @@ void QScrollPrepareEvent::setContentPos(const QPointF &pos)
\ingroup events
\inmodule QtGui
- \brief The QScrollEvent class is send when scrolling.
+ \brief The QScrollEvent class is sent when scrolling.
- The scroll event is send to indicate that the receiver should be scrolled.
+ The scroll event is sent to indicate that the receiver should be scrolled.
Usually the receiver should be something visual like QWidget or QGraphicsObject.
Some care should be taken that no conflicting QScrollEvents are sent from two
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index c6376b2647..a19eebfb7c 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2294,6 +2294,18 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (w->d_func()->blockedByModalWindow) {
// a modal window is blocking this window, don't allow touch events through
+
+ // QTBUG-37371 temporary fix; TODO: revisit in 5.4 when we have a forwarding solution
+ if (eventType == QEvent::TouchEnd) {
+ // but don't leave dangling state: e.g.
+ // QQuickWindowPrivate::itemForTouchPointId needs to be cleared.
+ QTouchEvent touchEvent(QEvent::TouchCancel,
+ e->device,
+ e->modifiers);
+ touchEvent.setTimestamp(e->timestamp);
+ touchEvent.setWindow(w);
+ QGuiApplication::sendSpontaneousEvent(w, &touchEvent);
+ }
continue;
}
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index fb7d15c160..5087e33b47 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -247,8 +247,8 @@ QMutex QOpenGLContextPrivate::makeCurrentTrackerMutex;
To set up a context, set its screen and format such that they match those
of the surface or surfaces with which the context is meant to be used, if
necessary make it share resources with other contexts with
- setShareContext(), and finally call create(). Use isValid() to check if the
- context was successfully initialized.
+ setShareContext(), and finally call create(). Use the return value or isValid()
+ to check if the context was successfully initialized.
A context can be made current against a given surface by calling
makeCurrent(). When OpenGL rendering is done, call swapBuffers() to swap
@@ -491,7 +491,7 @@ bool QOpenGLContext::create()
d->shareContext = 0;
d->shareGroup = d->shareContext ? d->shareContext->shareGroup() : new QOpenGLContextGroup;
d->shareGroup->d_func()->addContext(this);
- return d->platformGLContext;
+ return isValid();
}
/*!
@@ -578,6 +578,9 @@ bool QOpenGLContext::isValid() const
without having to manage it manually.
The context or a sharing context must be current.
+
+ The returned QOpenGLFunctions instance is ready to be used and it
+ does not need initializeOpenGLFunctions() to be called.
*/
QOpenGLFunctions *QOpenGLContext::functions() const
{
diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h
index 073eda8d07..a2d14be0fb 100644
--- a/src/gui/kernel/qplatformtheme.h
+++ b/src/gui/kernel/qplatformtheme.h
@@ -130,6 +130,7 @@ public:
ComboBoxPalette,
ItemViewPalette,
MessageBoxLabelPelette,
+ MessageBoxLabelPalette = MessageBoxLabelPelette,
TabBarPalette,
LabelPalette,
GroupBoxPalette,
diff --git a/src/gui/kernel/qsurfaceformat.cpp b/src/gui/kernel/qsurfaceformat.cpp
index 2b6cb2d949..23c0e59779 100644
--- a/src/gui/kernel/qsurfaceformat.cpp
+++ b/src/gui/kernel/qsurfaceformat.cpp
@@ -522,6 +522,10 @@ int QSurfaceFormat::alphaBufferSize() const
/*!
Set the desired \a size in bits of the red channel of the color buffer.
+
+ \note On Mac OSX, be sure to set the buffer size of all color channels,
+ otherwise this setting will have no effect. If one of the buffer sizes is not set,
+ the current bit-depth of the screen is used.
*/
void QSurfaceFormat::setRedBufferSize(int size)
{
@@ -533,6 +537,10 @@ void QSurfaceFormat::setRedBufferSize(int size)
/*!
Set the desired \a size in bits of the green channel of the color buffer.
+
+ \note On Mac OSX, be sure to set the buffer size of all color channels,
+ otherwise this setting will have no effect. If one of the buffer sizes is not set,
+ the current bit-depth of the screen is used.
*/
void QSurfaceFormat::setGreenBufferSize(int size)
{
@@ -544,6 +552,10 @@ void QSurfaceFormat::setGreenBufferSize(int size)
/*!
Set the desired \a size in bits of the blue channel of the color buffer.
+
+ \note On Mac OSX, be sure to set the buffer size of all color channels,
+ otherwise this setting will have no effect. If one of the buffer sizes is not set,
+ the current bit-depth of the screen is used.
*/
void QSurfaceFormat::setBlueBufferSize(int size)
{
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index 84c70606b1..ef0ef6d103 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -51,12 +51,12 @@ QT_BEGIN_NAMESPACE
/*!
\class QOpenGLFunctions
- \brief The QOpenGLFunctions class provides cross-platform access to the OpenGL/ES 2.0 API.
+ \brief The QOpenGLFunctions class provides cross-platform access to the OpenGL ES 2.0 API.
\since 5.0
\ingroup painting-3D
\inmodule QtGui
- OpenGL/ES 2.0 defines a subset of the OpenGL specification that is
+ OpenGL ES 2.0 defines a subset of the OpenGL specification that is
common across many desktop and embedded OpenGL implementations.
However, it can be difficult to use the functions from that subset
because they need to be resolved manually on desktop systems.
@@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE
}
\endcode
- The \c{paintGL()} function can then use any of the OpenGL/ES 2.0
+ The \c{paintGL()} function can then use any of the OpenGL ES 2.0
functions without explicit resolution, such as glActiveTexture()
in the following example:
@@ -119,14 +119,14 @@ QT_BEGIN_NAMESPACE
\endcode
QOpenGLFunctions can also be used directly for ad-hoc invocation
- of OpenGL/ES 2.0 functions on all platforms:
+ of OpenGL ES 2.0 functions on all platforms:
\code
QOpenGLFunctions glFuncs(QOpenGLContext::currentContext());
glFuncs.glActiveTexture(GL_TEXTURE1);
\endcode
- QOpenGLFunctions provides wrappers for all OpenGL/ES 2.0
+ QOpenGLFunctions provides wrappers for all OpenGL ES 2.0
functions, including the common subset of OpenGL 1.x and ES
2.0. While such functions, for example glClear() or
glDrawArrays(), can be called also directly, as long as the
@@ -135,7 +135,7 @@ QT_BEGIN_NAMESPACE
loading the OpenGL implementation.
The hasOpenGLFeature() and openGLFeatures() functions can be used
- to determine if the OpenGL implementation has a major OpenGL/ES 2.0
+ to determine if the OpenGL implementation has a major OpenGL ES 2.0
feature. For example, the following checks if non power of two
textures are available:
@@ -359,10 +359,37 @@ static int qt_gl_resolve_extensions()
{
int extensions = 0;
QOpenGLExtensionMatcher extensionMatcher;
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ QSurfaceFormat format = ctx->format();
+
if (extensionMatcher.match("GL_EXT_bgra"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
-
- if (QOpenGLContext::currentContext()->isES()) {
+ if (extensionMatcher.match("GL_ARB_texture_rectangle"))
+ extensions |= QOpenGLExtensions::TextureRectangle;
+ if (extensionMatcher.match("GL_SGIS_generate_mipmap"))
+ extensions |= QOpenGLExtensions::GenerateMipmap;
+ if (extensionMatcher.match("GL_ARB_texture_compression"))
+ extensions |= QOpenGLExtensions::TextureCompression;
+ if (extensionMatcher.match("GL_EXT_texture_compression_s3tc"))
+ extensions |= QOpenGLExtensions::DDSTextureCompression;
+ if (extensionMatcher.match("GL_OES_compressed_ETC1_RGB8_texture"))
+ extensions |= QOpenGLExtensions::ETC1TextureCompression;
+ if (extensionMatcher.match("GL_IMG_texture_compression_pvrtc"))
+ extensions |= QOpenGLExtensions::PVRTCTextureCompression;
+ if (extensionMatcher.match("GL_ARB_texture_mirrored_repeat"))
+ extensions |= QOpenGLExtensions::MirroredRepeat;
+ if (extensionMatcher.match("GL_EXT_stencil_two_side"))
+ extensions |= QOpenGLExtensions::StencilTwoSide;
+ if (extensionMatcher.match("GL_EXT_stencil_wrap"))
+ extensions |= QOpenGLExtensions::StencilWrap;
+ if (extensionMatcher.match("GL_NV_float_buffer"))
+ extensions |= QOpenGLExtensions::NVFloatBuffer;
+ if (extensionMatcher.match("GL_ARB_pixel_buffer_object"))
+ extensions |= QOpenGLExtensions::PixelBufferObject;
+
+ if (ctx->isES()) {
+ if (format.majorVersion() >= 2)
+ extensions |= QOpenGLExtensions::GenerateMipmap;
if (extensionMatcher.match("GL_OES_mapbuffer"))
extensions |= QOpenGLExtensions::MapBuffer;
if (extensionMatcher.match("GL_OES_packed_depth_stencil"))
@@ -375,7 +402,6 @@ static int qt_gl_resolve_extensions()
if (extensionMatcher.match("GL_IMG_texture_format_BGRA8888") || extensionMatcher.match("GL_EXT_texture_format_BGRA8888"))
extensions |= QOpenGLExtensions::BGRATextureFormat;
} else {
- QSurfaceFormat format = QOpenGLContext::currentContext()->format();
extensions |= QOpenGLExtensions::ElementIndexUint | QOpenGLExtensions::MapBuffer;
// Recognize features by extension name.
@@ -394,6 +420,19 @@ static int qt_gl_resolve_extensions()
extensions |= QOpenGLExtensions::PackedDepthStencil;
}
}
+
+ if (format.renderableType() == QSurfaceFormat::OpenGL && format.version() >= qMakePair(3, 2))
+ extensions |= QOpenGLExtensions::GeometryShaders;
+
+#ifndef QT_OPENGL_ES
+ if (extensionMatcher.match("GL_EXT_framebuffer_sRGB")) {
+ GLboolean srgbCapableFramebuffers = false;
+ ctx->functions()->glGetBooleanv(GL_FRAMEBUFFER_SRGB_CAPABLE_EXT, &srgbCapableFramebuffers);
+ if (srgbCapableFramebuffers)
+ extensions |= QOpenGLExtensions::SRGBFrameBuffer;
+ }
+#endif
+
return extensions;
}
@@ -498,7 +537,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindTexture(\a target, \a texture).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBindTexture.xml}{glBindTexture()}.
\since 5.3
@@ -509,7 +548,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendFunc(\a sfactor, \a dfactor).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFunc.xml}{glBlendFunc()}.
\since 5.3
@@ -520,7 +559,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glClear(\a mask).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glClear.xml}{glClear()}.
\since 5.3
@@ -531,7 +570,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glClearColor(\a red, \a green, \a blue, \a alpha).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glClearColor.xml}{glClearColor()}.
\since 5.3
@@ -542,7 +581,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glClearStencil(\a s).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glClearStencil.xml}{glClearStencil()}.
\since 5.3
@@ -553,7 +592,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glColorMask(\a red, \a green, \a blue, \a alpha).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glColorMask.xml}{glColorMask()}.
\since 5.3
@@ -564,7 +603,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCopyTexImage2D(\a target, \a level, \a internalformat, \a x, \a y, \a width, \a height, \a border).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCopyTexImage2D.xml}{glCopyTexImage2D()}.
\since 5.3
@@ -575,7 +614,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCopyTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a x, \a y, \a width, \a height).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCopyTexSubImage2D.xml}{glCopyTexSubImage2D()}.
\since 5.3
@@ -586,7 +625,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCullFace(\a mode).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCullFace.xml}{glCullFace()}.
\since 5.3
@@ -597,7 +636,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteTextures(\a n, \a textures).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteTextures.xml}{glDeleteTextures()}.
\since 5.3
@@ -608,7 +647,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDepthFunc(\a func).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDepthFunc.xml}{glDepthFunc()}.
\since 5.3
@@ -619,7 +658,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDepthMask(\a flag).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDepthMask.xml}{glDepthMask()}.
\since 5.3
@@ -630,7 +669,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDisable(\a cap).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDisable.xml}{glDisable()}.
\since 5.3
@@ -641,7 +680,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDrawArrays(\a mode, \a first, \a count).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDrawArrays.xml}{glDrawArrays()}.
\since 5.3
@@ -652,7 +691,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDrawElements(\a mode, \a count, \a type, \a indices).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDrawElements.xml}{glDrawElements()}.
\since 5.3
@@ -663,7 +702,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glEnable(\a cap).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glEnable.xml}{glEnable()}.
\since 5.3
@@ -674,7 +713,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFinish().
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glFinish.xml}{glFinish()}.
\since 5.3
@@ -685,7 +724,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFlush().
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glFlush.xml}{glFlush()}.
\since 5.3
@@ -696,7 +735,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFrontFace(\a mode).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glFrontFace.xml}{glFrontFace()}.
\since 5.3
@@ -707,7 +746,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenTextures(\a n, \a textures).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGenTextures.xml}{glGenTextures()}.
\since 5.3
@@ -718,7 +757,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetBooleanv(\a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetBooleanv.xml}{glGetBooleanv()}.
\since 5.3
@@ -729,7 +768,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetError().
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetError.xml}{glGetError()}.
\since 5.3
@@ -740,7 +779,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetFloatv(\a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetFloatv.xml}{glGetFloatv()}.
\since 5.3
@@ -751,7 +790,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetIntegerv(\a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetIntegerv.xml}{glGetIntegerv()}.
\since 5.3
@@ -762,7 +801,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetString(\a name).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetString.xml}{glGetString()}.
\since 5.3
@@ -773,7 +812,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetTexParameterfv(\a target, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetTexParameterfv.xml}{glGetTexParameterfv()}.
\since 5.3
@@ -784,7 +823,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetTexParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetTexParameteriv.xml}{glGetTexParameteriv()}.
\since 5.3
@@ -795,7 +834,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glHint(\a target, \a mode).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glHint.xml}{glHint()}.
\since 5.3
@@ -806,7 +845,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsEnabled(\a cap).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glIsEnabled.xml}{glIsEnabled()}.
\since 5.3
@@ -817,7 +856,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsTexture(\a texture).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glIsTexture.xml}{glIsTexture()}.
\since 5.3
@@ -828,7 +867,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glLineWidth(\a width).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glLineWidth.xml}{glLineWidth()}.
\since 5.3
@@ -839,7 +878,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glPixelStorei(\a pname, \a param).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glPixelStorei.xml}{glPixelStorei()}.
\since 5.3
@@ -850,7 +889,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glPolygonOffset(\a factor, \a units).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glPolygonOffset.xml}{glPolygonOffset()}.
\since 5.3
@@ -861,7 +900,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glReadPixels(\a x, \a y, \a width, \a height, \a format, \a type, \a pixels).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glReadPixels.xml}{glReadPixels()}.
\since 5.3
@@ -872,7 +911,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glScissor(\a x, \a y, \a width, \a height).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glScissor.xml}{glScissor()}.
\since 5.3
@@ -883,7 +922,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilFunc(\a func, \a ref, \a mask).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFunc.xml}{glStencilFunc()}.
\since 5.3
@@ -894,7 +933,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilMask(\a mask).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMask.xml}{glStencilMask()}.
\since 5.3
@@ -905,7 +944,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilOp(\a fail, \a zfail, \a zpass).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOp.xml}{glStencilOp()}.
\since 5.3
@@ -916,7 +955,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a format, \a type, \a pixels).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glTexImage2D.xml}{glTexImage2D()}.
\since 5.3
@@ -927,7 +966,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameterf(\a target, \a pname, \a param).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameterf.xml}{glTexParameterf()}.
\since 5.3
@@ -938,7 +977,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameterfv(\a target, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameterfv.xml}{glTexParameterfv()}.
\since 5.3
@@ -949,7 +988,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameteri(\a target, \a pname, \a param).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameteri.xml}{glTexParameteri()}.
\since 5.3
@@ -960,7 +999,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glTexParameteriv.xml}{glTexParameteriv()}.
\since 5.3
@@ -971,7 +1010,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a type, \a pixels).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glTexSubImage2D.xml}{glTexSubImage2D()}.
\since 5.3
@@ -982,7 +1021,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glViewport(\a x, \a y, \a width, \a height).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glViewport.xml}{glViewport()}.
\since 5.3
@@ -993,7 +1032,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glActiveTexture(\a texture).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glActiveTexture.xml}{glActiveTexture()}.
*/
@@ -1002,10 +1041,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glAttachShader(\a program, \a shader).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glAttachShader.xml}{glAttachShader()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1013,10 +1052,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindAttribLocation(\a program, \a index, \a name).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBindAttribLocation.xml}{glBindAttribLocation()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1024,7 +1063,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindBuffer(\a target, \a buffer).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBindBuffer.xml}{glBindBuffer()}.
*/
@@ -1036,7 +1075,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Note that Qt will translate a \a framebuffer argument of 0 to the currently
bound QOpenGLContext's defaultFramebufferObject().
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBindFramebuffer.xml}{glBindFramebuffer()}.
*/
@@ -1045,7 +1084,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBindRenderbuffer(\a target, \a renderbuffer).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBindRenderbuffer.xml}{glBindRenderbuffer()}.
*/
@@ -1054,7 +1093,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendColor(\a red, \a green, \a blue, \a alpha).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBlendColor.xml}{glBlendColor()}.
*/
@@ -1063,7 +1102,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendEquation(\a mode).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquation.xml}{glBlendEquation()}.
*/
@@ -1072,7 +1111,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendEquationSeparate(\a modeRGB, \a modeAlpha).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBlendEquationSeparate.xml}{glBlendEquationSeparate()}.
*/
@@ -1081,7 +1120,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBlendFuncSeparate(\a srcRGB, \a dstRGB, \a srcAlpha, \a dstAlpha).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBlendFuncSeparate.xml}{glBlendFuncSeparate()}.
*/
@@ -1090,7 +1129,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBufferData(\a target, \a size, \a data, \a usage).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBufferData.xml}{glBufferData()}.
*/
@@ -1099,7 +1138,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glBufferSubData(\a target, \a offset, \a size, \a data).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glBufferSubData.xml}{glBufferSubData()}.
*/
@@ -1108,7 +1147,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCheckFramebufferStatus(\a target).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCheckFramebufferStatus.xml}{glCheckFramebufferStatus()}.
*/
@@ -1117,9 +1156,9 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glClearDepth(\a depth) on
desktop OpenGL systems and glClearDepthf(\a depth) on
- embedded OpenGL/ES systems.
+ embedded OpenGL ES systems.
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glClearDepthf.xml}{glClearDepthf()}.
*/
@@ -1128,10 +1167,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCompileShader(\a shader).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCompileShader.xml}{glCompileShader()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1139,7 +1178,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCompressedTexImage2D(\a target, \a level, \a internalformat, \a width, \a height, \a border, \a imageSize, \a data).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexImage2D.xml}{glCompressedTexImage2D()}.
*/
@@ -1148,7 +1187,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCompressedTexSubImage2D(\a target, \a level, \a xoffset, \a yoffset, \a width, \a height, \a format, \a imageSize, \a data).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCompressedTexSubImage2D.xml}{glCompressedTexSubImage2D()}.
*/
@@ -1157,10 +1196,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCreateProgram().
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCreateProgram.xml}{glCreateProgram()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1168,10 +1207,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glCreateShader(\a type).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glCreateShader.xml}{glCreateShader()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1179,7 +1218,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteBuffers(\a n, \a buffers).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteBuffers.xml}{glDeleteBuffers()}.
*/
@@ -1188,7 +1227,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteFramebuffers(\a n, \a framebuffers).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteFramebuffers.xml}{glDeleteFramebuffers()}.
*/
@@ -1197,10 +1236,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteProgram(\a program).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteProgram.xml}{glDeleteProgram()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1208,7 +1247,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteRenderbuffers(\a n, \a renderbuffers).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteRenderbuffers.xml}{glDeleteRenderbuffers()}.
*/
@@ -1217,10 +1256,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDeleteShader(\a shader).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDeleteShader.xml}{glDeleteShader()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1228,9 +1267,9 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDepthRange(\a zNear, \a zFar) on
desktop OpenGL systems and glDepthRangef(\a zNear, \a zFar) on
- embedded OpenGL/ES systems.
+ embedded OpenGL ES systems.
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDepthRangef.xml}{glDepthRangef()}.
*/
@@ -1239,10 +1278,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDetachShader(\a program, \a shader).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDetachShader.xml}{glDetachShader()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1250,10 +1289,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glDisableVertexAttribArray(\a index).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glDisableVertexAttribArray.xml}{glDisableVertexAttribArray()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1261,10 +1300,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glEnableVertexAttribArray(\a index).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glEnableVertexAttribArray.xml}{glEnableVertexAttribArray()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1272,7 +1311,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFramebufferRenderbuffer(\a target, \a attachment, \a renderbuffertarget, \a renderbuffer).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferRenderbuffer.xml}{glFramebufferRenderbuffer()}.
*/
@@ -1281,7 +1320,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glFramebufferTexture2D(\a target, \a attachment, \a textarget, \a texture, \a level).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glFramebufferTexture2D.xml}{glFramebufferTexture2D()}.
*/
@@ -1290,7 +1329,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenBuffers(\a n, \a buffers).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGenBuffers.xml}{glGenBuffers()}.
*/
@@ -1299,7 +1338,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenerateMipmap(\a target).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGenerateMipmap.xml}{glGenerateMipmap()}.
*/
@@ -1308,7 +1347,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenFramebuffers(\a n, \a framebuffers).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGenFramebuffers.xml}{glGenFramebuffers()}.
*/
@@ -1317,7 +1356,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGenRenderbuffers(\a n, \a renderbuffers).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGenRenderbuffers.xml}{glGenRenderbuffers()}.
*/
@@ -1326,10 +1365,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetActiveAttrib(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveAttrib.xml}{glGetActiveAttrib()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1337,10 +1376,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetActiveUniform(\a program, \a index, \a bufsize, \a length, \a size, \a type, \a name).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetActiveUniform.xml}{glGetActiveUniform()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1348,10 +1387,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetAttachedShaders(\a program, \a maxcount, \a count, \a shaders).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttachedShaders.xml}{glGetAttachedShaders()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1359,10 +1398,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetAttribLocation(\a program, \a name).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetAttribLocation.xml}{glGetAttribLocation()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1370,7 +1409,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetBufferParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetBufferParameteriv.xml}{glGetBufferParameteriv()}.
*/
@@ -1379,7 +1418,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetFramebufferAttachmentParameteriv(\a target, \a attachment, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetFramebufferAttachmentParameteriv.xml}{glGetFramebufferAttachmentParameteriv()}.
*/
@@ -1388,10 +1427,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetProgramiv(\a program, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramiv.xml}{glGetProgramiv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1399,10 +1438,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetProgramInfoLog(\a program, \a bufsize, \a length, \a infolog).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetProgramInfoLog.xml}{glGetProgramInfoLog()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1410,7 +1449,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetRenderbufferParameteriv(\a target, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetRenderbufferParameteriv.xml}{glGetRenderbufferParameteriv()}.
*/
@@ -1419,10 +1458,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderiv(\a shader, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderiv.xml}{glGetShaderiv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1430,10 +1469,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderInfoLog(\a shader, \a bufsize, \a length, \a infolog).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderInfoLog.xml}{glGetShaderInfoLog()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1441,10 +1480,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderPrecisionFormat(\a shadertype, \a precisiontype, \a range, \a precision).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderPrecisionFormat.xml}{glGetShaderPrecisionFormat()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1452,10 +1491,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetShaderSource(\a shader, \a bufsize, \a length, \a source).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetShaderSource.xml}{glGetShaderSource()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1463,10 +1502,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetUniformfv(\a program, \a location, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformfv.xml}{glGetUniformfv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1474,10 +1513,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetUniformiv(\a program, \a location, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformiv.xml}{glGetUniformiv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1485,10 +1524,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetUniformLocation(\a program, \a name).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetUniformLocation.xml}{glGetUniformLocation()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1496,10 +1535,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetVertexAttribfv(\a index, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribfv.xml}{glGetVertexAttribfv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1507,10 +1546,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetVertexAttribiv(\a index, \a pname, \a params).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribiv.xml}{glGetVertexAttribiv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1518,10 +1557,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glGetVertexAttribPointerv(\a index, \a pname, \a pointer).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glGetVertexAttribPointerv.xml}{glGetVertexAttribPointerv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1529,7 +1568,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsBuffer(\a buffer).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glIsBuffer.xml}{glIsBuffer()}.
*/
@@ -1538,7 +1577,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsFramebuffer(\a framebuffer).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glIsFramebuffer.xml}{glIsFramebuffer()}.
*/
@@ -1547,10 +1586,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsProgram(\a program).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glIsProgram.xml}{glIsProgram()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1558,7 +1597,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsRenderbuffer(\a renderbuffer).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glIsRenderbuffer.xml}{glIsRenderbuffer()}.
*/
@@ -1567,10 +1606,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glIsShader(\a shader).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glIsShader.xml}{glIsShader()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1578,10 +1617,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glLinkProgram(\a program).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glLinkProgram.xml}{glLinkProgram()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1589,10 +1628,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glReleaseShaderCompiler().
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glReleaseShaderCompiler.xml}{glReleaseShaderCompiler()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1600,7 +1639,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glRenderbufferStorage(\a target, \a internalformat, \a width, \a height).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glRenderbufferStorage.xml}{glRenderbufferStorage()}.
*/
@@ -1609,7 +1648,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glSampleCoverage(\a value, \a invert).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glSampleCoverage.xml}{glSampleCoverage()}.
*/
@@ -1618,10 +1657,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glShaderBinary(\a n, \a shaders, \a binaryformat, \a binary, \a length).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glShaderBinary.xml}{glShaderBinary()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1629,10 +1668,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glShaderSource(\a shader, \a count, \a string, \a length).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glShaderSource.xml}{glShaderSource()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1640,7 +1679,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilFuncSeparate(\a face, \a func, \a ref, \a mask).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glStencilFuncSeparate.xml}{glStencilFuncSeparate()}.
*/
@@ -1649,7 +1688,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilMaskSeparate(\a face, \a mask).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glStencilMaskSeparate.xml}{glStencilMaskSeparate()}.
*/
@@ -1658,7 +1697,7 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glStencilOpSeparate(\a face, \a fail, \a zfail, \a zpass).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glStencilOpSeparate.xml}{glStencilOpSeparate()}.
*/
@@ -1667,10 +1706,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1f(\a location, \a x).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1f.xml}{glUniform1f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1678,10 +1717,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1fv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1fv.xml}{glUniform1fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1689,10 +1728,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1i(\a location, \a x).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1i.xml}{glUniform1i()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1700,10 +1739,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform1iv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform1iv.xml}{glUniform1iv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1711,10 +1750,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2f(\a location, \a x, \a y).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2f.xml}{glUniform2f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1722,10 +1761,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2fv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2fv.xml}{glUniform2fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1733,10 +1772,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2i(\a location, \a x, \a y).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2i.xml}{glUniform2i()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1744,10 +1783,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform2iv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform2iv.xml}{glUniform2iv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1755,10 +1794,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3f(\a location, \a x, \a y, \a z).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3f.xml}{glUniform3f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1766,10 +1805,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3fv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3fv.xml}{glUniform3fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1777,10 +1816,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3i(\a location, \a x, \a y, \a z).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3i.xml}{glUniform3i()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1788,10 +1827,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform3iv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform3iv.xml}{glUniform3iv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1799,10 +1838,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4f(\a location, \a x, \a y, \a z, \a w).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4f.xml}{glUniform4f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1810,10 +1849,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4fv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4fv.xml}{glUniform4fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1821,10 +1860,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4i(\a location, \a x, \a y, \a z, \a w).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4i.xml}{glUniform4i()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1832,10 +1871,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniform4iv(\a location, \a count, \a v).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniform4iv.xml}{glUniform4iv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1843,10 +1882,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniformMatrix2fv(\a location, \a count, \a transpose, \a value).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix2fv.xml}{glUniformMatrix2fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1854,10 +1893,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniformMatrix3fv(\a location, \a count, \a transpose, \a value).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix3fv.xml}{glUniformMatrix3fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1865,10 +1904,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUniformMatrix4fv(\a location, \a count, \a transpose, \a value).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUniformMatrix4fv.xml}{glUniformMatrix4fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1876,10 +1915,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glUseProgram(\a program).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glUseProgram.xml}{glUseProgram()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1887,10 +1926,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glValidateProgram(\a program).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glValidateProgram.xml}{glValidateProgram()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1898,10 +1937,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib1f(\a indx, \a x).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1f.xml}{glVertexAttrib1f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1909,10 +1948,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib1fv(\a indx, \a values).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib1fv.xml}{glVertexAttrib1fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1920,10 +1959,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib2f(\a indx, \a x, \a y).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2f.xml}{glVertexAttrib2f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1931,10 +1970,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib2fv(\a indx, \a values).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib2fv.xml}{glVertexAttrib2fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1942,10 +1981,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib3f(\a indx, \a x, \a y, \a z).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3f.xml}{glVertexAttrib3f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1953,10 +1992,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib3fv(\a indx, \a values).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib3fv.xml}{glVertexAttrib3fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1964,10 +2003,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib4f(\a indx, \a x, \a y, \a z, \a w).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4f.xml}{glVertexAttrib4f()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1975,10 +2014,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttrib4fv(\a indx, \a values).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttrib4fv.xml}{glVertexAttrib4fv()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -1986,10 +2025,10 @@ void QOpenGLFunctions::initializeOpenGLFunctions()
Convenience function that calls glVertexAttribPointer(\a indx, \a size, \a type, \a normalized, \a stride, \a ptr).
- For more information, see the OpenGL/ES 2.0 documentation for
+ For more information, see the OpenGL ES 2.0 documentation for
\l{http://www.khronos.org/opengles/sdk/docs/man/glVertexAttribPointer.xml}{glVertexAttribPointer()}.
- This convenience function will do nothing on OpenGL/ES 1.x systems.
+ This convenience function will do nothing on OpenGL ES 1.x systems.
*/
/*!
@@ -3155,8 +3194,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetBufferSubData(GLenum target, qop
(target, offset, size, data);
}
-#if !defined(QT_OPENGL_ES_2) && !defined(QT_OPENGL_DYNAMIC)
-
+#ifndef QT_OPENGL_ES_2
// Desktop only
static void QOPENGLF_APIENTRY qopenglfResolveGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params)
@@ -3164,6 +3202,7 @@ static void QOPENGLF_APIENTRY qopenglfResolveGetTexLevelParameteriv(GLenum targe
RESOLVE_FUNC_VOID(0, GetTexLevelParameteriv)(target, level, pname, params);
}
+#ifndef QT_OPENGL_DYNAMIC
// Special translation functions for ES-specific calls on desktop GL
static void QOPENGLF_APIENTRY qopenglfTranslateClearDepthf(GLclampf depth)
@@ -3176,7 +3215,9 @@ static void QOPENGLF_APIENTRY qopenglfTranslateDepthRangef(GLclampf zNear, GLcla
::glDepthRange(zNear, zFar);
}
-#endif // !ES2 && !DYNAMIC
+#endif // QT_OPENGL_DYNAMIC
+
+#endif // QT_OPENGL_ES2
QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *)
{
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index d2429cdd23..bfde270446 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -1516,6 +1516,9 @@ void QOpenGLShaderProgram::setAttributeArray
The setAttributeBuffer() function can be used to set the attribute
array to an offset within a vertex buffer.
+ \note Normalization will be enabled. If this is not desired, call
+ glVertexAttribPointer directly through QOpenGLFunctions.
+
\sa setAttributeValue(), setUniformValue(), enableAttributeArray()
\sa disableAttributeArray(), setAttributeBuffer()
*/
@@ -1659,6 +1662,9 @@ void QOpenGLShaderProgram::setAttributeArray
on the \a location. Otherwise the value specified with
setAttributeValue() for \a location will be used.
+ \note Normalization will be enabled. If this is not desired, call
+ glVertexAttribPointer directly through QOpenGLFunctions.
+
\sa setAttributeArray()
*/
void QOpenGLShaderProgram::setAttributeBuffer
diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp
index d52517add2..9710f1677c 100644
--- a/src/gui/opengl/qopengltextureblitter.cpp
+++ b/src/gui/opengl/qopengltextureblitter.cpp
@@ -68,11 +68,8 @@ static const char fragment_shader150[] =
"uniform sampler2D textureSampler;"
"uniform bool swizzle;"
"void main() {"
- " if (swizzle) {"
- " fragcolor = texture(textureSampler, uv).bgra;"
- " } else {"
- " fragcolor = texture(textureSampler,uv);"
- " }"
+ " vec4 tmpFragColor = texture(textureSampler, uv);"
+ " fragcolor = swizzle ? tmpFragColor.bgra : tmpFragColor;"
"}";
static const char vertex_shader[] =
@@ -91,11 +88,8 @@ static const char fragment_shader[] =
"uniform sampler2D textureSampler;"
"uniform bool swizzle;"
"void main() {"
- " if (swizzle) {"
- " gl_FragColor = texture2D(textureSampler, uv).bgra;"
- " } else {"
- " gl_FragColor = texture2D(textureSampler,uv);"
- " }"
+ " highp vec4 tmpFragColor = texture2D(textureSampler,uv);"
+ " gl_FragColor = swizzle ? tmpFragColor.bgra : tmpFragColor;"
"}";
static const GLfloat vertex_buffer_data[] = {
diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp
index 5844bf639c..3287bbb972 100644
--- a/src/gui/opengl/qopengltextureglyphcache.cpp
+++ b/src/gui/opengl/qopengltextureglyphcache.cpp
@@ -350,17 +350,7 @@ void QOpenGLTextureGlyphCache::fillTexture(const Coord &c, glyph_t glyph, QFixed
return;
}
- QImage mask;
-
- if (m_current_fontengine->hasInternalCaching()) {
- QImage *alphaMap = m_current_fontengine->lockedAlphaMapForGlyph(glyph, subPixelPosition, QFontEngine::Format_None);
- if (!alphaMap || alphaMap->isNull())
- return;
- mask = alphaMap->copy();
- m_current_fontengine->unlockAlphaMapForGlyph();
- } else {
- mask = textureMapForGlyph(glyph, subPixelPosition);
- }
+ QImage mask = textureMapForGlyph(glyph, subPixelPosition);
const int maskWidth = mask.width();
const int maskHeight = mask.height();
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 6bf80eddbd..ed45b8ea17 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -19,6 +19,8 @@ HEADERS += \
painting/qoutlinemapper_p.h \
painting/qpagedpaintdevice.h \
painting/qpagedpaintdevice_p.h \
+ painting/qpagelayout.h \
+ painting/qpagesize.h \
painting/qpaintdevice.h \
painting/qpaintengine.h \
painting/qpaintengine_p.h \
@@ -66,6 +68,8 @@ SOURCES += \
painting/qmemrotate.cpp \
painting/qoutlinemapper.cpp \
painting/qpagedpaintdevice.cpp \
+ painting/qpagelayout.cpp \
+ painting/qpagesize.cpp \
painting/qpaintdevice.cpp \
painting/qpaintengine.cpp \
painting/qpaintengineex.cpp \
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 3f598cd3a7..c7472cca29 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5937,7 +5937,7 @@ static void qt_gradient_quint16(int count, const QSpan *spans, void *userData)
}
}
-inline static void qt_bitmapblit_quint32(QRasterBuffer *rasterBuffer,
+inline static void qt_bitmapblit_argb32(QRasterBuffer *rasterBuffer,
int x, int y, quint32 color,
const uchar *map,
int mapWidth, int mapHeight, int mapStride)
@@ -5946,6 +5946,15 @@ inline static void qt_bitmapblit_quint32(QRasterBuffer *rasterBuffer,
map, mapWidth, mapHeight, mapStride);
}
+inline static void qt_bitmapblit_rgba8888(QRasterBuffer *rasterBuffer,
+ int x, int y, quint32 color,
+ const uchar *map,
+ int mapWidth, int mapHeight, int mapStride)
+{
+ qt_bitmapblit_template<quint32>(rasterBuffer, x, y, ARGB2RGBA(color),
+ map, mapWidth, mapHeight, mapStride);
+}
+
inline static void qt_bitmapblit_quint16(QRasterBuffer *rasterBuffer,
int x, int y, quint32 color,
const uchar *map,
@@ -6057,11 +6066,11 @@ static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, in
}
#endif
-static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
- int x, int y, quint32 color,
- const uchar *map,
- int mapWidth, int mapHeight, int mapStride,
- const QClipData *clip)
+static void qt_alphamapblit_argb32(QRasterBuffer *rasterBuffer,
+ int x, int y, quint32 color,
+ const uchar *map,
+ int mapWidth, int mapHeight, int mapStride,
+ const QClipData *clip)
{
const quint32 c = color;
const int destStride = rasterBuffer->bytesPerLine() / sizeof(quint32);
@@ -6152,10 +6161,19 @@ static void qt_alphamapblit_quint32(QRasterBuffer *rasterBuffer,
}
}
-static void qt_alphargbblit_quint32(QRasterBuffer *rasterBuffer,
- int x, int y, quint32 color,
- const uint *src, int mapWidth, int mapHeight, int srcStride,
- const QClipData *clip)
+static void qt_alphamapblit_rgba8888(QRasterBuffer *rasterBuffer,
+ int x, int y, quint32 color,
+ const uchar *map,
+ int mapWidth, int mapHeight, int mapStride,
+ const QClipData *clip)
+{
+ qt_alphamapblit_argb32(rasterBuffer, x, y, ARGB2RGBA(color), map, mapWidth, mapHeight, mapStride, clip);
+}
+
+static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
+ int x, int y, quint32 color,
+ const uint *src, int mapWidth, int mapHeight, int srcStride,
+ const QClipData *clip)
{
const quint32 c = color;
@@ -6297,27 +6315,27 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
{
blend_color_argb,
qt_gradient_argb32,
- qt_bitmapblit_quint32,
- qt_alphamapblit_quint32,
- qt_alphargbblit_quint32,
+ qt_bitmapblit_argb32,
+ qt_alphamapblit_argb32,
+ qt_alphargbblit_argb32,
qt_rectfill_argb32
},
// Format_ARGB32,
{
blend_color_generic,
qt_gradient_argb32,
- qt_bitmapblit_quint32,
- qt_alphamapblit_quint32,
- qt_alphargbblit_quint32,
+ qt_bitmapblit_argb32,
+ qt_alphamapblit_argb32,
+ qt_alphargbblit_argb32,
qt_rectfill_nonpremul_argb32
},
// Format_ARGB32_Premultiplied
{
blend_color_argb,
qt_gradient_argb32,
- qt_bitmapblit_quint32,
- qt_alphamapblit_quint32,
- qt_alphargbblit_quint32,
+ qt_bitmapblit_argb32,
+ qt_alphamapblit_argb32,
+ qt_alphargbblit_argb32,
qt_rectfill_argb32
},
// Format_RGB16
@@ -6381,42 +6399,39 @@ DrawHelper qDrawHelper[QImage::NImageFormats] =
{
blend_color_generic,
blend_src_generic,
- qt_bitmapblit_quint32,
+ qt_bitmapblit_rgba8888,
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- qt_alphamapblit_quint32,
- qt_alphargbblit_quint32,
+ qt_alphamapblit_rgba8888,
#else
0,
- 0,
#endif
+ 0,
qt_rectfill_rgba
},
// Format_RGBA8888
{
blend_color_generic,
blend_src_generic,
- qt_bitmapblit_quint32,
+ qt_bitmapblit_rgba8888,
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- qt_alphamapblit_quint32,
- qt_alphargbblit_quint32,
+ qt_alphamapblit_rgba8888,
#else
0,
- 0,
#endif
+ 0,
qt_rectfill_nonpremul_rgba
},
// Format_RGB8888_Premultiplied
{
blend_color_generic,
blend_src_generic,
- qt_bitmapblit_quint32,
+ qt_bitmapblit_rgba8888,
#if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
- qt_alphamapblit_quint32,
- qt_alphargbblit_quint32,
+ qt_alphamapblit_rgba8888,
#else
0,
- 0,
#endif
+ 0,
qt_rectfill_rgba
}
};
@@ -6502,9 +6517,9 @@ void qInitDrawhelperAsm()
qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2;
qDrawHelper[QImage::Format_ARGB32_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2;
qDrawHelper[QImage::Format_RGB16].bitmapBlit = qt_bitmapblit16_sse2;
- qDrawHelper[QImage::Format_RGBX8888].bitmapBlit = qt_bitmapblit32_sse2;
- qDrawHelper[QImage::Format_RGBA8888].bitmapBlit = qt_bitmapblit32_sse2;
- qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit32_sse2;
+ qDrawHelper[QImage::Format_RGBX8888].bitmapBlit = qt_bitmapblit8888_sse2;
+ qDrawHelper[QImage::Format_RGBA8888].bitmapBlit = qt_bitmapblit8888_sse2;
+ qDrawHelper[QImage::Format_RGBA8888_Premultiplied].bitmapBlit = qt_bitmapblit8888_sse2;
extern void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index f5523f7113..c37858d679 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -476,6 +476,13 @@ void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y,
}
}
+void qt_bitmapblit8888_sse2(QRasterBuffer *rasterBuffer, int x, int y,
+ quint32 color,
+ const uchar *src, int width, int height, int stride)
+{
+ qt_bitmapblit32_sse2(rasterBuffer, x, y, ARGB2RGBA(color), src, width, height, stride);
+}
+
void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
quint32 color,
const uchar *src, int width, int height, int stride)
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index 699c586cb0..97c1f87c2a 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -63,6 +63,9 @@ void qt_memfill16(quint16 *dest, quint16 value, int count);
void qt_bitmapblit32_sse2(QRasterBuffer *rasterBuffer, int x, int y,
quint32 color,
const uchar *src, int width, int height, int stride);
+void qt_bitmapblit8888_sse2(QRasterBuffer *rasterBuffer, int x, int y,
+ quint32 color,
+ const uchar *src, int width, int height, int stride);
void qt_bitmapblit16_sse2(QRasterBuffer *rasterBuffer, int x, int y,
quint32 color,
const uchar *src, int width, int height, int stride);
diff --git a/src/gui/painting/qpagedpaintdevice.cpp b/src/gui/painting/qpagedpaintdevice.cpp
index b95b3e3503..18ba964a26 100644
--- a/src/gui/painting/qpagedpaintdevice.cpp
+++ b/src/gui/painting/qpagedpaintdevice.cpp
@@ -44,42 +44,6 @@
QT_BEGIN_NAMESPACE
-static const struct {
- float width;
- float height;
-} pageSizes[] = {
- {210, 297}, // A4
- {176, 250}, // B5
- {215.9f, 279.4f}, // Letter
- {215.9f, 355.6f}, // Legal
- {190.5f, 254}, // Executive
- {841, 1189}, // A0
- {594, 841}, // A1
- {420, 594}, // A2
- {297, 420}, // A3
- {148, 210}, // A5
- {105, 148}, // A6
- {74, 105}, // A7
- {52, 74}, // A8
- {37, 52}, // A8
- {1000, 1414}, // B0
- {707, 1000}, // B1
- {31, 44}, // B10
- {500, 707}, // B2
- {353, 500}, // B3
- {250, 353}, // B4
- {125, 176}, // B6
- {88, 125}, // B7
- {62, 88}, // B8
- {44, 62}, // B9
- {163, 229}, // C5E
- {105, 241}, // US Common
- {110, 220}, // DLE
- {210, 330}, // Folio
- {431.8f, 279.4f}, // Ledger
- {279.4f, 431.8f} // Tabloid
-};
-
/*!
\class QPagedPaintDevice
\inmodule QtGui
@@ -110,46 +74,147 @@ QPagedPaintDevice::~QPagedPaintDevice()
}
/*!
- \enum QPagedPaintDevice::PageSize
-
- This enum type specifies the page size of the paint device.
-
- \value A0 841 x 1189 mm
- \value A1 594 x 841 mm
- \value A2 420 x 594 mm
- \value A3 297 x 420 mm
- \value A4 210 x 297 mm, 8.26 x 11.69 inches
- \value A5 148 x 210 mm
- \value A6 105 x 148 mm
- \value A7 74 x 105 mm
- \value A8 52 x 74 mm
- \value A9 37 x 52 mm
- \value B0 1000 x 1414 mm
- \value B1 707 x 1000 mm
- \value B2 500 x 707 mm
- \value B3 353 x 500 mm
- \value B4 250 x 353 mm
- \value B5 176 x 250 mm, 6.93 x 9.84 inches
- \value B6 125 x 176 mm
- \value B7 88 x 125 mm
- \value B8 62 x 88 mm
- \value B9 44 x 62 mm
- \value B10 31 x 44 mm
- \value C5E 163 x 229 mm
- \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
- \value DLE 110 x 220 mm
- \value Executive 7.5 x 10 inches, 190.5 x 254 mm
- \value Folio 210 x 330 mm
- \value Ledger 431.8 x 279.4 mm
- \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm
- \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm
- \value Tabloid 279.4 x 431.8 mm
- \value Custom Unknown, or a user defined size.
-
- \omitvalue NPageSize
-
- The page size can also be specified in millimeters using setPageSizeMM(). In this case the
- page size enum is set to Custom.
+ \enum QPagedPaintDevice::PageSize
+
+ This enum type lists the available page sizes as defined in the Postscript
+ PPD standard. These values are duplicated in QPageSize and QPrinter.
+
+ The defined sizes are:
+
+ \value A0 841 x 1189 mm
+ \value A1 594 x 841 mm
+ \value A2 420 x 594 mm
+ \value A3 297 x 420 mm
+ \value A4 210 x 297 mm, 8.26 x 11.69 inches
+ \value A5 148 x 210 mm
+ \value A6 105 x 148 mm
+ \value A7 74 x 105 mm
+ \value A8 52 x 74 mm
+ \value A9 37 x 52 mm
+ \value B0 1000 x 1414 mm
+ \value B1 707 x 1000 mm
+ \value B2 500 x 707 mm
+ \value B3 353 x 500 mm
+ \value B4 250 x 353 mm
+ \value B5 176 x 250 mm, 6.93 x 9.84 inches
+ \value B6 125 x 176 mm
+ \value B7 88 x 125 mm
+ \value B8 62 x 88 mm
+ \value B9 33 x 62 mm
+ \value B10 31 x 44 mm
+ \value C5E 163 x 229 mm
+ \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
+ \value DLE 110 x 220 mm
+ \value Executive 7.5 x 10 inches, 190.5 x 254 mm
+ \value Folio 210 x 330 mm
+ \value Ledger 431.8 x 279.4 mm
+ \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm
+ \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm
+ \value Tabloid 279.4 x 431.8 mm
+ \value Custom Unknown, or a user defined size.
+ \value A10
+ \value A3Extra
+ \value A4Extra
+ \value A4Plus
+ \value A4Small
+ \value A5Extra
+ \value B5Extra
+ \value JisB0
+ \value JisB1
+ \value JisB2
+ \value JisB3
+ \value JisB4
+ \value JisB5
+ \value JisB6,
+ \value JisB7
+ \value JisB8
+ \value JisB9
+ \value JisB10
+ \value AnsiA = Letter
+ \value AnsiB = Ledger
+ \value AnsiC
+ \value AnsiD
+ \value AnsiE
+ \value LegalExtra
+ \value LetterExtra
+ \value LetterPlus
+ \value LetterSmall
+ \value TabloidExtra
+ \value ArchA
+ \value ArchB
+ \value ArchC
+ \value ArchD
+ \value ArchE
+ \value Imperial7x9
+ \value Imperial8x10
+ \value Imperial9x11
+ \value Imperial9x12
+ \value Imperial10x11
+ \value Imperial10x13
+ \value Imperial10x14
+ \value Imperial12x11
+ \value Imperial15x11
+ \value ExecutiveStandard
+ \value Note
+ \value Quarto
+ \value Statement
+ \value SuperA
+ \value SuperB
+ \value Postcard
+ \value DoublePostcard
+ \value Prc16K
+ \value Prc32K
+ \value Prc32KBig
+ \value FanFoldUS
+ \value FanFoldGerman
+ \value FanFoldGermanLegal
+ \value EnvelopeB4
+ \value EnvelopeB5
+ \value EnvelopeB6
+ \value EnvelopeC0
+ \value EnvelopeC1
+ \value EnvelopeC2
+ \value EnvelopeC3
+ \value EnvelopeC4
+ \value EnvelopeC5 = C5E
+ \value EnvelopeC6
+ \value EnvelopeC65
+ \value EnvelopeC7
+ \value EnvelopeDL = DLE
+ \value Envelope9
+ \value Envelope10 = Comm10E
+ \value Envelope11
+ \value Envelope12
+ \value Envelope14
+ \value EnvelopeMonarch
+ \value EnvelopePersonal
+ \value EnvelopeChou3
+ \value EnvelopeChou4
+ \value EnvelopeInvite
+ \value EnvelopeItalian
+ \value EnvelopeKaku2
+ \value EnvelopeKaku3
+ \value EnvelopePrc1
+ \value EnvelopePrc2
+ \value EnvelopePrc3
+ \value EnvelopePrc4
+ \value EnvelopePrc5
+ \value EnvelopePrc6
+ \value EnvelopePrc7
+ \value EnvelopePrc8
+ \value EnvelopePrc9
+ \value EnvelopePrc10
+ \value EnvelopeYou4
+ \value LastPageSize = EnvelopeYou4
+ \omitvalue NPageSize
+ \omitvalue NPaperSize
+
+ Due to historic reasons QPageSize::Executive is not the same as the standard
+ Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.
+
+ The Postscript standard size QPageSize::Folio is different to the Windows
+ DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal
+ if needed.
*/
/*!
@@ -166,10 +231,7 @@ QPagedPaintDevice::~QPagedPaintDevice()
*/
void QPagedPaintDevice::setPageSize(PageSize size)
{
- if (size >= Custom)
- return;
- d->pageSize = size;
- d->pageSizeMM = QSizeF(pageSizes[size].width, pageSizes[size].height);
+ d->m_pageLayout.setPageSize(QPageSize(QPageSize::PageSizeId(size)));
}
/*!
@@ -177,16 +239,18 @@ void QPagedPaintDevice::setPageSize(PageSize size)
*/
QPagedPaintDevice::PageSize QPagedPaintDevice::pageSize() const
{
- return d->pageSize;
+ return PageSize(d->m_pageLayout.pageSize().id());
}
/*!
- Sets the page size to \a size. \a size is specified in millimeters.
- */
+ Sets the page size to \a size. \a size is specified in millimeters.
+
+ If the size matches a standard QPagedPaintDevice::PageSize then that page
+ size will be used, otherwise QPagedPaintDevice::Custom will be set.
+*/
void QPagedPaintDevice::setPageSizeMM(const QSizeF &size)
{
- d->pageSize = Custom;
- d->pageSizeMM = size;
+ d->m_pageLayout.setPageSize(QPageSize(size, QPageSize::Millimeter));
}
/*!
@@ -194,7 +258,7 @@ void QPagedPaintDevice::setPageSizeMM(const QSizeF &size)
*/
QSizeF QPagedPaintDevice::pageSizeMM() const
{
- return d->pageSizeMM;
+ return d->m_pageLayout.pageSize().size(QPageSize::Millimeter);
}
/*!
@@ -209,17 +273,48 @@ QSizeF QPagedPaintDevice::pageSizeMM() const
*/
void QPagedPaintDevice::setMargins(const Margins &margins)
{
- d->margins = margins;
+ d->m_pageLayout.setUnits(QPageLayout::Millimeter);
+ d->m_pageLayout.setMargins(QMarginsF(margins.left, margins.top, margins.right, margins.bottom));
}
/*!
- returns the current margins of the paint device. The default is 0.
+ Returns the current margins of the paint device. The default is 0.
+
+ Margins are specified in millimeters.
\sa setMargins()
*/
QPagedPaintDevice::Margins QPagedPaintDevice::margins() const
{
- return d->margins;
+ QMarginsF margins = d->m_pageLayout.margins(QPageLayout::Millimeter);
+ Margins result;
+ result.left = margins.left();
+ result.top = margins.top();
+ result.right = margins.right();
+ result.bottom = margins.bottom();
+ return result;
+}
+
+/*!
+ \internal
+
+ Returns the internal device page layout.
+*/
+
+QPageLayout QPagedPaintDevice::devicePageLayout() const
+{
+ return d->m_pageLayout;
+}
+
+/*!
+ \internal
+
+ Returns the internal device page layout.
+*/
+
+QPageLayout &QPagedPaintDevice::devicePageLayout()
+{
+ return d->m_pageLayout;
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpagedpaintdevice.h b/src/gui/painting/qpagedpaintdevice.h
index d44a401184..6d4c422a95 100644
--- a/src/gui/painting/qpagedpaintdevice.h
+++ b/src/gui/painting/qpagedpaintdevice.h
@@ -51,6 +51,7 @@ QT_BEGIN_NAMESPACE
#endif
class QPagedPaintDevicePrivate;
+class QPageLayout;
class Q_GUI_EXPORT QPagedPaintDevice : public QPaintDevice
{
@@ -60,10 +61,158 @@ public:
virtual bool newPage() = 0;
- enum PageSize { A4, B5, Letter, Legal, Executive,
- A0, A1, A2, A3, A5, A6, A7, A8, A9, B0, B1,
- B10, B2, B3, B4, B6, B7, B8, B9, C5E, Comm10E,
- DLE, Folio, Ledger, Tabloid, Custom, NPageSize = Custom };
+ // ### Qt6 Remove in favor of QPage::PageSize
+ // NOTE: Must keep in sync with QPageSize and QPrinter
+ enum PageSize {
+ // Existing Qt sizes
+ A4,
+ B5,
+ Letter,
+ Legal,
+ Executive,
+ A0,
+ A1,
+ A2,
+ A3,
+ A5,
+ A6,
+ A7,
+ A8,
+ A9,
+ B0,
+ B1,
+ B10,
+ B2,
+ B3,
+ B4,
+ B6,
+ B7,
+ B8,
+ B9,
+ C5E,
+ Comm10E,
+ DLE,
+ Folio,
+ Ledger,
+ Tabloid,
+ Custom,
+
+ // New values derived from PPD standard
+ A10,
+ A3Extra,
+ A4Extra,
+ A4Plus,
+ A4Small,
+ A5Extra,
+ B5Extra,
+
+ JisB0,
+ JisB1,
+ JisB2,
+ JisB3,
+ JisB4,
+ JisB5,
+ JisB6,
+ JisB7,
+ JisB8,
+ JisB9,
+ JisB10,
+
+ // AnsiA = Letter,
+ // AnsiB = Ledger,
+ AnsiC,
+ AnsiD,
+ AnsiE,
+ LegalExtra,
+ LetterExtra,
+ LetterPlus,
+ LetterSmall,
+ TabloidExtra,
+
+ ArchA,
+ ArchB,
+ ArchC,
+ ArchD,
+ ArchE,
+
+ Imperial7x9,
+ Imperial8x10,
+ Imperial9x11,
+ Imperial9x12,
+ Imperial10x11,
+ Imperial10x13,
+ Imperial10x14,
+ Imperial12x11,
+ Imperial15x11,
+
+ ExecutiveStandard,
+ Note,
+ Quarto,
+ Statement,
+ SuperA,
+ SuperB,
+ Postcard,
+ DoublePostcard,
+ Prc16K,
+ Prc32K,
+ Prc32KBig,
+
+ FanFoldUS,
+ FanFoldGerman,
+ FanFoldGermanLegal,
+
+ EnvelopeB4,
+ EnvelopeB5,
+ EnvelopeB6,
+ EnvelopeC0,
+ EnvelopeC1,
+ EnvelopeC2,
+ EnvelopeC3,
+ EnvelopeC4,
+ // EnvelopeC5 = C5E,
+ EnvelopeC6,
+ EnvelopeC65,
+ EnvelopeC7,
+ // EnvelopeDL = DLE,
+
+ Envelope9,
+ // Envelope10 = Comm10E,
+ Envelope11,
+ Envelope12,
+ Envelope14,
+ EnvelopeMonarch,
+ EnvelopePersonal,
+
+ EnvelopeChou3,
+ EnvelopeChou4,
+ EnvelopeInvite,
+ EnvelopeItalian,
+ EnvelopeKaku2,
+ EnvelopeKaku3,
+ EnvelopePrc1,
+ EnvelopePrc2,
+ EnvelopePrc3,
+ EnvelopePrc4,
+ EnvelopePrc5,
+ EnvelopePrc6,
+ EnvelopePrc7,
+ EnvelopePrc8,
+ EnvelopePrc9,
+ EnvelopePrc10,
+ EnvelopeYou4,
+
+ // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
+ LastPageSize = EnvelopeYou4,
+ NPageSize = LastPageSize,
+ NPaperSize = LastPageSize,
+
+ // Convenience overloads for naming consistency
+ AnsiA = Letter,
+ AnsiB = Ledger,
+ EnvelopeC5 = C5E,
+ EnvelopeDL = DLE,
+ Envelope10 = Comm10E
+ };
virtual void setPageSize(PageSize size);
PageSize pageSize() const;
@@ -71,6 +220,7 @@ public:
virtual void setPageSizeMM(const QSizeF &size);
QSizeF pageSizeMM() const;
+ // ### Qt6 Remove in favor of QMarginsF
struct Margins {
qreal left;
qreal right;
@@ -82,6 +232,8 @@ public:
Margins margins() const;
protected:
+ QPageLayout devicePageLayout() const;
+ QPageLayout &devicePageLayout();
friend class QPagedPaintDevicePrivate;
QPagedPaintDevicePrivate *d;
};
diff --git a/src/gui/painting/qpagedpaintdevice_p.h b/src/gui/painting/qpagedpaintdevice_p.h
index d9e5d43903..da58951dc7 100644
--- a/src/gui/painting/qpagedpaintdevice_p.h
+++ b/src/gui/painting/qpagedpaintdevice_p.h
@@ -55,27 +55,25 @@
#include <qpagedpaintdevice.h>
+#include "qpagelayout.h"
+
QT_BEGIN_NAMESPACE
class Q_GUI_EXPORT QPagedPaintDevicePrivate
{
public:
QPagedPaintDevicePrivate()
- : pageSize(QPagedPaintDevice::A4),
- pageSizeMM(210, 297),
+ : m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(0, 0, 0, 0)),
fromPage(0),
toPage(0),
pageOrderAscending(true),
printSelectionOnly(false)
{
- margins.left = margins.right = margins.top = margins.bottom = 0;
}
static inline QPagedPaintDevicePrivate *get(QPagedPaintDevice *pd) { return pd->d; }
- QPagedPaintDevice::PageSize pageSize;
- QSizeF pageSizeMM;
- QPagedPaintDevice::Margins margins;
+ QPageLayout m_pageLayout;
// These are currently required to keep QPrinter functionality working in QTextDocument::print()
int fromPage;
diff --git a/src/gui/painting/qpagelayout.cpp b/src/gui/painting/qpagelayout.cpp
new file mode 100644
index 0000000000..7ae117e423
--- /dev/null
+++ b/src/gui/painting/qpagelayout.cpp
@@ -0,0 +1,971 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 John Layt <jlayt@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+
+#include "qpagelayout.h"
+
+#include <QtCore/qpoint.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qsize.h>
+
+#include <qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+static qreal qt_clamp(qreal value, qreal min, qreal max)
+{
+ return qMin(qMax(value, min), max);
+}
+
+// Multiplier for converting units to points.
+Q_GUI_EXPORT qreal qt_pointMultiplier(QPageLayout::Unit unit)
+{
+ switch (unit) {
+ case QPageLayout::Millimeter:
+ return 2.83464566929;
+ case QPageLayout::Point:
+ return 1.0;
+ case QPageLayout::Inch:
+ return 72.0;
+ case QPageLayout::Pica:
+ return 12;
+ case QPageLayout::Didot:
+ return 1.065826771;
+ case QPageLayout::Cicero:
+ return 12.789921252;
+ }
+ return 1.0;
+}
+
+// Multiplier for converting pixels to points.
+extern qreal qt_pixelMultiplier(int resolution);
+
+QPointF qt_convertPoint(const QPointF &xy, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
+{
+ // If the size have the same units, or are all 0, then don't need to convert
+ if (fromUnits == toUnits || xy.isNull())
+ return xy;
+
+ // If converting to points then convert and round to 0 decimal places
+ if (toUnits == QPageLayout::Point) {
+ const qreal multiplier = qt_pointMultiplier(fromUnits);
+ return QPointF(qRound(xy.x() * multiplier),
+ qRound(xy.y() * multiplier));
+ }
+
+ // If converting to other units, need to convert to unrounded points first
+ QPointF pointXy = (fromUnits == QPageLayout::Point) ? xy : xy * qt_pointMultiplier(fromUnits);
+
+ // Then convert from points to required units rounded to 2 decimal places
+ const qreal multiplier = qt_pointMultiplier(toUnits);
+ return QPointF(qRound(pointXy.x() * 100 / multiplier) / 100.0,
+ qRound(pointXy.y() * 100 / multiplier) / 100.0);
+}
+
+Q_GUI_EXPORT QMarginsF qt_convertMargins(const QMarginsF &margins, QPageLayout::Unit fromUnits, QPageLayout::Unit toUnits)
+{
+ // If the margins have the same units, or are all 0, then don't need to convert
+ if (fromUnits == toUnits || margins.isNull())
+ return margins;
+
+ // If converting to points then convert and round to 0 decimal places
+ if (toUnits == QPageLayout::Point) {
+ const qreal multiplier = qt_pointMultiplier(fromUnits);
+ return QMarginsF(qRound(margins.left() * multiplier),
+ qRound(margins.top() * multiplier),
+ qRound(margins.right() * multiplier),
+ qRound(margins.bottom() * multiplier));
+ }
+
+ // If converting to other units, need to convert to unrounded points first
+ QMarginsF pointMargins = fromUnits == QPageLayout::Point ? margins : margins * qt_pointMultiplier(fromUnits);
+
+ // Then convert from points to required units rounded to 2 decimal places
+ const qreal multiplier = qt_pointMultiplier(toUnits);
+ return QMarginsF(qRound(pointMargins.left() * 100 / multiplier) / 100.0,
+ qRound(pointMargins.top() * 100 / multiplier) / 100.0,
+ qRound(pointMargins.right() * 100 / multiplier) / 100.0,
+ qRound(pointMargins.bottom() * 100 / multiplier) / 100.0);
+}
+
+class QPageLayoutPrivate : public QSharedData
+{
+public:
+
+ QPageLayoutPrivate();
+ QPageLayoutPrivate(const QPageSize &pageSize, QPageLayout::Orientation orientation,
+ const QMarginsF &margins, QPageLayout::Unit units,
+ const QMarginsF &minMargins);
+ ~QPageLayoutPrivate();
+
+ bool operator==(const QPageLayoutPrivate &other) const;
+ bool isEquivalentTo(const QPageLayoutPrivate &other) const;
+
+ bool isValid() const;
+
+ void clampMargins(const QMarginsF &margins);
+
+ QMarginsF margins(QPageLayout::Unit units) const;
+ QMargins marginsPoints() const;
+ QMargins marginsPixels(int resolution) const;
+
+ void setDefaultMargins(const QMarginsF &minMargins);
+
+ QSizeF paintSize() const;
+
+ QRectF fullRect() const;
+ QRectF fullRect(QPageLayout::Unit units) const;
+ QRect fullRectPoints() const;
+ QRect fullRectPixels(int resolution) const;
+
+ QRectF paintRect() const;
+
+private:
+ friend class QPageLayout;
+
+ QSizeF fullSizeUnits(QPageLayout::Unit units) const;
+
+ QPageSize m_pageSize;
+ QPageLayout::Orientation m_orientation;
+ QPageLayout::Mode m_mode;
+ QPageLayout::Unit m_units;
+ QSizeF m_fullSize;
+ QMarginsF m_margins;
+ QMarginsF m_minMargins;
+ QMarginsF m_maxMargins;
+};
+
+QPageLayoutPrivate::QPageLayoutPrivate()
+ : m_orientation(QPageLayout::Landscape),
+ m_mode(QPageLayout::StandardMode)
+{
+}
+
+QPageLayoutPrivate::QPageLayoutPrivate(const QPageSize &pageSize, QPageLayout::Orientation orientation,
+ const QMarginsF &margins, QPageLayout::Unit units,
+ const QMarginsF &minMargins)
+ : m_pageSize(pageSize),
+ m_orientation(orientation),
+ m_mode(QPageLayout::StandardMode),
+ m_units(units),
+ m_margins(margins)
+{
+ m_fullSize = fullSizeUnits(m_units);
+ setDefaultMargins(minMargins);
+}
+
+QPageLayoutPrivate::~QPageLayoutPrivate()
+{
+}
+
+bool QPageLayoutPrivate::operator==(const QPageLayoutPrivate &other) const
+{
+ return m_pageSize == other.m_pageSize
+ && m_orientation == other.m_orientation
+ && m_units == other.m_units
+ && m_margins == other.m_margins
+ && m_minMargins == other.m_minMargins
+ && m_maxMargins == other.m_maxMargins;
+}
+
+bool QPageLayoutPrivate::isEquivalentTo(const QPageLayoutPrivate &other) const
+{
+ return m_pageSize.isEquivalentTo(other.m_pageSize)
+ && m_orientation == other.m_orientation
+ && qt_convertMargins(m_margins, m_units, QPageLayout::Point)
+ == qt_convertMargins(other.m_margins, other.m_units, QPageLayout::Point);
+}
+
+bool QPageLayoutPrivate::isValid() const
+{
+ return m_pageSize.isValid();
+}
+
+void QPageLayoutPrivate::clampMargins(const QMarginsF &margins)
+{
+ m_margins = QMarginsF(qt_clamp(margins.left(), m_minMargins.left(), m_maxMargins.left()),
+ qt_clamp(margins.top(), m_minMargins.top(), m_maxMargins.top()),
+ qt_clamp(margins.right(), m_minMargins.right(), m_maxMargins.right()),
+ qt_clamp(margins.bottom(), m_minMargins.bottom(), m_maxMargins.bottom()));
+}
+
+QMarginsF QPageLayoutPrivate::margins(QPageLayout::Unit units) const
+{
+ return qt_convertMargins(m_margins, m_units, units);
+}
+
+QMargins QPageLayoutPrivate::marginsPoints() const
+{
+ return qt_convertMargins(m_margins, m_units, QPageLayout::Point).toMargins();
+}
+
+QMargins QPageLayoutPrivate::marginsPixels(int resolution) const
+{
+ return marginsPoints() / qt_pixelMultiplier(resolution);
+}
+
+void QPageLayoutPrivate::setDefaultMargins(const QMarginsF &minMargins)
+{
+ m_minMargins = minMargins;
+ m_maxMargins = QMarginsF(m_fullSize.width() - m_minMargins.right(),
+ m_fullSize.height() - m_minMargins.bottom(),
+ m_fullSize.width() - m_minMargins.left(),
+ m_fullSize.height() - m_minMargins.top());
+ if (m_mode == QPageLayout::StandardMode)
+ clampMargins(m_margins);
+}
+
+QSizeF QPageLayoutPrivate::fullSizeUnits(QPageLayout::Unit units) const
+{
+ QSizeF fullPageSize = m_pageSize.size(QPageSize::Unit(units));
+ return m_orientation == QPageLayout::Landscape ? fullPageSize.transposed() : fullPageSize;
+}
+
+QRectF QPageLayoutPrivate::fullRect() const
+{
+ return QRectF(QPointF(0, 0), m_fullSize);
+}
+
+QRectF QPageLayoutPrivate::fullRect(QPageLayout::Unit units) const
+{
+ return units == m_units ? fullRect() : QRectF(QPointF(0, 0), fullSizeUnits(units));
+}
+
+QRect QPageLayoutPrivate::fullRectPoints() const
+{
+ if (m_orientation == QPageLayout::Landscape)
+ return QRect(QPoint(0, 0), m_pageSize.sizePoints().transposed());
+ else
+ return QRect(QPoint(0, 0), m_pageSize.sizePoints());
+}
+
+QRect QPageLayoutPrivate::fullRectPixels(int resolution) const
+{
+ if (m_orientation == QPageLayout::Landscape)
+ return QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution).transposed());
+ else
+ return QRect(QPoint(0, 0), m_pageSize.sizePixels(resolution));
+}
+
+QRectF QPageLayoutPrivate::paintRect() const
+{
+ return m_mode == QPageLayout::FullPageMode ? fullRect() : fullRect() - m_margins;
+}
+
+
+/*!
+ \class QPageLayout
+ \inmodule QtGui
+ \since 5.3
+ \brief Describes the size, orientation and margins of a page.
+
+ The QPageLayout class defines the layout of a page in a paged document, with the
+ page size, orientation and margins able to be set and the full page and paintable
+ page rectangles defined by those attributes able to be queried in a variety of units.
+
+ The page size is defined by the QPageSize class which can be queried for page size
+ attributes. Note that the QPageSize itself is always defined in a Portrait
+ orientation.
+
+ The minimum margins can be defined for the layout but normally default to 0.
+ When used in conjunction with Qt's printing support the minimum margins
+ will reflect the minimum printable area defined by the printer.
+
+ In the default StandardMode the current margins and minimum margins are
+ always taken into account. The paintable rectangle is the full page
+ rectangle less the current margins, and the current margins can only be set
+ to values between the minimum margins and the maximum margins allowed by
+ the full page size.
+
+ In FullPageMode the current margins and minimum margins are not taken
+ into account. The paintable rectangle is the full page rectangle, and the
+ current margins can be set to any values regardless of the minimum margins
+ and page size.
+
+ \sa QPageSize
+*/
+
+/*!
+ \enum QPageLayout::Unit
+
+ This enum type is used to specify the measurement unit for page layout and margins.
+
+ \value Millimeter
+ \value Point 1/72th of an inch
+ \value Inch
+ \value Pica 1/72th of a foot, 1/6th of an inch, 12 Points
+ \value Didot 1/72th of a French inch, 0.375 mm
+ \value Cicero 1/6th of a French inch, 12 Didot, 4.5mm
+*/
+
+/*!
+ \enum QPageLayout::Orientation
+
+ This enum type defines the page orientation
+
+ \value Portrait The page size is used in its default orientation
+ \value Landscape The page size is rotated through 90 degrees
+
+ Note that some standard page sizes are defined with a width larger than
+ their height, hence the orientation is defined relative to the standard
+ page size and not using the relative page dimensions.
+*/
+
+/*!
+ \enum QPageLayout::Mode
+
+ Defines the page layout mode
+
+ \value StandardMode Paint Rect includes margins, margins must fall between the minimum and maximum.
+ \value FullPageMode Paint Rect excludes margins, margins can be any value and must be managed manually.
+*/
+
+/*!
+ Creates an invalid QPageLayout.
+*/
+
+QPageLayout::QPageLayout()
+ : d(new QPageLayoutPrivate())
+{
+}
+
+/*!
+ Creates a QPageLayout with the given \a pageSize, \a orientation and
+ \a margins in the given \a units.
+
+ Optionally define the minimum allowed margins \a minMargins, e.g. the minimum
+ margins able to be printed by a physical print device.
+
+ The constructed QPageLayout will be in StandardMode.
+
+ The \a margins given will be clamped to the minimum margins and the maximum
+ margins allowed by the page size.
+*/
+
+QPageLayout::QPageLayout(const QPageSize &pageSize, QPageLayout::Orientation orientation,
+ const QMarginsF &margins, QPageLayout::Unit units,
+ const QMarginsF &minMargins)
+ : d(new QPageLayoutPrivate(pageSize, orientation, margins, units, minMargins))
+{
+}
+
+/*!
+ Copy constructor, copies \a other to this.
+*/
+
+QPageLayout::QPageLayout(const QPageLayout &other)
+ : d(other.d)
+{
+}
+
+/*!
+ Destroys the page layout.
+*/
+
+QPageLayout::~QPageLayout()
+{
+}
+
+/*!
+ Assignment operator, assigns \a other to this.
+*/
+
+QPageLayout &QPageLayout::operator=(const QPageLayout &other)
+{
+ d = other.d;
+ return *this;
+}
+
+/*!
+ \fn void QPageLayout::swap(QPageLayout &other)
+
+ Swaps this page layout with \a other. This function is very fast and
+ never fails.
+*/
+
+/*!
+ \fn QPageLayout &QPageLayout::operator=(QPageLayout &&other)
+
+ Move-assigns \a other to this QPageLayout instance, transferring the
+ ownership of the managed pointer to this instance.
+*/
+
+/*!
+ Returns \c true if this page layout is equal to the \a other page layout,
+ i.e. if all the attributes are exactly equal.
+
+ Note that this is a strict equality, especially for page size where the
+ QPageSize ID, name and size must exactly match, and the margins where the
+ units must match.
+
+ \sa isEquivalentTo()
+*/
+
+bool QPageLayout::operator==(const QPageLayout &other) const
+{
+ if (d && other.d)
+ return (*d == *other.d);
+ return (d == other.d);
+}
+
+/*!
+ Returns \c true if this page layout is equivalent to the \a other page layout,
+ i.e. if the page has the same size, margins and orientation.
+*/
+
+bool QPageLayout::isEquivalentTo(const QPageLayout &other) const
+{
+ return d && other.d && d->isEquivalentTo(*other.d);
+}
+
+/*!
+ Returns \c true if this page layout is valid.
+*/
+
+bool QPageLayout::isValid() const
+{
+ return d->isValid();
+}
+
+/*!
+ Sets a page layout mode to \a mode.
+*/
+
+void QPageLayout::setMode(QPageLayout::Mode mode)
+{
+ d->m_mode = mode;
+}
+
+/*!
+ Returns the page layout mode.
+*/
+
+QPageLayout::Mode QPageLayout::mode() const
+{
+ return d->m_mode;
+}
+
+/*!
+ Sets the page size of the page layout to \a pageSize.
+
+ Optionally define the minimum allowed margins \a minMargins, e.g. the minimum
+ margins able to be printed by a physical print device, otherwise the
+ minimum margins will default to 0.
+
+ If StandardMode is set then the existing margins will be clamped
+ to the new minimum margins and the maximum margins allowed by the page size.
+ If FullPageMode is set then the existing margins will be unchanged.
+*/
+
+void QPageLayout::setPageSize(const QPageSize &pageSize, const QMarginsF &minMargins)
+{
+ if (!pageSize.isValid())
+ return;
+ d->m_pageSize = pageSize;
+ d->m_fullSize = d->fullSizeUnits(d->m_units);
+ d->setDefaultMargins(minMargins);
+}
+
+/*!
+ Returns the page size of the page layout.
+
+ Note that the QPageSize is always defined in a Portrait orientation. To
+ obtain a size that takes the set orientation into account you must use
+ fullRect().
+*/
+
+QPageSize QPageLayout::pageSize() const
+{
+ return d->m_pageSize;
+}
+
+/*!
+ Sets the page orientation of the page layout to \a orientation.
+
+ Changing the orientation does not affect the current margins or
+ the minimum margins.
+*/
+
+void QPageLayout::setOrientation(QPageLayout::Orientation orientation)
+{
+ if (orientation != d->m_orientation) {
+ d->m_orientation = orientation;
+ d->m_fullSize = d->fullSizeUnits(d->m_units);
+ // Adust the max margins to reflect change in max page size
+ const qreal change = d->m_fullSize.width() - d->m_fullSize.height();
+ d->m_maxMargins.setLeft(d->m_maxMargins.left() + change);
+ d->m_maxMargins.setRight(d->m_maxMargins.right() + change);
+ d->m_maxMargins.setTop(d->m_maxMargins.top() - change);
+ d->m_maxMargins.setBottom(d->m_maxMargins.bottom() - change);
+ }
+}
+
+/*!
+ Returns the page orientation of the page layout.
+*/
+
+QPageLayout::Orientation QPageLayout::orientation() const
+{
+ return d->m_orientation;
+}
+
+/*!
+ Sets the \a units used to define the page layout.
+*/
+
+void QPageLayout::setUnits(QPageLayout::Unit units)
+{
+ if (units != d->m_units) {
+ d->m_margins = qt_convertMargins(d->m_margins, d->m_units, units);
+ d->m_minMargins = qt_convertMargins(d->m_minMargins, d->m_units, units);
+ d->m_maxMargins = qt_convertMargins(d->m_maxMargins, d->m_units, units);
+ d->m_units = units;
+ d->m_fullSize = d->fullSizeUnits(d->m_units);
+ }
+}
+
+/*!
+ Returns the units the page layout is currently defined in.
+*/
+
+QPageLayout::Unit QPageLayout::units() const
+{
+ return d->m_units;
+}
+
+/*!
+ Sets the page margins of the page layout to \a margins
+ Returns true if the margins were successfully set.
+
+ The units used are those currently defined for the layout. To use different
+ units then call setUnits() first.
+
+ If in the default StandardMode then all the new margins must fall between the
+ minimum margins set and the maximum margins allowed by the page size,
+ otherwise the margins will not be set.
+
+ If in FullPageMode then any margin values will be accepted.
+
+ \sa margins(), units()
+*/
+
+bool QPageLayout::setMargins(const QMarginsF &margins)
+{
+ if (d->m_mode == QPageLayout::FullPageMode) {
+ d->m_margins = margins;
+ return true;
+ } else if (margins.left() >= d->m_minMargins.left()
+ && margins.right() >= d->m_minMargins.right()
+ && margins.top() >= d->m_minMargins.top()
+ && margins.bottom() >= d->m_minMargins.bottom()
+ && margins.left() <= d->m_maxMargins.left()
+ && margins.right() <= d->m_maxMargins.right()
+ && margins.top() <= d->m_maxMargins.top()
+ && margins.bottom() <= d->m_maxMargins.bottom()) {
+ d->m_margins = margins;
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Sets the left page margin of the page layout to \a leftMargin.
+ Returns true if the margin was successfully set.
+
+ The units used are those currently defined for the layout. To use different
+ units call setUnits() first.
+
+ If in the default StandardMode then the new margin must fall between the
+ minimum margin set and the maximum margin allowed by the page size,
+ otherwise the margin will not be set.
+
+ If in FullPageMode then any margin values will be accepted.
+
+ \sa setMargins(), margins()
+*/
+
+bool QPageLayout::setLeftMargin(qreal leftMargin)
+{
+ if (d->m_mode == QPageLayout::FullPageMode
+ || (leftMargin >= d->m_minMargins.left() && leftMargin <= d->m_maxMargins.left())) {
+ d->m_margins.setLeft(leftMargin);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Sets the right page margin of the page layout to \a rightMargin.
+ Returns true if the margin was successfully set.
+
+ The units used are those currently defined for the layout. To use different
+ units call setUnits() first.
+
+ If in the default StandardMode then the new margin must fall between the
+ minimum margin set and the maximum margin allowed by the page size,
+ otherwise the margin will not be set.
+
+ If in FullPageMode then any margin values will be accepted.
+
+ \sa setMargins(), margins()
+*/
+
+bool QPageLayout::setRightMargin(qreal rightMargin)
+{
+ if (d->m_mode == QPageLayout::FullPageMode
+ || (rightMargin >= d->m_minMargins.right() && rightMargin <= d->m_maxMargins.right())) {
+ d->m_margins.setRight(rightMargin);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Sets the top page margin of the page layout to \a topMargin.
+ Returns true if the margin was successfully set.
+
+ The units used are those currently defined for the layout. To use different
+ units call setUnits() first.
+
+ If in the default StandardMode then the new margin must fall between the
+ minimum margin set and the maximum margin allowed by the page size,
+ otherwise the margin will not be set.
+
+ If in FullPageMode then any margin values will be accepted.
+
+ \sa setMargins(), margins()
+*/
+
+bool QPageLayout::setTopMargin(qreal topMargin)
+{
+ if (d->m_mode == QPageLayout::FullPageMode
+ || (topMargin >= d->m_minMargins.top() && topMargin <= d->m_maxMargins.top())) {
+ d->m_margins.setTop(topMargin);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Sets the bottom page margin of the page layout to \a bottomMargin.
+ Returns true if the margin was successfully set.
+
+ The units used are those currently defined for the layout. To use different
+ units call setUnits() first.
+
+ If in the default StandardMode then the new margin must fall between the
+ minimum margin set and the maximum margin allowed by the page size,
+ otherwise the margin will not be set.
+
+ If in FullPageMode then any margin values will be accepted.
+
+ \sa setMargins(), margins()
+*/
+
+bool QPageLayout::setBottomMargin(qreal bottomMargin)
+{
+ if (d->m_mode == QPageLayout::FullPageMode
+ || (bottomMargin >= d->m_minMargins.bottom() && bottomMargin <= d->m_maxMargins.bottom())) {
+ d->m_margins.setBottom(bottomMargin);
+ return true;
+ }
+ return false;
+}
+
+/*!
+ Returns the margins of the page layout using the currently set units.
+
+ \sa setMargins(), units()
+*/
+
+QMarginsF QPageLayout::margins() const
+{
+ return d->m_margins;
+}
+
+/*!
+ Returns the margins of the page layout using the requested \a units.
+
+ \sa setMargins(), margins()
+*/
+
+QMarginsF QPageLayout::margins(QPageLayout::Unit units) const
+{
+ return d->margins(units);
+}
+
+/*!
+ Returns the margins of the page layout in Postscript Points (1/72 of an inch).
+
+ \sa setMargins(), margins()
+*/
+
+QMargins QPageLayout::marginsPoints() const
+{
+ return d->marginsPoints();
+}
+
+/*!
+ Returns the margins of the page layout in device pixels for the given \a resolution.
+
+ \sa setMargins()
+*/
+
+QMargins QPageLayout::marginsPixels(int resolution) const
+{
+ return d->marginsPixels(resolution);
+}
+
+/*!
+ Sets the minimum page margins of the page layout to \a minMargins.
+
+ It is not recommended to override the default values set for a page size
+ as this may be the minimum printable area for a physical print device.
+
+ If the StandardMode mode is set then the existing margins will be clamped
+ to the new \a minMargins and the maximum allowed by the page size. If the
+ FullPageMode is set then the existing margins will be unchanged.
+
+ \sa minimumMargins(), setMargins()
+*/
+
+void QPageLayout::setMinimumMargins(const QMarginsF &minMargins)
+{
+ d->setDefaultMargins(minMargins);
+}
+
+/*!
+ Returns the minimum margins of the page layout.
+
+ \sa setMinimumMargins(), maximumMargins()
+*/
+
+QMarginsF QPageLayout::minimumMargins() const
+{
+ return d->m_minMargins;
+}
+
+/*!
+ Returns the maximum margins that would be applied if the page layout was
+ in StandardMode.
+
+ The maximum margins allowed are calculated as the full size of the page
+ minus the minimum margins set. For example, if the page width is 100 points
+ and the minimum right margin is 10 points, then the maximum left margin
+ will be 90 points.
+
+ \sa setMinimumMargins(), minimumMargins()
+*/
+
+QMarginsF QPageLayout::maximumMargins() const
+{
+ return d->m_maxMargins;
+}
+
+/*!
+ Returns the full page rectangle in the current layout units.
+
+ The page rectangle takes into account the page size and page orientation,
+ but not the page margins.
+
+ \sa paintRect(), units()
+*/
+
+QRectF QPageLayout::fullRect() const
+{
+ return isValid() ? d->fullRect() : QRect();
+}
+
+/*!
+ Returns the full page rectangle in the required \a units.
+
+ The page rectangle takes into account the page size and page orientation,
+ but not the page margins.
+
+ \sa paintRect()
+*/
+
+QRectF QPageLayout::fullRect(QPageLayout::Unit units) const
+{
+ return isValid() ? d->fullRect(units) : QRect();
+}
+
+/*!
+ Returns the full page rectangle in Postscript Points (1/72 of an inch).
+
+ The page rectangle takes into account the page size and page orientation,
+ but not the page margins.
+
+ \sa paintRect()
+*/
+
+QRect QPageLayout::fullRectPoints() const
+{
+ return isValid() ? d->fullRectPoints() : QRect();
+}
+
+/*!
+ Returns the full page rectangle in device pixels for the given \a resolution.
+
+ The page rectangle takes into account the page size and page orientation,
+ but not the page margins.
+
+ \sa paintRect()
+*/
+
+QRect QPageLayout::fullRectPixels(int resolution) const
+{
+ return isValid() ? d->fullRectPixels(resolution) : QRect();
+}
+
+/*!
+ Returns the page rectangle in the current layout units.
+
+ The paintable rectangle takes into account the page size, orientation
+ and margins.
+
+ If the FullPageMode mode is set then the fullRect() is returned and
+ the margins must be manually managed.
+*/
+
+QRectF QPageLayout::paintRect() const
+{
+ return isValid() ? d->paintRect() : QRectF();
+}
+
+/*!
+ Returns the page rectangle in the required \a units.
+
+ The paintable rectangle takes into account the page size, orientation
+ and margins.
+
+ If the FullPageMode mode is set then the fullRect() is returned and
+ the margins must be manually managed.
+*/
+
+QRectF QPageLayout::paintRect(QPageLayout::Unit units) const
+{
+ if (!isValid())
+ return QRectF();
+ if (units == d->m_units)
+ return d->paintRect();
+ return d->m_mode == QPageLayout::FullPageMode ? d->fullRect(units)
+ : d->fullRect(units) - d->margins(units);
+}
+
+/*!
+ Returns the paintable rectangle in rounded Postscript Points (1/72 of an inch).
+
+ The paintable rectangle takes into account the page size, orientation
+ and margins.
+
+ If the FullPageMode mode is set then the fullRect() is returned and
+ the margins must be manually managed.
+*/
+
+QRect QPageLayout::paintRectPoints() const
+{
+ if (!isValid())
+ return QRect();
+ return d->m_mode == QPageLayout::FullPageMode ? d->fullRectPoints()
+ : d->fullRectPoints() - d->marginsPoints();
+}
+
+/*!
+ Returns the paintable rectangle in rounded device pixels for the given \a resolution.
+
+ The paintable rectangle takes into account the page size, orientation
+ and margins.
+
+ If the FullPageMode mode is set then the fullRect() is returned and
+ the margins must be manually managed.
+*/
+
+QRect QPageLayout::paintRectPixels(int resolution) const
+{
+ if (!isValid())
+ return QRect();
+ return d->m_mode == QPageLayout::FullPageMode ? d->fullRectPixels(resolution)
+ : d->fullRectPixels(resolution) - d->marginsPixels(resolution);
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPageLayout &layout)
+{
+ if (layout.isValid()) {
+ QString output = QStringLiteral("QPageLayout(%1, %2, l:%3 r:%4 t:%5 b:%6 %7)");
+ QString units;
+ switch (layout.units()) {
+ case QPageLayout::Millimeter:
+ units = QStringLiteral("mm");
+ break;
+ case QPageLayout::Point:
+ units = QStringLiteral("pt");
+ break;
+ case QPageLayout::Inch:
+ units = QStringLiteral("in");
+ break;
+ case QPageLayout::Pica:
+ units = QStringLiteral("pc");
+ break;
+ case QPageLayout::Didot:
+ units = QStringLiteral("DD");
+ break;
+ case QPageLayout::Cicero:
+ units = QStringLiteral("CC");
+ break;
+ }
+ output = output.arg(layout.pageSize().name())
+ .arg(layout.orientation() == QPageLayout::Portrait ? QStringLiteral("Portrait") : QStringLiteral("Landscape"))
+ .arg(layout.margins().left())
+ .arg(layout.margins().right())
+ .arg(layout.margins().top())
+ .arg(layout.margins().bottom())
+ .arg(units);
+ dbg.nospace() << output;
+ } else {
+ dbg.nospace() << QStringLiteral("QPageLayout()");
+ }
+ return dbg.space();
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qpagelayout.h b/src/gui/painting/qpagelayout.h
new file mode 100644
index 0000000000..86e430e311
--- /dev/null
+++ b/src/gui/painting/qpagelayout.h
@@ -0,0 +1,155 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 John Layt <jlayt@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPAGELAYOUT_H
+#define QPAGELAYOUT_H
+
+#include <QtCore/qsharedpointer.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qmargins.h>
+
+#include <QtGui/qpagesize.h>
+
+QT_BEGIN_NAMESPACE
+
+class QPageLayoutPrivate;
+class QMarginsF;
+
+class Q_GUI_EXPORT QPageLayout
+{
+public:
+
+ // NOTE: Must keep in sync with QPageSize::Unit and QPrinter::Unit
+ enum Unit {
+ Millimeter,
+ Point,
+ Inch,
+ Pica,
+ Didot,
+ Cicero
+ };
+
+ // NOTE: Must keep in sync with QPrinter::Orientation
+ enum Orientation {
+ Portrait,
+ Landscape
+ };
+
+ enum Mode {
+ StandardMode, // Paint Rect includes margins
+ FullPageMode // Paint Rect excludes margins
+ };
+
+ QPageLayout();
+ QPageLayout(const QPageSize &pageSize, QPageLayout::Orientation orientation,
+ const QMarginsF &margins, QPageLayout::Unit units = QPageLayout::Point,
+ const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0));
+ QPageLayout(const QPageLayout &other);
+ ~QPageLayout();
+
+ QPageLayout &operator=(const QPageLayout &other);
+ #ifdef Q_COMPILER_RVALUE_REFS
+ QPageLayout &operator=(QPageLayout &&other) { swap(other); return *this; }
+#endif
+
+ void swap(QPageLayout &other) { d.swap(other.d); }
+
+ bool operator==(const QPageLayout &other) const;
+ bool isEquivalentTo(const QPageLayout &other) const;
+
+ bool isValid() const;
+
+ void setMode(QPageLayout::Mode mode);
+ QPageLayout::Mode mode() const;
+
+ void setPageSize(const QPageSize &pageSize,
+ const QMarginsF &minMargins = QMarginsF(0, 0, 0, 0));
+ QPageSize pageSize() const;
+
+ void setOrientation(QPageLayout::Orientation orientation);
+ QPageLayout::Orientation orientation() const;
+
+ void setUnits(QPageLayout::Unit units);
+ QPageLayout::Unit units() const;
+
+ bool setMargins(const QMarginsF &margins);
+ bool setLeftMargin(qreal leftMargin);
+ bool setRightMargin(qreal rightMargin);
+ bool setTopMargin(qreal topMargin);
+ bool setBottomMargin(qreal bottomMargin);
+
+ QMarginsF margins() const;
+ QMarginsF margins(QPageLayout::Unit units) const;
+ QMargins marginsPoints() const;
+ QMargins marginsPixels(int resolution) const;
+
+ void setMinimumMargins(const QMarginsF &minMargins);
+ QMarginsF minimumMargins() const;
+ QMarginsF maximumMargins() const;
+
+ QRectF fullRect() const;
+ QRectF fullRect(QPageLayout::Unit units) const;
+ QRect fullRectPoints() const;
+ QRect fullRectPixels(int resolution) const;
+
+ QRectF paintRect() const;
+ QRectF paintRect(QPageLayout::Unit units) const;
+ QRect paintRectPoints() const;
+ QRect paintRectPixels(int resolution) const;
+
+private:
+ friend class QPageLayoutPrivate;
+ QSharedDataPointer<QPageLayoutPrivate> d;
+};
+
+Q_DECLARE_SHARED(QPageLayout)
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageLayout &pageLayout);
+#endif
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QPageLayout)
+Q_DECLARE_METATYPE(QPageLayout::Unit)
+Q_DECLARE_METATYPE(QPageLayout::Orientation)
+
+#endif // QPAGELAYOUT_H
diff --git a/src/gui/painting/qpagesize.cpp b/src/gui/painting/qpagesize.cpp
new file mode 100644
index 0000000000..6698d77bbd
--- /dev/null
+++ b/src/gui/painting/qpagesize.cpp
@@ -0,0 +1,1882 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 John Layt <jlayt@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qpagesize.h"
+
+#include <QtCore/qcoreapplication.h>
+#include <QtCore/qdebug.h>
+#include <QtCore/qpoint.h>
+#include <QtCore/qrect.h>
+#include <QtCore/qsize.h>
+#include <QtCore/qstring.h>
+
+QT_BEGIN_NAMESPACE
+
+// Define the Windows DMPAPER sizes for use in the look-up table
+// See http://msdn.microsoft.com/en-us/library/windows/desktop/dd319099.aspx
+
+enum WindowsDmPaper {
+ DMPAPER_NONE = 0, // Not a DMPAPER, use for sizes without a DMPAPER value
+ DMPAPER_LETTER = 1,
+ DMPAPER_LETTERSMALL = 2,
+ DMPAPER_TABLOID = 3,
+ DMPAPER_LEDGER = 4,
+ DMPAPER_LEGAL = 5,
+ DMPAPER_STATEMENT = 6,
+ DMPAPER_EXECUTIVE = 7,
+ DMPAPER_A3 = 8,
+ DMPAPER_A4 = 9,
+ DMPAPER_A4SMALL = 10,
+ DMPAPER_A5 = 11,
+ DMPAPER_B4 = 12,
+ DMPAPER_B5 = 13,
+ DMPAPER_FOLIO = 14,
+ DMPAPER_QUARTO = 15,
+ DMPAPER_10X14 = 16,
+ DMPAPER_11X17 = 17,
+ DMPAPER_NOTE = 18,
+ DMPAPER_ENV_9 = 19,
+ DMPAPER_ENV_10 = 20,
+ DMPAPER_ENV_11 = 21,
+ DMPAPER_ENV_12 = 22,
+ DMPAPER_ENV_14 = 23,
+ DMPAPER_CSHEET = 24,
+ DMPAPER_DSHEET = 25,
+ DMPAPER_ESHEET = 26,
+ DMPAPER_ENV_DL = 27,
+ DMPAPER_ENV_C5 = 28,
+ DMPAPER_ENV_C3 = 29,
+ DMPAPER_ENV_C4 = 30,
+ DMPAPER_ENV_C6 = 31,
+ DMPAPER_ENV_C65 = 32,
+ DMPAPER_ENV_B4 = 33,
+ DMPAPER_ENV_B5 = 34,
+ DMPAPER_ENV_B6 = 35,
+ DMPAPER_ENV_ITALY = 36,
+ DMPAPER_ENV_MONARCH = 37,
+ DMPAPER_ENV_PERSONAL = 38,
+ DMPAPER_FANFOLD_US = 39,
+ DMPAPER_FANFOLD_STD_GERMAN = 40,
+ DMPAPER_FANFOLD_LGL_GERMAN = 41,
+ DMPAPER_ISO_B4 = 42,
+ DMPAPER_JAPANESE_POSTCARD = 43,
+ DMPAPER_9X11 = 44,
+ DMPAPER_10X11 = 45,
+ DMPAPER_15X11 = 46,
+ DMPAPER_ENV_INVITE = 47,
+ DMPAPER_RESERVED_48 = 48,
+ DMPAPER_RESERVED_49 = 49,
+ DMPAPER_LETTER_EXTRA = 50,
+ DMPAPER_LEGAL_EXTRA = 51,
+ DMPAPER_TABLOID_EXTRA = 52,
+ DMPAPER_A4_EXTRA = 53,
+ DMPAPER_LETTER_TRANSVERSE = 54,
+ DMPAPER_A4_TRANSVERSE = 55,
+ DMPAPER_LETTER_EXTRA_TRANSVERSE = 56,
+ DMPAPER_A_PLUS = 57,
+ DMPAPER_B_PLUS = 58,
+ DMPAPER_LETTER_PLUS = 59,
+ DMPAPER_A4_PLUS = 60,
+ DMPAPER_A5_TRANSVERSE = 61,
+ DMPAPER_B5_TRANSVERSE = 62,
+ DMPAPER_A3_EXTRA = 63,
+ DMPAPER_A5_EXTRA = 64,
+ DMPAPER_B5_EXTRA = 65,
+ DMPAPER_A2 = 66,
+ DMPAPER_A3_TRANSVERSE = 67,
+ DMPAPER_A3_EXTRA_TRANSVERSE = 68,
+ DMPAPER_DBL_JAPANESE_POSTCARD = 69,
+ DMPAPER_A6 = 70,
+ DMPAPER_JENV_KAKU2 = 71,
+ DMPAPER_JENV_KAKU3 = 72,
+ DMPAPER_JENV_CHOU3 = 73,
+ DMPAPER_JENV_CHOU4 = 74,
+ DMPAPER_LETTER_ROTATED = 75,
+ DMPAPER_A3_ROTATED = 76,
+ DMPAPER_A4_ROTATED = 77,
+ DMPAPER_A5_ROTATED = 78,
+ DMPAPER_B4_JIS_ROTATED = 79,
+ DMPAPER_B5_JIS_ROTATED = 80,
+ DMPAPER_JAPANESE_POSTCARD_ROTATED = 81,
+ DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED = 82,
+ DMPAPER_A6_ROTATED = 83,
+ DMPAPER_JENV_KAKU2_ROTATED = 84,
+ DMPAPER_JENV_KAKU3_ROTATED = 85,
+ DMPAPER_JENV_CHOU3_ROTATED = 86,
+ DMPAPER_JENV_CHOU4_ROTATED = 87,
+ DMPAPER_B6_JIS = 88,
+ DMPAPER_B6_JIS_ROTATED = 89,
+ DMPAPER_12X11 = 90,
+ DMPAPER_JENV_YOU4 = 91,
+ DMPAPER_JENV_YOU4_ROTATED = 92,
+ DMPAPER_P16K = 93,
+ DMPAPER_P32K = 94,
+ DMPAPER_P32KBIG = 95,
+ DMPAPER_PENV_1 = 96,
+ DMPAPER_PENV_2 = 97,
+ DMPAPER_PENV_3 = 98,
+ DMPAPER_PENV_4 = 99,
+ DMPAPER_PENV_5 = 100,
+ DMPAPER_PENV_6 = 101,
+ DMPAPER_PENV_7 = 102,
+ DMPAPER_PENV_8 = 103,
+ DMPAPER_PENV_9 = 104,
+ DMPAPER_PENV_10 = 105,
+ DMPAPER_P16K_ROTATED = 106,
+ DMPAPER_P32K_ROTATED = 107,
+ DMPAPER_P32KBIG_ROTATED = 108,
+ DMPAPER_PENV_1_ROTATED = 109,
+ DMPAPER_PENV_2_ROTATED = 110,
+ DMPAPER_PENV_3_ROTATED = 111,
+ DMPAPER_PENV_4_ROTATED = 112,
+ DMPAPER_PENV_5_ROTATED = 113,
+ DMPAPER_PENV_6_ROTATED = 114,
+ DMPAPER_PENV_7_ROTATED = 115,
+ DMPAPER_PENV_8_ROTATED = 116,
+ DMPAPER_PENV_9_ROTATED = 117,
+ DMPAPER_PENV_10_ROTATED = 118,
+ DMPAPER_LAST = DMPAPER_PENV_10_ROTATED,
+ DMPAPER_USER = 256
+};
+
+// Conversion table for historic page size values that we don't support.
+// These are deprecated in PPD and strongly discouraged from being used,
+// so convert them to usable page sizes to support older print devices.
+// The paper source orientation will be handled in the QPrintMedia class,
+// we're only concerned about the standard size in QPageSize.
+// _ROTATED = 90 degrees or QPageLayout::Landscape
+// _TRANSVERSE = 180 degrees or QPageLayout::ReversePortrait
+
+static const int qt_windowsConversion[][2] = {
+ {DMPAPER_11X17, DMPAPER_TABLOID}, // = DMPAPER_LEDGER rotated
+ {DMPAPER_A3_EXTRA_TRANSVERSE, DMPAPER_A3_EXTRA},
+ {DMPAPER_A3_ROTATED, DMPAPER_A3},
+ {DMPAPER_A3_TRANSVERSE, DMPAPER_A3},
+ {DMPAPER_A4_ROTATED, DMPAPER_A4},
+ {DMPAPER_A4_TRANSVERSE, DMPAPER_A4},
+ {DMPAPER_A5_ROTATED, DMPAPER_A5},
+ {DMPAPER_A5_TRANSVERSE, DMPAPER_A5},
+ {DMPAPER_A6_ROTATED, DMPAPER_A6},
+ {DMPAPER_B4_JIS_ROTATED, DMPAPER_B4},
+ {DMPAPER_B5_JIS_ROTATED, DMPAPER_B5},
+ {DMPAPER_B5_TRANSVERSE, DMPAPER_B5},
+ {DMPAPER_B6_JIS_ROTATED, DMPAPER_B6_JIS},
+ {DMPAPER_DBL_JAPANESE_POSTCARD_ROTATED, DMPAPER_DBL_JAPANESE_POSTCARD},
+ {DMPAPER_JAPANESE_POSTCARD_ROTATED, DMPAPER_JAPANESE_POSTCARD},
+ {DMPAPER_JENV_CHOU3_ROTATED, DMPAPER_JENV_CHOU3},
+ {DMPAPER_JENV_CHOU4_ROTATED, DMPAPER_JENV_CHOU4},
+ {DMPAPER_JENV_KAKU2_ROTATED, DMPAPER_JENV_KAKU2},
+ {DMPAPER_JENV_KAKU3_ROTATED, DMPAPER_JENV_KAKU3},
+ {DMPAPER_JENV_YOU4_ROTATED, DMPAPER_JENV_YOU4},
+ {DMPAPER_LETTER_EXTRA_TRANSVERSE, DMPAPER_LETTER_EXTRA},
+ {DMPAPER_LETTER_ROTATED, DMPAPER_LETTER},
+ {DMPAPER_LETTER_TRANSVERSE, DMPAPER_LETTER},
+ {DMPAPER_P16K_ROTATED, DMPAPER_P16K},
+ {DMPAPER_P32K_ROTATED, DMPAPER_P32K},
+ {DMPAPER_P32KBIG_ROTATED, DMPAPER_P32KBIG},
+ {DMPAPER_PENV_1_ROTATED, DMPAPER_PENV_1},
+ {DMPAPER_PENV_2_ROTATED, DMPAPER_PENV_2},
+ {DMPAPER_PENV_3_ROTATED, DMPAPER_PENV_3},
+ {DMPAPER_PENV_4_ROTATED, DMPAPER_PENV_4},
+ {DMPAPER_PENV_5_ROTATED, DMPAPER_PENV_5},
+ {DMPAPER_PENV_6_ROTATED, DMPAPER_PENV_6},
+ {DMPAPER_PENV_7_ROTATED, DMPAPER_PENV_7},
+ {DMPAPER_PENV_8_ROTATED, DMPAPER_PENV_8},
+ {DMPAPER_PENV_9_ROTATED, DMPAPER_PENV_9},
+ {DMPAPER_PENV_10_ROTATED, DMPAPER_PENV_10} // Is = DMPAPER_LAST, use as loop terminator
+};
+
+static const int windowsConversionCount = int(sizeof(qt_windowsConversion) / sizeof(qt_windowsConversion[0]));
+
+// Standard sizes data
+struct StandardPageSize {
+ QPageSize::PageSizeId id;
+ int windowsId; // Windows DMPAPER value
+ QPageSize::Unit definitionUnits; // Standard definition size, e.g. ISO uses mm, ANSI uses inches
+ int widthPoints;
+ int heightPoints;
+ qreal widthMillimeters;
+ qreal heightMillimeters;
+ qreal widthInches;
+ qreal heightInches;
+ const char *mediaOption; // PPD standard mediaOption ID
+};
+
+// Standard page sizes taken from the Postscript PPD Standard v4.3
+// See http://partners.adobe.com/public/developer/en/ps/5003.PPD_Spec_v4.3.pdf
+// Excludes all Transverse and Rotated sizes
+// NB! This table needs to be in sync with QPageSize::PageSizeId
+static const StandardPageSize qt_pageSizes[] = {
+
+ // Existing Qt sizes including ISO, US, ANSI and other standards
+ {QPageSize::A4 , DMPAPER_A4 , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4"},
+ {QPageSize::B5 , DMPAPER_NONE , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "ISOB5"},
+ {QPageSize::Letter , DMPAPER_LETTER , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Letter"},
+ {QPageSize::Legal , DMPAPER_LEGAL , QPageSize::Inch , 612, 1008, 215.9, 355.6, 8.5 , 14 , "Legal"},
+ {QPageSize::Executive , DMPAPER_NONE , QPageSize::Inch , 540, 720, 190.5, 254 , 7.5 , 10 , "Executive.7.5x10in"}, // Qt size differs from Postscript / Windows
+ {QPageSize::A0 , DMPAPER_NONE , QPageSize::Millimeter, 2384, 3370, 841 , 1189 , 33.11, 46.81, "A0"},
+ {QPageSize::A1 , DMPAPER_NONE , QPageSize::Millimeter, 1684, 2384, 594 , 841 , 23.39, 33.11, "A1"},
+ {QPageSize::A2 , DMPAPER_A2 , QPageSize::Millimeter, 1191, 1684, 420 , 594 , 16.54, 23.39, "A2"},
+ {QPageSize::A3 , DMPAPER_A3 , QPageSize::Millimeter, 842, 1191, 297 , 420 , 11.69, 16.54, "A3"},
+ {QPageSize::A5 , DMPAPER_A5 , QPageSize::Millimeter, 420, 595, 148 , 210 , 5.83, 8.27, "A5"},
+ {QPageSize::A6 , DMPAPER_A6 , QPageSize::Millimeter, 297, 420, 105 , 148 , 4.13, 5.83, "A6"},
+ {QPageSize::A7 , DMPAPER_NONE , QPageSize::Millimeter, 210, 297, 74 , 105 , 2.91, 4.13, "A7"},
+ {QPageSize::A8 , DMPAPER_NONE , QPageSize::Millimeter, 148, 210, 52 , 74 , 2.05, 2.91, "A8"},
+ {QPageSize::A9 , DMPAPER_NONE , QPageSize::Millimeter, 105, 148, 37 , 52 , 1.46, 2.05, "A9"},
+ {QPageSize::B0 , DMPAPER_NONE , QPageSize::Millimeter, 2835, 4008, 1000 , 1414 , 39.37, 55.67, "ISOB0"},
+ {QPageSize::B1 , DMPAPER_NONE , QPageSize::Millimeter, 2004, 2835, 707 , 1000 , 27.83, 39.37, "ISOB1"},
+ {QPageSize::B10 , DMPAPER_NONE , QPageSize::Millimeter, 88, 125, 31 , 44 , 1.22, 1.73, "ISOB10"},
+ {QPageSize::B2 , DMPAPER_NONE , QPageSize::Millimeter, 1417, 2004, 500 , 707 , 19.68, 27.83, "ISOB2"},
+ {QPageSize::B3 , DMPAPER_NONE , QPageSize::Millimeter, 1001, 1417, 353 , 500 , 13.9 , 19.68, "ISOB3"},
+ {QPageSize::B4 , DMPAPER_ISO_B4 , QPageSize::Millimeter, 709, 1001, 250 , 353 , 9.84, 13.9 , "ISOB4"},
+ {QPageSize::B6 , DMPAPER_NONE , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.92, 6.93, "ISOB6"},
+ {QPageSize::B7 , DMPAPER_NONE , QPageSize::Millimeter, 249, 354, 88 , 125 , 3.46, 4.92, "ISOB7"},
+ {QPageSize::B8 , DMPAPER_NONE , QPageSize::Millimeter, 176, 249, 62 , 88 , 2.44, 3.46, "ISOB8"},
+ {QPageSize::B9 , DMPAPER_NONE , QPageSize::Millimeter, 125, 176, 44 , 62 , 1.73, 2.44, "ISOB9"},
+ {QPageSize::C5E , DMPAPER_ENV_C5 , QPageSize::Millimeter, 459, 649, 162 , 229 , 6.38, 9.02, "EnvC5"},
+ {QPageSize::Comm10E , DMPAPER_ENV_10 , QPageSize::Inch , 297, 684, 104.8, 241.3, 4.12, 9.5 , "Env10"},
+ {QPageSize::DLE , DMPAPER_ENV_DL , QPageSize::Millimeter, 312, 624, 110 , 220 , 4.33, 8.66, "EnvDL"},
+ {QPageSize::Folio , DMPAPER_NONE , QPageSize::Millimeter, 595, 935, 210 , 330 , 8.27, 13 , "Folio"},
+ {QPageSize::Ledger , DMPAPER_LEDGER , QPageSize::Inch , 1224, 792, 431.8, 279.4, 17 , 11 , "Ledger"},
+ {QPageSize::Tabloid , DMPAPER_TABLOID , QPageSize::Inch , 792, 1224, 279.4, 431.8, 11 , 17 , "Tabloid"},
+ {QPageSize::Custom , DMPAPER_USER , QPageSize::Millimeter, -1, -1, -1. , -1 , -1 , -1 , "Custom"}, // Special case to keep in sync with QPageSize::PageSizeId
+
+ // ISO Standard Sizes
+ {QPageSize::A10 , DMPAPER_NONE , QPageSize::Millimeter, 73, 105, 26 , 37 , 1.02, 1.46, "A10"},
+ {QPageSize::A3Extra , DMPAPER_A3_EXTRA , QPageSize::Millimeter, 913, 1262, 322 , 445 , 12.67, 17.52, "A3Extra"},
+ {QPageSize::A4Extra , DMPAPER_A4_EXTRA , QPageSize::Millimeter, 667, 914, 235.5, 322.3, 9.27, 12.69, "A4Extra"},
+ {QPageSize::A4Plus , DMPAPER_A4_PLUS , QPageSize::Millimeter, 595, 936, 210 , 330 , 8.27, 13 , "A4Plus"},
+ {QPageSize::A4Small , DMPAPER_A4SMALL , QPageSize::Millimeter, 595, 842, 210 , 297 , 8.27, 11.69, "A4Small"},
+ {QPageSize::A5Extra , DMPAPER_A5_EXTRA , QPageSize::Millimeter, 492, 668, 174 , 235 , 6.85, 9.25, "A5Extra"},
+ {QPageSize::B5Extra , DMPAPER_B5_EXTRA , QPageSize::Millimeter, 570, 782, 201 , 276 , 7.9 , 10.8 , "ISOB5Extra"},
+
+ // JIS Standard Sizes
+ {QPageSize::JisB0 , DMPAPER_NONE , QPageSize::Millimeter, 2920, 4127, 1030 , 1456 , 40.55, 57.32, "B0"},
+ {QPageSize::JisB1 , DMPAPER_NONE , QPageSize::Millimeter, 2064, 2920, 728 , 1030 , 28.66, 40.55, "B1"},
+ {QPageSize::JisB2 , DMPAPER_NONE , QPageSize::Millimeter, 1460, 2064, 515 , 728 , 20.28, 28.66, "B2"},
+ {QPageSize::JisB3 , DMPAPER_NONE , QPageSize::Millimeter, 1032, 1460, 364 , 515 , 14.33, 20.28, "B3"},
+ {QPageSize::JisB4 , DMPAPER_B4 , QPageSize::Millimeter, 729, 1032, 257 , 364 , 10.12, 14.33, "B4"},
+ {QPageSize::JisB5 , DMPAPER_B5 , QPageSize::Millimeter, 516, 729, 182 , 257 , 7.17, 10.12, "B5"},
+ {QPageSize::JisB6 , DMPAPER_B6_JIS , QPageSize::Millimeter, 363, 516, 128 , 182 , 5.04, 7.17, "B6"},
+ {QPageSize::JisB7 , DMPAPER_NONE , QPageSize::Millimeter, 258, 363, 91 , 128 , 3.58, 5.04, "B7"},
+ {QPageSize::JisB8 , DMPAPER_NONE , QPageSize::Millimeter, 181, 258, 64 , 91 , 2.52, 3.58, "B8"},
+ {QPageSize::JisB9 , DMPAPER_NONE , QPageSize::Millimeter, 127, 181, 45 , 64 , 1.77, 2.52, "B9"},
+ {QPageSize::JisB10 , DMPAPER_NONE , QPageSize::Millimeter, 91, 127, 32 , 45 , 1.26, 1.77, "B10"},
+
+ // ANSI / US Standard sizes
+ {QPageSize::AnsiC , DMPAPER_NONE , QPageSize::Inch , 1224, 1584, 431.8, 558.8, 17 , 22 , "AnsiC"},
+ {QPageSize::AnsiD , DMPAPER_NONE , QPageSize::Inch , 1584, 2448, 558.8, 863.6, 22 , 34 , "AnsiD"},
+ {QPageSize::AnsiE , DMPAPER_NONE , QPageSize::Inch , 2448, 3168, 863.6, 1118 , 34 , 44 , "AnsiE"},
+ {QPageSize::LegalExtra , DMPAPER_LEGAL_EXTRA , QPageSize::Inch , 684, 1080, 241.3, 381 , 9.5 , 15 , "LegalExtra"},
+ {QPageSize::LetterExtra , DMPAPER_LETTER_EXTRA , QPageSize::Inch , 684, 864, 241.3, 304.8, 9.5 , 12 , "LetterExtra"},
+ {QPageSize::LetterPlus , DMPAPER_LETTER_PLUS , QPageSize::Inch , 612, 914, 215.9, 322.3, 8.5 , 12.69, "LetterPlus"},
+ {QPageSize::LetterSmall , DMPAPER_LETTERSMALL , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "LetterSmall"},
+ {QPageSize::TabloidExtra , DMPAPER_TABLOID_EXTRA , QPageSize::Inch , 864, 1296, 304.8, 457.2, 12 , 18 , "TabloidExtra"},
+
+ // Architectural sizes
+ {QPageSize::ArchA , DMPAPER_NONE , QPageSize::Inch , 648, 864, 228.6, 304.8, 9 , 12 , "ARCHA"},
+ {QPageSize::ArchB , DMPAPER_NONE , QPageSize::Inch , 864, 1296, 304.8, 457.2, 12 , 18 , "ARCHB"},
+ {QPageSize::ArchC , DMPAPER_CSHEET , QPageSize::Inch , 1296, 1728, 457.2, 609.6, 18 , 24 , "ARCHC"},
+ {QPageSize::ArchD , DMPAPER_DSHEET , QPageSize::Inch , 1728, 2592, 609.6, 914.4, 24 , 36 , "ARCHD"},
+ {QPageSize::ArchE , DMPAPER_ESHEET , QPageSize::Inch , 2592, 3456, 914.4, 1219 , 36 , 48 , "ARCHE"},
+
+ // Inch-based Sizes
+ {QPageSize::Imperial7x9 , DMPAPER_NONE , QPageSize::Inch , 504, 648, 177.8, 228.6, 7 , 9 , "7x9"},
+ {QPageSize::Imperial8x10 , DMPAPER_NONE , QPageSize::Inch , 576, 720, 203.2, 254 , 8 , 10 , "8x10"},
+ {QPageSize::Imperial9x11 , DMPAPER_9X11 , QPageSize::Inch , 648, 792, 228.6, 279.4, 9 , 11 , "9x11"},
+ {QPageSize::Imperial9x12 , DMPAPER_NONE , QPageSize::Inch , 648, 864, 228.6, 304.8, 9 , 12 , "9x12"},
+ {QPageSize::Imperial10x11 , DMPAPER_10X11 , QPageSize::Inch , 720, 792, 254 , 279.4, 10 , 11 , "10x11"},
+ {QPageSize::Imperial10x13 , DMPAPER_NONE , QPageSize::Inch , 720, 936, 254 , 330.2, 10 , 13 , "10x13"},
+ {QPageSize::Imperial10x14 , DMPAPER_10X14 , QPageSize::Inch , 720, 1008, 254 , 355.6, 10 , 14 , "10x14"},
+ {QPageSize::Imperial12x11 , DMPAPER_12X11 , QPageSize::Inch , 864, 792, 304.8, 279.4, 12 , 11 , "12x11"},
+ {QPageSize::Imperial15x11 , DMPAPER_15X11 , QPageSize::Inch , 1080, 792, 381 , 279.4, 15 , 11 , "15x11"},
+
+ // Other Page Sizes
+ {QPageSize::ExecutiveStandard , DMPAPER_EXECUTIVE , QPageSize::Inch , 522, 756, 184.2, 266.7, 7.25, 10.5 , "Executive"}, // Qt size differs from Postscript / Windows
+ {QPageSize::Note , DMPAPER_NOTE , QPageSize::Inch , 612, 792, 215.9, 279.4, 8.5 , 11 , "Note"},
+ {QPageSize::Quarto , DMPAPER_QUARTO , QPageSize::Inch , 610, 780, 215.9, 275.1, 8.5 , 10.83, "Quarto"},
+ {QPageSize::Statement , DMPAPER_STATEMENT , QPageSize::Inch , 396, 612, 139.7, 215.9, 5.5 , 8.5 , "Statement"},
+ {QPageSize::SuperA , DMPAPER_A_PLUS , QPageSize::Millimeter, 643, 1009, 227 , 356 , 8.94, 14 , "SuperA"},
+ {QPageSize::SuperB , DMPAPER_B_PLUS , QPageSize::Millimeter, 864, 1380, 305 , 487 , 12 , 19.17, "SuperB"},
+ {QPageSize::Postcard , DMPAPER_JAPANESE_POSTCARD , QPageSize::Millimeter, 284, 419, 100 , 148 , 3.94, 5.83, "Postcard"},
+ {QPageSize::DoublePostcard , DMPAPER_DBL_JAPANESE_POSTCARD, QPageSize::Millimeter, 567, 419, 200 , 148 , 7.87, 5.83, "DoublePostcard"},
+ {QPageSize::Prc16K , DMPAPER_P16K , QPageSize::Millimeter, 414, 610, 146 , 215 , 5.75, 8.5 , "PRC16K"},
+ {QPageSize::Prc32K , DMPAPER_P32K , QPageSize::Millimeter, 275, 428, 97 , 151 , 3.82, 5.95, "PRC32K"},
+ {QPageSize::Prc32KBig , DMPAPER_P32KBIG , QPageSize::Millimeter, 275, 428, 97 , 151 , 3.82, 5.95, "PRC32KBig"},
+
+ // Fan Fold Sizes
+ {QPageSize::FanFoldUS , DMPAPER_FANFOLD_US , QPageSize::Inch , 1071, 792, 377.8, 279.4, 14.875, 11 , "FanFoldUS"},
+ {QPageSize::FanFoldGerman , DMPAPER_FANFOLD_STD_GERMAN , QPageSize::Inch , 612, 864, 215.9, 304.8, 8.5 , 12 , "FanFoldGerman"},
+ {QPageSize::FanFoldGermanLegal, DMPAPER_FANFOLD_LGL_GERMAN , QPageSize::Inch , 612, 936, 215.9, 330 , 8.5 , 13 , "FanFoldGermanLegal"},
+
+ // ISO Envelopes
+ {QPageSize::EnvelopeB4 , DMPAPER_ENV_B4 , QPageSize::Millimeter, 708, 1001, 250 , 353 , 9.84, 13.9 , "EnvISOB4"},
+ {QPageSize::EnvelopeB5 , DMPAPER_ENV_B5 , QPageSize::Millimeter, 499, 709, 176 , 250 , 6.9 , 9.8 , "EnvISOB5"},
+ {QPageSize::EnvelopeB6 , DMPAPER_ENV_B6 , QPageSize::Millimeter, 499, 354, 176 , 125 , 6.9 , 4.9 , "EnvISOB6"},
+ {QPageSize::EnvelopeC0 , DMPAPER_NONE , QPageSize::Millimeter, 2599, 3676, 917 , 1297 , 36.1 , 51.06, "EnvC0"},
+ {QPageSize::EnvelopeC1 , DMPAPER_NONE , QPageSize::Millimeter, 1837, 2599, 648 , 917 , 25.51, 36.1 , "EnvC1"},
+ {QPageSize::EnvelopeC2 , DMPAPER_NONE , QPageSize::Millimeter, 1298, 1837, 458 , 648 , 18.03, 25.51, "EnvC2"},
+ {QPageSize::EnvelopeC3 , DMPAPER_ENV_C3 , QPageSize::Millimeter, 918, 1296, 324 , 458 , 12.75, 18.03, "EnvC3"},
+ {QPageSize::EnvelopeC4 , DMPAPER_ENV_C4 , QPageSize::Millimeter, 649, 918, 229 , 324 , 9.02, 12.75, "EnvC4"},
+ {QPageSize::EnvelopeC6 , DMPAPER_ENV_C6 , QPageSize::Millimeter, 323, 459, 114 , 162 , 4.49, 6.38, "EnvC6"},
+ {QPageSize::EnvelopeC65 , DMPAPER_ENV_C65 , QPageSize::Millimeter, 324, 648, 114 , 229 , 4.5 , 9 , "EnvC65"},
+ {QPageSize::EnvelopeC7 , DMPAPER_NONE , QPageSize::Millimeter, 230, 323, 81 , 114 , 3.19, 4.49, "EnvC7"},
+
+ // US Envelopes
+ {QPageSize::Envelope9 , DMPAPER_ENV_9 , QPageSize::Inch , 279, 639, 98.4, 225.4, 3.875, 8.875, "Env9"},
+ {QPageSize::Envelope11 , DMPAPER_ENV_11 , QPageSize::Inch , 324, 747, 114.3, 263.5, 4.5 , 10.375, "Env11"},
+ {QPageSize::Envelope12 , DMPAPER_ENV_12 , QPageSize::Inch , 342, 792, 120.7, 279.4, 4.75, 11 , "Env12"},
+ {QPageSize::Envelope14 , DMPAPER_ENV_14 , QPageSize::Inch , 360, 828, 127 , 292.1, 5 , 11.5 , "Env14"},
+ {QPageSize::EnvelopeMonarch , DMPAPER_ENV_MONARCH , QPageSize::Inch , 279, 540, 98.43, 190.5, 3.875, 7.5 , "EnvMonarch"},
+ {QPageSize::EnvelopePersonal , DMPAPER_ENV_PERSONAL , QPageSize::Inch , 261, 468, 92.08, 165.1, 3.625, 6.5 , "EnvPersonal"},
+
+ // Other Envelopes
+ {QPageSize::EnvelopeChou3 , DMPAPER_JENV_CHOU3 , QPageSize::Millimeter, 340, 666, 120 , 235 , 4.72, 9.25, "EnvChou3"},
+ {QPageSize::EnvelopeChou4 , DMPAPER_JENV_CHOU4 , QPageSize::Millimeter, 255, 581, 90 , 205 , 3.54, 8 , "EnvChou4"},
+ {QPageSize::EnvelopeInvite , DMPAPER_ENV_INVITE , QPageSize::Millimeter, 624, 624, 220 , 220 , 8.66, 8.66, "EnvInvite"},
+ {QPageSize::EnvelopeItalian , DMPAPER_ENV_ITALY , QPageSize::Millimeter, 312, 652, 110 , 230 , 4.33, 9 , "EnvItalian"},
+ {QPageSize::EnvelopeKaku2 , DMPAPER_JENV_KAKU2 , QPageSize::Millimeter, 680, 941, 240 , 332 , 9.45, 13 , "EnvKaku2"},
+ {QPageSize::EnvelopeKaku3 , DMPAPER_JENV_KAKU3 , QPageSize::Millimeter, 612, 785, 216 , 277 , 8.5 , 10.9 , "EnvKaku3"},
+ {QPageSize::EnvelopePrc1 , DMPAPER_PENV_1 , QPageSize::Millimeter, 289, 468, 102 , 165 , 4 , 6.5 , "EnvPRC1"},
+ {QPageSize::EnvelopePrc2 , DMPAPER_PENV_2 , QPageSize::Millimeter, 289, 499, 102 , 176 , 4 , 6.9 , "EnvPRC2"},
+ {QPageSize::EnvelopePrc3 , DMPAPER_PENV_3 , QPageSize::Millimeter, 354, 499, 125 , 176 , 4.9 , 6.9 , "EnvPRC3"},
+ {QPageSize::EnvelopePrc4 , DMPAPER_PENV_4 , QPageSize::Millimeter, 312, 590, 110 , 208 , 4.33, 8.2 , "EnvPRC4"},
+ {QPageSize::EnvelopePrc5 , DMPAPER_PENV_5 , QPageSize::Millimeter, 312, 624, 110 , 220 , 4.33, 8.66, "EnvPRC5"},
+ {QPageSize::EnvelopePrc6 , DMPAPER_PENV_6 , QPageSize::Millimeter, 340, 652, 120 , 230 , 4.7 , 9 , "EnvPRC6"},
+ {QPageSize::EnvelopePrc7 , DMPAPER_PENV_7 , QPageSize::Millimeter, 454, 652, 160 , 230 , 6.3 , 9 , "EnvPRC7"},
+ {QPageSize::EnvelopePrc8 , DMPAPER_PENV_8 , QPageSize::Millimeter, 340, 876, 120 , 309 , 4.7 , 12.2 , "EnvPRC8"},
+ {QPageSize::EnvelopePrc9 , DMPAPER_PENV_9 , QPageSize::Millimeter, 649, 918, 229 , 324 , 9 , 12.75, "EnvPRC9"},
+ {QPageSize::EnvelopePrc10 , DMPAPER_PENV_10 , QPageSize::Millimeter, 918, 1298, 324 , 458 , 12.75, 18 , "EnvPRC10"},
+ {QPageSize::EnvelopeYou4 , DMPAPER_JENV_YOU4 , QPageSize::Millimeter, 298, 666, 105 , 235 , 4.13, 9.25, "EnvYou4"}
+};
+
+static const int pageSizesCount = int(sizeof(qt_pageSizes) / sizeof(qt_pageSizes[0]));
+
+// Return key name for PageSize
+static QString qt_keyForPageSizeId(QPageSize::PageSizeId id)
+{
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ return QString::fromLatin1(qt_pageSizes[id].mediaOption);
+}
+
+// Return id name for PPD Key
+static QPageSize::PageSizeId qt_idForPpdKey(const QString &ppdKey, QSize *match = 0)
+{
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ if (ppdKey.isEmpty())
+ return QPageSize::Custom;
+ QString key = ppdKey;
+ // Remove any Rotated or Tranverse modifiers
+ if (key.endsWith(QStringLiteral("Rotated")))
+ key.chop(7);
+ else if (key.endsWith(QStringLiteral(".Transverse")))
+ key.chop(11);
+ for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) {
+ if (QLatin1String(qt_pageSizes[i].mediaOption) == key) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+ return QPageSize::Custom;
+}
+
+// Return id name for Windows ID
+static QPageSize::PageSizeId qt_idForWindowsID(int windowsId, QSize *match = 0)
+{
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ // If outside known values then is Custom
+ if (windowsId <= DMPAPER_NONE || windowsId > DMPAPER_LAST)
+ return QPageSize::Custom;
+ // Check if one of the unsupported values, convert to valid value if is
+ for (int i = 0; i < windowsConversionCount; ++i) {
+ if (qt_windowsConversion[i][0] == windowsId) {
+ windowsId = qt_windowsConversion[i][1];
+ break;
+ }
+ }
+ // Look for the value in our supported size table
+ for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) {
+ if (qt_pageSizes[i].windowsId == windowsId) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+ // Otherwise is Custom
+ return QPageSize::Custom;
+}
+
+// Return key name for custom size
+static QString qt_keyForCustomSize(const QSizeF &size, QPageSize::Unit units)
+{
+ // PPD custom format
+ QString key = QStringLiteral("Custom.%1x%2%3");
+ QString abbrev;
+ switch (units) {
+ case QPageSize::Millimeter:
+ abbrev = QStringLiteral("mm");
+ break;
+ case QPageSize::Point:
+ break;
+ case QPageSize::Inch:
+ abbrev = QStringLiteral("in");
+ break;
+ case QPageSize::Pica:
+ abbrev = QStringLiteral("pc");
+ break;
+ case QPageSize::Didot:
+ abbrev = QStringLiteral("DD");
+ break;
+ case QPageSize::Cicero:
+ abbrev = QStringLiteral("CC");
+ break;
+ }
+ // Assumes size is already max 2 decimal places
+ return key.arg(size.width()).arg(size.height()).arg(abbrev);
+}
+
+// Return localized name for custom size
+static QString qt_nameForCustomSize(const QSizeF &size, QPageSize::Unit units)
+{
+ QString name;
+ switch (units) {
+ case QPageSize::Millimeter:
+ //: Custom size name in millimeters
+ name = QCoreApplication::translate("QPageSize", "Custom (%1mm x %2mm)");
+ break;
+ case QPageSize::Point:
+ //: Custom size name in points
+ name = QCoreApplication::translate("QPageSize", "Custom (%1pt x %2pt)");
+ break;
+ case QPageSize::Inch:
+ //: Custom size name in inches
+ name = QCoreApplication::translate("QPageSize", "Custom (%1in x %2in)");
+ break;
+ case QPageSize::Pica:
+ //: Custom size name in picas
+ name = QCoreApplication::translate("QPageSize", "Custom (%1pc x %2pc)");
+ break;
+ case QPageSize::Didot:
+ //: Custom size name in didots
+ name = QCoreApplication::translate("QPageSize", "Custom (%1DD x %2DD)");
+ break;
+ case QPageSize::Cicero:
+ //: Custom size name in ciceros
+ name = QCoreApplication::translate("QPageSize", "Custom (%1CC x %2CC)");
+ break;
+ }
+ // Assumes size is already max 2 decimal places
+ return name.arg(size.width()).arg(size.height());
+}
+
+// Multiplier for converting units to points.
+static qreal qt_pointMultiplier(QPageSize::Unit unit)
+{
+ switch (unit) {
+ case QPageSize::Millimeter:
+ return 2.83464566929;
+ case QPageSize::Point:
+ return 1.0;
+ case QPageSize::Inch:
+ return 72.0;
+ case QPageSize::Pica:
+ return 12;
+ case QPageSize::Didot:
+ return 1.065826771;
+ case QPageSize::Cicero:
+ return 12.789921252;
+ }
+ return 1.0;
+}
+
+// Multiplier for converting pixels to points.
+Q_GUI_EXPORT qreal qt_pixelMultiplier(int resolution)
+{
+ return resolution <= 0 ? 1.0 : 72.0 / resolution;
+}
+
+static QSizeF qt_definitionSize(QPageSize::PageSizeId pageSizeId)
+{
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ QPageSize::Unit units = qt_pageSizes[pageSizeId].definitionUnits;
+ if (units == QPageSize::Millimeter)
+ return QSizeF(qt_pageSizes[pageSizeId].widthMillimeters, qt_pageSizes[pageSizeId].heightMillimeters);
+ Q_ASSERT(units == QPageSize::Inch); // We currently only support definitions in mm or inches
+ return QSizeF(qt_pageSizes[pageSizeId].widthInches, qt_pageSizes[pageSizeId].heightInches);
+}
+
+static QSizeF qt_convertUnits(const QSizeF &size, QPageSize::Unit fromUnits, QPageSize::Unit toUnits)
+{
+ if (!size.isValid())
+ return QSizeF();
+
+ // If the units are the same or the size is 0, then don't need to convert
+ if (fromUnits == toUnits || (qFuzzyIsNull(size.width()) && qFuzzyIsNull(size.height())))
+ return size;
+
+ QSizeF newSize = size;
+ // First convert to points
+ if (fromUnits != QPageSize::Point) {
+ const qreal multiplier = qt_pointMultiplier(fromUnits);
+ newSize = newSize * multiplier;
+ }
+ // Then convert from points to required units
+ const qreal multiplier = qt_pointMultiplier(toUnits);
+ // Try force to 2 decimal places for consistency
+ const int width = qRound(newSize.width() * 100 / multiplier);
+ const int height = qRound(newSize.height() * 100 / multiplier);
+ return QSizeF(width / 100.0, height / 100.0);
+}
+
+static QSize qt_convertUnitsToPoints(const QSizeF &size, QPageSize::Unit units)
+{
+ if (!size.isValid())
+ return QSize();
+ return QSizeF(size * qt_pointMultiplier(units)).toSize();
+}
+
+static QSize qt_convertPointsToPixels(const QSize &size, int resolution)
+{
+ if (!size.isValid() || resolution <= 0)
+ return QSize();
+ const qreal multiplier = qt_pixelMultiplier(resolution);
+ return QSize(qRound(size.width() / multiplier), qRound(size.height() / multiplier));
+}
+
+static QSizeF qt_convertPointsToUnits(const QSize &size, QPageSize::Unit units)
+{
+ if (!size.isValid())
+ return QSizeF();
+ const qreal multiplier = qt_pointMultiplier(units);
+ // Try force to 2 decimal places for consistency
+ const int width = qRound(size.width() * 100 / multiplier);
+ const int height = qRound(size.height() * 100 / multiplier);
+ return QSizeF(width / 100.0, height / 100.0);
+}
+
+static QSizeF qt_unitSize(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units)
+{
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ switch (units) {
+ case QPageSize::Millimeter:
+ return QSizeF(qt_pageSizes[pageSizeId].widthMillimeters, qt_pageSizes[pageSizeId].heightMillimeters);
+ case QPageSize::Point:
+ return QSizeF(qt_pageSizes[pageSizeId].widthPoints, qt_pageSizes[pageSizeId].heightPoints);
+ case QPageSize::Inch:
+ return QSizeF(qt_pageSizes[pageSizeId].widthInches, qt_pageSizes[pageSizeId].heightInches);
+ case QPageSize::Pica:
+ case QPageSize::Didot:
+ case QPageSize::Cicero:
+ return qt_convertPointsToUnits(QSize(qt_pageSizes[pageSizeId].widthPoints,
+ qt_pageSizes[pageSizeId].heightPoints), units);
+ }
+ return QSizeF();
+}
+
+// Find matching standard page size for point size
+static QPageSize::PageSizeId qt_idForPointSize(const QSize &size, QPageSize::SizeMatchPolicy matchPolicy, QSize *match)
+{
+ if (!size.isValid())
+ return QPageSize::Custom;
+
+ // Try exact match in portrait layout
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ for (int i = 0; i <= int(QPageSize::LastPageSize); ++i) {
+ if (size.width() == qt_pageSizes[i].widthPoints && size.height() == qt_pageSizes[i].heightPoints) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+
+ // If no exact match only try fuzzy if asked
+ if (matchPolicy != QPageSize::ExactMatch) {
+ // Set up the fuzzy tolerance
+ // TODO Use ISO standard tolerance based on page size?
+ const int tolerance = 3; // = approx 1mm
+ const int minWidth = size.width() - tolerance;
+ const int maxWidth = size.width() + tolerance;
+ const int minHeight = size.height() - tolerance;
+ const int maxHeight = size.height() + tolerance;
+
+ // First try fuzzy match in portrait layout
+ for (int i = 0; i <= QPageSize::LastPageSize; ++i) {
+ const int width = qt_pageSizes[i].widthPoints;
+ const int height = qt_pageSizes[i].heightPoints;
+ if (width >= minWidth && width <= maxWidth && height >= minHeight && height <= maxHeight) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+
+ // If FuzzyOrientationMatch then try rotated sizes
+ if (matchPolicy == QPageSize::FuzzyOrientationMatch) {
+ // First try exact match in landscape layout
+ for (int i = 0; i <= QPageSize::LastPageSize; ++i) {
+ if (size.width() == qt_pageSizes[i].heightPoints && size.height() == qt_pageSizes[i].widthPoints) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+
+ // Then try fuzzy match in landscape layout
+ for (int i = 0; i <= QPageSize::LastPageSize; ++i) {
+ const int width = qt_pageSizes[i].heightPoints;
+ const int height = qt_pageSizes[i].widthPoints;
+ if (width >= minWidth && width <= maxWidth && height >= minHeight && height <= maxHeight) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+ }
+ }
+
+ if (match)
+ *match = size;
+ // Otherwise no match so Custom
+ return QPageSize::Custom;
+}
+
+// Find matching standard page size for point size
+static QPageSize::PageSizeId qt_idForSize(const QSizeF &size, QPageSize::Unit units,
+ QPageSize::SizeMatchPolicy matchPolicy, QSize *match)
+{
+ if (!size.isValid())
+ return QPageSize::Custom;
+
+ // Try exact match if units are the same
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ if (units == QPageSize::Millimeter) {
+ for (int i = 0; i <= QPageSize::LastPageSize; ++i) {
+ if (size.width() == qt_pageSizes[i].widthMillimeters && size.height() == qt_pageSizes[i].heightMillimeters) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+ } else if (units == QPageSize::Inch) {
+ for (int i = 0; i <= QPageSize::LastPageSize; ++i) {
+ if (size.width() == qt_pageSizes[i].widthInches && size.height() == qt_pageSizes[i].heightInches) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+ } else if (units == QPageSize::Point) {
+ for (int i = 0; i <= QPageSize::LastPageSize; ++i) {
+ if (size.width() == qt_pageSizes[i].widthPoints && size.height() == qt_pageSizes[i].heightPoints) {
+ if (match)
+ *match = QSize(qt_pageSizes[i].widthPoints, qt_pageSizes[i].heightPoints);
+ return qt_pageSizes[i].id;
+ }
+ }
+ }
+
+ // If no exact match then convert to points and try match those
+ QSize points = qt_convertUnitsToPoints(size, units);
+ return qt_idForPointSize(points, matchPolicy, match);
+}
+
+class QPageSizePrivate : public QSharedData
+{
+public:
+ QPageSizePrivate();
+ explicit QPageSizePrivate(QPageSize::PageSizeId pageSizeId);
+ QPageSizePrivate(const QSize &pointSize,
+ const QString &name,
+ QPageSize::SizeMatchPolicy matchPolicy);
+ QPageSizePrivate(const QSizeF &size, QPageSize::Unit units,
+ const QString &name,
+ QPageSize::SizeMatchPolicy matchPolicy);
+ QPageSizePrivate(const QString &key, const QSize &size, const QString &name);
+ QPageSizePrivate(int windowsId, const QSize &pointSize, const QString &name);
+ ~QPageSizePrivate();
+
+ bool operator==(const QPageSizePrivate &other) const;
+ bool isEquivalentTo(const QPageSizePrivate &other) const;
+
+ bool isValid() const;
+
+ QSizeF size(QPageSize::Unit units) const;
+ QSize sizePixels(int resolution) const;
+
+private:
+ friend class QPageSize;
+
+ void init(QPageSize::PageSizeId id, const QString &name);
+ void init(const QSize &size, const QString &name);
+ void init(const QSizeF &size, QPageSize::Unit units, const QString &name);
+
+ QString m_key;
+ QPageSize::PageSizeId m_id;
+ QSize m_pointSize;
+ QString m_name;
+ int m_windowsId;
+ QSizeF m_size;
+ QPageSize::Unit m_units;
+};
+
+QPageSizePrivate::QPageSizePrivate()
+ : m_id(QPageSize::Custom),
+ m_windowsId(0),
+ m_units(QPageSize::Point)
+{
+}
+
+QPageSizePrivate::QPageSizePrivate(QPageSize::PageSizeId pageSizeId)
+ : m_id(QPageSize::Custom),
+ m_windowsId(0),
+ m_units(QPageSize::Point)
+{
+ if (pageSizeId >= QPageSize::PageSizeId(0) && pageSizeId <= QPageSize::LastPageSize)
+ init(pageSizeId, QString());
+}
+
+QPageSizePrivate::QPageSizePrivate(const QSize &pointSize, const QString &name, QPageSize::SizeMatchPolicy matchPolicy)
+ : m_id(QPageSize::Custom),
+ m_windowsId(0),
+ m_units(QPageSize::Point)
+{
+ if (pointSize.isValid()) {
+ QPageSize::PageSizeId id = qt_idForPointSize(pointSize, matchPolicy, 0);
+ id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
+ }
+}
+
+QPageSizePrivate::QPageSizePrivate(const QSizeF &size, QPageSize::Unit units,
+ const QString &name, QPageSize::SizeMatchPolicy matchPolicy)
+ : m_id(QPageSize::Custom),
+ m_windowsId(0),
+ m_units(QPageSize::Point)
+{
+ if (size.isValid()) {
+ QPageSize::PageSizeId id = qt_idForSize(size, units, matchPolicy, 0);
+ id == QPageSize::Custom ? init(size, units, name) : init(id, name);
+ }
+}
+
+QPageSizePrivate::QPageSizePrivate(const QString &key, const QSize &pointSize, const QString &name)
+ : m_id(QPageSize::Custom),
+ m_windowsId(0),
+ m_units(QPageSize::Point)
+{
+ if (!key.isEmpty() && pointSize.isValid()) {
+ QPageSize::PageSizeId id = qt_idForPpdKey(key, 0);
+ // If not a known PPD key, check if size is a standard PPD size
+ if (id == QPageSize::Custom)
+ id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, 0);
+ id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
+ m_key = key;
+ }
+}
+
+QPageSizePrivate::QPageSizePrivate(int windowsId, const QSize &pointSize, const QString &name)
+ : m_id(QPageSize::Custom),
+ m_windowsId(0),
+ m_units(QPageSize::Point)
+{
+ if (windowsId > 0 && pointSize.isValid()) {
+ QPageSize::PageSizeId id = qt_idForWindowsID(windowsId, 0);
+ // If not a known Windows ID, check if size is a standard PPD size
+ if (id == QPageSize::Custom)
+ id = qt_idForPointSize(pointSize, QPageSize::FuzzyMatch, 0);
+ id == QPageSize::Custom ? init(pointSize, name) : init(id, name);
+ m_windowsId = windowsId;
+ }
+}
+
+QPageSizePrivate::~QPageSizePrivate()
+{
+}
+
+// Init a standard PageSizeId
+void QPageSizePrivate::init(QPageSize::PageSizeId id, const QString &name)
+{
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ m_id = id;
+ m_size = qt_definitionSize(id);
+ m_units = qt_pageSizes[id].definitionUnits;
+ m_key = qt_keyForPageSizeId(id);
+ m_name = name.isEmpty() ? QPageSize::name(id) : name;
+ m_windowsId = qt_pageSizes[id].windowsId;
+ m_pointSize = QSize(qt_pageSizes[id].widthPoints, qt_pageSizes[id].heightPoints);
+}
+
+// Init a point size
+void QPageSizePrivate::init(const QSize &size, const QString &name)
+{
+ m_id = QPageSize::Custom;
+ m_size = size;
+ m_units = QPageSize::Point;
+ m_key = qt_keyForCustomSize(m_size, m_units);
+ m_name = name.isEmpty() ? qt_nameForCustomSize(m_size, m_units) : name;
+ m_windowsId = 0;
+ m_pointSize = size;
+}
+
+// Init a unit size
+void QPageSizePrivate::init(const QSizeF &size, QPageSize::Unit units, const QString &name)
+{
+ m_id = QPageSize::Custom;
+ m_size = size;
+ m_units = units;
+ m_key = qt_keyForCustomSize(m_size, m_units);
+ if (name.isEmpty())
+ m_name = qt_nameForCustomSize(m_size, m_units);
+ else
+ m_name = name;
+ m_windowsId = 0;
+ m_pointSize = qt_convertUnitsToPoints(m_size, m_units);
+}
+
+bool QPageSizePrivate::operator==(const QPageSizePrivate &other) const
+{
+ return m_size == other.m_size
+ && m_units == other.m_units
+ && m_key == other.m_key
+ && m_name == other.m_name;
+}
+
+bool QPageSizePrivate::isEquivalentTo(const QPageSizePrivate &other) const
+{
+ return m_pointSize == other.m_pointSize;
+}
+
+bool QPageSizePrivate::isValid() const
+{
+ return m_pointSize.isValid() && !m_key.isEmpty() && !m_name.isEmpty();
+}
+
+QSizeF QPageSizePrivate::size(QPageSize::Unit units) const
+{
+ // If want units we've stored in, we already have them
+ if (units == m_units)
+ return m_size;
+
+ // If want points we already have them
+ if (units == QPageSize::Point)
+ return QSizeF(m_pointSize.width(), m_pointSize.height());
+
+ // If a custom size do a conversion
+ if (m_id == QPageSize::Custom)
+ return qt_convertUnits(m_size, m_units, units);
+
+ // Otherwise use the standard sizes
+ return qt_unitSize(m_id, units);
+}
+
+QSize QPageSizePrivate::sizePixels(int resolution) const
+{
+ return qt_convertPointsToPixels(m_pointSize, resolution);;
+}
+
+
+/*!
+ \class QPageSize
+ \inmodule QtGui
+ \since 5.3
+ \brief The QPageSize class describes the size and name of a defined page size
+
+ This class implements support for the set of standard page sizes as defined
+ in the Adobe Postscript PPD Standard v4.3. It defines the standard set of
+ page sizes in points, millimeters and inches and ensures these sizes are
+ consistently used. Other size units can be used but will be calculated
+ results and so may not always be consistent. The defined point sizes are
+ always a integer, all other sizes can be fractions of a unit.
+
+ The defined size is always in width x height order with no implied page
+ orientation. Note that it is possible for page sizes to be defined where the
+ width is greater than the height, such as QPageSize::Ledger, so you cannot
+ rely on comparing the width and height values to determine page orientation.
+
+ For example, A4 is defined by the standard as 210mm x 297mm, 8.27in x 11.69in,
+ or 595pt x 842pt.
+
+ You can also define custom page sizes with custom names in any units you want
+ and this unit size will be preserved and used as the base for all other unit
+ size calculations.
+
+ When creating a QPageSize using a custom QSize you can choose if you want
+ QPageSize to try match the size to a standard page size. By default
+ QPaperSize uses a FuzzyMatch mode where it will match a given page size to
+ a standard page size if it falls within 3 postscript points of a defined
+ standard size. You can override this to request only an exact match but this
+ is not recommended as conversions between units can easily lose 3 points and
+ result in incorrect page sizes.
+
+ A QPageSize instance may also be obtained by querying the supported page sizes
+ for a print device. In this case the localized name returned is that defined
+ by the printer itself. Note that the print device may not support the current
+ default locale language.
+
+ The class also provides convenience methods for converting page size IDs to and from
+ various unit sizes.
+
+ \sa QPagedPaintDevice, QPdfWriter
+*/
+
+/*!
+ \enum QPageSize::PageSizeId
+
+ This enum type lists the available page sizes as defined in the Postscript
+ PPD standard. These values are duplicated in QPagedPaintDevice and QPrinter.
+
+ The defined sizes are:
+
+ \value A0 841 x 1189 mm
+ \value A1 594 x 841 mm
+ \value A2 420 x 594 mm
+ \value A3 297 x 420 mm
+ \value A4 210 x 297 mm, 8.26 x 11.69 inches
+ \value A5 148 x 210 mm
+ \value A6 105 x 148 mm
+ \value A7 74 x 105 mm
+ \value A8 52 x 74 mm
+ \value A9 37 x 52 mm
+ \value B0 1000 x 1414 mm
+ \value B1 707 x 1000 mm
+ \value B2 500 x 707 mm
+ \value B3 353 x 500 mm
+ \value B4 250 x 353 mm
+ \value B5 176 x 250 mm, 6.93 x 9.84 inches
+ \value B6 125 x 176 mm
+ \value B7 88 x 125 mm
+ \value B8 62 x 88 mm
+ \value B9 44 x 62 mm
+ \value B10 31 x 44 mm
+ \value C5E 163 x 229 mm
+ \value Comm10E 105 x 241 mm, U.S. Common 10 Envelope
+ \value DLE 110 x 220 mm
+ \value Executive 7.5 x 10 inches, 190.5 x 254 mm
+ \value Folio 210 x 330 mm
+ \value Ledger 431.8 x 279.4 mm
+ \value Legal 8.5 x 14 inches, 215.9 x 355.6 mm
+ \value Letter 8.5 x 11 inches, 215.9 x 279.4 mm
+ \value Tabloid 279.4 x 431.8 mm
+ \value Custom Unknown, or a user defined size.
+ \value A10
+ \value A3Extra
+ \value A4Extra
+ \value A4Plus
+ \value A4Small
+ \value A5Extra
+ \value B5Extra
+ \value JisB0
+ \value JisB1
+ \value JisB2
+ \value JisB3
+ \value JisB4
+ \value JisB5
+ \value JisB6,
+ \value JisB7
+ \value JisB8
+ \value JisB9
+ \value JisB10
+ \value AnsiA = Letter
+ \value AnsiB = Ledger
+ \value AnsiC
+ \value AnsiD
+ \value AnsiE
+ \value LegalExtra
+ \value LetterExtra
+ \value LetterPlus
+ \value LetterSmall
+ \value TabloidExtra
+ \value ArchA
+ \value ArchB
+ \value ArchC
+ \value ArchD
+ \value ArchE
+ \value Imperial7x9
+ \value Imperial8x10
+ \value Imperial9x11
+ \value Imperial9x12
+ \value Imperial10x11
+ \value Imperial10x13
+ \value Imperial10x14
+ \value Imperial12x11
+ \value Imperial15x11
+ \value ExecutiveStandard
+ \value Note
+ \value Quarto
+ \value Statement
+ \value SuperA
+ \value SuperB
+ \value Postcard
+ \value DoublePostcard
+ \value Prc16K
+ \value Prc32K
+ \value Prc32KBig
+ \value FanFoldUS
+ \value FanFoldGerman
+ \value FanFoldGermanLegal
+ \value EnvelopeB4
+ \value EnvelopeB5
+ \value EnvelopeB6
+ \value EnvelopeC0
+ \value EnvelopeC1
+ \value EnvelopeC2
+ \value EnvelopeC3
+ \value EnvelopeC4
+ \value EnvelopeC5 = C5E
+ \value EnvelopeC6
+ \value EnvelopeC65
+ \value EnvelopeC7
+ \value EnvelopeDL = DLE
+ \value Envelope9
+ \value Envelope10 = Comm10E
+ \value Envelope11
+ \value Envelope12
+ \value Envelope14
+ \value EnvelopeMonarch
+ \value EnvelopePersonal
+ \value EnvelopeChou3
+ \value EnvelopeChou4
+ \value EnvelopeInvite
+ \value EnvelopeItalian
+ \value EnvelopeKaku2
+ \value EnvelopeKaku3
+ \value EnvelopePrc1
+ \value EnvelopePrc2
+ \value EnvelopePrc3
+ \value EnvelopePrc4
+ \value EnvelopePrc5
+ \value EnvelopePrc6
+ \value EnvelopePrc7
+ \value EnvelopePrc8
+ \value EnvelopePrc9
+ \value EnvelopePrc10
+ \value EnvelopeYou4
+ \value LastPageSize = EnvelopeYou4
+ \omitvalue NPageSize
+ \omitvalue NPaperSize
+
+ Due to historic reasons QPageSize::Executive is not the same as the standard
+ Postscript and Windows Executive size, use QPageSize::ExecutiveStandard instead.
+
+ The Postscript standard size QPageSize::Folio is different to the Windows
+ DMPAPER_FOLIO size, use the Postscript standard size QPageSize::FanFoldGermanLegal
+ if needed.
+*/
+
+/*!
+ \enum QPageSize::Unit
+
+ This enum type is used to specify the measurement unit for page sizes.
+
+ \value Millimeter
+ \value Point 1/72th of an inch
+ \value Inch
+ \value Pica 1/72th of a foot, 1/6th of an inch, 12 Points
+ \value Didot 1/72th of a French inch, 0.375 mm
+ \value Cicero 1/6th of a French inch, 12 Didot, 4.5mm
+*/
+
+/*!
+ \enum QPageSize::SizeMatchPolicy
+
+ \value FuzzyMatch Match to a standard page size if within the margin of tolerance.
+ \value FuzzyOrientationMatch Match to a standard page size if within the margin of tolerance regardless of orientation.
+ \value ExactMatch Only match to a standard page size if the sizes match exactly.
+*/
+
+/*!
+ Creates a null QPageSize.
+*/
+
+QPageSize::QPageSize()
+ : d(new QPageSizePrivate())
+{
+}
+
+/*!
+ Creates a QPageSize of the standard \a pageSize.
+
+ If \a pageSize is QPageSize::Custom then the resulting QPageSize will not
+ be valid. Use the custom size constructor instead.
+*/
+
+QPageSize::QPageSize(QPageSize::PageSizeId pageSize)
+ : d(new QPageSizePrivate(pageSize))
+{
+}
+
+/*!
+ Creates a QPageSize of the given \a pointSize in Points using the matching \a matchPolicy.
+
+ If the given \a pointSize matches a standard QPageSize::PageSizeId, then that page
+ size will be used. Note that if the \a matchPolicy is FuzzyMatch this may result
+ in the \a pointSize being adjusted to the standard size. To prevent this happening
+ use a \a matchPolicy of ExactMatch instead.
+
+ If the given \a pointSize is not a standard QPageSize::PageSizeId then a QPageSize::Custom
+ size will be created.
+
+ If \a name is null then the standard localized name will be used. If a custom page
+ size then a custom name in the format "Custom (width x height)" will be created.
+
+ The \a matchPolicy defaults to FuzzyMatch.
+*/
+
+QPageSize::QPageSize(const QSize &pointSize, const QString &name, SizeMatchPolicy matchPolicy)
+ : d(new QPageSizePrivate(pointSize, name, matchPolicy))
+{
+}
+
+/*!
+ Creates a custom page of the given \a size in \a units.
+
+ If the given \a size matches a standard QPageSize::PageSizeId, then that page
+ size will be used. Note that if the \a matchPolicy is FuzzyMatch this may result
+ in the \a size being adjusted to the standard size. To prevent this happening
+ use a \a matchPolicy of ExactMatch instead.
+
+ If the given \a size is not a standard QPageSize::PageSizeId then a QPageSize::Custom
+ size will be created. The original unit size will be preserved and used as the
+ base for all other unit size calculations.
+
+ If \a name is null then a custom name will be created in the form
+ "Custom (width x height)" where the size is expressed in units provided.
+*/
+
+QPageSize::QPageSize(const QSizeF &size, QPageSize::Unit units,
+ const QString &name, SizeMatchPolicy matchPolicy)
+ : d(new QPageSizePrivate(size, units, name, matchPolicy))
+{
+}
+
+/*!
+ \internal
+
+ Create page with given key, size and name, for use by printer plugin.
+*/
+
+QPageSize::QPageSize(const QString &key, const QSize &pointSize, const QString &name)
+ : d(new QPageSizePrivate(key, pointSize, name))
+{
+}
+
+/*!
+ \internal
+
+ Create page with given windows ID, size and name, for use by printer plugin.
+*/
+
+QPageSize::QPageSize(int windowsId, const QSize &pointSize, const QString &name)
+ : d(new QPageSizePrivate(windowsId, pointSize, name))
+{
+}
+
+/*!
+ \internal
+
+ Create page with given private backend
+*/
+
+QPageSize::QPageSize(QPageSizePrivate &dd)
+ : d(&dd)
+{
+}
+
+/*!
+ Copy constructor, copies \a other to this.
+*/
+
+QPageSize::QPageSize(const QPageSize &other)
+ : d(other.d)
+{
+}
+
+/*!
+ Destroys the page.
+*/
+
+QPageSize::~QPageSize()
+{
+}
+
+/*!
+ Assignment operator, assigns \a other to this.
+*/
+
+QPageSize &QPageSize::operator=(const QPageSize &other)
+{
+ d = other.d;
+ return *this;
+}
+
+/*!
+ \fn void QPageSize::swap(QPageSize &other)
+
+ Swaps this QPageSize with \a other. This function is very fast and
+ never fails.
+*/
+
+/*!
+ \fn QPageSize &QPageSize::operator=(QPageSize &&other)
+
+ Move-assigns \a other to this QPageSize instance, transferring the
+ ownership of the managed pointer to this instance.
+*/
+
+/*!
+ Returns \c true if this page is equal to the \a other page, i.e. if the
+ page has the same attributes. Current attributes are size and name.
+*/
+
+bool QPageSize::operator==(const QPageSize &other) const
+{
+ if (d == other.d)
+ return true;
+ return d && other.d && *d == *other.d;
+}
+
+/*!
+ Returns \c true if this page is equivalent to the \a other page, i.e. if the
+ page has the same size regardless of other attributes like name.
+*/
+
+bool QPageSize::isEquivalentTo(const QPageSize &other) const
+{
+ if (d == other.d)
+ return true;
+ return d && other.d && d->isEquivalentTo(*other.d);
+}
+
+/*!
+ Returns \c true if this page size is valid.
+
+ The page size may be invalid if created with an invalid PageSizeId, or a
+ negative or invalid QSize or QSizeF, or the null constructor.
+*/
+
+bool QPageSize::isValid() const
+{
+ return d && d->isValid();
+}
+
+/*!
+ Returns the unique key of the page size.
+
+ By default this is the PPD standard mediaOption keyword for the page size,
+ or the PPD custom format key. If the QPageSize instance was obtained from
+ a print device then this will be the key provided by the print device and
+ may differ from the standard key.
+
+ If the QPageSize is invalid then the key will be an empty string.
+
+ This key should never be shown to end users, it is an internal key only.
+ For a human-readable name use name().
+
+ \sa name()
+*/
+
+QString QPageSize::key() const
+{
+ return isValid() ? d->m_key : QString();
+}
+
+/*!
+ Returns a localized human-readable name for the page size.
+
+ If the QPageSize instance was obtained from a print device then the name
+ used is that provided by the print device. Note that a print device may
+ not support the current default locale language.
+
+ If the QPageSize is invalid then the name will be an empty string.
+*/
+
+QString QPageSize::name() const
+{
+ return isValid() ? d->m_name : QString();
+}
+
+/*!
+ Returns the standard QPageSize::PageSizeId of the page, or QPageSize::Custom.
+
+ If the QPageSize is invalid then the ID will be QPageSize::Custom.
+*/
+
+QPageSize::PageSizeId QPageSize::id() const
+{
+ return isValid() ? d->m_id : QPageSize::Custom;
+}
+
+/*!
+ Returns the Windows DMPAPER enum value for the page size.
+
+ Not all valid PPD page sizes have a Windows equivalent, in which case 0
+ will be returned.
+
+ If the QPageSize is invalid then the Windows ID will be 0.
+
+ \sa id()
+*/
+
+int QPageSize::windowsId() const
+{
+ if (!isValid())
+ return 0;
+ return d->m_windowsId > 0 ? d->m_windowsId : QPageSize::windowsId(d->m_id);
+}
+
+/*!
+ Returns the definition size of the page size.
+
+ For a standard page size this will be the size as defined in the relevant
+ standard, i.e. ISO A4 will be defined in millimeters while ANSI Letter will
+ be defined in inches.
+
+ For a custom page size this will be the original size used to create the
+ page size object.
+
+ If the QPageSize is invalid then the QSizeF will be invalid.
+
+ \sa definitionUnits()
+*/
+
+QSizeF QPageSize::definitionSize() const
+{
+ return isValid() ? d->m_size : QSizeF();
+}
+
+/*!
+ Returns the definition units of the page size.
+
+ For a standard page size this will be the units as defined in the relevant
+ standard, i.e. ISO A4 will be defined in millimeters while ANSI Letter will
+ be defined in inches.
+
+ For a custom page size this will be the original units used to create the
+ page size object.
+
+ If the QPageSize is invalid then the QPageSize::Unit will be invalid.
+
+ \sa definitionSize()
+*/
+
+QPageSize::Unit QPageSize::definitionUnits() const
+{
+ return isValid() ? d->m_units : QPageSize::Unit(-1);
+}
+
+/*!
+ Returns the size of the page in the required \a units.
+
+ If the QPageSize is invalid then the QSizeF will be invalid.
+*/
+
+QSizeF QPageSize::size(QPageSize::Unit units) const
+{
+ return isValid() ? d->size(units) : QSize();
+}
+
+/*!
+ Returns the size of the page in Postscript Points (1/72 of an inch).
+
+ If the QPageSize is invalid then the QSize will be invalid.
+*/
+
+QSize QPageSize::sizePoints() const
+{
+ return isValid() ? d->m_pointSize : QSize();
+}
+
+/*!
+ Returns the size of the page in Device Pixels at the given \a resolution.
+
+ If the QPageSize is invalid then the QSize will be invalid.
+*/
+
+QSize QPageSize::sizePixels(int resolution) const
+{
+ return isValid() ? d->sizePixels(resolution) : QSize();
+}
+
+/*!
+ Returns the page rectangle in the required \a units.
+
+ If the QPageSize is invalid then the QRect will be invalid.
+*/
+
+QRectF QPageSize::rect(QPageSize::Unit units) const
+{
+ return isValid() ? QRectF(QPointF(0, 0), d->size(units)) : QRectF();
+}
+
+/*!
+ Returns the page rectangle in Postscript Points (1/72 of an inch).
+
+ If the QPageSize is invalid then the QRect will be invalid.
+*/
+
+QRect QPageSize::rectPoints() const
+{
+ return isValid() ? QRect(QPoint(0, 0), d->m_pointSize) : QRect();
+}
+
+/*!
+ Returns the page rectangle in Device Pixels at the given \a resolution.
+
+ If the QPageSize is invalid then the QRect will be invalid.
+*/
+
+QRect QPageSize::rectPixels(int resolution) const
+{
+ return isValid() ? QRect(QPoint(0, 0), d->sizePixels(resolution)) : QRect();
+}
+
+// Statics
+
+/*!
+ Returns the PPD mediaOption keyword of the standard \a pageSizeId.
+
+ If the QPageSize is invalid then the key will be empty.
+*/
+
+QString QPageSize::key(QPageSize::PageSizeId pageSizeId)
+{
+ if (pageSizeId < QPageSize::PageSizeId(0) || pageSizeId > QPageSize::LastPageSize)
+ return QString();
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ return QString::fromUtf8(qt_pageSizes[pageSizeId].mediaOption);
+}
+
+static QString msgImperialPageSizeInch(int width, int height)
+{
+ //: Page size in 'Inch'.
+ return QCoreApplication::translate("QPageSize", "%1 x %2 in").arg(width).arg(height);
+}
+
+/*!
+ Returns the localized name of the standard \a pageSizeId.
+
+ If the QPageSize is invalid then the name will be empty.
+*/
+
+QString QPageSize::name(QPageSize::PageSizeId pageSizeId)
+{
+ if (pageSizeId < QPageSize::PageSizeId(0) || pageSizeId > QPageSize::LastPageSize)
+ return QString();
+
+ switch (pageSizeId) {
+ case QPageSize::A0:
+ return QCoreApplication::translate("QPageSize", "A0");
+ case QPageSize::A1:
+ return QCoreApplication::translate("QPageSize", "A1");
+ case QPageSize::A2:
+ return QCoreApplication::translate("QPageSize", "A2");
+ case QPageSize::A3:
+ return QCoreApplication::translate("QPageSize", "A3");
+ case QPageSize::A4:
+ return QCoreApplication::translate("QPageSize", "A4");
+ case QPageSize::A5:
+ return QCoreApplication::translate("QPageSize", "A5");
+ case QPageSize::A6:
+ return QCoreApplication::translate("QPageSize", "A6");
+ case QPageSize::A7:
+ return QCoreApplication::translate("QPageSize", "A7");
+ case QPageSize::A8:
+ return QCoreApplication::translate("QPageSize", "A8");
+ case QPageSize::A9:
+ return QCoreApplication::translate("QPageSize", "A9");
+ case QPageSize::A10:
+ return QCoreApplication::translate("QPageSize", "A10");
+ case QPageSize::B0:
+ return QCoreApplication::translate("QPageSize", "B0");
+ case QPageSize::B1:
+ return QCoreApplication::translate("QPageSize", "B1");
+ case QPageSize::B2:
+ return QCoreApplication::translate("QPageSize", "B2");
+ case QPageSize::B3:
+ return QCoreApplication::translate("QPageSize", "B3");
+ case QPageSize::B4:
+ return QCoreApplication::translate("QPageSize", "B4");
+ case QPageSize::B5:
+ return QCoreApplication::translate("QPageSize", "B5");
+ case QPageSize::B6:
+ return QCoreApplication::translate("QPageSize", "B6");
+ case QPageSize::B7:
+ return QCoreApplication::translate("QPageSize", "B7");
+ case QPageSize::B8:
+ return QCoreApplication::translate("QPageSize", "B8");
+ case QPageSize::B9:
+ return QCoreApplication::translate("QPageSize", "B9");
+ case QPageSize::B10:
+ return QCoreApplication::translate("QPageSize", "B10");
+ case QPageSize::Executive:
+ return QCoreApplication::translate("QPageSize", "Executive (7.5 x 10 in)");
+ case QPageSize::ExecutiveStandard:
+ return QCoreApplication::translate("QPageSize", "Executive (7.25 x 10.5 in)");
+ case QPageSize::Folio:
+ return QCoreApplication::translate("QPageSize", "Folio (8.27 x 13 in)");
+ case QPageSize::Legal:
+ return QCoreApplication::translate("QPageSize", "Legal");
+ case QPageSize::Letter:
+ return QCoreApplication::translate("QPageSize", "Letter / ANSI A");
+ case QPageSize::Tabloid:
+ return QCoreApplication::translate("QPageSize", "Tabloid / ANSI B");
+ case QPageSize::Ledger:
+ return QCoreApplication::translate("QPageSize", "Ledger / ANSI B");
+ case QPageSize::Custom:
+ return QCoreApplication::translate("QPageSize", "Custom");
+ case QPageSize::A3Extra:
+ return QCoreApplication::translate("QPageSize", "A3 Extra");
+ case QPageSize::A4Extra:
+ return QCoreApplication::translate("QPageSize", "A4 Extra");
+ case QPageSize::A4Plus:
+ return QCoreApplication::translate("QPageSize", "A4 Plus");
+ case QPageSize::A4Small:
+ return QCoreApplication::translate("QPageSize", "A4 Small");
+ case QPageSize::A5Extra:
+ return QCoreApplication::translate("QPageSize", "A5 Extra");
+ case QPageSize::B5Extra:
+ return QCoreApplication::translate("QPageSize", "B5 Extra");
+ case QPageSize::JisB0:
+ return QCoreApplication::translate("QPageSize", "JIS B0");
+ case QPageSize::JisB1:
+ return QCoreApplication::translate("QPageSize", "JIS B1");
+ case QPageSize::JisB2:
+ return QCoreApplication::translate("QPageSize", "JIS B2");
+ case QPageSize::JisB3:
+ return QCoreApplication::translate("QPageSize", "JIS B3");
+ case QPageSize::JisB4:
+ return QCoreApplication::translate("QPageSize", "JIS B4");
+ case QPageSize::JisB5:
+ return QCoreApplication::translate("QPageSize", "JIS B5");
+ case QPageSize::JisB6:
+ return QCoreApplication::translate("QPageSize", "JIS B6");
+ case QPageSize::JisB7:
+ return QCoreApplication::translate("QPageSize", "JIS B7");
+ case QPageSize::JisB8:
+ return QCoreApplication::translate("QPageSize", "JIS B8");
+ case QPageSize::JisB9:
+ return QCoreApplication::translate("QPageSize", "JIS B9");
+ case QPageSize::JisB10:
+ return QCoreApplication::translate("QPageSize", "JIS B10");
+ case QPageSize::AnsiC:
+ return QCoreApplication::translate("QPageSize", "ANSI C");
+ case QPageSize::AnsiD:
+ return QCoreApplication::translate("QPageSize", "ANSI D");
+ case QPageSize::AnsiE:
+ return QCoreApplication::translate("QPageSize", "ANSI E");
+ case QPageSize::LegalExtra:
+ return QCoreApplication::translate("QPageSize", "Legal Extra");
+ case QPageSize::LetterExtra:
+ return QCoreApplication::translate("QPageSize", "Letter Extra");
+ case QPageSize::LetterPlus:
+ return QCoreApplication::translate("QPageSize", "Letter Plus");
+ case QPageSize::LetterSmall:
+ return QCoreApplication::translate("QPageSize", "Letter Small");
+ case QPageSize::TabloidExtra:
+ return QCoreApplication::translate("QPageSize", "Tabloid Extra");
+ case QPageSize::ArchA:
+ return QCoreApplication::translate("QPageSize", "Architect A");
+ case QPageSize::ArchB:
+ return QCoreApplication::translate("QPageSize", "Architect B");
+ case QPageSize::ArchC:
+ return QCoreApplication::translate("QPageSize", "Architect C");
+ case QPageSize::ArchD:
+ return QCoreApplication::translate("QPageSize", "Architect D");
+ case QPageSize::ArchE:
+ return QCoreApplication::translate("QPageSize", "Architect E");
+ case QPageSize::Imperial7x9:
+ return msgImperialPageSizeInch(7, 9);
+ case QPageSize::Imperial8x10:
+ return msgImperialPageSizeInch(8, 10);
+ case QPageSize::Imperial9x11:
+ return msgImperialPageSizeInch(9, 11);
+ case QPageSize::Imperial9x12:
+ return msgImperialPageSizeInch(9, 12);
+ case QPageSize::Imperial10x11:
+ return msgImperialPageSizeInch(10, 11);
+ case QPageSize::Imperial10x13:
+ return msgImperialPageSizeInch(10, 13);
+ case QPageSize::Imperial10x14:
+ return msgImperialPageSizeInch(10, 14);
+ case QPageSize::Imperial12x11:
+ return msgImperialPageSizeInch(12, 11);
+ case QPageSize::Imperial15x11:
+ return msgImperialPageSizeInch(15, 11);
+ case QPageSize::Note:
+ return QCoreApplication::translate("QPageSize", "Note");
+ case QPageSize::Quarto:
+ return QCoreApplication::translate("QPageSize", "Quarto");
+ case QPageSize::Statement:
+ return QCoreApplication::translate("QPageSize", "Statement");
+ case QPageSize::SuperA:
+ return QCoreApplication::translate("QPageSize", "Super A");
+ case QPageSize::SuperB:
+ return QCoreApplication::translate("QPageSize", "Super B");
+ case QPageSize::Postcard:
+ return QCoreApplication::translate("QPageSize", "Postcard");
+ case QPageSize::DoublePostcard:
+ return QCoreApplication::translate("QPageSize", "Double Postcard");
+ case QPageSize::Prc16K:
+ return QCoreApplication::translate("QPageSize", "PRC 16K");
+ case QPageSize::Prc32K:
+ return QCoreApplication::translate("QPageSize", "PRC 32K");
+ case QPageSize::Prc32KBig:
+ return QCoreApplication::translate("QPageSize", "PRC 32K Big");
+ case QPageSize::FanFoldUS:
+ return QCoreApplication::translate("QPageSize", "Fan-fold US (14.875 x 11 in)");
+ case QPageSize::FanFoldGerman:
+ return QCoreApplication::translate("QPageSize", "Fan-fold German (8.5 x 12 in)");
+ case QPageSize::FanFoldGermanLegal:
+ return QCoreApplication::translate("QPageSize", "Fan-fold German Legal (8.5 x 13 in)");
+ case QPageSize::EnvelopeB4:
+ return QCoreApplication::translate("QPageSize", "Envelope B4");
+ case QPageSize::EnvelopeB5:
+ return QCoreApplication::translate("QPageSize", "Envelope B5");
+ case QPageSize::EnvelopeB6:
+ return QCoreApplication::translate("QPageSize", "Envelope B6");
+ case QPageSize::EnvelopeC0:
+ return QCoreApplication::translate("QPageSize", "Envelope C0");
+ case QPageSize::EnvelopeC1:
+ return QCoreApplication::translate("QPageSize", "Envelope C1");
+ case QPageSize::EnvelopeC2:
+ return QCoreApplication::translate("QPageSize", "Envelope C2");
+ case QPageSize::EnvelopeC3:
+ return QCoreApplication::translate("QPageSize", "Envelope C3");
+ case QPageSize::EnvelopeC4:
+ return QCoreApplication::translate("QPageSize", "Envelope C4");
+ case QPageSize::EnvelopeC5: // C5E
+ return QCoreApplication::translate("QPageSize", "Envelope C5");
+ case QPageSize::EnvelopeC6:
+ return QCoreApplication::translate("QPageSize", "Envelope C6");
+ case QPageSize::EnvelopeC65:
+ return QCoreApplication::translate("QPageSize", "Envelope C65");
+ case QPageSize::EnvelopeC7:
+ return QCoreApplication::translate("QPageSize", "Envelope C7");
+ case QPageSize::EnvelopeDL: // DLE:
+ return QCoreApplication::translate("QPageSize", "Envelope DL");
+ case QPageSize::Envelope9:
+ return QCoreApplication::translate("QPageSize", "Envelope US 9");
+ case QPageSize::Envelope10: // Comm10E
+ return QCoreApplication::translate("QPageSize", "Envelope US 10");
+ case QPageSize::Envelope11:
+ return QCoreApplication::translate("QPageSize", "Envelope US 11");
+ case QPageSize::Envelope12:
+ return QCoreApplication::translate("QPageSize", "Envelope US 12");
+ case QPageSize::Envelope14:
+ return QCoreApplication::translate("QPageSize", "Envelope US 14");
+ case QPageSize::EnvelopeMonarch:
+ return QCoreApplication::translate("QPageSize", "Envelope Monarch");
+ case QPageSize::EnvelopePersonal:
+ return QCoreApplication::translate("QPageSize", "Envelope Personal");
+ case QPageSize::EnvelopeChou3:
+ return QCoreApplication::translate("QPageSize", "Envelope Chou 3");
+ case QPageSize::EnvelopeChou4:
+ return QCoreApplication::translate("QPageSize", "Envelope Chou 4");
+ case QPageSize::EnvelopeInvite:
+ return QCoreApplication::translate("QPageSize", "Envelope Invite");
+ case QPageSize::EnvelopeItalian:
+ return QCoreApplication::translate("QPageSize", "Envelope Italian");
+ case QPageSize::EnvelopeKaku2:
+ return QCoreApplication::translate("QPageSize", "Envelope Kaku 2");
+ case QPageSize::EnvelopeKaku3:
+ return QCoreApplication::translate("QPageSize", "Envelope Kaku 3");
+ case QPageSize::EnvelopePrc1:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 1");
+ case QPageSize::EnvelopePrc2:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 2");
+ case QPageSize::EnvelopePrc3:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 3");
+ case QPageSize::EnvelopePrc4:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 4");
+ case QPageSize::EnvelopePrc5:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 5");
+ case QPageSize::EnvelopePrc6:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 6");
+ case QPageSize::EnvelopePrc7:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 7");
+ case QPageSize::EnvelopePrc8:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 8");
+ case QPageSize::EnvelopePrc9:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 9");
+ case QPageSize::EnvelopePrc10:
+ return QCoreApplication::translate("QPageSize", "Envelope PRC 10");
+ case QPageSize::EnvelopeYou4:
+ return QCoreApplication::translate("QPageSize", "Envelope You 4");
+ }
+ return QString();
+}
+
+/*!
+ Returns the standard QPageSize::PageSizeId of the given \a pointSize in
+ points using the given \a matchPolicy.
+
+ If using FuzzyMatch then the point size of the PageSizeId returned may not
+ exactly match the \a pointSize you passed in. You should call
+ QPageSize::sizePoints() using the returned PageSizeId to find out the actual
+ point size of the PageSizeId before using it in any calculations.
+*/
+
+QPageSize::PageSizeId QPageSize::id(const QSize &pointSize, QPageSize::SizeMatchPolicy matchPolicy)
+{
+ return qt_idForPointSize(pointSize, matchPolicy, 0);
+}
+
+/*!
+ Returns the standard QPageSize::PageSizeId of the given \a size in \a units
+ using the given \a matchPolicy.
+
+ If using FuzzyMatch then the unit size of the PageSizeId returned may not
+ exactly match the \a size you passed in. You should call
+ QPageSize::size() using the returned PageSizeId to find out the actual
+ unit size of the PageSizeId before using it in any calculations.
+*/
+
+QPageSize::PageSizeId QPageSize::id(const QSizeF &size, QPageSize::Unit units,
+ QPageSize::SizeMatchPolicy matchPolicy)
+{
+ return qt_idForSize(size, units, matchPolicy, 0);
+}
+
+/*!
+ Returns the PageSizeId for the given Windows DMPAPER enum value \a windowsId.
+
+ If there is no matching PageSizeId then QPageSize::Custom is returned.
+*/
+
+QPageSize::PageSizeId QPageSize::id(int windowsId)
+{
+ return qt_idForWindowsID(windowsId);
+}
+
+/*!
+ Returns the Windows DMPAPER enum value of the standard \a pageSizeId.
+
+ Not all valid PPD page sizes have a Windows equivalent, in which case 0
+ will be returned.
+*/
+
+int QPageSize::windowsId(QPageSize::PageSizeId pageSizeId)
+{
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ return qt_pageSizes[pageSizeId].windowsId;
+}
+
+/*!
+ Returns the definition size of the standard \a pageSizeId.
+
+ To obtain the definition units, call QPageSize::definitionUnits().
+*/
+
+QSizeF QPageSize::definitionSize(QPageSize::PageSizeId pageSizeId)
+{
+ if (pageSizeId == QPageSize::Custom)
+ return QSizeF();
+ return qt_definitionSize(pageSizeId);
+}
+
+/*!
+ Returns the definition units of the standard \a pageSizeId.
+
+ To obtain the definition size, call QPageSize::definitionSize().
+*/
+
+QPageSize::Unit QPageSize::definitionUnits(QPageSize::PageSizeId pageSizeId)
+{
+ if (pageSizeId == QPageSize::Custom)
+ return QPageSize::Unit(-1);
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ return qt_pageSizes[pageSizeId].definitionUnits;
+}
+
+/*!
+ Returns the size of the standard \a pageSizeId in the requested \a units.
+*/
+
+QSizeF QPageSize::size(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units)
+{
+ if (pageSizeId == QPageSize::Custom)
+ return QSizeF();
+ return qt_unitSize(pageSizeId, units);
+}
+
+/*!
+ Returns the size of the standard \a pageSizeId in Points.
+*/
+
+QSize QPageSize::sizePoints(QPageSize::PageSizeId pageSizeId)
+{
+ if (pageSizeId == QPageSize::Custom)
+ return QSize();
+ Q_ASSERT(pageSizesCount == QPageSize::LastPageSize + 1);
+ return QSize(qt_pageSizes[pageSizeId].widthPoints, qt_pageSizes[pageSizeId].heightPoints);
+}
+
+/*!
+ Returns the size of the standard \a pageSizeId in Device Pixels
+ for the given \a resolution.
+*/
+
+QSize QPageSize::sizePixels(QPageSize::PageSizeId pageSizeId, int resolution)
+{
+ if (pageSizeId == QPageSize::Custom)
+ return QSize();
+ return qt_convertPointsToPixels(QPageSize::sizePoints(pageSizeId), resolution);
+}
+
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug dbg, const QPageSize &pageSize)
+{
+ if (pageSize.isValid()) {
+ QString output = QStringLiteral("QPageSize(\"%1\", \"%2\", %3x%4pt, %5)");
+ output = output.arg(pageSize.name())
+ .arg(pageSize.key())
+ .arg(pageSize.sizePoints().width())
+ .arg(pageSize.sizePoints().height())
+ .arg(pageSize.id());
+ dbg.nospace() << output;
+ } else {
+ dbg.nospace() << QStringLiteral("QPageSize()");
+ }
+ return dbg.space();
+}
+#endif
+
+QT_END_NAMESPACE
diff --git a/src/gui/painting/qpagesize.h b/src/gui/painting/qpagesize.h
new file mode 100644
index 0000000000..c8a472747d
--- /dev/null
+++ b/src/gui/painting/qpagesize.h
@@ -0,0 +1,311 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 John Layt <jlayt@kde.org>
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** 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, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPAGESIZE_H
+#define QPAGESIZE_H
+
+#include <QtCore/qsharedpointer.h>
+
+QT_BEGIN_NAMESPACE
+
+#if defined(B0)
+#undef B0 // Terminal hang-up. We assume that you do not want that.
+#endif
+
+class QPageSizePrivate;
+class QString;
+class QSize;
+class QSizeF;
+
+class Q_GUI_EXPORT QPageSize
+{
+public:
+
+ // ### Qt6 Re-order and remove duplicates
+ // NOTE: Must keep in sync with QPagedPrintEngine and QPrinter
+ enum PageSizeId {
+ // Existing Qt sizes
+ A4,
+ B5,
+ Letter,
+ Legal,
+ Executive,
+ A0,
+ A1,
+ A2,
+ A3,
+ A5,
+ A6,
+ A7,
+ A8,
+ A9,
+ B0,
+ B1,
+ B10,
+ B2,
+ B3,
+ B4,
+ B6,
+ B7,
+ B8,
+ B9,
+ C5E,
+ Comm10E,
+ DLE,
+ Folio,
+ Ledger,
+ Tabloid,
+ Custom,
+
+ // New values derived from PPD standard
+ A10,
+ A3Extra,
+ A4Extra,
+ A4Plus,
+ A4Small,
+ A5Extra,
+ B5Extra,
+
+ JisB0,
+ JisB1,
+ JisB2,
+ JisB3,
+ JisB4,
+ JisB5,
+ JisB6,
+ JisB7,
+ JisB8,
+ JisB9,
+ JisB10,
+
+ // AnsiA = Letter,
+ // AnsiB = Ledger,
+ AnsiC,
+ AnsiD,
+ AnsiE,
+ LegalExtra,
+ LetterExtra,
+ LetterPlus,
+ LetterSmall,
+ TabloidExtra,
+
+ ArchA,
+ ArchB,
+ ArchC,
+ ArchD,
+ ArchE,
+
+ Imperial7x9,
+ Imperial8x10,
+ Imperial9x11,
+ Imperial9x12,
+ Imperial10x11,
+ Imperial10x13,
+ Imperial10x14,
+ Imperial12x11,
+ Imperial15x11,
+
+ ExecutiveStandard,
+ Note,
+ Quarto,
+ Statement,
+ SuperA,
+ SuperB,
+ Postcard,
+ DoublePostcard,
+ Prc16K,
+ Prc32K,
+ Prc32KBig,
+
+ FanFoldUS,
+ FanFoldGerman,
+ FanFoldGermanLegal,
+
+ EnvelopeB4,
+ EnvelopeB5,
+ EnvelopeB6,
+ EnvelopeC0,
+ EnvelopeC1,
+ EnvelopeC2,
+ EnvelopeC3,
+ EnvelopeC4,
+ // EnvelopeC5 = C5E,
+ EnvelopeC6,
+ EnvelopeC65,
+ EnvelopeC7,
+ // EnvelopeDL = DLE,
+
+ Envelope9,
+ // Envelope10 = Comm10E,
+ Envelope11,
+ Envelope12,
+ Envelope14,
+ EnvelopeMonarch,
+ EnvelopePersonal,
+
+ EnvelopeChou3,
+ EnvelopeChou4,
+ EnvelopeInvite,
+ EnvelopeItalian,
+ EnvelopeKaku2,
+ EnvelopeKaku3,
+ EnvelopePrc1,
+ EnvelopePrc2,
+ EnvelopePrc3,
+ EnvelopePrc4,
+ EnvelopePrc5,
+ EnvelopePrc6,
+ EnvelopePrc7,
+ EnvelopePrc8,
+ EnvelopePrc9,
+ EnvelopePrc10,
+ EnvelopeYou4,
+
+ // Last item, with commonly used synynoms from QPagedPrintEngine / QPrinter
+ LastPageSize = EnvelopeYou4,
+ NPageSize = LastPageSize,
+ NPaperSize = LastPageSize,
+
+ // Convenience overloads for naming consistency
+ AnsiA = Letter,
+ AnsiB = Ledger,
+ EnvelopeC5 = C5E,
+ EnvelopeDL = DLE,
+ Envelope10 = Comm10E
+ };
+
+ // NOTE: Must keep in sync with QPageLayout::Unit and QPrinter::Unit
+ enum Unit {
+ Millimeter,
+ Point,
+ Inch,
+ Pica,
+ Didot,
+ Cicero
+ };
+
+ enum SizeMatchPolicy {
+ FuzzyMatch,
+ FuzzyOrientationMatch,
+ ExactMatch
+ };
+
+ QPageSize();
+ explicit QPageSize(QPageSize::PageSizeId pageSizeId);
+ QPageSize(const QSize &pointSize,
+ const QString &name = QString(),
+ QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch);
+ QPageSize(const QSizeF &size, QPageSize::Unit units,
+ const QString &name = QString(),
+ QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch);
+ QPageSize(const QPageSize &other);
+ ~QPageSize();
+
+ QPageSize &operator=(const QPageSize &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+ QPageSize &operator=(QPageSize &&other) { swap(other); return *this; }
+#endif
+
+ void swap(QPageSize &other) { d.swap(other.d); }
+
+ bool operator==(const QPageSize &other) const;
+ bool isEquivalentTo(const QPageSize &other) const;
+
+ bool isValid() const;
+
+ QString key() const;
+ QString name() const;
+
+ QPageSize::PageSizeId id() const;
+
+ int windowsId() const;
+
+ QSizeF definitionSize() const;
+ QPageSize::Unit definitionUnits() const;
+
+ QSizeF size(QPageSize::Unit units) const;
+ QSize sizePoints() const;
+ QSize sizePixels(int resolution) const;
+
+ QRectF rect(QPageSize::Unit units) const;
+ QRect rectPoints() const;
+ QRect rectPixels(int resolution) const;
+
+ static QString key(QPageSize::PageSizeId pageSizeId);
+ static QString name(QPageSize::PageSizeId pageSizeId);
+
+ static QPageSize::PageSizeId id(const QSize &pointSize,
+ QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch);
+ static QPageSize::PageSizeId id(const QSizeF &size, QPageSize::Unit units,
+ QPageSize::SizeMatchPolicy matchPolicy = QPageSize::FuzzyMatch);
+
+ static QPageSize::PageSizeId id(int windowsId);
+ static int windowsId(QPageSize::PageSizeId pageSizeId);
+
+ static QSizeF definitionSize(QPageSize::PageSizeId pageSizeId);
+ static QPageSize::Unit definitionUnits(QPageSize::PageSizeId pageSizeId);
+
+ static QSizeF size(QPageSize::PageSizeId pageSizeId, QPageSize::Unit units);
+ static QSize sizePoints(QPageSize::PageSizeId pageSizeId);
+ static QSize sizePixels(QPageSize::PageSizeId pageSizeId, int resolution);
+
+private:
+ friend class QPageSizePrivate;
+ friend class QPlatformPrintDevice;
+ QPageSize(const QString &key, const QSize &pointSize, const QString &name);
+ QPageSize(int windowsId, const QSize &pointSize, const QString &name);
+ QPageSize(QPageSizePrivate &dd);
+ QSharedDataPointer<QPageSizePrivate> d;
+};
+
+Q_DECLARE_SHARED(QPageSize)
+
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug dbg, const QPageSize &pageSize);
+#endif
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE(QPageSize)
+Q_DECLARE_METATYPE(QPageSize::PageSizeId)
+Q_DECLARE_METATYPE(QPageSize::Unit)
+
+#endif // QPAGESIZE_H
diff --git a/src/gui/painting/qpaintengine_blitter.cpp b/src/gui/painting/qpaintengine_blitter.cpp
index e356a3a36a..26eacacd49 100644
--- a/src/gui/painting/qpaintengine_blitter.cpp
+++ b/src/gui/painting/qpaintengine_blitter.cpp
@@ -494,11 +494,12 @@ void QBlitterPaintEngine::clipEnabledChanged()
bool QBlitterPaintEngine::begin(QPaintDevice *pdev)
{
+ Q_D(QBlitterPaintEngine);
bool ok = QRasterPaintEngine::begin(pdev);
#ifdef QT_BLITTER_RASTEROVERLAY
- Q_D(QBlitterPaintEngine);
d->pmData->unmergeOverlay();
#endif
+ d->pdev = pdev;
return ok;
}
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index e35cdd370e..fe5fc051df 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -3828,7 +3828,7 @@ Qt::BGMode QPainter::backgroundMode() const
/*!
\overload
- Sets the painter's pen to have style Qt::SolidLine, width 0 and the
+ Sets the painter's pen to have style Qt::SolidLine, width 1 and the
specified \a color.
*/
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 147fa3f561..56cfc0f707 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -1425,19 +1425,60 @@ QPaintEngine::Type QPdfEngine::type() const
return QPaintEngine::Pdf;
}
+void QPdfEngine::setResolution(int resolution)
+{
+ Q_D(QPdfEngine);
+ d->resolution = resolution;
+}
+
+int QPdfEngine::resolution() const
+{
+ Q_D(const QPdfEngine);
+ return d->resolution;
+}
+
+void QPdfEngine::setPageLayout(const QPageLayout &pageLayout)
+{
+ Q_D(QPdfEngine);
+ d->m_pageLayout = pageLayout;
+}
+void QPdfEngine::setPageSize(const QPageSize &pageSize)
+{
+ Q_D(QPdfEngine);
+ d->m_pageLayout.setPageSize(pageSize);
+}
+
+void QPdfEngine::setPageOrientation(QPageLayout::Orientation orientation)
+{
+ Q_D(QPdfEngine);
+ d->m_pageLayout.setOrientation(orientation);
+}
+
+void QPdfEngine::setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)
+{
+ Q_D(QPdfEngine);
+ d->m_pageLayout.setUnits(units);
+ d->m_pageLayout.setMargins(margins);
+}
+QPageLayout QPdfEngine::pageLayout() const
+{
+ Q_D(const QPdfEngine);
+ return d->m_pageLayout;
+}
+
+// Metrics are in Device Pixels
int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
{
Q_D(const QPdfEngine);
int val;
- QRect r = d->pageRect();
switch (metricType) {
case QPaintDevice::PdmWidth:
- val = r.width();
+ val = d->m_pageLayout.paintRectPixels(d->resolution).width();
break;
case QPaintDevice::PdmHeight:
- val = r.height();
+ val = d->m_pageLayout.paintRectPixels(d->resolution).height();
break;
case QPaintDevice::PdmDpiX:
case QPaintDevice::PdmDpiY:
@@ -1448,10 +1489,10 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
val = 1200;
break;
case QPaintDevice::PdmWidthMM:
- val = qRound(r.width()*25.4/d->resolution);
+ val = qRound(d->m_pageLayout.paintRect(QPageLayout::Millimeter).width());
break;
case QPaintDevice::PdmHeightMM:
- val = qRound(r.height()*25.4/d->resolution);
+ val = qRound(d->m_pageLayout.paintRect(QPageLayout::Millimeter).height());
break;
case QPaintDevice::PdmNumColors:
val = INT_MAX;
@@ -1469,21 +1510,12 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const
return val;
}
-static inline QSizeF pageSizeToPostScriptPoints(const QSizeF &pageSizeMM)
-{
-#define Q_MM(n) int((n * 720 + 127) / 254)
- return QSizeF(Q_MM(pageSizeMM.width()), Q_MM(pageSizeMM.height()));
-#undef Q_MM
-}
-
QPdfEnginePrivate::QPdfEnginePrivate()
: clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false),
outDevice(0), ownsDevice(false),
- fullPage(false), embedFonts(true),
- landscape(false),
+ embedFonts(true),
grayscale(false),
- paperSize(pageSizeToPostScriptPoints(QSizeF(210, 297))), // A4
- leftMargin(10), topMargin(10), rightMargin(10), bottomMargin(10) // ~3.5 mm
+ m_pageLayout(QPageSize(QPageSize::A4), QPageLayout::Portrait, QMarginsF(10, 10, 10, 10))
{
resolution = 1200;
currentObject = 1;
@@ -1495,11 +1527,6 @@ QPdfEnginePrivate::QPdfEnginePrivate()
stream = new QDataStream;
}
-void QPdfEnginePrivate::setPaperSize(const QSizeF &pageSizeMM)
-{
- paperSize = pageSizeToPostScriptPoints(pageSizeMM);
-}
-
bool QPdfEngine::begin(QPaintDevice *pdev)
{
Q_D(QPdfEngine);
@@ -1581,31 +1608,6 @@ QPdfEnginePrivate::~QPdfEnginePrivate()
delete stream;
}
-QRect QPdfEnginePrivate::paperRect() const
-{
- int w = qRound(paperSize.width()*resolution/72.);
- int h = qRound(paperSize.height()*resolution/72.);
-
- if (!landscape)
- return QRect(0, 0, w, h);
- else
- return QRect(0, 0, h, w);
-}
-
-QRect QPdfEnginePrivate::pageRect() const
-{
- QRect r = paperRect();
-
- if(!fullPage)
- r.adjust(qRound(leftMargin*(resolution/72.)),
- qRound(topMargin*(resolution/72.)),
- -qRound(rightMargin*(resolution/72.)),
- -qRound(bottomMargin*(resolution/72.)));
-
- return r;
-}
-
-
void QPdfEnginePrivate::writeHeader()
{
addXrefEntry(0,false);
@@ -2615,9 +2617,9 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti)
QTransform QPdfEnginePrivate::pageMatrix() const
{
qreal scale = 72./resolution;
- QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, height());
- if (!fullPage) {
- QRect r = pageRect();
+ QTransform tmp(scale, 0.0, 0.0, -scale, 0.0, m_pageLayout.fullRectPoints().height());
+ if (m_pageLayout.mode() != QPageLayout::FullPageMode) {
+ QRect r = m_pageLayout.paintRectPixels(resolution);
tmp.translate(r.left(), r.top());
}
return tmp;
@@ -2626,12 +2628,12 @@ QTransform QPdfEnginePrivate::pageMatrix() const
void QPdfEnginePrivate::newPage()
{
if (currentPage && currentPage->pageSize.isEmpty())
- currentPage->pageSize = QSize(width(), height());
+ currentPage->pageSize = m_pageLayout.fullRectPoints().size();
writePage();
delete currentPage;
currentPage = new QPdfPage;
- currentPage->pageSize = QSize(width(), height());
+ currentPage->pageSize = m_pageLayout.fullRectPoints().size();
stroker.stream = currentPage;
pages.append(requestObject());
diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h
index ae2d4b00ac..e9459eff83 100644
--- a/src/gui/painting/qpdf_p.h
+++ b/src/gui/painting/qpdf_p.h
@@ -64,6 +64,7 @@
#include "private/qpaintengine_p.h"
#include "private/qfontengine_p.h"
#include "private/qfontsubset_p.h"
+#include "qpagelayout.h"
// #define USE_NATIVE_GRADIENTS
@@ -179,7 +180,9 @@ public:
~QPdfEngine() {}
void setOutputFilename(const QString &filename);
- inline void setResolution(int resolution);
+
+ void setResolution(int resolution);
+ int resolution() const;
// reimplementations QPaintEngine
bool begin(QPaintDevice *pdev);
@@ -207,6 +210,14 @@ public:
// Printer stuff...
bool newPage();
+ // Page layout stuff
+ void setPageLayout(const QPageLayout &pageLayout);
+ void setPageSize(const QPageSize &pageSize);
+ void setPageOrientation(QPageLayout::Orientation orientation);
+ void setPageMargins(const QMarginsF &margins, QPageLayout::Unit units = QPageLayout::Point);
+
+ QPageLayout pageLayout() const;
+
void setPen();
void setBrush();
void setupGraphicsState(QPaintEngine::DirtyFlags flags);
@@ -224,19 +235,6 @@ public:
inline uint requestObject() { return currentObject++; }
- QRect paperRect() const;
- QRect pageRect() const;
- void setPaperSize(const QSizeF &pageSizeMM);
-
- int width() const {
- QRect r = paperRect();
- return qRound(r.width()*72./resolution);
- }
- int height() const {
- QRect r = paperRect();
- return qRound(r.height()*72./resolution);
- }
-
void writeHeader();
void writeTail();
@@ -278,15 +276,12 @@ public:
QString outputFileName;
QString title;
QString creator;
- bool fullPage;
bool embedFonts;
int resolution;
- bool landscape;
bool grayscale;
- // in postscript points
- QSizeF paperSize;
- qreal leftMargin, topMargin, rightMargin, bottomMargin;
+ // Page layout: size, orientation and margins
+ QPageLayout m_pageLayout;
private:
#ifdef USE_NATIVE_GRADIENTS
@@ -325,12 +320,6 @@ private:
QHash<QPair<uint, uint>, uint > alphaCache;
};
-void QPdfEngine::setResolution(int resolution)
-{
- Q_D(QPdfEngine);
- d->resolution = resolution;
-}
-
QT_END_NAMESPACE
#endif // QT_NO_PDF
diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp
index 27fb8b1646..08c8f42fd9 100644
--- a/src/gui/painting/qpdfwriter.cpp
+++ b/src/gui/painting/qpdfwriter.cpp
@@ -90,6 +90,9 @@ QPdfWriter::QPdfWriter(const QString &filename)
Q_D(QPdfWriter);
d->engine->setOutputFilename(filename);
+
+ // Set QPagedPaintDevice layout to match the current paint engine layout
+ devicePageLayout() = d->engine->pageLayout();
}
/*!
@@ -101,6 +104,9 @@ QPdfWriter::QPdfWriter(QIODevice *device)
Q_D(QPdfWriter);
d->engine->d_func()->outDevice = device;
+
+ // Set QPagedPaintDevice layout to match the current paint engine layout
+ devicePageLayout() = d->engine->pageLayout();
}
/*!
@@ -147,7 +153,6 @@ void QPdfWriter::setCreator(const QString &creator)
d->engine->d_func()->creator = creator;
}
-
/*!
\reimp
*/
@@ -159,25 +164,213 @@ QPaintEngine *QPdfWriter::paintEngine() const
}
/*!
- \reimp
- */
-void QPdfWriter::setPageSize(PageSize size)
+ \since 5.3
+
+ Sets the PDF \a resolution in DPI.
+
+ This setting affects the coordinate system as returned by, for
+ example QPainter::viewport().
+
+ \sa resolution()
+*/
+
+void QPdfWriter::setResolution(int resolution)
{
Q_D(const QPdfWriter);
+ if (resolution > 0)
+ d->engine->setResolution(resolution);
+}
+
+/*!
+ \since 5.3
- QPagedPaintDevice::setPageSize(size);
- d->engine->d_func()->setPaperSize(pageSizeMM());
+ Returns the resolution of the PDF in DPI.
+
+ \sa setResolution()
+*/
+
+int QPdfWriter::resolution() const
+{
+ Q_D(const QPdfWriter);
+ return d->engine->resolution();
}
/*!
- \reimp
- */
-void QPdfWriter::setPageSizeMM(const QSizeF &size)
+ \since 5.3
+
+ Sets the PDF page layout to \a newPageLayout.
+
+ You should call this before calling QPainter::begin(), or immediately
+ before calling newPage() to apply the new page layout to a new page.
+ You should not call any painting methods between a call to setPageLayout()
+ and newPage() as the wrong paint metrics may be used.
+
+ Returns true if the page layout was successfully set to \a newPageLayout.
+
+ \sa pageLayout()
+*/
+
+bool QPdfWriter::setPageLayout(const QPageLayout &newPageLayout)
{
Q_D(const QPdfWriter);
+ // Try to set the paint engine page layout
+ d->engine->setPageLayout(newPageLayout);
+ // Set QPagedPaintDevice layout to match the current paint engine layout
+ devicePageLayout() = d->engine->pageLayout();
+ return pageLayout().isEquivalentTo(newPageLayout);
+}
+
+/*!
+ \since 5.3
+
+ Sets the PDF page size to \a pageSize.
+
+ To get the current QPageSize use pageLayout().pageSize().
+
+ You should call this before calling QPainter::begin(), or immediately
+ before calling newPage() to apply the new page size to a new page.
+ You should not call any painting methods between a call to setPageSize()
+ and newPage() as the wrong paint metrics may be used.
+
+ Returns true if the page size was successfully set to \a pageSize.
- QPagedPaintDevice::setPageSizeMM(size);
- d->engine->d_func()->setPaperSize(pageSizeMM());
+ \sa pageLayout()
+*/
+
+bool QPdfWriter::setPageSize(const QPageSize &pageSize)
+{
+ Q_D(const QPdfWriter);
+ // Try to set the paint engine page size
+ d->engine->setPageSize(pageSize);
+ // Set QPagedPaintDevice layout to match the current paint engine layout
+ devicePageLayout() = d->engine->pageLayout();
+ return pageLayout().pageSize().isEquivalentTo(pageSize);
+}
+
+/*!
+ \since 5.3
+
+ Sets the PDF page \a orientation.
+
+ The page orientation is used to define the orientation of the
+ page size when obtaining the page rect.
+
+ You should call this before calling QPainter::begin(), or immediately
+ before calling newPage() to apply the new orientation to a new page.
+ You should not call any painting methods between a call to setPageOrientation()
+ and newPage() as the wrong paint metrics may be used.
+
+ To get the current QPageLayout::Orientation use pageLayout().pageOrientation().
+
+ Returns true if the page orientation was successfully set to \a orientation.
+
+ \sa pageLayout()
+*/
+
+bool QPdfWriter::setPageOrientation(QPageLayout::Orientation orientation)
+{
+ Q_D(const QPdfWriter);
+ // Set the print engine value
+ d->engine->setPageOrientation(orientation);
+ // Set QPagedPaintDevice layout to match the current paint engine layout
+ devicePageLayout() = d->engine->pageLayout();
+ return pageLayout().orientation() == orientation;
+}
+
+/*!
+ \since 5.3
+
+ Set the PDF page \a margins in the current page layout units.
+
+ You should call this before calling QPainter::begin(), or immediately
+ before calling newPage() to apply the new margins to a new page.
+ You should not call any painting methods between a call to setPageMargins()
+ and newPage() as the wrong paint metrics may be used.
+
+ To get the current page margins use pageLayout().pageMargins().
+
+ Returns true if the page margins were successfully set to \a margins.
+
+ \sa pageLayout()
+*/
+
+bool QPdfWriter::setPageMargins(const QMarginsF &margins)
+{
+ Q_D(const QPdfWriter);
+ // Try to set engine margins
+ d->engine->setPageMargins(margins, pageLayout().units());
+ // Set QPagedPaintDevice layout to match the current paint engine layout
+ devicePageLayout() = d->engine->pageLayout();
+ return pageLayout().margins() == margins;
+}
+
+/*!
+ \since 5.3
+
+ Set the PDF page \a margins defined in the given \a units.
+
+ You should call this before calling QPainter::begin(), or immediately
+ before calling newPage() to apply the new margins to a new page.
+ You should not call any painting methods between a call to setPageMargins()
+ and newPage() as the wrong paint metrics may be used.
+
+ To get the current page margins use pageLayout().pageMargins().
+
+ Returns true if the page margins were successfully set to \a margins.
+
+ \sa pageLayout()
+*/
+
+bool QPdfWriter::setPageMargins(const QMarginsF &margins, QPageLayout::Unit units)
+{
+ Q_D(const QPdfWriter);
+ // Try to set engine margins
+ d->engine->setPageMargins(margins, units);
+ // Set QPagedPaintDevice layout to match the current paint engine layout
+ devicePageLayout() = d->engine->pageLayout();
+ return pageLayout().margins() == margins && pageLayout().units() == units;
+}
+
+/*!
+ Returns the current page layout. Use this method to access the current
+ QPageSize, QPageLayout::Orientation, QMarginsF, fullRect() and paintRect().
+
+ Note that you cannot use the setters on the returned object, you must either
+ call the individual QPdfWriter methods or use setPageLayout().
+
+ \sa setPageLayout(), setPageSize(), setPageOrientation(), setPageMargins()
+*/
+
+QPageLayout QPdfWriter::pageLayout() const
+{
+ Q_D(const QPdfWriter);
+ return d->engine->pageLayout();
+}
+
+/*!
+ \reimp
+
+ \obsolete Use setPageSize(QPageSize(id)) instead
+
+ \sa setPageSize()
+*/
+
+void QPdfWriter::setPageSize(PageSize size)
+{
+ setPageSize(QPageSize(QPageSize::PageSizeId(size)));
+}
+
+/*!
+ \reimp
+
+ \obsolete Use setPageSize(QPageSize(size, QPageSize::Millimeter)) instead
+
+ \sa setPageSize()
+*/
+
+void QPdfWriter::setPageSizeMM(const QSizeF &size)
+{
+ setPageSize(QPageSize(size, QPageSize::Millimeter));
}
/*!
@@ -203,19 +396,15 @@ bool QPdfWriter::newPage()
/*!
- \reimp
+ \reimp
+
+ \obsolete Use setPageMargins(QMarginsF(l, t, r, b), QPageLayout::Millimeter) instead
+
+ \sa setPageMargins()
*/
void QPdfWriter::setMargins(const Margins &m)
{
- Q_D(QPdfWriter);
-
- QPagedPaintDevice::setMargins(m);
-
- const qreal multiplier = 72./25.4;
- d->engine->d_func()->leftMargin = m.left*multiplier;
- d->engine->d_func()->rightMargin = m.right*multiplier;
- d->engine->d_func()->topMargin = m.top*multiplier;
- d->engine->d_func()->bottomMargin = m.bottom*multiplier;
+ setPageMargins(QMarginsF(m.left, m.top, m.right, m.bottom), QPageLayout::Millimeter);
}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index f5c25de5e9..fce0b88ea8 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -48,6 +48,7 @@
#include <QtCore/qobject.h>
#include <QtGui/qpagedpaintdevice.h>
+#include <QtGui/qpagelayout.h>
QT_BEGIN_NAMESPACE
@@ -70,6 +71,17 @@ public:
bool newPage();
+ void setResolution(int resolution);
+ int resolution() const;
+
+ bool setPageLayout(const QPageLayout &pageLayout);
+ bool setPageSize(const QPageSize &pageSize);
+ bool setPageOrientation(QPageLayout::Orientation orientation);
+ bool setPageMargins(const QMarginsF &margins);
+ bool setPageMargins(const QMarginsF &margins, QPageLayout::Unit units);
+
+ QPageLayout pageLayout() const;
+
void setPageSize(PageSize size);
void setPageSizeMM(const QSizeF &size);
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 4843e93858..710d84e3aa 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -186,6 +186,28 @@ void QPlatformTextureList::clear()
*/
#ifndef QT_NO_OPENGL
+
+static QRect deviceRect(const QRect &rect, QWindow *window)
+{
+ QRect deviceRect(rect.topLeft() * window->devicePixelRatio(),
+ rect.size() * window->devicePixelRatio());
+ return deviceRect;
+}
+
+static QRegion deviceRegion(const QRegion &region, QWindow *window)
+{
+ if (!(window->devicePixelRatio() > 1))
+ return region;
+
+ QVector<QRect> rects;
+ foreach (QRect rect, region.rects())
+ rects.append(deviceRect(rect, window));
+
+ QRegion deviceRegion;
+ deviceRegion.setRects(rects.constData(), rects.count());
+ return deviceRegion;
+}
+
/*!
Flushes the given \a region from the specified \a window onto the
screen, and composes it with the specified \a textures.
@@ -205,7 +227,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
context->makeCurrent(window);
QOpenGLFunctions *funcs = context->functions();
- funcs->glViewport(0, 0, window->width(), window->height());
+ funcs->glViewport(0, 0, window->width() * window->devicePixelRatio(), window->height() * window->devicePixelRatio());
if (!d_ptr->blitter) {
d_ptr->blitter = new QOpenGLTextureBlitter;
@@ -214,16 +236,18 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
d_ptr->blitter->bind();
- QRect windowRect(QPoint(), window->size());
+ QRect windowRect(QPoint(), window->size() * window->devicePixelRatio());
+
for (int i = 0; i < textures->count(); ++i) {
GLuint textureId = textures->textureId(i);
funcs->glBindTexture(GL_TEXTURE_2D, textureId);
- QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(textures->geometry(i), windowRect);
+ QRect targetRect = deviceRect(textures->geometry(i), window);
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, windowRect);
d_ptr->blitter->blit(textureId, target, QOpenGLTextureBlitter::OriginBottomLeft);
}
- GLuint textureId = toTexture(region);
+ GLuint textureId = toTexture(deviceRegion(region, window));
if (!textureId)
return;
@@ -306,6 +330,13 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const
funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
QRect imageRect = image.rect();
QRect rect = dirtyRegion.boundingRect() & imageRect;
+
+#ifndef QT_OPENGL_ES_2
+ funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, image.width());
+ funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
+ image.constScanLine(rect.y()) + rect.x() * 4);
+ funcs->glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
+#else
// if the rect is wide enough it's cheaper to just
// extend it instead of doing an image copy
if (rect.width() >= imageRect.width() / 2) {
@@ -323,6 +354,7 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion) const
funcs->glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x(), rect.y(), rect.width(), rect.height(), GL_RGBA, GL_UNSIGNED_BYTE,
image.copy(rect).constBits());
}
+#endif
}
return d_ptr->textureId;
diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp
index beeac6bd43..20c62fdd9d 100644
--- a/src/gui/painting/qregion.cpp
+++ b/src/gui/painting/qregion.cpp
@@ -1713,7 +1713,7 @@ QT_END_INCLUDE_NAMESPACE
* the buffers together
*/
typedef struct _POINTBLOCK {
- int data[NUMPTSTOBUFFER * sizeof(QPoint)];
+ char data[NUMPTSTOBUFFER * sizeof(QPoint)];
QPoint *pts;
struct _POINTBLOCK *next;
} POINTBLOCK;
diff --git a/src/gui/text/qcssparser_p.h b/src/gui/text/qcssparser_p.h
index b087a2384a..123a53c5cc 100644
--- a/src/gui/text/qcssparser_p.h
+++ b/src/gui/text/qcssparser_p.h
@@ -508,7 +508,7 @@ const quint64 PseudoClass_EditFocus = Q_UINT64_C(0x0000080000000000);
const quint64 PseudoClass_Alternate = Q_UINT64_C(0x0000100000000000);
// The Any specifier is never generated, but can be used as a wildcard in searches.
const quint64 PseudoClass_Any = Q_UINT64_C(0x0000ffffffffffff);
-const int NumPseudos = 46;
+const int NumPseudos = 45;
struct Pseudo
{
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 02b9e6d25c..ae7b6c1c0d 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -317,6 +317,7 @@ struct QtFontFamily
QtFontFamily(const QString &n)
:
+ populated(false),
fixedPitch(false),
name(n), count(0), foundries(0)
, bogusWritingSystems(false)
@@ -330,6 +331,7 @@ struct QtFontFamily
free(foundries);
}
+ bool populated : 1;
bool fixedPitch : 1;
QString name;
@@ -344,6 +346,8 @@ struct QtFontFamily
bool matchesFamilyName(const QString &familyName) const;
QtFontFoundry *foundry(const QString &f, bool = false);
+
+ void ensurePopulated();
};
QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create)
@@ -375,6 +379,14 @@ bool QtFontFamily::matchesFamilyName(const QString &familyName) const
return name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive);
}
+void QtFontFamily::ensurePopulated()
+{
+ if (populated)
+ return;
+
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFamily(name);
+ Q_ASSERT(populated);
+}
class QFontDatabasePrivate
{
@@ -386,7 +398,14 @@ public:
~QFontDatabasePrivate() {
free();
}
- QtFontFamily *family(const QString &f, bool = false);
+
+ enum FamilyRequestFlags {
+ RequestFamily = 0,
+ EnsureCreated,
+ EnsurePopulated
+ };
+
+ QtFontFamily *family(const QString &f, FamilyRequestFlags flags = EnsurePopulated);
void free() {
while (count--)
delete families[count];
@@ -424,8 +443,10 @@ void QFontDatabasePrivate::invalidate()
emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
}
-QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create)
+QtFontFamily *QFontDatabasePrivate::family(const QString &f, FamilyRequestFlags flags)
{
+ QtFontFamily *fam = 0;
+
int low = 0;
int high = count;
int pos = count / 2;
@@ -439,28 +460,34 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create)
pos = (high + low) / 2;
}
if (!res)
- return families[pos];
+ fam = families[pos];
}
- if (!create)
- return 0;
- if (res < 0)
- pos++;
+ if (!fam && (flags & EnsureCreated)) {
+ if (res < 0)
+ pos++;
+
+ // qDebug() << "adding family " << f.toLatin1() << " at " << pos << " total=" << count;
+ if (!(count % 8)) {
+ QtFontFamily **newFamilies = (QtFontFamily **)
+ realloc(families,
+ (((count+8) >> 3) << 3) * sizeof(QtFontFamily *));
+ Q_CHECK_PTR(newFamilies);
+ families = newFamilies;
+ }
+
+ QtFontFamily *family = new QtFontFamily(f);
+ memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *));
+ families[pos] = family;
+ count++;
- // qDebug() << "adding family " << f.toLatin1() << " at " << pos << " total=" << count;
- if (!(count % 8)) {
- QtFontFamily **newFamilies = (QtFontFamily **)
- realloc(families,
- (((count+8) >> 3) << 3) * sizeof(QtFontFamily *));
- Q_CHECK_PTR(newFamilies);
- families = newFamilies;
+ fam = families[pos];
}
- QtFontFamily *family = new QtFontFamily(f);
- memmove(families + pos + 1, families + pos, (count-pos)*sizeof(QtFontFamily *));
- families[pos] = family;
- count++;
- return families[pos];
+ if (fam && (flags & EnsurePopulated))
+ fam->ensurePopulated();
+
+ return fam;
}
@@ -670,7 +697,7 @@ void qt_registerFont(const QString &familyName, const QString &stylename,
styleKey.style = style;
styleKey.weight = weight;
styleKey.stretch = stretch;
- QtFontFamily *f = d->family(familyName, true);
+ QtFontFamily *f = d->family(familyName, QFontDatabasePrivate::EnsureCreated);
f->fixedPitch = fixedPitch;
for (int i = 0; i < QFontDatabase::WritingSystemsCount; ++i) {
@@ -689,6 +716,13 @@ void qt_registerFont(const QString &familyName, const QString &stylename,
integration->fontDatabase()->releaseHandle(size->handle);
}
size->handle = handle;
+ f->populated = true;
+}
+
+void qt_registerFontFamily(const QString &familyName)
+{
+ // Create uninitialized/unpopulated family
+ privateDb()->family(familyName, QFontDatabasePrivate::EnsureCreated);
}
void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias)
@@ -697,7 +731,7 @@ void qt_registerAliasToFontFamily(const QString &familyName, const QString &alia
return;
QFontDatabasePrivate *d = privateDb();
- QtFontFamily *f = d->family(familyName, false);
+ QtFontFamily *f = d->family(familyName, QFontDatabasePrivate::RequestFamily);
if (!f)
return;
@@ -1092,6 +1126,8 @@ static int match(int script, const QFontDef &request,
if (!matchFamilyName(family_name, test.family))
continue;
+ test.family->ensurePopulated();
+
if (family_name.isEmpty())
load(test.family->name, script);
@@ -1304,6 +1340,8 @@ QList<QFontDatabase::WritingSystem> QFontDatabase::writingSystems() const
QList<WritingSystem> list;
for (int i = 0; i < d->count; ++i) {
QtFontFamily *family = d->families[i];
+ family->ensurePopulated();
+
if (family->count == 0)
continue;
for (int x = Latin; x < WritingSystemsCount; ++x) {
@@ -1367,11 +1405,14 @@ QStringList QFontDatabase::families(WritingSystem writingSystem) const
QStringList flist;
for (int i = 0; i < d->count; i++) {
QtFontFamily *f = d->families[i];
- if (f->count == 0)
+ if (f->populated && f->count == 0)
continue;
- if (writingSystem != Any && (f->writingSystems[writingSystem] != QtFontFamily::Supported))
- continue;
- if (f->count == 1) {
+ if (writingSystem != Any) {
+ f->ensurePopulated();
+ if (f->writingSystems[writingSystem] != QtFontFamily::Supported)
+ continue;
+ }
+ if (!f->populated || f->count == 1) {
flist.append(f->name);
} else {
for (int j = 0; j < f->count; j++) {
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 11e9ce6c02..fe38755ffd 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -1934,8 +1934,6 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition)
lockFace();
QScopedPointer<Glyph> glyph(loadGlyphFor(g, subPixelPosition, antialias ? Format_A8 : Format_Mono));
- if (cacheEnabled)
- glyph.take();
if (!glyph || !glyph->data) {
unlockFace();
return QFontEngine::alphaMapForGlyph(g);
@@ -1960,6 +1958,8 @@ QImage QFontEngineFT::alphaMapForGlyph(glyph_t g, QFixed subPixelPosition)
for (int y = 0; y < glyph->height; ++y)
memcpy(img.scanLine(y), &glyph->data[y * pitch], pitch);
}
+ if (cacheEnabled)
+ glyph.take();
unlockFace();
return img;
@@ -1973,8 +1973,6 @@ QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, co
lockFace();
QScopedPointer<Glyph> glyph(loadGlyphFor(g, subPixelPosition, Format_A32));
- if (cacheEnabled)
- glyph.take();
if (!glyph || !glyph->data) {
unlockFace();
return QFontEngine::alphaRGBMapForGlyph(g, subPixelPosition, t);
@@ -1982,6 +1980,9 @@ QImage QFontEngineFT::alphaRGBMapForGlyph(glyph_t g, QFixed subPixelPosition, co
QImage img(glyph->width, glyph->height, QImage::Format_RGB32);
memcpy(img.bits(), glyph->data, 4 * glyph->width * glyph->height);
+
+ if (cacheEnabled)
+ glyph.take();
unlockFace();
return img;
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 5f277c878a..33301005c6 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -53,6 +53,7 @@ void qt_registerFont(const QString &familyname, const QString &stylename,
bool scalable, int pixelSize, bool fixedPitch,
const QSupportedWritingSystems &writingSystems, void *hanlde);
+void qt_registerFontFamily(const QString &familyName);
void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias);
/*!
@@ -118,7 +119,7 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void *
The writing systems supported by the font are specified by the
\a writingSystems argument.
- \sa registerQPF2Font()
+ \sa registerQPF2Font(), registerFontFamily()
*/
void QPlatformFontDatabase::registerFont(const QString &familyname, const QString &stylename,
const QString &foundryname, QFont::Weight weight,
@@ -134,6 +135,18 @@ void QPlatformFontDatabase::registerFont(const QString &familyname, const QStrin
fixedPitch, writingSystems, usrPtr);
}
+/*!
+ Registers a font family with the font database. The font will be
+ lazily populated by a callback to populateFamily() when the font
+ database determines that the family needs population.
+
+ \sa populateFamily(), registerFont()
+*/
+void QPlatformFontDatabase::registerFontFamily(const QString &familyName)
+{
+ qt_registerFontFamily(familyName);
+}
+
class QWritingSystemsPrivate
{
public:
@@ -249,6 +262,11 @@ QPlatformFontDatabase::~QPlatformFontDatabase()
Reimplement this function in a subclass for a convenient place to initialize
the internal font database.
+ You may lazily populate the database by calling registerFontFamily() instead
+ of registerFont(), in which case you'll get a callback to populateFamily()
+ when the required family needs population. You then call registerFont() to
+ finish population of the family.
+
The default implementation looks in the fontDir() location and registers all
QPF2 fonts.
*/
@@ -276,6 +294,18 @@ void QPlatformFontDatabase::populateFontDatabase()
}
/*!
+ This function is called whenever a lazily populated family, populated
+ through registerFontFamily(), needs full population.
+
+ You are expected to fully populate the family by calling registerFont()
+ for each font that matches the family name.
+*/
+void QPlatformFontDatabase::populateFamily(const QString &familyName)
+{
+ Q_UNUSED(familyName);
+}
+
+/*!
This function is called whenever the font database is invalidated.
Reimplement this function to clear any internal data structures that
diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h
index 870480809b..b200cf0e58 100644
--- a/src/gui/text/qplatformfontdatabase.h
+++ b/src/gui/text/qplatformfontdatabase.h
@@ -96,6 +96,7 @@ class Q_GUI_EXPORT QPlatformFontDatabase
public:
virtual ~QPlatformFontDatabase();
virtual void populateFontDatabase();
+ virtual void populateFamily(const QString &familyName);
virtual void invalidate();
virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script);
@@ -125,6 +126,7 @@ public:
bool scalable, int pixelSize, bool fixedPitch,
const QSupportedWritingSystems &writingSystems, void *handle);
+ static void registerFontFamily(const QString &familyName);
static void registerAliasToFontFamily(const QString &familyName, const QString &alias);
};
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index b153219136..0afc6f9259 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -573,6 +573,9 @@ namespace {
case PdmDepth:
val = 24;
break;
+ case PdmDevicePixelRatio:
+ val = 1;
+ break;
default:
val = 0;
qWarning("DrawTextItemDevice::metric: Invalid metric command");
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 0298adde7a..3b079b7ee3 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -2374,6 +2374,7 @@ void QTextEngine::freeMemory()
layoutData->hasBidi = false;
layoutData->layoutState = LayoutEmpty;
layoutData->haveCharAttributes = false;
+ layoutData->items.clear();
}
for (int i = 0; i < lines.size(); ++i) {
lines[i].justified = 0;
@@ -2520,7 +2521,8 @@ void QTextEngine::setAdditionalFormats(const QList<QTextLayout::FormatRange> &fo
specialData->addFormats = formatList;
indexAdditionalFormats();
}
- resetFontEngineCache();
+ invalidate();
+ clearLineData();
}
void QTextEngine::indexAdditionalFormats()
diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri
index 2a0e4eff32..c67769ad48 100644
--- a/src/gui/text/text.pri
+++ b/src/gui/text/text.pri
@@ -88,7 +88,7 @@ HEADERS += \
contains(QT_CONFIG, harfbuzz)|contains(QT_CONFIG, system-harfbuzz) {
DEFINES += QT_ENABLE_HARFBUZZ_NG
- include($$PWD/../../3rdparty/harfbuzz.pri)
+ include($$PWD/../../3rdparty/harfbuzzng.pri)
SOURCES += text/qharfbuzzng.cpp
HEADERS += text/qharfbuzzng_p.h