r24899 by craig - Qt6 build warning removal: Switch QVariant for QMetaType

scribus-commit scribus-commit at lists.scribus.net
Fri Feb 4 21:33:35 UTC 2022


Author: craig
Date: Fri Feb  4 21:33:35 2022
New Revision: 24899

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24899
Log:
Qt6 build warning removal: Switch QVariant for QMetaType

Modified:
    trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.cpp
    trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.h

Modified: trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24899&path=/trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.cpp
==============================================================================
--- trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.cpp	(original)
+++ trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.cpp	Fri Feb  4 21:33:35 2022
@@ -1,18 +1,18 @@
 /*
-    Copyright (C)  2010  Brad Hards <bradh at frogmouth.net>
+	Copyright (C)  2010  Brad Hards <bradh at frogmouth.net>
 
-    This library is free software: you can redistribute it and/or modify
-    it under the terms of the GNU Lesser General Public License as published by
-    the Free Software Foundation, either version 2.1 of the License, or
-    (at your option) any later version.
+	This library is free software: you can redistribute it and/or modify
+	it under the terms of the GNU Lesser General Public License as published by
+	the Free Software Foundation, either version 2.1 of the License, or
+	(at your option) any later version.
 
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU Lesser General Public License for more details.
+	This library is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU Lesser General Public License for more details.
 
-    You should have received a copy of the GNU Lesser General Public License
-    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+	You should have received a copy of the GNU Lesser General Public License
+	along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include "UserPropsDestination.h"
@@ -21,53 +21,77 @@
 
 namespace RtfReader
 {
-    UserPropsDestination::UserPropsDestination( Reader *reader, AbstractRtfOutput *output, const QString &name ) :
-      Destination( reader, output, name ), m_nextPlainTextIsPropertyName( true ),
-      m_propertyType( QVariant::String )
-    {
-    }
+	UserPropsDestination::UserPropsDestination( Reader *reader, AbstractRtfOutput *output, const QString &name ) :
+		Destination( reader, output, name ), m_nextPlainTextIsPropertyName( true ),
+		m_propertyType( QMetaType::QString )
+	{
+	}
 
-    UserPropsDestination::~UserPropsDestination()
-    {}
+	UserPropsDestination::~UserPropsDestination()
+	{}
 
-    void UserPropsDestination::handleControlWord( const QString &controlWord, bool hasValue, const int value )
-    {
-	if ( controlWord == "propname" ) {
-	    m_nextPlainTextIsPropertyName = true;
-	} else if ( ( controlWord == "proptype" ) && hasValue ) {
-	    if ( value == 30 ) {
-		m_propertyType = QVariant::String;
-	    } else if ( value == 3 ) {
-		m_propertyType = QVariant::Int;
-	    } else if ( value == 5 ) {
-		m_propertyType = QVariant::Double;
-	    } else if ( value == 64 ) {
-	      	m_propertyType = QVariant::Date;
-	    } else if ( value == 11 ) {
-		m_propertyType = QVariant::Bool;
-	    } else {
-	//	qDebug() << "unhandled value type in UserPropsDestination:" << value;
-	    }
-	} else if ( controlWord == "staticval" ) {
-	    m_nextPlainTextIsPropertyName = false;
-	} else {
-	//    qDebug() << "unexpected control word in UserPropsDestination:" << controlWord;
+	void UserPropsDestination::handleControlWord( const QString &controlWord, bool hasValue, const int value )
+	{
+		if ( controlWord == "propname" )
+		{
+			m_nextPlainTextIsPropertyName = true;
+		}
+		else if ( ( controlWord == "proptype" ) && hasValue )
+		{
+			if ( value == 30 )
+			{
+				m_propertyType = QMetaType::QString;
+			}
+			else if ( value == 3 )
+			{
+				m_propertyType = QMetaType::Int;
+			}
+			else if ( value == 5 )
+			{
+				m_propertyType = QMetaType::Double;
+			}
+			else if ( value == 64 )
+			{
+				m_propertyType = QMetaType::QDate;
+			}
+			else if ( value == 11 )
+			{
+				m_propertyType = QMetaType::Bool;
+			}
+			else
+			{
+				//	qDebug() << "unhandled value type in UserPropsDestination:" << value;
+			}
+		}
+		else if ( controlWord == "staticval" )
+		{
+			m_nextPlainTextIsPropertyName = false;
+		}
+		else
+		{
+			//    qDebug() << "unexpected control word in UserPropsDestination:" << controlWord;
+		}
 	}
-    }
 
 	void UserPropsDestination::handlePlainText( const QByteArray &plainText )
-    {
-	if ( m_nextPlainTextIsPropertyName ) {
-	    m_propertyName = plainText;
-	} else {
-	    QVariant value;
-	    if ( m_propertyType == QVariant::String ) {
-		value = QVariant( plainText );
-	    } else {
-		// TODO: Really need some examples of this stuff - int, float, date and boolean
-	//	qDebug() << "unhandled value type in UserPropsDestination:" << m_propertyType;
-	    }
-	    m_output->addUserProp( m_propertyName, value );
+	{
+		if ( m_nextPlainTextIsPropertyName )
+		{
+			m_propertyName = plainText;
+		}
+		else
+		{
+			QVariant value;
+			if ( m_propertyType == QMetaType::QString )
+			{
+				value = QVariant( plainText );
+			}
+			else
+			{
+				// TODO: Really need some examples of this stuff - int, float, date and boolean
+				//	qDebug() << "unhandled value type in UserPropsDestination:" << m_propertyType;
+			}
+			m_output->addUserProp( m_propertyName, value );
+		}
 	}
-    }
 }

Modified: trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24899&path=/trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.h
==============================================================================
--- trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.h	(original)
+++ trunk/Scribus/scribus/third_party/rtf-qt/UserPropsDestination.h	Fri Feb  4 21:33:35 2022
@@ -18,30 +18,30 @@
 #ifndef RTFREADER_USERPROPSDESTINATION_H
 #define RTFREADER_USERPROPSDESTINATION_H
 
+#include <QColor>
 #include <QString>
 #include <QVariant>
-#include <QColor>
 
 #include "Destination.h"
 namespace RtfReader
 {
-    class Reader;
+class Reader;
 
-	class UserPropsDestination: public Destination
-    {
-      public:
-	UserPropsDestination( Reader *reader, AbstractRtfOutput *output, const QString &name );
+class UserPropsDestination: public Destination
+{
+	public:
+		UserPropsDestination( Reader *reader, AbstractRtfOutput *output, const QString &name );
 
-	virtual ~UserPropsDestination();
+		virtual ~UserPropsDestination();
 
-	virtual void handleControlWord( const QString &controlWord, bool hasValue, const int value );
-	virtual void handlePlainText(const QByteArray &plainText );
+		virtual void handleControlWord( const QString &controlWord, bool hasValue, const int value );
+		virtual void handlePlainText(const QByteArray &plainText );
 
-      private:
-	bool m_nextPlainTextIsPropertyName;
-	QVariant::Type m_propertyType;
-	QString m_propertyName;
-      };
+	private:
+		bool m_nextPlainTextIsPropertyName;
+		QMetaType::Type m_propertyType;
+		QString m_propertyName;
+};
 }
 
 #endif




More information about the scribus-commit mailing list