void QWaylandDataDevice::startDrag(QMimeData *mimeData, QWaylandWindow *icon)
{
    m_dragSource.reset(new QWaylandDataSource(m_display->dndSelectionHandler(), mimeData));
    connect(m_dragSource.data(), &QWaylandDataSource::cancelled, this, &QWaylandDataDevice::dragSourceCancelled);
    QWaylandWindow *origin = m_display->currentInputDevice()->pointerFocus();

    start_drag(m_dragSource->object(), origin->object(), icon->object(), m_display->currentInputDevice()->serial());
}
Example #2
0
void CModViewView::OnRButtonDown(UINT nFlags, CPoint point) 
{
	GetCursorPos(&DragStartPoint);

	start_drag( (mkey_enum)nFlags, DragStartPoint.x, DragStartPoint.y );
	SetCapture();
	ShowCursor(false); 
	sys_rbuttondown = true;

//	CView::OnRButtonDown(nFlags, point);
}
cdrag_widget::cdrag_widget()
{
    //preparing all drag btns
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_show_txt.png" ), tr( "Show Text" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_set_stuff.png" ), tr( "Set Variable" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_input_dialog.png" ), tr( "Input Dialog" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_choices.png" ), tr( "Choice Dialog" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit-wait.png" ), tr( "Wait" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_comment.png" ), tr( "Comment" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_matrix_op.png" ), tr( "Matrix Operation" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_loop_start.png" ), tr( "Loop" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_loop_end.png" ), tr( "Exit Loop" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );
    this->elements.append( new QPushButton( QIcon( ":/resources/img/event_edit_if.png" ), tr( "Fork" )) );

    // when a btn becomes draged it hides it self so we can findout which btn was draged an emit
    // it's mime date for the drag
    for ( int i = 0; i < this->elements.count(); i++ )
    {
        this->elements[i]->setMinimumHeight( 36 );
        this->elements[i]->setIconSize( QSize(32,32) );
        QObject::connect( this->elements[i], SIGNAL(clicked()),
                          this->elements[i], SLOT(hide()) );
        QObject::connect( this->elements[i], SIGNAL(clicked()),
                          this,              SLOT(start_drag()) );
    }
    QVBoxLayout* vl = new QVBoxLayout();
    for (int i = 0; i < this->elements.count(); i++)
    {
        vl->addWidget( this->elements[i] );
    }
    this->setLayout( vl );


}