Example #1
0
void TCommandLine::mousePressEvent( QMouseEvent * event )
{
    if( event->button() == Qt::RightButton )
    {
        QTextCursor c = cursorForPosition( event->pos() );
        c.select(QTextCursor::WordUnderCursor);

        if( ! Hunspell_spell( mpHunspell, c.selectedText().toLatin1().data()) )
        {
            char ** sl;
            mHunspellSuggestionNumber = Hunspell_suggest( mpHunspell, &sl, c.selectedText().toLatin1().data() );
            QMenu * popup = new QMenu( this );
            for( int i=0; i<mHunspellSuggestionNumber; i++ )
            {
                QAction * pA;
                pA = popup->addAction( sl[i] );
                connect( pA, SIGNAL(triggered()), this, SLOT(slot_popupMenu()));
            }
            mpHunspellSuggestionList = sl;
            mPopupPosition = event->pos();
            popup->popup( event->globalPos() );
        }

        event->accept();
        return;
    }
    QPlainTextEdit::mousePressEvent( event );
}
Example #2
0
int TCommandLine::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QPlainTextEdit::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: textChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: slot_textChanged((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 2: slot_sendCommand((*reinterpret_cast< const char*(*)>(_a[1]))); break;
        case 3: slot_popupMenu(); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Example #3
0
int TTextEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: slot_toggleTimeStamps(); break;
        case 1: slot_copySelectionToClipboard(); break;
        case 2: slot_scrollBarMoved((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: slot_popupMenu(); break;
        case 4: slot_copySelectionToClipboardHTML(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}