Skip to content

Commit

Permalink
Show full path of gdal/ogr layers as a tooltip (#4399)
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Oct 18, 2011
1 parent 139e297 commit c3f6dff
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/core/qgsbrowsermodel.cpp
Expand Up @@ -134,6 +134,10 @@ QVariant QgsBrowserModel::data( const QModelIndex &index, int role ) const
{
return item->name();
}
else if ( role == Qt::ToolTipRole )
{
return item->toolTip();
}
else if ( role == Qt::DecorationRole && index.column() == 0 )
{
return item->icon();
Expand Down
4 changes: 4 additions & 0 deletions src/core/qgsdataitem.h
Expand Up @@ -112,6 +112,9 @@ class CORE_EXPORT QgsDataItem : public QObject

void setIcon( QIcon icon ) { mIcon = icon; }

void setToolTip( QString msg ) { mToolTip = msg; }
QString toolTip() const { return mToolTip; }

protected:

Type mType;
Expand All @@ -120,6 +123,7 @@ class CORE_EXPORT QgsDataItem : public QObject
bool mPopulated;
QString mName;
QString mPath; // it is also used to identify item in tree
QString mToolTip;
QIcon mIcon;

public slots:
Expand Down
3 changes: 2 additions & 1 deletion src/providers/gdal/qgsgdalprovider.cpp
Expand Up @@ -1940,6 +1940,7 @@ QgsGdalLayerItem::QgsGdalLayerItem( QgsDataItem* parent,
QString name, QString path, QString uri )
: QgsLayerItem( parent, name, path, uri, QgsLayerItem::Raster, "gdal" )
{
mToolTip = uri;
}

QgsGdalLayerItem::~QgsGdalLayerItem()
Expand Down Expand Up @@ -2023,7 +2024,7 @@ QGISEXTERN QgsDataItem * dataItem( QString thePath, QgsDataItem* parentItem )

QgsDebugMsg( "GdalDataset opened " + thePath );

QString name = info.fileName();
QString name = info.completeBaseName();
QString uri = thePath;

QgsLayerItem * item = new QgsGdalLayerItem( parentItem, name, thePath, uri );
Expand Down
1 change: 1 addition & 0 deletions src/providers/ogr/qgsogrprovider.cpp
Expand Up @@ -2271,6 +2271,7 @@ QgsOgrLayerItem::QgsOgrLayerItem( QgsDataItem* parent,
QString name, QString path, QString uri, LayerType layerType )
: QgsLayerItem( parent, name, path, uri, layerType, "ogr" )
{
mToolTip = uri;
}

QgsOgrLayerItem::~QgsOgrLayerItem()
Expand Down

0 comments on commit c3f6dff

Please sign in to comment.