Merge pull request #5130 from nyalldawson/deprecated

Fix use of some deprecated Qt methods
This commit is contained in:
Nyall Dawson 2017-09-06 04:22:40 +10:00 committed by GitHub
commit a11e0c6687
42 changed files with 109 additions and 110 deletions

View File

@ -568,7 +568,7 @@ QgsAlignRaster::RasterInfo::RasterInfo( const QString &layerpath )
( void ) GDALGetGeoTransform( mDataset, mGeoTransform );
// TODO: may be null or empty string
mCrsWkt = QString::fromAscii( GDALGetProjectionRef( mDataset ) );
mCrsWkt = QString::fromLatin1( GDALGetProjectionRef( mDataset ) );
mBandCnt = GDALGetBandNumber( mDataset );
}

View File

@ -290,7 +290,7 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
//set up models, views and delegates
mColumnModel = new QgsComposerAttributeTableColumnModelV2( mComposerTable, mColumnsTableView );
mColumnsTableView->setModel( mColumnModel );
mColumnsTableView->horizontalHeader()->setResizeMode( QHeaderView::Stretch );
mColumnsTableView->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
mColumnSourceDelegate = new QgsComposerColumnSourceDelegate( vLayer, mColumnsTableView, mComposerTable );
mColumnsTableView->setItemDelegateForColumn( 0, mColumnSourceDelegate );
@ -312,7 +312,7 @@ QgsAttributeSelectionDialog::QgsAttributeSelectionDialog( QgsComposerAttributeTa
mSortedProxyModel->sort( 0, Qt::AscendingOrder );
mSortColumnTableView->setSortingEnabled( false );
mSortColumnTableView->setModel( mSortedProxyModel );
mSortColumnTableView->horizontalHeader()->setResizeMode( QHeaderView::Stretch );
mSortColumnTableView->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
}
mOrderComboBox->insertItem( 0, tr( "Ascending" ) );

View File

@ -591,9 +591,9 @@ QgsComposer::QgsComposer( QgsComposition *composition )
mItemsTreeView->setColumnWidth( 0, 30 );
mItemsTreeView->setColumnWidth( 1, 30 );
mItemsTreeView->header()->setResizeMode( 0, QHeaderView::Fixed );
mItemsTreeView->header()->setResizeMode( 1, QHeaderView::Fixed );
mItemsTreeView->header()->setMovable( false );
mItemsTreeView->header()->setSectionResizeMode( 0, QHeaderView::Fixed );
mItemsTreeView->header()->setSectionResizeMode( 1, QHeaderView::Fixed );
mItemsTreeView->header()->setSectionsMovable( false );
mItemsTreeView->setDragEnabled( true );
mItemsTreeView->setAcceptDrops( true );

View File

