PDA

View Full Version : custom QColumnView, some questions



Mystical Groovy
9th October 2009, 14:19
Hey all

(1)I want the column thats being created when user clicks and item into the first Column of QColumnView to have a widget that;ll include labels and stuff...

I tried to do this by reimplementing the QColumnView just like the documentations says.

heres my class on my .h file


class MyColumn : public QColumnView
{
Q_OBJECT
public:
QAbstractItemView * createColumn ( const QModelIndex & index );
};


here's the sample code in my .cpp file


QAbstractItemView * MyColumn::createColumn ( const QModelIndex & index )
{
QFrame *frame = new QFrame();
frame->setMinimumSize(250,300);
frame->setMaximumSize(250,300);

//return QColumnView::createColumn(frame);
//return frame;
return MyColumn::createColumn(frame);

}


and of course this gives me errors :)

oh and i have one more question.
(2) id like the vertical scrollbar that the first column has to be shown in the right end of QColumnView widget and when the user clicks an item the scrollbar to move in the left just when the items text is over so that the new column will fit in the space after the first column, without the need to create a second horizontal scrollbar in the bottom.

I hope ive made myself clear, thanks for any help :)

Mystical Groovy
9th October 2009, 15:03
lol ok, ive managed to create a simple pushbutton and show it in the last column using setPreviewWidget() without the need for a custom QColumnView... lol.....