示例#1
0
void Completion::invokeCompletion( TextEditor* editor, QMakeProject* p )
{
	if ( !isVisible() )
	{
		mEditor = editor;
		setParent( mEditor, windowFlags() );
		QPoint position = mEditor->mapToGlobal( mEditor->cursorRect().topLeft() );
		position.ry() += mEditor->cursorRect().height();
		// Need a fix as when the last line is near the bottom screen coordinate, the window is unvisible
		move( position );
		if ( prepareCompletion( p ) )
		{
			emit beforeCompletionShow();
			show();
		}
	}
}
示例#2
0
void Completer::invokeCompletion( QPlainTextEdit* editor )
{
    if ( !isVisible() )
    {
        mEditor = editor;
        setParent( mEditor, windowFlags() );
        QPoint position = mEditor->mapToGlobal( mEditor->cursorRect().topLeft() );
        int h = mEditor->cursorRect().height();
        QDesktopWidget *dw = QApplication::desktop();

        if(position.ry() < (dw->screen()->height()-height()))
            position.ry() += h;
        else
            position.ry() -= (h+height());

        move( position );
        if ( prepareCompletion() )
        {
            show();
            lwItems->setFocus();
        }
    }
}