[Qt-interest] How to show the word in the center of a Tableview's cell?

Malyushytsky, Alex alex at wai.com
Mon Apr 6 09:56:59 CEST 2009


Data returns lets say value depending on the role.
See more about roles in QT documentation.

Alex

-----Original Message-----
From: Kermit Mei [mailto:kermit.mei at gmail.com]
Sent: Saturday, April 04, 2009 2:07 AM
To: Malyushytsky, Alex
Cc: Qt-interest
Subject: Re: [Qt-interest] How to show the word in the center of a Tableview's cell?

On Fri, 2009-04-03 at 19:40 -0700, Malyushytsky, Alex wrote:
> The easiest way probably will be:
>
> Subclass  QAbstractTableModel
> Override data():
>
> ..........
> if (role == Qt::TextAlignmentRole )
> {
>         return Qt::AlignHCenter;
> }
> else
>  QAbstractTableModel:: data( role )
> ..............
>
> Have not tested it, but should work.
>
> Hope this helps,
>    Alex
?
Yes, sir, it works.

But I can't understand, data should return a object of QVariant, Why
here return At::AlignHCenter, and it works?

Thank you!



---------------------------------------------------------------------------------------------------
Weidlinger Associates, Inc. made the following annotations.

"This message and any attachments are solely for the intended recipient and may contain confidential or privileged information. If you are not the intended recipient, any disclosure, copying, use, or distribution of the information included in this message and any attachments is prohibited. If you have received this communication in error, please notify us by reply e-mail and immediately and permanently delete this message and any attachments. Thank you."

"Please consider our environment before printing this email."




More information about the Qt-interest-old mailing list