本文整理汇总了C++中QDropEvent::pos方法的典型用法代码示例。如果您正苦于以下问题:C++ QDropEvent::pos方法的具体用法?C++ QDropEvent::pos怎么用?C++ QDropEvent::pos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDropEvent
的用法示例。
在下文中一共展示了QDropEvent::pos方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: msgEventAccepted
static QString msgEventAccepted(const QDropEvent &e)
{
QString message;
QTextStream str(&message);
str << "Event at " << e.pos().x() << ',' << e.pos().y() << ' ' << (e.isAccepted() ? "accepted" : "ignored");
return message;
}
示例2: 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 );
}
示例3: 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);
}
示例4: sipConvertFromNewType
static PyObject *meth_QDropEvent_pos(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
QDropEvent *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QDropEvent, &sipCpp))
{
QPoint *sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = new QPoint(sipCpp->pos());
Py_END_ALLOW_THREADS
return sipConvertFromNewType(sipRes,sipType_QPoint,NULL);
}
}
示例5: eventFilter
bool BookmarkToolBar::eventFilter(QObject *watched, QEvent *event)
{
if (m_currentMenu && m_currentMenu->isVisible()
&& !m_currentMenu->rect().contains(m_currentMenu->mapFromGlobal(QCursor::pos())))
{
// To switch root folders as in a menubar
KBookmarkActionMenu* act = dynamic_cast<KBookmarkActionMenu *>(actionAt(mapFromGlobal(QCursor::pos())));
if (event->type() == QEvent::MouseMove && act && act->menu() != m_currentMenu)
{
m_currentMenu->hide();
QPoint pos = mapToGlobal(widgetForAction(act)->pos());
act->menu()->popup(QPoint(pos.x(), pos.y() + widgetForAction(act)->height()));
}
else if (event->type() == QEvent::MouseButtonPress && act)
{
m_currentMenu->hide();
}
return QObject::eventFilter(watched, event);
}
switch (event->type())
{
case QEvent::Show:
{
if (!m_filled)
{
BookmarkManager::self()->fillBookmarkBar(this);
m_filled = true;
}
}
break;
case QEvent::ActionRemoved:
{
QActionEvent *actionEvent = static_cast<QActionEvent*>(event);
if (actionEvent && actionEvent->action() != m_dropAction)
{
QWidget *widget = widgetForAction(actionEvent->action());
if (widget)
{
widget->removeEventFilter(this);
}
}
}
break;
case QEvent::ParentChange:
{
QActionEvent *actionEvent = static_cast<QActionEvent*>(event);
if (actionEvent && actionEvent->action() != m_dropAction)
{
QWidget *widget = widgetForAction(actionEvent->action());
if (widget)
{
widget->removeEventFilter(this);
}
}
}
break;
case QEvent::DragEnter:
{
QDragEnterEvent *dragEvent = static_cast<QDragEnterEvent*>(event);
if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type())
|| dragEvent->mimeData()->hasFormat("text/uri-list")
|| dragEvent->mimeData()->hasFormat("text/plain"))
{
QFrame* dropIndicatorWidget = new QFrame(this);
dropIndicatorWidget->setFrameShape(QFrame::VLine);
m_dropAction = insertWidget(actionAt(dragEvent->pos()), dropIndicatorWidget);
dragEvent->accept();
}
}
break;
case QEvent::DragLeave:
{
QDragLeaveEvent *dragEvent = static_cast<QDragLeaveEvent*>(event);
if (m_checkedAction)
{
m_checkedAction->setCheckable(false);
m_checkedAction->setChecked(false);
}
delete m_dropAction;
m_dropAction = 0;
dragEvent->accept();
}
break;
case QEvent::DragMove:
{
QDragMoveEvent *dragEvent = static_cast<QDragMoveEvent*>(event);
if (dragEvent->mimeData()->hasFormat(BookmarkManager::bookmark_mime_type())
|| dragEvent->mimeData()->hasFormat("text/uri-list")
//.........这里部分代码省略.........