Skip to content
Permalink
Browse files
Remove all use of Qt3 compatibiliy routines except for the GRASS prov…
…ider/plugin. Automatic casts of QString to char* have also been removed for compatibility with Qt/Mac-Cocoa (64-bit).

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@8406 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed May 7, 2008
1 parent 880ee6d commit 4b45366ad011a8b91b986077d17d9940ab3dcbc4
Showing with 1,103 additions and 1,321 deletions.
  1. +4 −0 CMakeLists.txt
  2. +1 −1 python/core/qgsmaplayerregistry.sip
  3. +13 −17 src/app/CMakeLists.txt
  4. +11 −9 src/app/composer/qgscomposer.cpp
  5. +0 −1 src/app/composer/qgscomposeritem.h
  6. +4 −0 src/app/composer/qgscomposerlabel.cpp
  7. +1 −1 src/app/composer/qgscomposermap.cpp
  8. +0 −1 src/app/composer/qgscomposerscalebar.h
  9. +33 −40 src/app/composer/qgscomposervectorlegend.cpp
  10. +7 −15 src/app/composer/qgscomposervectorlegend.h
  11. +3 −3 src/app/legend/qgslegend.cpp
  12. +1 −2 src/app/legend/qgslegendlayerfile.cpp
  13. +22 −15 src/app/main.cpp
  14. +22 −61 src/app/qgisapp.cpp
  15. +0 −12 src/app/qgisapp.h
  16. +2 −2 src/app/qgsabout.cpp
  17. +111 −101 src/app/qgsattributeactiondialog.cpp
  18. +7 −2 src/app/qgsattributeactiondialog.h
  19. +182 −148 src/app/qgsattributetable.cpp
  20. +34 −28 src/app/qgsattributetable.h
  21. +3 −3 src/app/qgsattributetabledisplay.cpp
  22. +21 −14 src/app/qgsbookmarks.cpp
  23. +2 −2 src/app/qgsbookmarks.h
  24. +1 −1 src/app/qgsdbsourceselect.cpp
  25. +9 −10 src/app/qgsdelattrdialog.cpp
  26. +2 −2 src/app/qgsdelattrdialog.h
  27. +37 −42 src/app/qgsgeomtypedialog.cpp
  28. +1 −1 src/app/qgsgraduatedsymboldialog.cpp
  29. +21 −30 src/app/qgsmeasuredialog.cpp
  30. +10 −33 src/app/qgsnumericsortlistviewitem.cpp
  31. +9 −10 src/app/qgsnumericsortlistviewitem.h
  32. +6 −7 src/app/qgsoptions.cpp
  33. +2 −2 src/app/qgspastetransformations.cpp
  34. +14 −8 src/app/qgspgquerybuilder.cpp
  35. +4 −0 src/app/qgspythondialog.cpp
  36. +2 −2 src/app/qgspythonutils.cpp
  37. +51 −52 src/app/qgsrasterlayerproperties.cpp
  38. +1 −1 src/app/qgsrasterlayerproperties.h
  39. +9 −5 src/app/qgssearchquerybuilder.cpp
  40. +9 −12 src/app/qgsserversourceselect.cpp
  41. +1 −1 src/app/qgsserversourceselect.h
  42. +1 −1 src/app/qgsuniquevaluedialog.cpp
  43. +7 −2 src/app/qgsvectorlayerproperties.cpp
  44. +0 −8 src/core/CMakeLists.txt
  45. +3 −3 src/core/qgscoordinatetransform.cpp
  46. +1 −1 src/core/qgsdistancearea.cpp
  47. +1 −1 src/core/qgsmaplayerregistry.cpp
  48. +1 −1 src/core/qgsmaplayerregistry.h
  49. +3 −3 src/core/qgsproject.cpp
  50. +44 −47 src/core/qgsprojectproperty.cpp
  51. +17 −16 src/core/qgsprojectproperty.h
  52. +2 −3 src/core/qgsprovidercountcalcevent.cpp
  53. +3 −7 src/core/qgsprovidercountcalcevent.h
  54. +2 −3 src/core/qgsproviderextentcalcevent.cpp
  55. +4 −8 src/core/qgsproviderextentcalcevent.h
  56. +4 −4 src/core/qgsproviderregistry.cpp
  57. +1 −1 src/core/qgsrect.cpp
  58. +4 −4 src/core/qgsspatialrefsys.cpp
  59. +1 −1 src/core/qgsvectorfilewriter.cpp
  60. +1 −1 src/core/qgsvectorlayer.cpp
  61. +50 −57 src/core/raster/qgsrasterlayer.cpp
  62. +3 −2 src/core/raster/qgsrasterlayer.h
  63. +1 −2 src/core/symbology/qgssymbologyutils.cpp
  64. +0 −9 src/gui/CMakeLists.txt
  65. +3 −2 src/gui/qgsmapoverviewcanvas.cpp
  66. +2 −2 src/gui/qgsmaptoolpan.cpp
  67. +1 −1 src/gui/qgsprojectionselector.cpp
  68. +1 −1 src/gui/qgsquickprint.cpp
  69. +13 −1 src/helpviewer/CMakeLists.txt
  70. +2 −4 src/helpviewer/main.cpp
  71. +3 −3 src/helpviewer/qgshelpviewer.cpp
  72. +4 −0 src/plugins/copyright_label/plugingui.cpp
  73. +0 −1 src/plugins/geoprocessing/qgsdlgpgbufferbase.ui
  74. +11 −11 src/plugins/geoprocessing/qgspggeoprocessing.cpp
  75. +0 −1 src/plugins/georeferencer/mapcoordsdialogbase.ui
  76. +1 −1 src/plugins/georeferencer/plugingui.cpp
  77. +0 −1 src/plugins/georeferencer/qgsgeorefwarpoptionsdialogbase.ui
  78. +1 −1 src/plugins/georeferencer/qgsimagewarper.cpp
  79. +1 −1 src/plugins/georeferencer/qgspointdialog.cpp
  80. +2 −1 src/plugins/gps_importer/qgsgpsdevicedialog.cpp
  81. +0 −4 src/plugins/gps_importer/qgsgpsdevicedialogbase.ui
  82. +35 −43 src/plugins/gps_importer/qgsgpsplugin.cpp
  83. +1 −1 src/plugins/gps_importer/qgsgpsplugingui.cpp
  84. +2 −2 src/plugins/grass/qgsgrassshell.cpp
  85. +5 −14 src/plugins/north_arrow/pluginguibase.ui
  86. +6 −2 src/plugins/quick_print/quickprintgui.cpp
  87. +2 −4 src/plugins/spit/qgsshapefile.cpp
  88. +2 −2 src/plugins/spit/qgsspit.cpp
  89. +0 −1 src/plugins/wfs/CMakeLists.txt
  90. +4 −4 src/plugins/wfs/qgswfssourceselect.cpp
  91. +1 −1 src/providers/delimitedtext/qgsdelimitedtextprovider.cpp
  92. +1 −1 src/providers/gpx/gpsdata.cpp
  93. +7 −0 src/providers/grass/CMakeLists.txt
  94. +4 −4 src/providers/grass/qgsgrass.cpp
  95. +1 −1 src/providers/grass/qgsgrassprovider.cpp
  96. +7 −7 src/providers/ogr/qgsogrprovider.cpp
  97. +2 −2 src/providers/postgres/qgspostgrescountthread.cpp
  98. +6 −6 src/providers/postgres/qgspostgresextentthread.cpp
  99. +3 −3 src/providers/postgres/qgspostgresprovider.cpp
  100. +1 −1 src/providers/wms/qgswmsprovider.cpp
  101. +8 −6 src/ui/CMakeLists.txt
  102. +0 −1 src/ui/qgsaddattrdialogbase.ui
  103. +21 −23 src/ui/qgsattributeactiondialogbase.ui
  104. +0 −4 src/ui/qgsattributedialogbase.ui
  105. +10 −14 src/ui/qgsbookmarksbase.ui
  106. +0 −1 src/ui/qgscomposerlabelbase.ui
  107. +0 −1 src/ui/qgscomposermapbase.ui
  108. +0 −1 src/ui/qgscomposerpicturebase.ui
  109. +0 −1 src/ui/qgscomposerscalebarbase.ui
  110. +21 −10 src/ui/qgscomposervectorlegendbase.ui
  111. +0 −1 src/ui/qgscompositionbase.ui
  112. +0 −1 src/ui/qgscontinuouscolordialogbase.ui
  113. +2 −15 src/ui/qgsdelattrdialogbase.ui
  114. +0 −4 src/ui/qgsfillstylewidgetbase.ui
  115. +10 −10 src/ui/qgsgeomtypedialogbase.ui
  116. +0 −1 src/ui/qgsgraduatedsymboldialogbase.ui
  117. +0 −4 src/ui/qgshelpviewerbase.ui
  118. +0 −4 src/ui/qgsidentifyresultsbase.ui
  119. +1 −13 src/ui/qgslabeldialogbase.ui
  120. +0 −1 src/ui/qgsludialogbase.ui
  121. +56 −94 src/ui/qgsmeasurebase.ui
  122. +0 −1 src/ui/qgsmessageviewer.ui
  123. +1 −13 src/ui/qgsnewconnectionbase.ui
  124. +1 −13 src/ui/qgsnewhttpconnectionbase.ui
  125. +0 −4 src/ui/qgspastetransformationsbase.ui
  126. +0 −1 src/ui/qgspluginmanagerbase.ui
  127. +1 −16 src/ui/qgspointstylewidgetbase.ui
  128. +7 −29 src/ui/qgsrasterlayerpropertiesbase.ui
  129. +2 −15 src/ui/qgsserversourceselectbase.ui
  130. +0 −1 src/ui/qgssinglesymboldialogbase.ui
  131. +0 −1 src/ui/qgsuniquevaluedialogbase.ui
