PDA

View Full Version : QTableView Alignment



guidupas
23rd April 2014, 21:07
Hello everyone!

I am trying to align a QTableView column and its is not working.

When I do this it works fine:


modeloLancamentosInvestimento->setData(modeloLancamentosInvestimento->index(modeloLancamentosInvestimento->rowCount()-1, 0), Qt::AlignRight, Qt::TextAlignmentRole);


But I need to align it vertically at the center to and when i try it does not work:


modeloLancamentosInvestimento->setData(modeloLancamentosInvestimento->index(modeloLancamentosInvestimento->rowCount()-1, 0), Qt::AlignRight | Qt::AlignVCenter, Qt::TextAlignmentRole);


How can I do that?

Thanks all.

guidupas
24th April 2014, 00:54
Solved



QStandardItem *itemTabela = modeloLancamentosInvestimento->item(modeloLancamentosInvestimento->rowCount()-1, 0);
itemTabela->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);