Skip to content

Commit 553ca1d

Browse files
author
jef
committed
show feature count in attribute table title
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13074 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 651024c commit 553ca1d

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

src/app/attributetable/qgsattributetabledialog.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
7575
bool myDockFlag = mySettings.value( "/qgis/dockAttributeTable", false ).toBool();
7676
if ( myDockFlag )
7777
{
78-
mDock = new QgsAttributeTableDock( tr( "Attribute table - %1" ).arg( mLayer->name() ), QgisApp::instance() );
78+
mDock = new QgsAttributeTableDock( tr( "Attribute table - %1 (%n Feature(s))", "feature count", mModel->rowCount() ).arg( mLayer->name() ), QgisApp::instance() );
7979
mDock->setAllowedAreas( Qt::BottomDockWidgetArea | Qt::TopDockWidgetArea );
8080
mDock->setWidget( this );
8181
connect( this, SIGNAL( destroyed() ), mDock, SLOT( close() ) );
8282
QgisApp::instance()->addDockWidget( Qt::BottomDockWidgetArea, mDock );
8383
}
8484

85-
setWindowTitle( tr( "Attribute table - %1" ).arg( mLayer->name() ) );
85+
setWindowTitle( tr( "Attribute table - %1 (%n Feature(s))", "feature count", mModel->rowCount() ).arg( mLayer->name() ) );
8686

8787
mRemoveSelectionButton->setIcon( getThemeIcon( "/mActionUnselectAttributes.png" ) );
8888
mSelectedToTopButton->setIcon( getThemeIcon( "/mActionSelectedToTop.png" ) );
@@ -578,12 +578,15 @@ void QgsAttributeTableDialog::doSearch( QString searchString )
578578
connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateSelectionFromLayer() ) );
579579

580580
QString str;
581+
QWidget *w = mDock ? qobject_cast<QWidget*>( mDock ) : qobject_cast<QWidget*>( this );
581582
if ( mSelectedFeatures.size() )
582-
str.sprintf( tr( "Found %d matching features.", "", mSelectedFeatures.size() ).toUtf8(), mSelectedFeatures.size() );
583+
{
584+
w->setWindowTitle( tr( "Attribute table - %1 (%n matching features)", "matching features", mSelectedFeatures.size() ).arg( mLayer->name() ) );
585+
}
583586
else
584-
str = tr( "No matching features found." );
585-
586-
QgisApp::instance()->statusBar()->showMessage( str );
587+
{
588+
w->setWindowTitle( tr( "Attribute table - %1 (No matching features)" ).arg( mLayer->name() ) );
589+
}
587590
}
588591

589592
void QgsAttributeTableDialog::search()

src/app/attributetable/qgsattributetablemodel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ void QgsAttributeTableModel::loadLayer()
220220
}
221221

222222
// not needed when we have featureAdded signal
223-
mFeatureCount = pendingFeatureCount;
223+
mFeatureCount = mLayer->pendingFeatureCount();
224224
mFieldCount = mAttributes.size();
225225

226226
if ( ins )

0 commit comments

Comments
 (0)