Improve GUI by removing some blank spaces around grids and center widgets

This commit is contained in:
2017-10-15 11:36:27 +02:00
parent 2b664c3b4f
commit b86b934e75
9 changed files with 136 additions and 41 deletions

View File

@@ -30,6 +30,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
KissPanel(kiss, parent, lowResolution), _chartView(0)
{
QHBoxLayout *hbox = new QHBoxLayout();
QHBoxLayout *hbox1 = new QHBoxLayout();
QVBoxLayout *vbox = new QVBoxLayout();
_hbox2 = new QHBoxLayout();
_vbox2 = new QVBoxLayout();
@@ -73,14 +74,20 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
_monthTo->setCurrentIndex(11);
QLabel* label = new QLabel(_("From"));
hbox->addWidget(label);
hbox->addWidget(_monthFrom);
hbox->addWidget(_yearFrom);
label->setAlignment(Qt::AlignRight);
hbox->addWidget(label, 1);
hbox->addWidget(_monthFrom, 2);
hbox->addWidget(_yearFrom, 2);
hbox->addStretch(1);
label = new QLabel(_("To"));
hbox->addWidget(label);
hbox->addWidget(_monthTo);
hbox->addWidget(_yearTo);
label->setAlignment(Qt::AlignRight);
hbox->addWidget(label, 1);
hbox->addWidget(_monthTo, 2);
hbox->addWidget(_yearTo, 2);
hbox->addStretch(1);
connect(_yearFrom, SIGNAL(currentIndexChanged(int)), this, SLOT(OnRangeChange(int)));
connect(_monthFrom, SIGNAL(currentIndexChanged(int)), this, SLOT(OnRangeChange(int)));
@@ -98,6 +105,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
}
_account->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
_account->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
connect(_account, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(OnAccountChange(QListWidgetItem*)));
@@ -114,7 +122,10 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
_costRepartitionBanner = new CostRepartitionBanner(_kiss, this, _categories);
_vbox3->addWidget(_account);
hbox1->addStretch(1);
hbox1->addWidget(_account, 2);
hbox1->addStretch(1);
_vbox3->addLayout(hbox1, 1);
nbCategories = user->GetCategoriesNumber();
@@ -122,7 +133,7 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
for(i=0; i<nbCategories; i++)
_categoriesValues[i] = 0.0;
_vbox3->addWidget(_costRepartitionBanner);
_vbox3->addWidget(_costRepartitionBanner, 3);
_vbox2->addLayout(hbox);
_hbox2->addLayout(_vbox2);
@@ -130,6 +141,9 @@ StatsPanel::StatsPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
_hbox2->addLayout(_vbox3);
_hbox2->setStretch(0, 4);
_hbox2->setStretch(1, 1);
OnRangeChange(0);
layout();