class Outliner: public QTreeeView {
protected:
/** mouseMoveEvent() */
{
if ( !(event->buttons() & Qt::LeftButton) )
return;
if ( (event->pos() - m_qDragStartPosition).manhattanLength() <
Application::startDragDistance() )
return;
//mimeData->setData ( mimeType, data );
drag->setMimeData ( mimeData );
Qt::DropAction dropAction = drag->start ( Qt::CopyAction | Qt::MoveAction );
repaint ( );
}// mouseMoveEvent(QMouseEvent*)
/** mousePressEvent() */
{
if ( event->button() == Qt::LeftButton )
m_qDragStartPosition = event->pos ( );
}// mousePressEvent(QMouseEvent*)
/** paintEvent() */
{
int x, y, w, h;
m_rDropSite.getRect ( &x, &y, &w, &h );
painter.drawLine ( 0, y, 192, y );
}// paintEvent(QPaintEvent*)
};// class Outliner
class Outliner: public QTreeeView {
protected:
/** mouseMoveEvent() */
void mouseMoveEvent ( QMouseEvent *event )
{
if ( !(event->buttons() & Qt::LeftButton) )
return;
if ( (event->pos() - m_qDragStartPosition).manhattanLength() <
Application::startDragDistance() )
return;
QDrag *drag = new QDrag ( this );
QMimeData *mimeData = new QMimeData;
//mimeData->setData ( mimeType, data );
drag->setMimeData ( mimeData );
Qt::DropAction dropAction = drag->start ( Qt::CopyAction | Qt::MoveAction );
repaint ( );
}// mouseMoveEvent(QMouseEvent*)
/** mousePressEvent() */
void mousePressEvent ( QMouseEvent *event )
{
QTreeView::mousePressEvent ( event );
if ( event->button() == Qt::LeftButton )
m_qDragStartPosition = event->pos ( );
}// mousePressEvent(QMouseEvent*)
/** paintEvent() */
void paintEvent ( QPaintEvent *event )
{
QTreeView::paintEvent ( event );
QPainter painter ( viewport );
int x, y, w, h;
m_rDropSite.getRect ( &x, &y, &w, &h );
painter.drawLine ( 0, y, 192, y );
}// paintEvent(QPaintEvent*)
};// class Outliner
To copy to clipboard, switch view to plain text mode
Bookmarks