Skip to content
Permalink
Browse files

Show full path of gdal/ogr layers as a tooltip (#4399)

  • Loading branch information
wonder-sk committed Oct 18, 2011
1 parent 139e297 commit c3f6dff9f696d1a65080200eefad3cbc07f4407f
@@ -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();
@@ -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;
@@ -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:
@@ -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()
@@ -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 );
@@ -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()

0 comments on commit c3f6dff

Please sign in to comment.
You can’t perform that action at this time.