コード例 #1
0
ファイル: knmusictreeviewbase.cpp プロジェクト: ZhenZinian/Mu
void KNMusicTreeViewBase::dragLeaveEvent(QDragLeaveEvent *)
{
    //Clear the state.
    setState(NoState);
    //Stop auto scroll.
    stopAutoScroll();
    //Clear the dragging hover.
    m_dragMoveRow=-1;
    m_dragIndicatorPos=QAbstractItemView::OnViewport;
    //Update the viewport.
    viewport()->update();
}
コード例 #2
0
ファイル: knmusictreeviewbase.cpp プロジェクト: ZhenZinian/Mu
void KNMusicTreeViewBase::dropEvent(QDropEvent *event)
{
    //Clear the state.
    setState(NoState);
    //Check the model.
    if(musicModel()==nullptr)
    {
        //Ignore the drop event when the music model is null.
        event->ignore();
        return;
    }
    //Clear the dragging hover.
    m_dragMoveRow=-1;
    m_dragIndicatorPos=QAbstractItemView::OnViewport;
    //Drop the data.
    int row=-1;
    //Get the drop row.
    if(dropOn(event, row))
    {
        //Check the music model, and do the drop mime data to the proxy model.
        if(musicModel()!=nullptr &&
                proxyModel()->dropMimeData(event->mimeData(),
                                           Qt::MoveAction,
                                           row,
                                           Name,
                                           QModelIndex()))
        {
            event->accept();
        }
    }
    //Stop auto scroll.
    stopAutoScroll();
    //Set state.
    setState(NoState);
    //Update view port.
    viewport()->update();
}
コード例 #3
0
// Released button
long MFXAddEditTypedTable::onLeftBtnRelease(FXObject*, FXSelector, void* ptr) {
    FXEvent* event = (FXEvent*)ptr;
    if (isEnabled()) {
        ungrab();
        flags &= ~FLAG_PRESSED;
        flags |= FLAG_UPDATE;
        mode = MOUSE_NONE;
        stopAutoScroll();
        setDragCursor(getApp()->getDefaultCursor(DEF_ARROW_CURSOR));
        if (target && target->tryHandle(this, FXSEL(SEL_LEFTBUTTONRELEASE, message), ptr)) {
            return 1;
        }

        // Scroll to make item visibke
        makePositionVisible(current.row, current.col);

        // Update anchor
        //setAnchorItem(current.row,current.col); // FIXME look into the selection stuff

        // Generate clicked callbacks
        if (event->click_count == 1) {
            handle(this, FXSEL(SEL_CLICKED, 0), (void*)&current);
        } else if (event->click_count == 2) {
            handle(this, FXSEL(SEL_DOUBLECLICKED, 0), (void*)&current);
        } else if (event->click_count == 3) {
            handle(this, FXSEL(SEL_TRIPLECLICKED, 0), (void*)&current);
        }

        // Command callback only when clicked on item
        if (0 <= current.row && 0 <= current.col && isItemEnabled(current.row, current.col)) {
            handle(this, FXSEL(SEL_COMMAND, 0), (void*)&current);
        }
        return 1;
    }
    return 0;
}
コード例 #4
0
 inline void tst_stopAutoScroll()
     { stopAutoScroll(); }