PDA

View Full Version : Still facing Alignment problem in QTable



joseph
14th December 2006, 13:28
hai All


I am still facing some problem with ALIGNMENT ( cell_data in QTable) while am trying to include QCheckTableItem as cell_data in QTable

This is the class i have created to support Left alignment in QTable


class MyTableItem : public QTableITem
{
QString m_strAlign ;
public :
-----
-------- // other constructors support pixmap, text..etc

// new constructor which support QCheckTableItem in Cell_Data
DWCTableItem( QTable * table,
EditType editType,
const QCheckTableItem * chkTableItem,
const QString & AlignSpec = "LeftCenter" )
: QTableItem ( table, editType ) , m_strAlign ( AlignSpec )
{

}
virtual alignment() const
{
---
---// after some process
---
return Qt::AlignLeft ;

}


};



In run time am calling this as follows.....



-----------------
QTable *myTable = new QTable(.... );
QCheckTableItem *myCheckTableItem = new QCheckTableItem ( myTable, "SomeText" );



myTable->setItem ( row, col, new MyTableItem(
myTable,
QTableItem::Never,
myCheckTableItem ) );
------------------



After this QTable is not showing any thing in that cell , where we used the funciton



myTable->setItem ( row, col, new MyTableItem(
myTable,
QTableItem::Never,
myCheckTableItem ) );


Please tell me whether am using the appropriate constructor of QTableITem in MyTableITem...??
please tell me what's wrong with this...!!


Thanks in advance

wysota
14th December 2006, 15:18
Your constructor body is empty. Should it be like that? You're not doing anything with the check box item.

joseph
15th December 2006, 08:36
I got the solution by creating new class called MyCheckTableITem( subclass of QCheckTableITem. )


But is there any other way to solve this , Because i have already created new class callled MyTableItem ( subclass of QTableItem ) to customise the alignment in MyTable ( QTable ) . This class ( MyTableItem) will not support QCheckTableItem .

I just want to know that can we do some more code in MyTableItem_class , so that it will support the QCheckTableItem.

Thanks

wysota
15th December 2006, 11:22
Is there a question here somewhere? Or is that only an explanation of what you did? :)

joseph
15th December 2006, 12:28
If i mislead you ..sorry.

That was not to show what i have done. Instead i was just asking that , any other way to slove my problem what i have mentioned before..

If you have any suggession please tell me..


Thanks

wysota
15th December 2006, 12:40
You have to clearly state what you need. What is the exact thing you're trying to achieve?