@ -30,7 +30,7 @@ QgsLocatorOptionsWidget::QgsLocatorOptionsWidget( QgsLocatorWidget *locator, QWi
mFiltersTreeView->setModel( mModel );
mFiltersTreeView->header()->setStretchLastSection( false );
mFiltersTreeView->header()->setResizeMode( 0, QHeaderView::Stretch );
mFiltersTreeView->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
mConfigureFilterButton->setEnabled( false );
connect( mFiltersTreeView->selectionModel(), &QItemSelectionModel::selectionChanged, this, [ = ]( const QItemSelection & selected, const QItemSelection & )

View File

@ -1601,7 +1601,7 @@ void QgsNodeTool::deleteVertex()
QList<int> &vertexIds = it2.value();
bool res = QgsVectorLayer::Success;
qSort( vertexIds.begin(), vertexIds.end(), qGreater<int>() );
std::sort( vertexIds.begin(), vertexIds.end(), std::greater<int>() );
Q_FOREACH ( int vertexId, vertexIds )
{
if ( res != QgsVectorLayer::EmptyGeometry )

View File

@ -236,7 +236,7 @@ void QgsHandleBadLayers::setFilename( int row, const QString &filename )
QUrl uriSource = QUrl::fromEncoded( datasource.toLatin1() );
QUrl uriDest = QUrl::fromLocalFile( filename );
uriDest.setQueryItems( uriSource.queryItems() );
datasource = QString::fromAscii( uriDest.toEncoded() );
datasource = QString::fromLatin1( uriDest.toEncoded() );
}
}
else

View File

@ -447,7 +447,7 @@ void QgsIdentifyResultsDialog::addFeature( const QgsMapToolIdentify::IdentifyRes
void QgsIdentifyResultsDialog::addFeature( QgsVectorLayer *vlayer, const QgsFeature &f, const QMap<QString, QString> &derivedAttributes )
{
QTreeWidgetItem *layItem = layerItem( vlayer );
lstResults->header()->setResizeMode( QHeaderView::ResizeToContents );
lstResults->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
lstResults->header()->setStretchLastSection( false );
if ( !layItem )

View File

@ -94,12 +94,12 @@ void QgsMapToolAnnotation::canvasPressEvent( QgsMapMouseEvent *e )
return;
}
mLastMousePosition = e->posF();
mLastMousePosition = e->pos();
QgsMapCanvasAnnotationItem *item = selectedItem();
if ( item )
{
mCurrentMoveAction = item->moveActionForPosition( e->posF() );
mCurrentMoveAction = item->moveActionForPosition( e->pos() );
if ( mCurrentMoveAction != QgsMapCanvasAnnotationItem::NoAction )
{
return;
@ -110,7 +110,7 @@ void QgsMapToolAnnotation::canvasPressEvent( QgsMapMouseEvent *e )
{
//select a new item if there is one at this position
mCanvas->scene()->clearSelection();
QgsMapCanvasAnnotationItem *existingItem = itemAtPos( e->posF() );
QgsMapCanvasAnnotationItem *existingItem = itemAtPos( e->pos() );
if ( existingItem )
{
existingItem->setSelected( true );
@ -124,8 +124,8 @@ void QgsMapToolAnnotation::canvasPressEvent( QgsMapMouseEvent *e )
QgsPointXY mapPos = transformCanvasToAnnotation( toMapCoordinates( e->pos() ), annotation );
annotation->setMapPosition( mapPos );
annotation->setMapPositionCrs( mCanvas->mapSettings().destinationCrs() );
annotation->setRelativePosition( QPointF( e->posF().x() / mCanvas->width(),
e->posF().y() / mCanvas->height() ) );
annotation->setRelativePosition( QPointF( e->pos().x() / mCanvas->width(),
e->pos().y() / mCanvas->height() ) );
annotation->setFrameSize( QSizeF( 200, 100 ) );
QgsProject::instance()->annotationManager()->addAnnotation( annotation );
@ -184,17 +184,17 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent *e )
{
QgsPointXY mapPos = transformCanvasToAnnotation( e->snapPoint(), annotation );
annotation->setMapPosition( mapPos );
annotation->setRelativePosition( QPointF( e->posF().x() / mCanvas->width(),
e->posF().y() / mCanvas->height() ) );
annotation->setRelativePosition( QPointF( e->pos().x() / mCanvas->width(),
e->pos().y() / mCanvas->height() ) );
item->update();
QgsProject::instance()->setDirty( true );
}
else if ( mCurrentMoveAction == QgsMapCanvasAnnotationItem::MoveFramePosition )
{
QPointF newCanvasPos = item->pos() + ( e->posF() - mLastMousePosition );
QPointF newCanvasPos = item->pos() + ( e->pos() - mLastMousePosition );
if ( annotation->hasFixedMapPosition() )
{
annotation->setFrameOffsetFromReferencePoint( annotation->frameOffsetFromReferencePoint() + ( e->posF() - mLastMousePosition ) );
annotation->setFrameOffsetFromReferencePoint( annotation->frameOffsetFromReferencePoint() + ( e->pos() - mLastMousePosition ) );
annotation->setRelativePosition( QPointF( newCanvasPos.x() / mCanvas->width(),
newCanvasPos.y() / mCanvas->height() ) );
}
@ -223,27 +223,27 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent *e )
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameRightDown ||
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameRightUp )
{
xmax += e->posF().x() - mLastMousePosition.x();
xmax += e->pos().x() - mLastMousePosition.x();
}
if ( mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameLeft ||
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameLeftDown ||
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameLeftUp )
{
xmin += e->posF().x() - mLastMousePosition.x();
relPosX = ( relPosX * mCanvas->width() + e->posF().x() - mLastMousePosition.x() ) / ( double )mCanvas->width();
xmin += e->pos().x() - mLastMousePosition.x();
relPosX = ( relPosX * mCanvas->width() + e->pos().x() - mLastMousePosition.x() ) / ( double )mCanvas->width();
}
if ( mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameUp ||
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameLeftUp ||
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameRightUp )
{
ymin += e->posF().y() - mLastMousePosition.y();
relPosY = ( relPosY * mCanvas->height() + e->posF().y() - mLastMousePosition.y() ) / ( double )mCanvas->height();
ymin += e->pos().y() - mLastMousePosition.y();
relPosY = ( relPosY * mCanvas->height() + e->pos().y() - mLastMousePosition.y() ) / ( double )mCanvas->height();
}
if ( mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameDown ||
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameLeftDown ||
mCurrentMoveAction == QgsMapCanvasAnnotationItem::ResizeFrameRightDown )
{
ymax += e->posF().y() - mLastMousePosition.y();
ymax += e->pos().y() - mLastMousePosition.y();
}
//switch min / max if necessary
@ -270,18 +270,18 @@ void QgsMapToolAnnotation::canvasMoveEvent( QgsMapMouseEvent *e )
}
else if ( item )
{
QgsMapCanvasAnnotationItem::MouseMoveAction moveAction = item->moveActionForPosition( e->posF() );
QgsMapCanvasAnnotationItem::MouseMoveAction moveAction = item->moveActionForPosition( e->pos() );
if ( mCanvas )
{
mCanvas->setCursor( QCursor( item->cursorShapeForAction( moveAction ) ) );
}
}
mLastMousePosition = e->posF();
mLastMousePosition = e->pos();
}
void QgsMapToolAnnotation::canvasDoubleClickEvent( QgsMapMouseEvent *e )
{
QgsMapCanvasAnnotationItem *item = itemAtPos( e->posF() );
QgsMapCanvasAnnotationItem *item = itemAtPos( e->pos() );
if ( !item )
{
return;

View File

@ -60,7 +60,7 @@ class APP_EXPORT QgsMapToolAnnotation: public QgsMapTool
QgsPointXY transformCanvasToAnnotation( QgsPointXY p, QgsAnnotation *annotation ) const;
QgsMapCanvasAnnotationItem::MouseMoveAction mCurrentMoveAction = QgsMapCanvasAnnotationItem::NoAction;
QPointF mLastMousePosition = QPointF( 0, 0 );
QPoint mLastMousePosition = QPoint( 0, 0 );
};
#endif // QGSMAPTOOLANNOTATION_H

View File

@ -259,7 +259,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
twIdentifyLayers->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Identifiable" ) ) );
twIdentifyLayers->setHorizontalHeaderItem( 3, new QTableWidgetItem( tr( "Read Only" ) ) );
twIdentifyLayers->setRowCount( mapLayers.size() );
twIdentifyLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
twIdentifyLayers->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
int i = 0;
for ( QMap<QString, QgsMapLayer *>::const_iterator it = mapLayers.constBegin(); it != mapLayers.constEnd(); ++it, i++ )
@ -620,7 +620,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
}
}
twWFSLayers->setRowCount( j );
twWFSLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
twWFSLayers->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
mWCSUrlLineEdit->setText( QgsProject::instance()->readEntry( QStringLiteral( "WCSUrl" ), QStringLiteral( "/" ), QLatin1String( "" ) ) );
QStringList wcsLayerIdList = QgsProject::instance()->readListEntry( QStringLiteral( "WCSLayers" ), QStringLiteral( "/" ) );
@ -659,7 +659,7 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas *mapCanvas, QWidget *pa
}
}
twWCSLayers->setRowCount( j );
twWCSLayers->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
twWCSLayers->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
// Default Styles
mStyle = QgsStyle::defaultStyle();

