本文整理汇总了C++中QDropEvent::ignore方法的典型用法代码示例。如果您正苦于以下问题:C++ QDropEvent::ignore方法的具体用法?C++ QDropEvent::ignore怎么用?C++ QDropEvent::ignore使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDropEvent
的用法示例。
在下文中一共展示了QDropEvent::ignore方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: event
bool QLineEdit::event( QEvent * e )
{
#if 0 // it works, but we'll wait with enabling it.
if ( !e )
return QWidget::event( e );
if ( e->type() == Event_DragEnter ) {
if ( ((QDragEnterEvent *) e)->provides( "text/plain" ) ) {
((QDragEnterEvent *) e)->accept( rect() );
return TRUE;
}
} else if ( e->type() == Event_DragLeave ) {
return TRUE;
} else if ( e->type() == Event_Drop ) {
QDropEvent * de = (QDropEvent *) e;
QString str;
if ( QTextDrag::decode( de, str ) ) {
if ( !hasMarkedText() ) {
int margin = frame() ? 2 : 0;
setCursorPosition( xPosToCursorPos( &tbuf[(int)offset],
fontMetrics(),
de->pos().x() - margin,
width() - 2*margin ) );
}
insert( str );
de->accept();
} else {
de->ignore();
}
return TRUE;
}
#endif
return QWidget::event( e );
}
示例2: eventFilter
/** Redefined to forward events to children. */
bool TabPlaylist::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::DragEnter) {
event->accept();
return true;
} else if (event->type() == QEvent::Drop) {
QDropEvent *de = static_cast<QDropEvent*>(event);
if (de->source() == NULL) {
// Drag & Drop comes from another application but has landed in the playlist area
de->ignore();
QDropEvent *d = new QDropEvent(de->pos(), de->possibleActions(), de->mimeData(), de->mouseButtons(), de->keyboardModifiers());
_mainWindow->dispatchDrop(d);
return true;
} else {
if (obj == cornerWidget()) {
auto p = this->addPlaylist();
p->forceDrop(de);
} else {
currentPlayList()->forceDrop(de);
}
return true;
}
}
return QTabWidget::eventFilter(obj, event);
}
示例3: eventFilter
bool ArticleViewPrivate::eventFilter(QObject * obj, QEvent * event)
{
//qDebug() << "eventFilter" << obj << event;
const AbstractBibliographicModel * model = qobject_cast< const AbstractBibliographicModel * >(view ? origin(view->model()) : 0);
// Only filter the view's events
if (model && obj == view->viewport()) {
switch (event->type()) {
case QEvent::DragMove:
case QEvent::DragEnter: {
QDropEvent * e = static_cast< QDropEvent * >(event);
if ((dropping = model->acceptsDrop(e->mimeData()))) {
view->viewport()->update();
e->accept();
} else {
e->ignore();
}
//qDebug() << "---" << dropping;
return true;
break;
}
case QEvent::DragLeave:
dropping = false;
view->viewport()->update();
break;
case QEvent::Drop:
dropping = false;
view->viewport()->update();
break;
default:
break;
}
}
return QObject::eventFilter(obj, event);
}