Improve GUI by removing some blank spaces around grids and center widgets
This commit is contained in:
parent
2b664c3b4f
commit
b86b934e75
|
@ -47,6 +47,8 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
|
|||
{
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
QHBoxLayout *hbox2 = new QHBoxLayout;
|
||||
QHBoxLayout *hbox3 = new QHBoxLayout;
|
||||
QHBoxLayout *hbox4 = new QHBoxLayout;
|
||||
QVBoxLayout *vbox = new QVBoxLayout;
|
||||
QVBoxLayout *vbox2 = new QVBoxLayout;
|
||||
QVBoxLayout *vbox3 = new QVBoxLayout;
|
||||
|
@ -73,7 +75,7 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
|
|||
_calendar->setFirstDayOfWeek(Qt::Monday);
|
||||
_calendar->setNavigationBarVisible(false);
|
||||
_calendar->setVerticalHeaderFormat(QCalendarWidget::NoVerticalHeader);
|
||||
_calendar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
_calendar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
connect(_calendar, SIGNAL(selectionChanged ()), this, SLOT(OnCalendarChange()));
|
||||
|
||||
_accounts = new QString[user->GetAccountsNumber()];
|
||||
|
@ -107,6 +109,7 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
|
|||
|
||||
_grid = new GridAccount(_kiss, this, true, true, true);
|
||||
_grid->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
_grid->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
|
||||
_accountsGrid = new QTableWidget(this);
|
||||
_accountsGrid->setColumnCount(NUMBER_COLS_ACCOUNTS);
|
||||
|
@ -114,7 +117,8 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
|
|||
_accountsGrid->verticalHeader()->setHidden(true);
|
||||
|
||||
_accountsGrid->resizeColumnsToContents();
|
||||
_accountsGrid->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
_accountsGrid->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
||||
_accountsGrid->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
|
||||
connect(_accountsGrid, SIGNAL(cellChanged(int, int)), this, SLOT(OnAccountModified(int, int)));
|
||||
|
||||
|
@ -122,6 +126,7 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
|
|||
_statsGrid->verticalHeader()->setHidden(true);
|
||||
_statsGrid->horizontalHeader()->setHidden(true);
|
||||
_statsGrid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
_statsGrid->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
|
||||
_costRepartitionBanner = new CostRepartitionBanner(_kiss, this, _categories);
|
||||
|
||||
|
@ -166,6 +171,8 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
|
|||
vbox3->addWidget(_tree);
|
||||
vbox3->addWidget(buttonUpdateNextMonths);
|
||||
vbox3->addStretch(1);
|
||||
vbox3->addWidget(_calendar);
|
||||
vbox3->addStretch(1);
|
||||
vbox3->addWidget(buttonGroup);
|
||||
vbox3->addWidget(buttonUnGroup);
|
||||
vbox3->addStretch(1);
|
||||
|
@ -174,15 +181,31 @@ void AccountPanel::Init(KissCount* kiss, wxUI *parent, int curMode)
|
|||
vbox3->addWidget(groupBox);
|
||||
|
||||
hbox->addLayout(vbox3);
|
||||
hbox2->addStretch(3);
|
||||
hbox2->addWidget(_accountsGrid, 2);
|
||||
hbox2->addWidget(_calendar);
|
||||
hbox2->addStretch(3);
|
||||
vbox2->addLayout(hbox2);
|
||||
vbox2->addWidget(_grid, 1);
|
||||
|
||||
hbox4->addStretch();
|
||||
hbox4->addWidget(_grid);
|
||||
hbox4->addStretch();
|
||||
|
||||
vbox2->addLayout(hbox4, 1);
|
||||
|
||||
hbox->addLayout(vbox2);
|
||||
vbox->addWidget(_statsGrid);
|
||||
|
||||
hbox3->addStretch(0);
|
||||
hbox3->addWidget(_statsGrid);
|
||||
hbox3->addStretch(0);
|
||||
vbox->addLayout(hbox3);
|
||||
|
||||
vbox->addWidget(_costRepartitionBanner);
|
||||
hbox->addLayout(vbox);
|
||||
|
||||
hbox->setStretch(0, 1);
|
||||
hbox->setStretch(1, 4);
|
||||
hbox->setStretch(2, 1);
|
||||
|
||||
ChangeUser();
|
||||
|
||||
layout();
|
||||
|
|
|
@ -65,7 +65,7 @@ CostRepartitionBanner::CostRepartitionBanner(KissCount* kiss, QFrame* parent, QS
|
|||
slice = series->append(_categories[i], 0);
|
||||
if (i < wxUI::MAX_CATEGORY)
|
||||
slice->setBrush(QBrush(wxUI::categoryColors[i]));
|
||||
slice->setLabelVisible();
|
||||
slice->setLabelVisible(false);
|
||||
}
|
||||
|
||||
_pie->addSeries(series);
|
||||
|
@ -86,13 +86,22 @@ CostRepartitionBanner::CostRepartitionBanner(KissCount* kiss, QFrame* parent, QS
|
|||
_statsGrid->verticalHeader()->setHidden(true);
|
||||
_statsGrid->horizontalHeader()->setHidden(true);
|
||||
_statsGrid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
_statsGrid->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
_statsGrid->setMaximumHeight( 300 );
|
||||
|
||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
|
||||
QChartView *chartView = new QChartView(_pie);
|
||||
chartView->setRenderHint(QPainter::Antialiasing);
|
||||
|
||||
vbox->addWidget(_statsGrid);
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
|
||||
hbox->addStretch();
|
||||
hbox->addWidget(_statsGrid);
|
||||
hbox->addStretch();
|
||||
|
||||
vbox->addLayout(hbox);
|
||||
|
||||
vbox->addWidget(chartView);
|
||||
|
||||
setMaximumWidth(350);
|
||||
|
@ -171,5 +180,5 @@ void CostRepartitionBanner::UpdateCosts(int *categoriesValues, int totalDebit)
|
|||
percents = 0.0;
|
||||
_statsGrid->item(1, 1)->setText(v.sprintf("%.2lf (%02d %%)", (double)value/100, (int)percents));
|
||||
|
||||
_statsGrid->resizeColumnToContents(1);
|
||||
_statsGrid->resizeColumnsToContents();
|
||||
}
|
||||
|
|
|
@ -48,8 +48,11 @@ ExportPanel::ExportPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
|
|||
vbox->addWidget(_searchButton);
|
||||
|
||||
_grid = new GridAccount(_kiss, this, false, false, true);
|
||||
_grid->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
|
||||
hbox->addWidget(_grid);
|
||||
hbox->addStretch(1);
|
||||
hbox->addWidget(_grid, 4);
|
||||
hbox->addStretch(1);
|
||||
|
||||
_exportButton = new QPushButton(_("Export"));
|
||||
|
||||
|
@ -58,6 +61,7 @@ ExportPanel::ExportPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
|
|||
vbox2->addWidget(_exportButton);
|
||||
|
||||
hbox->addLayout(vbox2);
|
||||
hbox->addStretch(1);
|
||||
|
||||
vbox->addLayout(hbox, 2);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent, bool lowResolu
|
|||
QHBoxLayout *hbox1 = new QHBoxLayout;
|
||||
QHBoxLayout *hbox2 = new QHBoxLayout;
|
||||
QHBoxLayout *hbox3 = new QHBoxLayout;
|
||||
//QHBoxLayout *hbox = new QHBoxLayout;
|
||||
QHBoxLayout *hbox = new QHBoxLayout;
|
||||
QGroupBox* staticUser, *staticAccount, *staticCategories, *staticTags, *staticLanguage, *staticOperationOrder, *staticSharedWith;
|
||||
User* user = _kiss->GetUser();
|
||||
QGridLayout *gridBagSizer;
|
||||
|
@ -69,6 +69,7 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent, bool lowResolu
|
|||
staticUser->setLayout(staticBoxSizer);
|
||||
|
||||
gridBagSizer = new QGridLayout();
|
||||
gridBagSizer->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
|
||||
label = new QLabel(_("Name"));
|
||||
gridBagSizer->addWidget(label, 0, 0);
|
||||
|
@ -86,7 +87,10 @@ PreferencesPanel::PreferencesPanel(KissCount* kiss, wxUI *parent, bool lowResolu
|
|||
|
||||
staticBoxSizer->addLayout(gridBagSizer);
|
||||
|
||||
vbox->addWidget(staticUser);
|
||||
hbox->addStretch();
|
||||
hbox->addWidget(staticUser);
|
||||
hbox->addStretch();
|
||||
vbox->addLayout(hbox);
|
||||
|
||||
connect(buttonChangeName, SIGNAL(clicked()), this, SLOT(OnChangeName()));
|
||||
connect(buttonChangePassword, SIGNAL(clicked()), this, SLOT(OnChangePassword()));
|
||||
|
@ -544,7 +548,7 @@ void PreferencesPanel::InitLanguage(User* user)
|
|||
|
||||
for (i=0; i<SupportedLanguages::NB_SUPPORTED_LANGUAGES; i++)
|
||||
{
|
||||
item = new QListWidgetItem(SupportedLanguages::languages[i].name.toLatin1());
|
||||
item = new QListWidgetItem(SupportedLanguages::languages[i].name);
|
||||
item->setIcon(QIcon(SupportedLanguages::languages[i].icon)),
|
||||
_language->addItem(item);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ SearchBanner::SearchBanner(KissCount* kiss, QFrame *parent, void* caller, OnButt
|
|||
std::vector<Category>::iterator categoryIt;
|
||||
std::vector<Tag>::iterator tagIt;
|
||||
QDate firstOfMonth = QDate::currentDate();
|
||||
int i;
|
||||
|
||||
_checkDateFrom = new QCheckBox(_("Date from"));
|
||||
_checkDateTo = new QCheckBox(_("Date to"));
|
||||
|
@ -75,7 +76,6 @@ SearchBanner::SearchBanner(KissCount* kiss, QFrame *parent, void* caller, OnButt
|
|||
item = new QListWidgetItem(_(categoryIt->name.toStdString().c_str()), _category);
|
||||
item->setCheckState (Qt::Unchecked);
|
||||
}
|
||||
_category->setMaximumSize(QSize(_category->contentsRect().width()*1.5, _category->sizeHint().height()));
|
||||
|
||||
_tag = new QListWidget(this);
|
||||
item = new QListWidgetItem(_("Unknown"), _tag);
|
||||
|
@ -85,7 +85,6 @@ SearchBanner::SearchBanner(KissCount* kiss, QFrame *parent, void* caller, OnButt
|
|||
item = new QListWidgetItem(_(tagIt->name.toStdString().c_str()), _tag);
|
||||
item->setCheckState (Qt::Unchecked);
|
||||
}
|
||||
_tag->setMaximumSize(QSize(_tag->contentsRect().width()*1.5, _tag->sizeHint().height()));
|
||||
|
||||
_optype = new QListWidget(this);
|
||||
item = new QListWidgetItem(_("Fix"), _optype);
|
||||
|
@ -96,7 +95,6 @@ SearchBanner::SearchBanner(KissCount* kiss, QFrame *parent, void* caller, OnButt
|
|||
item->setCheckState (Qt::Unchecked);
|
||||
item = new QListWidgetItem(_("Not checked"), _optype);
|
||||
item->setCheckState (Qt::Unchecked);
|
||||
_optype->setMaximumSize(QSize(_optype->contentsRect().width()*1.5, _optype->sizeHint().height()));
|
||||
|
||||
_account = new QListWidget(this);
|
||||
item = new QListWidgetItem(_("Unknown"), _account);
|
||||
|
@ -106,7 +104,6 @@ SearchBanner::SearchBanner(KissCount* kiss, QFrame *parent, void* caller, OnButt
|
|||
item = new QListWidgetItem(accountIt->name, _account);
|
||||
item->setCheckState (Qt::Unchecked);
|
||||
}
|
||||
_account->setMaximumSize(QSize(_account->contentsRect().width()*1.5, _account->sizeHint().height()));
|
||||
|
||||
QLabel* labelDescription = new QLabel(_("Description"));
|
||||
QLabel* labelAmountFrom = new QLabel(_("Amount from"));
|
||||
|
@ -116,6 +113,14 @@ SearchBanner::SearchBanner(KissCount* kiss, QFrame *parent, void* caller, OnButt
|
|||
QLabel* labelOperations = new QLabel(_("Operations"));
|
||||
QLabel* labelAccount = new QLabel(_("Account"));
|
||||
|
||||
labelDescription->setAlignment(Qt::AlignCenter);
|
||||
labelAmountFrom->setAlignment(Qt::AlignCenter);
|
||||
labelAmountTo->setAlignment(Qt::AlignCenter);
|
||||
labelCategory->setAlignment(Qt::AlignCenter);
|
||||
labelTag->setAlignment(Qt::AlignCenter);
|
||||
labelOperations->setAlignment(Qt::AlignCenter);
|
||||
labelAccount->setAlignment(Qt::AlignCenter);
|
||||
|
||||
gridBagSizer->addWidget(labelDescription, 0, 0);
|
||||
gridBagSizer->addWidget(_description, 1, 0);
|
||||
gridBagSizer->addWidget(_checkDateFrom, 0, 1);
|
||||
|
@ -135,6 +140,12 @@ SearchBanner::SearchBanner(KissCount* kiss, QFrame *parent, void* caller, OnButt
|
|||
gridBagSizer->addWidget(labelAccount, 0, 8);
|
||||
gridBagSizer->addWidget(_account, 1, 8);
|
||||
|
||||
_category->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::MinimumExpanding);
|
||||
_category->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
|
||||
for(i=0; i<=8; i++)
|
||||
gridBagSizer->setColumnStretch(i, 1);
|
||||
|
||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,7 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
|
|||
vbox->addWidget(_searchButton);
|
||||
|
||||
_grid = new GridAccount(_kiss, this, false, false, true);
|
||||
|
||||
hbox->addWidget(_grid);
|
||||
_grid->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents);
|
||||
|
||||
_changeAccountButton = new QPushButton(_("Change account"));
|
||||
_changeCategoryButton = new QPushButton(_("Change category"));
|
||||
|
@ -80,9 +79,12 @@ SearchPanel::SearchPanel(KissCount* kiss, wxUI *parent, bool lowResolution) :
|
|||
vbox2->addWidget(_changeTagButton);
|
||||
vbox2->addWidget(_renameButton);
|
||||
|
||||
hbox->addStretch();
|
||||
hbox->addLayout(vbox2);
|
||||
|
||||
hbox->addWidget(_costRepartitionBanner);
|
||||
hbox->addStretch();
|
||||
hbox->addWidget(_grid);
|
||||
hbox->addStretch();
|
||||
hbox->addWidget(_costRepartitionBanner, 2);
|
||||
|
||||
vbox->addLayout(hbox, 2);
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -348,6 +348,33 @@ void GridAccount::InsertOperationWithWeek(User* user, Operation& op, int line, b
|
|||
ComputeWeeks();
|
||||
}
|
||||
|
||||
void GridAccount::InsertCenteredWidget(int line, int column, QWidget* widget, int margins)
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout;
|
||||
layout->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
layout->setSizeConstraint(QLayout::SetMinimumSize);
|
||||
layout->setContentsMargins(margins, margins, margins, margins);
|
||||
layout->addWidget(widget);
|
||||
|
||||
QWidget* fakeWidget = new QWidget;
|
||||
fakeWidget->setLayout(layout);
|
||||
setCellWidget(line, column, fakeWidget);
|
||||
}
|
||||
|
||||
QWidget* GridAccount::GetCenteredWidget(int line, int column)
|
||||
{
|
||||
QWidget* fakeWidget= cellWidget(line, column);
|
||||
|
||||
if (!fakeWidget) return 0;
|
||||
|
||||
QLayout* layout = fakeWidget->layout();
|
||||
QLayoutItem* layoutItem = layout->itemAt(0);
|
||||
|
||||
if (!layoutItem) return 0;
|
||||
|
||||
return layoutItem->widget();
|
||||
}
|
||||
|
||||
void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix, int month, int year)
|
||||
{
|
||||
std::vector<Operation>::iterator it;
|
||||
|
@ -414,13 +441,13 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
|
|||
|
||||
checkBox = new QCheckBox();
|
||||
checkBox->setCheckState(Qt::Unchecked);
|
||||
setCellWidget(line, OP_DELETE, checkBox);
|
||||
InsertCenteredWidget(line, OP_DELETE, checkBox);
|
||||
_deleteSignalMapper.setMapping(checkBox, op.id);
|
||||
connect(checkBox, SIGNAL(stateChanged(int)), &_deleteSignalMapper, SLOT(map()));
|
||||
|
||||
checkBox = new QCheckBox();
|
||||
checkBox->setCheckState((op.checked) ? Qt::Checked : Qt::Unchecked);
|
||||
setCellWidget(line, CHECKED, checkBox);
|
||||
InsertCenteredWidget(line, CHECKED, checkBox);
|
||||
_checkSignalMapper.setMapping(checkBox, op.id);
|
||||
connect(checkBox, SIGNAL(stateChanged(int)), &_checkSignalMapper, SLOT(map()));
|
||||
|
||||
|
@ -496,8 +523,6 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
|
|||
this->item(line, OP_DATE)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
this->item(line, DEBIT)->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
this->item(line, CREDIT)->setTextAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
this->item(line, OP_DELETE)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
this->item(line, CHECKED)->setTextAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
|
||||
|
||||
if (op.id && op.meta)
|
||||
{
|
||||
|
@ -507,7 +532,7 @@ void GridAccount::InsertOperation(User* user, Operation& op, int line, bool fix,
|
|||
connect(button, SIGNAL(clicked()), &_treeSignalMapper, SLOT(map()));
|
||||
|
||||
button->setMaximumSize(QSize(height, height));
|
||||
setCellWidget(line, TREE, button);
|
||||
InsertCenteredWidget(line, TREE, button);
|
||||
|
||||
SET_READ_ONLY(this->item(line, OP_DATE));
|
||||
SET_READ_ONLY(this->item(line, CREDIT));
|
||||
|
@ -558,14 +583,14 @@ void GridAccount::DeleteOperation(const Operation& op) throw (OperationNotFound)
|
|||
|
||||
void GridAccount::RemoveRow(const Operation& op, int line, bool deleteOp)
|
||||
{
|
||||
QPushButton* button = qobject_cast<QPushButton*> (cellWidget(line, TREE));
|
||||
QPushButton* button = qobject_cast<QPushButton*> (GetCenteredWidget(line, TREE));
|
||||
|
||||
if (button)
|
||||
button->disconnect(&_treeSignalMapper, SLOT(map()));
|
||||
QCheckBox* checkBox = qobject_cast<QCheckBox*> (cellWidget(line, CHECKED));
|
||||
QCheckBox* checkBox = qobject_cast<QCheckBox*> (GetCenteredWidget(line, CHECKED));
|
||||
if (checkBox)
|
||||
checkBox->disconnect(&_checkSignalMapper, SLOT(map()));
|
||||
checkBox = qobject_cast<QCheckBox*> (cellWidget(line, OP_DELETE));
|
||||
checkBox = qobject_cast<QCheckBox*> (GetCenteredWidget(line, OP_DELETE));
|
||||
if (checkBox)
|
||||
checkBox->disconnect(&_deleteSignalMapper, SLOT(map()));
|
||||
removeRow(line);
|
||||
|
@ -666,7 +691,7 @@ void GridAccount::CheckOperation(Operation& op, int line, bool check, bool force
|
|||
op.checked = check;
|
||||
UpdateOperation(op);
|
||||
|
||||
QCheckBox* checkBox = qobject_cast<QCheckBox*>(cellWidget(line, CHECKED));
|
||||
QCheckBox* checkBox = qobject_cast<QCheckBox*>(GetCenteredWidget(line, CHECKED));
|
||||
if (checkBox)
|
||||
checkBox->setCheckState(check ? Qt::Checked : Qt::Unchecked);
|
||||
}
|
||||
|
@ -688,7 +713,7 @@ int GridAccount::RemoveMeta(Operation op, int line, bool removeRoot, bool delete
|
|||
std::vector<Operation*>::iterator it, it2;
|
||||
int i, deletedOperations = 0;
|
||||
Operation op2;
|
||||
QPushButton* button = qobject_cast<QPushButton*> (cellWidget(line, TREE));
|
||||
QPushButton* button = qobject_cast<QPushButton*> (GetCenteredWidget(line, TREE));
|
||||
|
||||
for(i=0; i<(int)op.childs.size(); i++)
|
||||
{
|
||||
|
@ -761,7 +786,7 @@ bool GridAccount::IsMetaOpened(int id)
|
|||
{
|
||||
int row = GetDisplayedRow(id);
|
||||
|
||||
QPushButton* button = qobject_cast<QPushButton*> (cellWidget(row, TREE));
|
||||
QPushButton* button = qobject_cast<QPushButton*> (GetCenteredWidget(row, TREE));
|
||||
|
||||
return (button->text() == QString("-"));
|
||||
}
|
||||
|
|
|
@ -106,5 +106,8 @@ private:
|
|||
Operation& GetOperation(int id) throw(OperationNotFound);
|
||||
void UpdateOperation(Operation& op);
|
||||
int GetDisplayedRow(int id) throw (OperationNotFound);
|
||||
|
||||
void InsertCenteredWidget(int line, int column, QWidget* widget, int margins=3);
|
||||
QWidget* GetCenteredWidget(int line, int column);
|
||||
};
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue
Block a user