[QGIS Commit] r12198 - trunk/qgis/src/app
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Thu Nov 19 12:22:22 EST 2009
Author: jef
Date: 2009-11-19 12:22:21 -0500 (Thu, 19 Nov 2009)
New Revision: 12198
Modified:
trunk/qgis/src/app/qgisapp.cpp
trunk/qgis/src/app/qgsattributeeditor.cpp
Log:
hopefully restore Qt 4.3 compability
Modified: trunk/qgis/src/app/qgisapp.cpp
===================================================================
--- trunk/qgis/src/app/qgisapp.cpp 2009-11-19 17:16:28 UTC (rev 12197)
+++ trunk/qgis/src/app/qgisapp.cpp 2009-11-19 17:22:21 UTC (rev 12198)
@@ -4879,7 +4879,11 @@
#endif
QString version = QString( "%1.%2.%3" ).arg( QGis::QGIS_VERSION_INT / 10000 ).arg( QGis::QGIS_VERSION_INT / 100 % 100 ).arg( QGis::QGIS_VERSION_INT % 100 );
QgsDebugMsg( QString( "load library %1 (%2)" ).arg( pythonlibName ).arg( version ) );
+#if QT_VERSION >= 0x040400
QLibrary pythonlib( pythonlibName, version );
+#else
+ QLibrary pythonlib( pythonlibName );
+#endif
// It's necessary to set these two load hints, otherwise Python library won't work correctly
// see http://lists.kde.org/?l=pykde&m=117190116820758&w=2
pythonlib.setLoadHints( QLibrary::ResolveAllSymbolsHint | QLibrary::ExportExternalSymbolsHint );
Modified: trunk/qgis/src/app/qgsattributeeditor.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributeeditor.cpp 2009-11-19 17:16:28 UTC (rev 12197)
+++ trunk/qgis/src/app/qgsattributeeditor.cpp 2009-11-19 17:22:21 UTC (rev 12198)
@@ -25,7 +25,6 @@
#include <QPushButton>
#include <QLineEdit>
#include <QTextEdit>
-#include <QPlainTextEdit>
#include <QFileDialog>
#include <QComboBox>
#include <QCheckBox>
@@ -33,6 +32,10 @@
#include <QCompleter>
#include <QHBoxLayout>
+#if QT_VERSION >= 0x040400
+#include <QPlainTextEdit>
+#endif
+
void QgsAttributeEditor::selectFileName( void )
{
QPushButton *pb = qobject_cast<QPushButton *>( sender() );
@@ -259,17 +262,26 @@
{
QLineEdit *le = NULL;
QTextEdit *te = NULL;
+#if QT_VERSION >= 0x040400
QPlainTextEdit *pte = NULL;
+#endif
if ( editor )
{
le = qobject_cast<QLineEdit *>( editor );
te = qobject_cast<QTextEdit *>( editor );
+#if QT_VERSION >= 0x040400
pte = qobject_cast<QPlainTextEdit *>( editor );
+#endif
}
else if ( editType == QgsVectorLayer::TextEdit )
{
+#if QT_VERSION >= 0x040400
pte = new QPlainTextEdit( parent );
+#else
+ te = new QTextEdit( parent );
+ te->setAcceptRichText( false );
+#endif
}
else
{
@@ -307,14 +319,18 @@
if ( te )
{
+#if QT_VERSION >= 0x040400
te->setAcceptRichText( true );
+#endif
myWidget = te;
}
+#if QT_VERSION < 0x040400
if ( pte )
{
myWidget = pte;
}
+#endif
}
break;
@@ -390,7 +406,11 @@
QTextEdit *te = qobject_cast<QTextEdit *>( widget );
if ( te )
{
+#if QT_VERSION >= 0x040400
text = te->toHtml();
+#else
+ text = te->toPlainText();
+#endif
modified = te->document()->isModified();
if ( text == "NULL" )
{
@@ -398,6 +418,7 @@
}
}
+#if QT_VERSION >= 0x040400
QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( widget );
if ( pte )
{
@@ -408,6 +429,7 @@
text = QString::null;
}
}
+#endif
QComboBox *cb = qobject_cast<QComboBox *>( widget );
if ( cb )
@@ -574,9 +596,14 @@
{
QLineEdit *le = qobject_cast<QLineEdit *>( editor );
QTextEdit *te = qobject_cast<QTextEdit *>( editor );
+#if QT_VERSION >= 0x040400
QPlainTextEdit *pte = qobject_cast<QPlainTextEdit *>( editor );
if ( !le && !te && !pte )
return false;
+#else
+ if ( !le && !te )
+ return false;
+#endif
QString text;
if ( value.isNull() )
@@ -589,10 +616,15 @@
if ( le )
le->setText( text );
+#if QT_VERSION >= 0x040400
if ( te )
te->setHtml( text );
if ( pte )
pte->setPlainText( text );
+#else
+ if ( te )
+ te->setPlainText( text );
+#endif
}
break;
More information about the QGIS-commit
mailing list