@@ -151,6 +151,10 @@ FIND_PACKAGE(Qt4 REQUIRED)

INCLUDE( ${QT_USE_FILE} )

# Disable automatic conversion from QString to ASCII 8-bit strings (char *)
# (Keeps code compatible with Qt/Mac/64bit)
ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII)

FIND_PROGRAM(QT_LRELEASE_EXECUTABLE
NAMES lrelease
PATHS ${QT_BINARY_DIR}
@@ -89,7 +89,7 @@ signals:
protected:

//! protected constructor
QgsMapLayerRegistry( QObject * parent = 0, const char * name = 0 );
QgsMapLayerRegistry( QObject * parent = 0 );


}; // class QgsMapLayerRegistry
@@ -1,5 +1,11 @@

# TODO: delete qgsvectorsymbologywidget.cpp and qgsvectorsymbologywidget.h from SVN
# TODO: delete from SVN
# qgslinestyledialog.(cpp|h)
# qgslinestylewidget.(cpp|h)
# qgsmarkerdialog.(cpp|h)
# qgspatterndialog.(cpp|h)
# qgspointstylewidget.(cpp|h)
# qgsvectorsymbologywidget.(cpp|h)

SET(QGIS_APP_SRCS
main.cpp
@@ -25,8 +31,6 @@ SET(QGIS_APP_SRCS
qgshelpviewer.cpp
qgsidentifyresults.cpp
qgslabeldialog.cpp
qgslinestyledialog.cpp
qgslinestylewidget.cpp
qgsludialog.cpp
qgsmaptooladdfeature.cpp
qgsmaptooladdvertex.cpp
@@ -41,19 +45,16 @@ SET(QGIS_APP_SRCS
qgsmaptoolselect.cpp
qgsmaptoolsplitfeatures.cpp
qgsmaptoolvertexedit.cpp
qgsmarkerdialog.cpp
qgsmeasuredialog.cpp
qgsmeasuretool.cpp
qgsnewhttpconnection.cpp
qgsnumericsortlistviewitem.cpp
qgsoptions.cpp
qgspastetransformations.cpp
qgspatterndialog.cpp
qgspluginitem.cpp
qgspluginmanager.cpp
qgspluginmetadata.cpp
qgspluginregistry.cpp
qgspointstylewidget.cpp
qgsprojectproperties.cpp
qgsrasterlayerproperties.cpp
qgssearchquerybuilder.cpp
@@ -106,19 +107,14 @@ SET (QGIS_APP_MOC_HDRS
qgshelpviewer.h
qgsidentifyresults.h
qgslabeldialog.h
qgslinestyledialog.h
qgslinestylewidget.h
qgsludialog.h
qgsmaplayerinterface.h
qgsmaptoolidentify.h
qgsmarkerdialog.h
qgsmeasuredialog.h
qgsnewhttpconnection.h
qgsoptions.h
qgspastetransformations.h
qgspatterndialog.h
qgspluginmanager.h
qgspointstylewidget.h
qgsprojectproperties.h
qgsrasterlayerproperties.h
qgssearchquerybuilder.h
@@ -232,19 +228,19 @@ TARGET_LINK_LIBRARIES(qgis
${QT_QTCORE_LIBRARY}
${QT_QTGUI_LIBRARY}
${QT_QTXML_LIBRARY}
#${QT_QTSQL_LIBRARY}
${QT_QTSVG_LIBRARY}
${QT_QTNETWORK_LIBRARY}
#should only be needed for win
${QT_QTMAIN_LIBRARY}
${QT_QT3SUPPORT_LIBRARY}
qgis_core
qgis_gui
)
IF (MSVC)
#This resolves issues like cant find winmain etc
TARGET_LINK_LIBRARIES(qgis qtmain)
ENDIF (MSVC)
IF (${QTVERSION} STRLESS "4.3.0")
TARGET_LINK_LIBRARIES(qgis ${QT_QT3SUPPORT_LIBRARY} )
IF (APPLE)
TARGET_LINK_LIBRARIES(qgis ${QT_QTSQL_LIBRARY} )
ENDIF (APPLE)
ENDIF (${QTVERSION} STRLESS "4.3.0")

IF (APPLE)
TARGET_LINK_LIBRARIES(qgis ${APP_SERVICES_LIBRARY} )
@@ -68,11 +68,14 @@ QgsComposer::QgsComposer( QgisApp *qgis): QMainWindow()
mView = new QgsComposerView ( this, mViewFrame);
mPrinter = 0;

QGridLayout *l = new QGridLayout(mViewFrame, 1, 1 );
QGridLayout *l = new QGridLayout(mViewFrame );
l->setMargin(0);
l->addWidget( mView, 0, 0 );

mCompositionOptionsLayout = new QGridLayout( mCompositionOptionsFrame, 1, 1 );
mItemOptionsLayout = new QGridLayout( mItemOptionsFrame, 1, 1 );
mCompositionOptionsLayout = new QGridLayout( mCompositionOptionsFrame );
mCompositionOptionsLayout->setMargin(0);
mItemOptionsLayout = new QGridLayout( mItemOptionsFrame );
mItemOptionsLayout->setMargin(0);

mCompositionNameComboBox->insertItem( tr("Map 1") );

@@ -322,7 +325,6 @@ void QgsComposer::on_mActionPrint_activated(void)

// There is a bug in Qt<=4.2.2 (dialog is not correct) if output is set to file
// => disable until they fix it
//mPrinter->setOutputToFile (true ) ;
//mPrinter->setOutputFileName ( QDir::convertSeparators ( QDir::home().path() + "/" + "qgis.eps") );
#endif
mPrinter->setColorMode(QPrinter::Color);
@@ -331,7 +333,7 @@ void QgsComposer::on_mActionPrint_activated(void)
{
// Because of bug in Qt<=4.2.2 (dialog is not correct) we have to reset always
// to printer otherwise print to file is checked but printer combobox is in dialog
mPrinter->setOutputToFile(false);
mPrinter->setOutputFileName(NULL);
}

//set the resolution and paper orientation each time we call up the dialog, not just the first time we run it
@@ -426,7 +428,7 @@ void QgsComposer::on_mActionPrint_activated(void)
std::cout << "Overwrite the bounding box" << std::endl;
if (!f.open(QIODevice::ReadWrite))
{
throw QgsIOException(tr("Couldn't open " + f.name() + tr(" for read/write")));
throw QgsIOException(tr("Couldn't open ") + f.name() + tr(" for read/write"));
}
Q_LONG offset = 0;
Q_LONG size;
@@ -740,7 +742,7 @@ void QgsComposer::on_mActionExportAsImage_activated(void)

if ( result != QDialog::Accepted) return;

myOutputFileNameQString = myQFileDialog->selectedFile();
myOutputFileNameQString = myQFileDialog->selectedFiles().first();
QString myFilterString = myQFileDialog->selectedFilter();
#ifdef QGISDEBUG
std::cout << "Selected filter: " << myFilterString.toLocal8Bit().data() << std::endl;
@@ -799,7 +801,7 @@ void QgsComposer::on_mActionExportAsSVG_activated(void)
"such as the legend or scale bar.</p>"
#else
"Qt4 svg code. In particular, there are problems "
"with layers not being clipped to the map"
"with layers not being clipped to the map "
"bounding box.</p>"
#endif
"If you require a vector-based output file from "
@@ -821,7 +823,7 @@ void QgsComposer::on_mActionExportAsSVG_activated(void)
raise ();
if ( result != QDialog::Accepted) return;

QString myOutputFileNameQString = myQFileDialog->selectedFile();
QString myOutputFileNameQString = myQFileDialog->selectedFiles().first();
if ( myOutputFileNameQString == "" ) return;

myQSettings.writeEntry("/UI/lastSaveAsSvgFile", myOutputFileNameQString);
@@ -20,7 +20,6 @@
#include "qgscomposition.h"

class QWidget;
class Q3Canvas;
class QDomNode;
class QDomDocument;

@@ -256,7 +256,11 @@ void QgsComposerLabel::setOptions ( void )
void QgsComposerLabel::on_mTextEdit_textChanged()
{
QRectF r = boundingRect();
#if QT_VERSION < 0x040300
mText = mTextEdit->text();
#else
mText = mTextEdit->toPlainText();
#endif
QAbstractGraphicsShapeItem::prepareGeometryChange();
QAbstractGraphicsShapeItem::update();
writeSettings();
@@ -286,7 +286,7 @@ void QgsComposerMap::cache ( void )
mCacheExtent.setXmax ( mCacheExtent.xMin() + w * scale );
mCacheExtent.setYmax ( mCacheExtent.yMin() + h * scale );

mCachePixmap.resize( w, h );
mCachePixmap = QPixmap( w, h );

// WARNING: ymax in QgsMapToPixel is device height!!!
QgsMapToPixel transform(scale, h, mCacheExtent.yMin(), mCacheExtent.xMin() );
@@ -19,7 +19,6 @@
#include "ui_qgscomposerscalebarbase.h"
#include "qgscomposeritem.h"
#include <QAbstractGraphicsShapeItem>
#include <Q3PointArray>
#include <QRect>
#include <QPen>

@@ -26,10 +26,11 @@
#include "qgsvectorlayer.h"

#include <QFontDialog>
#include <QPainter>
#include <Q3PopupMenu>
#include <QGraphicsScene>

#include <QHeaderView>
#include <QMenu>
#include <QPainter>
#include <QTreeWidgetItem>

#include <iostream>
#include <vector>
@@ -114,21 +115,11 @@ void QgsComposerVectorLegend::init ( void )
// setActive(true);

// Layers list view
mLayersListView->setColumnText(0,tr("Layers"));
mLayersListView->addColumn(tr("Group"));
mLayersListView->setSorting(-1);
mLayersListView->setResizeMode(Q3ListView::AllColumns);
mLayersListView->setSelectionMode(Q3ListView::Extended);

mLayersPopupMenu = new Q3PopupMenu( );

mLayersPopupMenu->insertItem( tr("Combine selected layers"), this, SLOT(groupLayers()) );

connect ( mLayersListView, SIGNAL(clicked(Q3ListViewItem *)),
this, SLOT(layerChanged(Q3ListViewItem *)));
//x mLayersListView->setResizeMode(QTreeView::AllColumns);
mLayersListView->setColumnHidden(2, true);

connect ( mLayersListView, SIGNAL(rightButtonClicked(Q3ListViewItem *, const QPoint &, int)),
this, SLOT( showLayersPopupMenu(Q3ListViewItem *, const QPoint &, int)) );
connect ( mLayersListView, SIGNAL(itemClicked(QTreeWidgetItem *, int)),
this, SLOT(layerChanged(QTreeWidgetItem *)));

// Plot style
setPlotStyle ( QgsComposition::Preview );
@@ -475,7 +466,7 @@ void QgsComposerVectorLegend::cache ( void )
std::cout << "QgsComposerVectorLegend::cache()" << std::endl;

//typical boundingRect size is 15 units wide,
mCachePixmap.resize ((int)QGraphicsRectItem::rect().width(), (int)QGraphicsRectItem::rect().height() );
mCachePixmap = QPixmap((int)QGraphicsRectItem::rect().width(), (int)QGraphicsRectItem::rect().height() );


QPainter p(&mCachePixmap);
@@ -666,24 +657,25 @@ void QgsComposerVectorLegend::setOptions ( void )
int nlayers = mMapCanvas->layerCount();
for ( int i = 0; i < nlayers; i++ ) {
QgsMapLayer *layer = mMapCanvas->getZpos(i);

// if ( !layer->visible() ) continue;
//if ( layer->type() != QgsMapLayer::VECTOR ) continue;

Q3CheckListItem *li = new Q3CheckListItem ( mLayersListView, layer->name(), Q3CheckListItem::CheckBox );
QTreeWidgetItem *item = new QTreeWidgetItem(mLayersListView);

item->setText(0, layer->name() );

QString id = layer->getLayerID();
li->setText(2, id );
item->setText(2, id );

item->setCheckState(0, layerOn(id) ? Qt::Checked : Qt::Unchecked);

li->setOn ( layerOn(id) );

int group = layerGroup(id);
if ( group > 0 ) {
li->setText(1, QString::number(group) );
item->setText(1, QString::number(group) );
}

mLayersListView->insertItem ( li );
}
mLayersListView->header()->resizeSections(QHeaderView::Stretch);
}
}

@@ -701,11 +693,13 @@ bool QgsComposerVectorLegend::selected( void )
return mSelected;
}

void QgsComposerVectorLegend::showLayersPopupMenu ( Q3ListViewItem * lvi, const QPoint & pt, int )
void QgsComposerVectorLegend::contextMenuEvent( QContextMenuEvent *event)
{
std::cout << "QgsComposerVectorLegend::showLayersPopupMenu" << std::endl;
std::cout << "QgsComposerVectorLegend::contextMenuEvent" << std::endl;

mLayersPopupMenu->exec(pt);
QMenu layersPopupMenu( this);
layersPopupMenu.addAction( tr("Combine selected layers"), this, SLOT(groupLayers()) );
layersPopupMenu.exec( event->globalPos());
}

bool QgsComposerVectorLegend::layerOn ( QString id )
@@ -752,15 +746,14 @@ void QgsComposerVectorLegend::setLayerGroup ( QString id, int group )
}
}

