Display number of table rows in tab

* countChanged event
* applied in components
This commit is contained in:
Klaus Basan
2014-09-25 23:37:15 +02:00
parent 84b5cee7d8
commit ae0ef4283c
12 changed files with 119 additions and 23 deletions

View File

@@ -12,6 +12,9 @@
#include "dockwidgetinfoareacomponent.h"
#include "../guiutility.h"
using namespace BlackGui;
using namespace BlackGui::Views;
namespace BlackGui
{
namespace Components
@@ -25,6 +28,9 @@ namespace BlackGui
{
ui->setupUi(this);
m_timerComponent = new CTimerBasedComponent(SLOT(update()), this);
connect(this->ui->tvp_AircraftsInRange, &CAircraftView::countChanged, this, &CAircraftComponent::ps_countChanged);
connect(this->ui->tvp_AirportsInRange, &CAircraftView::countChanged, this, &CAircraftComponent::ps_countChanged);
}
CAircraftComponent::~CAircraftComponent()
@@ -92,5 +98,19 @@ namespace BlackGui
Q_UNUSED(index);
}
void CAircraftComponent::ps_countChanged(int count)
{
Q_UNUSED(count);
int ac = this->indexOf(this->ui->tb_AircraftsInRange);
int ap = this->indexOf(this->ui->tb_AirportsInRange);
QString acs = this->tabBar()->tabText(ac);
QString aps = this->tabBar()->tabText(ap);
acs = CGuiUtility::replaceTabCountValue(acs, this->countAircrafts());
aps = CGuiUtility::replaceTabCountValue(aps, this->countAirportsInRange());
this->tabBar()->setTabText(ac, acs);
this->tabBar()->setTabText(ap, aps);
}
} // namespace
} // namespace