View File

@ -461,8 +461,8 @@ void QgsRasterLayerProperties::setupTransparencyTable( int nBands )
tableTransparency->setHorizontalHeaderItem( 2, new QTableWidgetItem( tr( "Percent Transparent" ) ) );
}
tableTransparency->horizontalHeader()->setResizeMode( 0, QHeaderView::Stretch );
tableTransparency->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
tableTransparency->horizontalHeader()->setSectionResizeMode( 0, QHeaderView::Stretch );
tableTransparency->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
}
void QgsRasterLayerProperties::populateTransparencyTable( QgsRasterRenderer *renderer )

View File

@ -318,7 +318,7 @@ bool QgsApplication::notify( QObject *receiver, QEvent *event )
}
catch ( std::exception &e )
{
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
if ( qApp->thread() == QThread::currentThread() )
QMessageBox::critical( activeWindow(), tr( "Exception" ), e.what() );
}

View File

@ -186,14 +186,14 @@ string "'"{str_char}*"'"
"," { return COMMA; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext) ); return NUMBER_FLOAT; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext) ); return NUMBER_FLOAT; }
{num_int} {
bool ok;
yylval->numberInt = cLocale.toInt( QString::fromAscii(yytext), &ok );
yylval->numberInt = cLocale.toInt( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_INT;
yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext), &ok );
yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_FLOAT;

View File

@ -160,7 +160,7 @@ class QgsExpressionSorter
delete expressionContext->popScope();
qSort( indexedFeatures.begin(), indexedFeatures.end(), *this );
std::sort( indexedFeatures.begin(), indexedFeatures.end(), *this );
features.clear();

View File

