Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, February 2007
Drag n Drop for QTableView objects


Message 1 in thread

Hi,

 

I have a few apps that I'm converting to Qt4, and I've come across a few
problems using the new QtableView classes. One problem I haven't been
able to solve is getting column headers to respond to drag n drop
events. I want to be able to move columns to a different position or
remove them by dragging them out. I have found a Qt help file containg a
chapter about Using Drag and Drop with Item Views, but it only mentions
MIME copies and nothing about whole columns. Does anybody knoe how to
achieve this with the new QtableView classes.

 

Frank Tiekink

 

P.S. I'm using Qt4.2, winxpsp2.


Message 2 in thread

Frank Tiekink (IDE) wrote:
> Hi,
> 
>  
> 
> I have a few apps that I’m converting to Qt4, and I’ve come across a few
> problems using the new QtableView classes. One problem I haven’t been
> able to solve is getting column headers to respond to drag n drop
> events. I want to be able to move columns to a different position or
> remove them by dragging them out. I have found a Qt help file containg a
> chapter about Using Drag and Drop with Item Views, but it only mentions
> MIME copies and nothing about whole columns. Does anybody knoe how to
> achieve this with the new QtableView classes.
>

For moving them around by D&D, you can use QHeaderView::setMovable.
Dragging them out of the header won't be that easy, but migth work as
well... somehow. We let the user remove columns by popping up a context
menu on the header that allows you to toggle display of columns (or rows).

hth
M

--
 [ signature omitted ]