[Qt-interest] Alignment of data in a QTableView
Robert Escott
robert at binarylogic.co.za
Mon Feb 7 06:58:02 CET 2011
I used to have this same problem. I think your problem is how you join your
two flags together. Try ORing them instead of ADDing them.
I.e.
QVariant MyClass::data(QModelIndex const &index, int role){
//
QVariant returnValue; // null by default
If (role == Qt::TextAlignmentRole){
returnValue = QVariant(Qt::AlignRight | Qt::AlignVCenter);
}
Return returnValue;
}
-----Original Message-----
From: qt-interest-bounces+robert=binarylogic.co.za at qt.nokia.com
[mailto:qt-interest-bounces+robert=binarylogic.co.za at qt.nokia.com] On Behalf
Of Robert Hairgrove
Sent: 06 February 2011 17:47
To: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Alignment of data in a QTableView
Never mind, problem is solved:
There was an extra newline character in the last field of my data.
Apparently, unlike calling std::getline(), calling QIODevice::readLine()
on the file does not strip out the NL character automatically (yes, I
discovered this in the docs for QIODevice later).
_______________________________________________
Qt-interest mailing list
Qt-interest at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list