Skip to content
Permalink
Browse files

Properly show feature count in attribute table title

Total # of features
Filtered features
Selected features
  • Loading branch information
m-kuhn committed Apr 8, 2013
1 parent 082c6ba commit af4c4be7a3d255fd095423b3da6b2562968ba180
@@ -109,6 +109,10 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *theLayer, QWid
connect( mLayer, SIGNAL( editingStarted() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( editingStopped() ), this, SLOT( editingToggled() ) );
connect( mLayer, SIGNAL( layerDeleted() ), this, SLOT( close() ) );
connect( mLayer, SIGNAL( selectionChanged() ), this, SLOT( updateTitle() ) );

// connect table info to window
connect( mMainView, SIGNAL( filterChanged() ), this, SLOT( updateTitle() ) );

// info from table to application
connect( this, SIGNAL( saveEdits( QgsMapLayer * ) ), QgisApp::instance(), SLOT( saveEdits( QgsMapLayer * ) ) );
@@ -193,12 +197,11 @@ QgsAttributeTableDialog::~QgsAttributeTableDialog()
void QgsAttributeTableDialog::updateTitle()
{
QWidget *w = mDock ? qobject_cast<QWidget*>( mDock ) : qobject_cast<QWidget*>( this );
w->setWindowTitle( tr( "Attribute table - %1 :: %n / %2 feature(s) filtered",
"feature count",
mMainView->filteredFeatureCount()
)
w->setWindowTitle( tr( "Attribute table - %1 :: Features total: %2, filtered: %3, selected: %4" )
.arg( mLayer->name() )
.arg( mMainView->featureCount() )
.arg( mMainView->filteredFeatureCount() )
.arg( mLayer->selectedFeatureCount() )
);
}

@@ -610,14 +613,4 @@ void QgsAttributeTableDialog::setFilterExpression( QString filterString )
QgisApp::instance()->messageBar()->pushMessage( tr( "Error filtering" ), filterExpression.evalErrorString(), QgsMessageBar::WARNING, QgisApp::instance()->messageTimeout() );
return;
}

QWidget *w = mDock ? qobject_cast<QWidget*>( mDock ) : qobject_cast<QWidget*>( this );
if ( mMainView->filteredFeatureCount() )
{
w->setWindowTitle( tr( "Attribute table - %1 (%n matching features)", "matching features", mMainView->filteredFeatureCount() ).arg( mMainView->filteredFeatureCount() ) );
}
else
{
w->setWindowTitle( tr( "Attribute table - %1 (No matching features)" ).arg( mLayer->name() ) );
}
}
@@ -138,6 +138,11 @@ class QgsAttributeTableDialog : public QDialog, private Ui::QgsAttributeTableDia
void filterQueryChanged( const QString& query );
void filterQueryAccepted();

/**
* update window title
*/
void updateTitle();

signals:
/**
* Informs that editing mode has been toggled
@@ -164,11 +169,6 @@ class QgsAttributeTableDialog : public QDialog, private Ui::QgsAttributeTableDia
*/
void columnBoxInit();

/**
* update window title
*/
void updateTitle();

QMenu* mMenuActions;
QAction* mActionToggleEditing;

@@ -191,6 +191,9 @@ void QgsDualView::initModels( QgsMapCanvas* mapCanvas )
mMasterModel->loadLayer();

mFilterModel = new QgsAttributeTableFilterModel( mapCanvas, mMasterModel, mMasterModel );

connect( mFilterModel, SIGNAL( filterInvalidated() ), this, SIGNAL( filterChanged() ) );

mFeatureListModel = new QgsFeatureListModel( mFilterModel, mFilterModel );
}

@@ -98,6 +98,7 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
void setCurrentEditSelection( const QgsFeatureIds& fids );

signals:
void filterChanged();

private slots:
/**

0 comments on commit af4c4be

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