diff options
Diffstat (limited to 'src/datavisualization/utils')
-rw-r--r-- | src/datavisualization/utils/texturehelper.cpp | 6 | ||||
-rw-r--r-- | src/datavisualization/utils/texturehelper_p.h | 4 | ||||
-rw-r--r-- | src/datavisualization/utils/utils.cpp | 25 |
3 files changed, 20 insertions, 15 deletions
diff --git a/src/datavisualization/utils/texturehelper.cpp b/src/datavisualization/utils/texturehelper.cpp index 0e66459c..4ff56cb3 100644 --- a/src/datavisualization/utils/texturehelper.cpp +++ b/src/datavisualization/utils/texturehelper.cpp @@ -47,8 +47,7 @@ TextureHelper::TextureHelper() // Discard warnings about deprecated functions QtMessageHandler handler = qInstallMessageHandler(discardDebugMsgs); - m_openGlFunctions_2_1 = - QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_2_1>(); + m_openGlFunctions_2_1 = new QOpenGLFunctions_2_1; if (m_openGlFunctions_2_1) m_openGlFunctions_2_1->initializeOpenGLFunctions(); @@ -63,6 +62,7 @@ TextureHelper::TextureHelper() TextureHelper::~TextureHelper() { + delete m_openGlFunctions_2_1; } GLuint TextureHelper::create2DTexture(const QImage &image, bool useTrilinearFiltering, @@ -328,7 +328,7 @@ GLuint TextureHelper::createDepthTextureFrameBuffer(const QSize &size, GLuint &f // Attach texture to depth attachment glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, depthtextureid, 0); - m_openGlFunctions_2_1->glDrawBuffer(GL_NONE); + m_openGlFunctions_2_1->glDrawBuffers(0, GL_NONE); m_openGlFunctions_2_1->glReadBuffer(GL_NONE); // Verify that the frame buffer is complete diff --git a/src/datavisualization/utils/texturehelper_p.h b/src/datavisualization/utils/texturehelper_p.h index fac32a42..9ef68d74 100644 --- a/src/datavisualization/utils/texturehelper_p.h +++ b/src/datavisualization/utils/texturehelper_p.h @@ -45,7 +45,7 @@ #include <QtGui/QLinearGradient> #if !defined(QT_OPENGL_ES_2) // 3D Textures are not supported by ES set -# include <QtGui/QOpenGLFunctions_2_1> +# include <QtOpenGL/QOpenGLFunctions_2_1> #endif QT_BEGIN_NAMESPACE_DATAVISUALIZATION @@ -78,7 +78,7 @@ class TextureHelper : protected QOpenGLFunctions QRgb qt_gl_convertToGLFormatHelper(QRgb src_pixel, GLenum texture_format); #if !defined(QT_OPENGL_ES_2) - QOpenGLFunctions_2_1 *m_openGlFunctions_2_1; // Not owned + QOpenGLFunctions_2_1 *m_openGlFunctions_2_1; #endif friend class Bars3DRenderer; friend class Surface3DRenderer; diff --git a/src/datavisualization/utils/utils.cpp b/src/datavisualization/utils/utils.cpp index e80058db..2503ad2b 100644 --- a/src/datavisualization/utils/utils.cpp +++ b/src/datavisualization/utils/utils.cpp @@ -33,6 +33,7 @@ #include <QtGui/QOpenGLContext> #include <QtGui/QOffscreenSurface> #include <QtCore/QCoreApplication> +#include <QtCore/QRegularExpression> QT_BEGIN_NAMESPACE_DATAVISUALIZATION @@ -217,24 +218,28 @@ QImage Utils::getGradientImage(QLinearGradient &gradient) Utils::ParamType Utils::preParseFormat(const QString &format, QString &preStr, QString &postStr, int &precision, char &formatSpec) { - static QRegExp formatMatcher(QStringLiteral("^([^%]*)%([\\-\\+#\\s\\d\\.lhjztL]*)([dicuoxfegXFEG])(.*)$")); - static QRegExp precisionMatcher(QStringLiteral("\\.(\\d+)")); + static QRegularExpression formatMatcher(QStringLiteral("^([^%]*)%([\\-\\+#\\s\\d\\.lhjztL]*)([dicuoxfegXFEG])(.*)$")); + static QRegularExpression precisionMatcher(QStringLiteral("\\.(\\d+)")); Utils::ParamType retVal; - if (formatMatcher.indexIn(format, 0) != -1) { - preStr = formatMatcher.cap(1); + QRegularExpressionMatch formatMatch = formatMatcher.match(format, 0); + + if (formatMatch.hasMatch()) { + preStr = formatMatch.captured(1); // Six and 'g' are defaults in Qt API precision = 6; - if (!formatMatcher.cap(2).isEmpty()) { - if (precisionMatcher.indexIn(formatMatcher.cap(2), 0) != -1) - precision = precisionMatcher.cap(1).toInt(); + if (!formatMatch.captured(2).isEmpty()) { + QRegularExpressionMatch precisionMatch = precisionMatcher.match(formatMatch.captured(2), + 0); + if (precisionMatch.hasMatch()) + precision = precisionMatch.captured(1).toInt(); } - if (formatMatcher.cap(3).isEmpty()) + if (formatMatch.captured(3).isEmpty()) formatSpec = 'g'; else - formatSpec = formatMatcher.cap(3).at(0).toLatin1(); - postStr = formatMatcher.cap(4); + formatSpec = formatMatch.captured(3).at(0).toLatin1(); + postStr = formatMatch.captured(4); retVal = mapFormatCharToParamType(formatSpec); } else { retVal = ParamTypeUnknown; |