I'm afraid that doesn't work :
virtual bool editorEvent
( QEvent* event,
QAbstractItemModel* model,
const QStyleOptionViewItem
& option,
const QModelIndex
& index
) {
if( event
->type
() == QEvent::MouseButtonDblClick ) {
const QRect TextRect
= textRectangle
( NULL, option.
rect, option.
font, option.
text );
if( TextRect.contains( MouseEvent->globalPos() ) == false )
}
return QItemDelegate::editorEvent( event, model, option, index
);
}
virtual bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
{
if( event->type() == QEvent::MouseButtonDblClick )
{
QMouseEvent* MouseEvent = static_cast< QMouseEvent* >( event );
const QRect TextRect = textRectangle( NULL, option.rect, option.font, option.text );
if( TextRect.contains( MouseEvent->globalPos() ) == false )
return QAbstractItemDelegate::editorEvent( event, model, option, index );
}
return QItemDelegate::editorEvent( event, model, option, index );
}
To copy to clipboard, switch view to plain text mode
Is it possible to have this action working in the doubleClicked signal of the QListView ?
Because I have the doubleClicked action who do something in my tree and that bypass the delegate action.
That mean have that to bypass the double click of delegate :
{
public:
{
}
virtual bool editorEvent
( QEvent* event,
QAbstractItemModel* model,
const QStyleOptionViewItem
& option,
const QModelIndex
& index
) {
if( event
->type
() == QEvent::MouseButtonDblClick ) return true;
return QItemDelegate::editorEvent( event, model, option, index
);
}
};
class CItemDelegate : public QItemDelegate
{
public:
CItemDelegate( QObject* Parent ) :
QItemDelegate( Parent )
{
}
virtual bool editorEvent( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
{
if( event->type() == QEvent::MouseButtonDblClick )
return true;
return QItemDelegate::editorEvent( event, model, option, index );
}
};
To copy to clipboard, switch view to plain text mode
Thanks for the help
Bookmarks