void QgsComposerVectorLegend::layerChanged ( Q3ListViewItem *lvi )
void QgsComposerVectorLegend::layerChanged ( QTreeWidgetItem *lvi )
{
std::cout << "QgsComposerVectorLegend::layerChanged" << std::endl;

if ( lvi == 0 ) return;

QString id = lvi->text(2);
Q3CheckListItem *cli = dynamic_cast <Q3CheckListItem *>(lvi);
setLayerOn ( id, cli->isOn() );
setLayerOn(id, lvi->checkState(0) == Qt::Checked);

writeSettings();

@@ -773,18 +766,18 @@ void QgsComposerVectorLegend::groupLayers ( void )
{
std::cout << "QgsComposerVectorLegend::groupLayers" << std::endl;

Q3ListViewItemIterator it( mLayersListView );
QTreeWidgetItemIterator it( mLayersListView );
int count = 0;
Q3ListViewItem *lastItem = NULL;
QTreeWidgetItem *lastItem = NULL;
QString id;
while ( it.current() ) {
if ( it.current()->isSelected() ) {
std::cout << "selected: " << it.current()->text(0).toLocal8Bit().data() << " " << it.current()->text(2).toLocal8Bit().data() << std::endl;
while ( *it ) {
if ( (*it)->isSelected() ) {
std::cout << "selected: " << (*it)->text(0).toLocal8Bit().data() << " " << (*it)->text(2).toLocal8Bit().data() << std::endl;

id = it.current()->text(2);
id = (*it)->text(2);
setLayerGroup ( id, mNextLayerGroup );
it.current()->setText(1,QString::number(mNextLayerGroup) );
lastItem = it.current();
(*it)->setText(1,QString::number(mNextLayerGroup) );
lastItem = *it;
count++;
}
++it;
Loading

0 comments on commit 4b45366

Please sign in to comment.