@ -257,7 +257,7 @@ bool QgsMapLayer::readLayerXml( const QDomElement &layerElement, const QgsReadWr
QUrl urlDest = QUrl::fromLocalFile( context.pathResolver().readPath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
mDataSource = QString::fromAscii( urlDest.toEncoded() );
mDataSource = QString::fromLatin1( urlDest.toEncoded() );
}
else if ( provider == QLatin1String( "wms" ) )
{
@ -621,7 +621,7 @@ bool QgsMapLayer::writeLayerXml( QDomElement &layerElement, QDomDocument &docume
QUrl urlSource = QUrl::fromEncoded( src.toLatin1() );
QUrl urlDest = QUrl::fromLocalFile( context.pathResolver().writePath( urlSource.toLocalFile() ) );
urlDest.setQueryItems( urlSource.queryItems() );
src = QString::fromAscii( urlDest.toEncoded() );
src = QString::fromLatin1( urlDest.toEncoded() );
}
else if ( vlayer && vlayer->providerType() == QLatin1String( "memory" ) )
{

View File

@ -223,7 +223,7 @@ void QgsMapRendererCustomPainterJob::staticRender( QgsMapRendererCustomPainterJo
catch ( std::exception &e )
{
Q_UNUSED( e );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
}
catch ( ... )
{

View File

@ -263,7 +263,7 @@ void QgsMapRendererParallelJob::renderLayerStatic( LayerRenderJob &job )
catch ( std::exception &e )
{
Q_UNUSED( e );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
}
catch ( ... )
{
@ -307,7 +307,7 @@ void QgsMapRendererParallelJob::renderLabelsStatic( QgsMapRendererParallelJob *s
catch ( std::exception &e )
{
Q_UNUSED( e );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromAscii( e.what() ) );
QgsDebugMsg( "Caught unhandled std::exception: " + QString::fromLatin1( e.what() ) );
}
catch ( ... )
{

View File

@ -164,18 +164,18 @@ string "'"{str_char}*"'"
"," { return COMMA; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext) ); return NUMBER_FLOAT; }
{num_float} { yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext) ); return NUMBER_FLOAT; }
{num_int} {
bool ok;
yylval->numberInt = cLocale.toInt( QString::fromAscii(yytext), &ok );
yylval->numberInt = cLocale.toInt( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_INT;
yylval->numberInt64 = cLocale.toLongLong( QString::fromAscii(yytext), &ok );
yylval->numberInt64 = cLocale.toLongLong( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_INT64;
yylval->numberFloat = cLocale.toDouble( QString::fromAscii(yytext), &ok );
yylval->numberFloat = cLocale.toDouble( QString::fromLatin1(yytext), &ok );
if( ok )
return NUMBER_FLOAT;

View File

@ -16,7 +16,6 @@
#include "qgsstringutils.h"
#include <QVector>
#include <QRegExp>
#include <QTextDocument> // for Qt::escape
#include <QStringList>
#include <QTextBoundaryFinder>
@ -362,7 +361,7 @@ QString QgsStringUtils::insertLinks( const QString &string, bool *foundLinks )
{
protoUrl.prepend( "http://" );
}
QString anchor = QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( Qt::escape( protoUrl ), Qt::escape( url ) );
QString anchor = QStringLiteral( "<a href=\"%1\">%2</a>" ).arg( protoUrl.toHtmlEscaped(), url.toHtmlEscaped() );
converted.replace( urlRegEx.pos( 1 ), url.length(), anchor );
offset = urlRegEx.pos( 1 ) + anchor.length();
}
@ -371,7 +370,7 @@ QString QgsStringUtils::insertLinks( const QString &string, bool *foundLinks )
{
found = true;
QString email = emailRegEx.cap( 1 );
QString anchor = QStringLiteral( "<a href=\"mailto:%1\">%1</a>" ).arg( Qt::escape( email ), Qt::escape( email ) );
QString anchor = QStringLiteral( "<a href=\"mailto:%1\">%1</a>" ).arg( email.toHtmlEscaped(), email.toHtmlEscaped() );
converted.replace( emailRegEx.pos( 1 ), email.length(), anchor );
offset = emailRegEx.pos( 1 ) + anchor.length();
}

View File

@ -63,7 +63,7 @@ void QgsAuthMethodPlugins::setupTable()
tblAuthPlugins->setColumnWidth( 0, 150 );
tblAuthPlugins->setColumnWidth( 1, 300 );
tblAuthPlugins->setRowCount( QgsAuthManager::instance()->authMethodsKeys().size() );
tblAuthPlugins->verticalHeader()->setResizeMode( QHeaderView::ResizeToContents );
tblAuthPlugins->verticalHeader()->setSectionResizeMode( QHeaderView::ResizeToContents );
tblAuthPlugins->setSortingEnabled( true );
tblAuthPlugins->setSelectionBehavior( QAbstractItemView::SelectRows );
}

View File

@ -571,7 +571,7 @@ void QgsLayoutRuler::setCursorPosition( QPointF position )
void QgsLayoutRuler::mouseMoveEvent( QMouseEvent *event )
{
mMarkerPos = event->posF();
mMarkerPos = event->pos();
update();
QPointF displayPos;
@ -651,7 +651,7 @@ void QgsLayoutRuler::mouseMoveEvent( QMouseEvent *event )
}
//update cursor position in status bar
displayPos = mTransform.inverted().map( event->posF() );
displayPos = mTransform.inverted().map( event->pos() );
switch ( mOrientation )
{
case Qt::Horizontal:

View File

@ -104,7 +104,7 @@ class GUI_EXPORT QgsLayoutRuler: public QWidget
QgsLayoutView *mView = nullptr;
QTransform mTransform;
QPointF mMarkerPos;
QPoint mMarkerPos;
QFont mRulerFont;
std::unique_ptr< QFontMetrics > mRulerFontMetrics;

View File

@ -122,7 +122,7 @@ void QgsBrowserDockWidget::showEvent( QShowEvent *e )
mBrowserView->setModel( mProxyModel );
// provide a horizontal scroll bar instead of using ellipse (...) for longer items
mBrowserView->setTextElideMode( Qt::ElideNone );
mBrowserView->header()->setResizeMode( 0, QHeaderView::ResizeToContents );
mBrowserView->header()->setSectionResizeMode( 0, QHeaderView::ResizeToContents );
mBrowserView->header()->setStretchLastSection( false );
// selectionModel is created when model is set on tree

View File

@ -601,7 +601,7 @@ void QgsColorWheel::setColorFromPos( const QPointF pos )
void QgsColorWheel::mouseMoveEvent( QMouseEvent *event )
{
setColorFromPos( event->posF() );
setColorFromPos( event->pos() );
QgsColorWidget::mouseMoveEvent( event );
}
@ -621,7 +621,7 @@ void QgsColorWheel::mousePressEvent( QMouseEvent *event )
{
mClickedPart = QgsColorWheel::Wheel;
}
setColorFromPos( event->posF() );
setColorFromPos( event->pos() );
}
void QgsColorWheel::mouseReleaseEvent( QMouseEvent *event )
@ -1162,7 +1162,7 @@ void QgsColorRampWidget::setMarkerSize( const int markerSize )
void QgsColorRampWidget::mouseMoveEvent( QMouseEvent *event )
{
setColorFromPoint( event->posF() );
setColorFromPoint( event->pos() );
QgsColorWidget::mouseMoveEvent( event );
}
@ -1191,7 +1191,7 @@ void QgsColorRampWidget::wheelEvent( QWheelEvent *event )
void QgsColorRampWidget::mousePressEvent( QMouseEvent *event )
{
setColorFromPoint( event->posF() );
setColorFromPoint( event->pos() );
}
void QgsColorRampWidget::keyPressEvent( QKeyEvent *event )

View File

@ -386,11 +386,11 @@ void QgsComposerRuler::setSceneTransform( const QTransform &transform )
void QgsComposerRuler::mouseMoveEvent( QMouseEvent *event )
{
//qWarning( "QgsComposerRuler::mouseMoveEvent" );
updateMarker( event->posF() );
setSnapLinePosition( event->posF() );
updateMarker( event->pos() );
setSnapLinePosition( event->pos() );
//update cursor position in status bar
QPointF displayPos = mTransform.inverted().map( event->posF() );
QPointF displayPos = mTransform.inverted().map( event->pos() );
if ( mDirection == Horizontal )
{
//mouse is over a horizontal ruler, so don't show a y coordinate

View File

@ -29,9 +29,9 @@ QgsOrderByDialog::QgsOrderByDialog( QgsVectorLayer *layer, QWidget *parent )
{
setupUi( this );
mOrderByTableWidget->horizontalHeader()->setResizeMode( QHeaderView::Stretch );
mOrderByTableWidget->horizontalHeader()->setResizeMode( 1, QHeaderView::ResizeToContents );
mOrderByTableWidget->horizontalHeader()->setResizeMode( 2, QHeaderView::ResizeToContents );
mOrderByTableWidget->horizontalHeader()->setSectionResizeMode( QHeaderView::Stretch );
mOrderByTableWidget->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::ResizeToContents );
mOrderByTableWidget->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::ResizeToContents );
mOrderByTableWidget->installEventFilter( this );

View File

@ -49,16 +49,16 @@ QgsProjectionSelectionTreeWidget::QgsProjectionSelectionTreeWidget( QWidget *par
// Get the full path name to the sqlite3 spatial reference database.
mSrsDatabaseFileName = QgsApplication::srsDatabaseFilePath();
lstCoordinateSystems->header()->setResizeMode( AuthidColumn, QHeaderView::Stretch );
lstCoordinateSystems->header()->setSectionResizeMode( AuthidColumn, QHeaderView::Stretch );
lstCoordinateSystems->header()->resizeSection( QgisCrsIdColumn, 0 );
lstCoordinateSystems->header()->setResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );
lstCoordinateSystems->header()->setSectionResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );
// Hide (internal) ID column
lstCoordinateSystems->setColumnHidden( QgisCrsIdColumn, true );
lstRecent->header()->setResizeMode( AuthidColumn, QHeaderView::Stretch );
lstRecent->header()->setSectionResizeMode( AuthidColumn, QHeaderView::Stretch );
lstRecent->header()->resizeSection( QgisCrsIdColumn, 0 );
lstRecent->header()->setResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );
lstRecent->header()->setSectionResizeMode( QgisCrsIdColumn, QHeaderView::Fixed );
// Hide (internal) ID column
lstRecent->setColumnHidden( QgisCrsIdColumn, true );

View File

@ -38,7 +38,7 @@ void QgsShortcutsManager::registerAllChildActions( QObject *object, bool recursi
QList< QAction * > actions = object->findChildren< QAction * >();
Q_FOREACH ( QAction *a, actions )
{
registerAction( a, a->shortcut() );
registerAction( a, a->shortcut().toString() );
}
}
else
@ -47,7 +47,7 @@ void QgsShortcutsManager::registerAllChildActions( QObject *object, bool recursi
{
if ( QAction *a = qobject_cast<QAction *>( child ) )
{
registerAction( a, a->shortcut() );
registerAction( a, a->shortcut().toString() );
}
}
}
@ -60,7 +60,7 @@ void QgsShortcutsManager::registerAllChildShortcuts( QObject *object, bool recur
QList< QShortcut * > shortcuts = object->findChildren< QShortcut * >();
Q_FOREACH ( QShortcut *s, shortcuts )
{
registerShortcut( s, s->key() );
registerShortcut( s, s->key().toString() );
}
}
else
@ -69,7 +69,7 @@ void QgsShortcutsManager::registerAllChildShortcuts( QObject *object, bool recur
{
if ( QShortcut *s = qobject_cast<QShortcut *>( child ) )
{
registerShortcut( s, s->key() );
registerShortcut( s, s->key().toString() );
}
}
}

View File

@ -49,7 +49,7 @@ QgsTaskManagerWidget::QgsTaskManagerWidget( QgsTaskManager *manager, QWidget *pa
mTreeView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
mTreeView->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
mTreeView->header()->setStretchLastSection( false );
mTreeView->header()->setResizeMode( 0, QHeaderView::Stretch );
mTreeView->header()->setSectionResizeMode( 0, QHeaderView::Stretch );
vLayout->addWidget( mTreeView );

View File

@ -273,8 +273,8 @@ QgsVariableEditorTree::QgsVariableEditorTree( QWidget *parent )
setAlternatingRowColors( true );
setEditTriggers( QAbstractItemView::AllEditTriggers );
setRootIsDecorated( false );
header()->setMovable( false );
header()->setResizeMode( QHeaderView::Interactive );
header()->setSectionsMovable( false );
header()->setSectionResizeMode( QHeaderView::Interactive );
mEditorDelegate = new VariableEditorDelegate( this, this );
setItemDelegate( mEditorDelegate );

View File

@ -115,7 +115,7 @@ void eVisDatabaseConnectionGui::drawNewVectorLayer( const QString &layerName, co
url.addQueryItem( QStringLiteral( "delimiterType" ), QStringLiteral( "regexp" ) );
url.addQueryItem( QStringLiteral( "xField" ), xCoordinate );
url.addQueryItem( QStringLiteral( "yField" ), yCoordinate );
emit drawVectorLayer( QString::fromAscii( url.toEncoded() ), layerName, QStringLiteral( "delimitedtext" ) );
emit drawVectorLayer( QString::fromLatin1( url.toEncoded() ), layerName, QStringLiteral( "delimitedtext" ) );
mTempOutputFileList->last()->close();
}
}

View File

@ -97,10 +97,10 @@ void QgsGeometryCheckerFixSummaryDialog::addError( QTableWidget *table, QgsGeome
void QgsGeometryCheckerFixSummaryDialog::setupTable( QTableWidget *table )
{
table->resizeColumnToContents( 0 );
table->horizontalHeader()->setResizeMode( 1, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 2, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 4, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 4, QHeaderView::Stretch );
table->setEditTriggers( QAbstractItemView::NoEditTriggers );
table->setSelectionBehavior( QAbstractItemView::SelectRows );

View File

@ -754,8 +754,8 @@ void QgsGrassModuleInputSelectedView::setModel( QAbstractItemModel *model )
QTreeView::setModel( model );
header()->hide();
header()->setStretchLastSection( false );
header()->setResizeMode( 0, QHeaderView::Stretch );
header()->setResizeMode( 1, QHeaderView::Fixed );
header()->setSectionResizeMode( 0, QHeaderView::Stretch );
header()->setSectionResizeMode( 1, QHeaderView::Fixed );
header()->resizeSection( 1, 16 );
}

View File

@ -117,7 +117,7 @@ QgsGrassNewMapset::QgsGrassNewMapset( QgisInterface *iface,
mMapsetsListView->clear();
mMapsetLineEdit->setValidator( new QRegExpValidator( rx, mMapsetLineEdit ) );
mMapsetsListView->header()->setResizeMode( QHeaderView::ResizeToContents );
mMapsetsListView->header()->setSectionResizeMode( QHeaderView::ResizeToContents );
// FINISH
mOpenNewMapsetCheckBox->setChecked( settings.value( QStringLiteral( "GRASS/newMapsetWizard/openMapset" ), true ).toBool() );

View File

@ -314,7 +314,7 @@ void HistoryScrollBuffer::addCellsVector(const QVector<Character>& cells)
void HistoryScrollBuffer::addCells(const Character a[], int count)
{
HistoryLine newLine(count);
qCopy(a,a+count,newLine.begin());
std::copy(a,a+count,newLine.begin());
addCellsVector(newLine);
}
@ -730,7 +730,7 @@ void CompactHistoryScroll::addCellsVector ( const TextLine& cells )
void CompactHistoryScroll::addCells ( const Character a[], int count )
{
TextLine newLine ( count );
qCopy ( a,a+count,newLine.begin() );
std::copy ( a,a+count,newLine.begin() );
addCellsVector ( newLine );
}

View File

@ -185,16 +185,16 @@ QVector<QgsDataItem *> QgsDb2ConnectionItem::createChildren()
}
QgsDb2GeometryColumns db2GC = QgsDb2GeometryColumns( db );
int sqlcode = db2GC.open();
QString sqlcode = db2GC.open();
/* Enabling the DB2 Spatial Extender creates the DB2GSE schema and tables,
so the Extender is either not enabled or set up if SQLCODE -204 is returned. */
if ( sqlcode == -204 )
if ( sqlcode == QStringLiteral( "-204" ) )
{
children.append( new QgsErrorItem( this, tr( "DB2 Spatial Extender is not enabled or set up." ), mPath + "/error" ) );
return children;
}
else if ( sqlcode != 0 )
else if ( !sqlcode.isEmpty() && sqlcode != QStringLiteral( "0" ) )
{
children.append( new QgsErrorItem( this, db.lastError().text(), mPath + "/error" ) );
return children;

View File

@ -32,12 +32,12 @@ QgsDb2GeometryColumns::~QgsDb2GeometryColumns()
mQuery.clear();
}
int QgsDb2GeometryColumns::open()
QString QgsDb2GeometryColumns::open()
{
return open( QString(), QString() );
}
int QgsDb2GeometryColumns::open( const QString &schemaName, const QString &tableName )
QString QgsDb2GeometryColumns::open( const QString &schemaName, const QString &tableName )
{
QString queryExtents( "SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, TYPE_NAME, "
"SRS_ID, SRS_NAME, MIN_X, MIN_Y, MAX_X, MAX_Y "
@ -46,7 +46,7 @@ int QgsDb2GeometryColumns::open( const QString &schemaName, const QString &table
"SRS_ID, SRS_NAME "
"FROM DB2GSE.ST_GEOMETRY_COLUMNS" );
mQuery = QSqlQuery( mDatabase );
int sqlcode = 0;
QString nativeError;
mEnvironment = ENV_LUW;
if ( !schemaName.isEmpty() && !tableName.isEmpty() )
@ -61,30 +61,30 @@ int QgsDb2GeometryColumns::open( const QString &schemaName, const QString &table
if ( !mQuery.exec( queryExtents ) )
{
QgsDebugMsg( "ST_Geometry_Columns query failed: " + mDatabase.lastError().text() );
sqlcode = mQuery.lastError().number();
QgsDebugMsg( QString( "SQLCODE: %1" ).arg( sqlcode ) );
nativeError = mQuery.lastError().nativeErrorCode();
QgsDebugMsg( QString( "SQLCODE: %1" ).arg( nativeError ) );
/* The MIN_X, MIN_Y, MAX_X, and MAX_Y columns are not available on z/OS (and LUW 9.5)
so SQLCODE -206 is returned when specifying non-existent columns. */
if ( mQuery.lastError().number() == -206 )
if ( mQuery.lastError().nativeErrorCode() == QStringLiteral( "-206" ) )
{
QgsDebugMsg( "Try query with no extents" );
mQuery.clear();
if ( !mQuery.exec( queryNoExtents ) )
{
QgsDebugMsg( QString( "SQLCODE: %1" ).arg( mQuery.lastError().number() ) );
QgsDebugMsg( QString( "SQLCODE: %1" ).arg( mQuery.lastError().nativeErrorCode() ) );
}
else
{
QgsDebugMsg( "success; must be z/OS" );
mEnvironment = ENV_ZOS;
sqlcode = 0;
nativeError.clear();
}
}
}
// QgsDebugMsg( QString( "sqlcode: %1" ).arg( sqlcode ) );
return sqlcode;
return nativeError;
}
bool QgsDb2GeometryColumns::isActive()

View File

@ -37,8 +37,8 @@ class QgsDb2GeometryColumns // clazy:exclude=rule-of-three
bool isActive();
void close();
int open();
int open( const QString &schemaName, const QString &tableName );
QString open();
QString open( const QString &schemaName, const QString &tableName );
bool populateLayerProperty( QgsDb2LayerProperty &layer );
int db2Environment();

View File

@ -584,8 +584,8 @@ void QgsDb2Provider::updateStatistics() const
QgsDebugMsg( QString( "mSRId: %1" ).arg( mSRId ) );
QgsDb2GeometryColumns gc( mDatabase );
int rc = gc.open( mSchemaName, mTableName ); // returns SQLCODE if failure
if ( rc == 0 )
QString rc = gc.open( mSchemaName, mTableName ); // returns SQLCODE if failure
if ( rc.isEmpty() || rc == QStringLiteral( "0" ) )
{
mEnvironment = gc.db2Environment();
if ( -1 == mSRId )
@ -1395,7 +1395,7 @@ QgsVectorLayerExporter::ExportError QgsDb2Provider::createEmptyLayer( const QStr
sql = "DROP TABLE " + fullName;
if ( !q.exec( sql ) )
{
if ( q.lastError().number() != -206 ) // -206 is "not found" just ignore
if ( q.lastError().nativeErrorCode() != QStringLiteral( "-206" ) ) // -206 is "not found" just ignore
{
QString lastError = q.lastError().text();
QgsDebugMsg( lastError );
@ -1499,8 +1499,8 @@ QgsVectorLayerExporter::ExportError QgsDb2Provider::createEmptyLayer( const QStr
// get the environment
QgsDb2GeometryColumns gc( db );
int rc = gc.open( schemaName, tableName ); // returns SQLCODE if failure
if ( rc == 0 )
QString rc = gc.open( schemaName, tableName ); // returns SQLCODE if failure
if ( rc.isEmpty() || rc == QStringLiteral( "0" ) )
{
db2Environment = gc.db2Environment();
}

View File

@ -495,8 +495,8 @@ void QgsDb2SourceSelect::on_btnConnect_clicked()
}
QgsDb2GeometryColumns db2GC = QgsDb2GeometryColumns( db );
int sqlcode = db2GC.open();
if ( 0 != sqlcode )
QString sqlcode = db2GC.open();
if ( !sqlcode.isEmpty() && QStringLiteral( "0" ) != sqlcode )
{
QMessageBox::warning( this, tr( "DB2GSE.ST_GEOMETRY_COLUMNS Not Found" ),
tr( "DB2GSE.ST_GEOMETRY_COLUMNS not found. The DB2 Spatial Extender is not enabled or set up." ) );

View File

@ -1093,7 +1093,7 @@ void QgsDelimitedTextProvider::setUriParameter( const QString &parameter, const
QUrl url = QUrl::fromEncoded( dataSourceUri().toLatin1() );
if ( url.hasQueryItem( parameter ) ) url.removeAllQueryItems( parameter );
if ( ! value.isEmpty() ) url.addQueryItem( parameter, value );
setDataSourceUri( QString::fromAscii( url.toEncoded() ) );
setDataSourceUri( QString::fromLatin1( url.toEncoded() ) );
}
void QgsDelimitedTextProvider::onFileUpdated()

View File

@ -193,7 +193,7 @@ void QgsDelimitedTextSourceSelect::addButtonClicked()
// add the layer to the map
emit addVectorLayer( QString::fromAscii( url.toEncoded() ), txtLayerName->text() );
emit addVectorLayer( QString::fromLatin1( url.toEncoded() ), txtLayerName->text() );
if ( widgetMode() == QgsProviderRegistry::WidgetMode::None )
{
accept();