示例#1
0
void RtfCssEditor::insertBrace() {
  if (c->widget() != this)
    return;
  QTextCursor tc = textCursor();
  int currentPos = tc.position();
  tc.movePosition(QTextCursor::Down);
  tc.select(QTextCursor::LineUnderCursor);
  if (tc.selectedText().isEmpty() == true) {
    tc.setPosition(currentPos);
    //if (QTextCursor::NextWord)
    tc.insertText("\n    \n}");
    /*tc.movePosition(QTextCursor::Left);
    tc.movePosition(QTextCursor::Left);*/
    tc.movePosition(QTextCursor::Left);
    tc.movePosition(QTextCursor::Left);
    setTextCursor(tc);
    QRect cr = cursorRect();
    cr.setWidth(c->popup()->sizeHintForColumn(0) + c->popup()->verticalScrollBar()->sizeHint().width());
    c->complete(cr); // popup it up!
  }
  else {
    tc.setPosition(currentPos);
    tc.insertText("\n    ");
  }
  tc.movePosition(QTextCursor::EndOfWord);
  QRect cr = cursorRect();
  cr.setWidth(c->popup()->sizeHintForColumn(0) + c->popup()->verticalScrollBar()->sizeHint().width());
  c->complete(cr); // popup it up!
    
}
示例#2
0
void QEglFSCursor::changeCursor(QCursor *cursor, QWindow *window)
{
    Q_UNUSED(window);
    const QRect oldCursorRect = cursorRect();
    if (setCurrentCursor(cursor))
        update(oldCursorRect | cursorRect());
}
示例#3
0
/** Redefined to be able to move TagButton when typing. */
void TagLineEdit::keyPressEvent(QKeyEvent *event)
{
	if (event->key() == Qt::Key_Left || event->key() == Qt::Key_Right) {
		/// TODO cursorWordForward / cursorWordBackard to stop on TagButton
		if (QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) {
			qDebug() << "cursorWordForward / backward";
		}
		LineEdit::keyPressEvent(event);
		for (TagButton *t : _tags) {
			if (t->frameGeometry().contains(cursorRect().center())) {
				if (event->key() == Qt::Key_Left) {
					cursorBackward(false, t->spaceCount() - 1);
				} else {
					cursorForward(false, t->spaceCount() - 1);
				}
				break;
			}
		}
	} else {
		QString k = event->text();
		int w = fontMetrics().width(k);
		if (event->key() == Qt::Key_Delete) {
			qDebug() << Q_FUNC_INFO << "Key_Delete";
			w = -w;
		}
		for (TagButton *t : _tags) {
			if (t->frameGeometry().x() > cursorRect().center().x()) {
				t->move(t->x() + w, 0);
			}
		}
		LineEdit::keyPressEvent(event);
	}
}
示例#4
0
/** TagButton instances are converted with whitespaces in the LineEdit in order to move them. */
void TagLineEdit::insertSpaces()
{
	TagButton *t = qobject_cast<TagButton*>(sender());
	int cx = cursorRect().x();
	t->setPosition(cursorPosition());
	int numberOfSpace = 2;

	this->setText(this->text().insert(cursorPosition(), "  "));

	cursorForward(false, 2);
	while (t->frameGeometry().contains(cursorRect().center())) {
		this->setText(this->text().insert(cursorPosition(), " "));
		cursorForward(false);
		numberOfSpace++;
	}
	t->setMinimumWidth(numberOfSpace * fontMetrics().width(" ") - 5);
	t->setSpaceCount(numberOfSpace);
	t->disconnect();

	for (TagButton *tag : _tags) {
		//qDebug() << Q_FUNC_INFO << "trying to move tag";
		if (t != tag && tag->frameGeometry().x() > cx) {
			//qDebug() << Q_FUNC_INFO << "moving tag" << tag->text();
			tag->move(tag->x() + fontMetrics().width(" ") * numberOfSpace, 0);
		}
	}
}
示例#5
0
void QEGLPlatformCursor::setPos(const QPoint &pos)
{
    QGuiApplicationPrivate::inputDeviceManager()->setCursorPos(pos);
    const QRect oldCursorRect = cursorRect();
    m_cursor.pos = pos;
    update(oldCursorRect | cursorRect());
    m_screen->handleCursorMove(m_cursor.pos);
}
示例#6
0
void QEglFSCursor::pointerEvent(const QMouseEvent &event)
{
    if (event.type() != QEvent::MouseMove)
        return;
    const QRect oldCursorRect = cursorRect();
    m_cursor.pos = event.pos();
    update(oldCursorRect | cursorRect());
}
示例#7
0
void QEGLPlatformCursor::pointerEvent(const QMouseEvent &event)
{
    if (event.type() != QEvent::MouseMove)
        return;
    const QRect oldCursorRect = cursorRect();
    m_cursor.pos = event.screenPos().toPoint();
    update(oldCursorRect | cursorRect());
    m_screen->handleCursorMove(m_cursor.pos);
}
示例#8
0
void TextEdit::keyPressEvent(QKeyEvent *e){

	QTextEdit::keyPressEvent(e);
	if (completationOpen) return; // don't open a second completationbox

	QTextCursor cursor = textCursor();

	QChar rchar = cursor.block().text()[cursor.position() - cursor.block().position()];
	if (!rchar.isLetterOrNumber()){

		//request a new completation list
		QString lstring = cursor.block().text().left(cursor.position() - cursor.block().position());
		parent->requestCompletationList(lstring);
		QString last = lstring.split(QRegExp("\\W")).last();
		//open the completationbox if the list has more than one entry
		if(parent->completationList.count() != 0 && !rchar.isLetterOrNumber() ){;
			QWidget *box = new CompletionBox(this, parent->completationList, last.left(last.length() - parent->completationOffset -1));
			box->move(mapToGlobal(cursorRect().bottomLeft()));
			box->show();
			connect(parent,SIGNAL(HelpStringSignal(const QString&)),box,SLOT(setHelpString(const QString&)));
			connect(box,SIGNAL(requestHelpString(const QString&)), parent, SLOT(emitRequestHelpString(const QString&)));	

			}
		}
	}
示例#9
0
void TextEdit::insertCompletion(const QString& completion)
{

    QTextCursor tc = textCursor();
    int extra = completion.length() - c->completionPrefix().length();

    QString s = completion.right(extra);
    if (s.endsWith("*") ) {  	
    	s.chop(1);	
    }
    DomModel* mymodel = dommodel();


    if ( !s.contains("operacion:") ) {
         s = mymodel->prefix()+ s + mymodel->suffix();

     }

    
    tc.insertText(s+" ");
    QRect cr = cursorRect();
//marcador
    setTextCursor(tc);
    showFromWidget(cr, s );

    updateDockSbMenu();


}
示例#10
0
QRect SourceEdit::lineRect()
{
    QRect rect = cursorRect();
    rect.setLeft(0);
    rect.setWidth(viewport()->width());
    return rect;
}
示例#11
0
/** Redefined to display user input like closable "bubbles". */
void TagLineEdit::paintEvent(QPaintEvent *)
{
	QStylePainter p(this);

	// Draw frame
	QStyleOptionFrameV3 frame;
	this->initStyleOption(&frame);
	QPalette palette = QApplication::palette();
	p.setPen(palette.mid().color());
	p.setBrush(palette.base());
	p.drawRect(this->rect().adjusted(0, 0, -1, -1));

	// Compute cursor position
	QRect contentsRect = this->style()->subElementRect(QStyle::SE_LineEditContents, &frame);
	QRect rText = contentsRect.adjusted(2, 0, 0, 0);
	if (!_tags.isEmpty() || (placeholderText().isEmpty() || (!placeholderText().isEmpty() && hasFocus()))) {
		p.setPen(palette.text().color());
		p.drawText(rText, Qt::AlignLeft | Qt::AlignVCenter, text());

		// Animate cursor is focus is owned by this widget
		bool overlap = false;
		for (TagButton *t : _tags) {
			if (t->frameGeometry().contains(cursorRect().center())) {
				overlap = true;
				break;
			}
		}
		if (!overlap && hasFocus()) {
			this->drawCursor(&p, rText.adjusted(0, 1, 0, -1));
		}
	} else {
		p.setPen(palette.mid().color());
		p.drawText(rText, Qt::AlignLeft | Qt::AlignVCenter, placeholderText());
	}
}
示例#12
0
void TagLineEdit::addTag(const QString &tag, int column)
{
	if (tag.trimmed().isEmpty()) {
		return;
	}
	for (TagButton *button : _tags) {
		if (button->text() == tag.trimmed().toLower()) {
			// It useless to add a tag more than once (IMHO)
			return;
		}
	}

	TagButton *t = new TagButton(tag.trimmed(), this);
	if (column != -1) {
		t->setColumn(column);
	}
	t->setMaximumHeight(this->height() - 2);

	// Move all tag buttons, next to the one that is about to be closed, to the left
	connect(t->closeButton(), &QToolButton::clicked, this, [=]() {
		this->closeTagButton(t);
	});

	_tags.append(t);
	this->setFocus();

	// Unfortunately, we have to wait that a QShowEvent is emitted to have correct size of the Widget
	connect(t, &TagButton::shown, this, &TagLineEdit::insertSpaces);
	t->move(cursorRect().right() + 1, 0);
	t->show();
}
示例#13
0
void TikzEditor::printWhiteSpaces(QPainter &painter)
{
	const QFontMetrics fontMetrics = QFontMetrics(document()->defaultFont());

	for (QTextBlock block = firstVisibleBlock(); block.isValid(); block = block.next())
	{
		if (blockBoundingGeometry(block).top() > viewport()->height())
			break;

		const QString text = block.text();
		const int textLength = text.length();

		for (int i = 0; i < textLength; ++i)
		{
			QTextCursor cursor = textCursor();
			cursor.setPosition(block.position() + i, QTextCursor::MoveAnchor);
			const QRect rect = cursorRect(cursor);

//			const QFontMetrics fontMetrics = QFontMetrics(cursor.charFormat().font());

			if (m_showWhiteSpaces && text.at(i) == ' ')
				paintSpace(painter, rect.x() + spaceWidth() / 2.0, rect.y() + fontMetrics.height() / 2.0);
			else if (m_showTabulators && text.at(i) == '\t')
				paintTabstop(painter, rect.x() + spaceWidth() / 2.0, rect.y() + fontMetrics.height() / 2.0);
		}
	}
}
示例#14
0
void TikzEditor::highlightCurrentLine()
{
/*
	// this hides the white space and tab marks on the current line :-(
	QList<QTextEdit::ExtraSelection> extraSelections;
	if (!isReadOnly())
	{
		QTextEdit::ExtraSelection selection;
		selection.format.setBackground(m_highlightCurrentLineColor);
		selection.format.setProperty(QTextFormat::FullWidthSelection, true);
		selection.cursor = textCursor();
		selection.cursor.clearSelection();
		extraSelections.append(selection);
	}
	setExtraSelections(extraSelections);

	// highlight the currently selected brackets (if any)
	matchBrackets();
*/

	// update the area covering the previously highlighted line (updating the whole viewport is too slow :-( )
	m_previousHighlightedLine.moveTop(m_previousHighlightedLine.top() - (verticalScrollBar()->value() - m_oldVerticalScrollBarValue + 0.5) * m_previousHighlightedLine.height());
	m_previousHighlightedLine.setHeight(2 * m_previousHighlightedLine.height()); // should be large enough to cover the previous line (ugly hack :-( )
	viewport()->update(m_previousHighlightedLine);

	// update the area covering the currently highlighted line
	QRect rect = cursorRect();
	rect.setX(0);
	rect.setWidth(viewport()->width());
	viewport()->update(rect);

	m_previousHighlightedLine = rect;
	m_oldVerticalScrollBarValue = verticalScrollBar()->value();
}
示例#15
0
void WizTitleEdit::onTextEdit(const QString& text)
{
    if (!c)
        return;

    QString completionPrefix = textUnderCursor();
    bool isSeparator = (!completionPrefix.isEmpty() || charBeforeCursor() == m_separator) ? true : false;

    if (!isSeparator) {
        c->popup()->hide();
        return;
    }


    static QString eow("~!#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word

    if (!isSeparator && (text.isEmpty()
                      || eow.contains(text.right(1)))) {
        c->popup()->hide();
        return;
    }

    if (completionPrefix != c->completionPrefix()) {
        updateCompleterPopupItems(completionPrefix);
    }

    QRect cr = cursorRect();
    cr.setWidth(c->popup()->sizeHintForColumn(0)
                + c->popup()->verticalScrollBar()->sizeHint().width() + 20); // bigger
    c->complete(cr); // popup it up!
}
示例#16
0
void TextEditor::paintEvent(QPaintEvent *e) {
   int width = viewport()->width(), height = fontMetrics().height();
   QRect cRect(0, cursorRect().y(), viewport()->width(), height);
   const int cursorPos = textCursor().block().position();
   
   QPainter p(viewport());
   // good for highlighting line during paused execution:
   p.fillRect(cRect, QBrush(QColor(215, 227, 255)));
   
   if (m_pc != NULL && m_program->getStatus() == PAUSED) {
      QColor highlightColor = QColor(255, 240, 117); // yellow
      highlightLine(p, m_pc, highlightColor, width, height);
      
//      highlightColor = highlightColor.lighter(105);
//      cerr << "<<<Painting: size = " << m_lastInstructions.size() << endl;
      foreach(ParseNode *parseNode, m_lastInstructions) {
         highlightColor = highlightColor.lighter(120);
         if (highlightColor == Qt::white) {
            //cerr << "\t" << i << " painted!\n";
            break;
         }
         
         if (!parseNode->isValid())
            continue;
         
         const QTextBlock *block = parseNode->getTextBlock();
         if (block != NULL && block->isValid() && parseNode != m_pc && cursorPos != block->position())
            highlightLine(p, parseNode, highlightColor, width, height);
      }
示例#17
0
void LineEdit::keyPressEvent (QKeyEvent *e)
{
    if (c && c->popup()->isVisible()) {
            // The following keys are forwarded by the completer to the widget
           switch (e->key()) {
           case Qt::Key_Enter:
           case Qt::Key_Return:
           case Qt::Key_Escape:
           case Qt::Key_Tab:
           case Qt::Key_Backtab:
                e->ignore();
                return; // let the completer do default behavior
           default:
               break;
           }
        }

        bool isShortcut = ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_E); // CTRL+E
        if ((e->key () == Qt::Key_Enter) || (e->key () == Qt::Key_Return)) {
            e->ignore ();
            emit returnPressed();
            return;
        }
        if (!c || !isShortcut) // do not process the shortcut when we have a completer
            QTextEdit::keyPressEvent(e);

        const bool ctrlOrShift = e->modifiers() & (Qt::ControlModifier | Qt::ShiftModifier);
        if (!c || (ctrlOrShift && e->text().isEmpty()))
            return;

        static QString eow("~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word
        bool hasModifier = (e->modifiers() != Qt::NoModifier) && !ctrlOrShift;
        QString completionPrefix = textUnderCursor();

        if (!isShortcut && (hasModifier || e->text().isEmpty()|| completionPrefix.length() < 2
                          || eow.contains(e->text().right(1)))) {
            c->popup()->hide();
            return;
        }

        if (completionPrefix != c->completionPrefix()) {
            c->setCompletionPrefix(completionPrefix);
            c->popup()->setCurrentIndex(c->completionModel()->index(0, 0));
        }
        QRect cr = cursorRect();
        cr.setWidth(c->popup()->sizeHintForColumn(0)
                    + c->popup()->verticalScrollBar()->sizeHint().width());
        c->complete(cr); // popup it up!

    /*
    if ((e->key () == Qt::Key_Enter) || (e->key () == Qt::Key_Return)) {
        e->ignore ();
        emit returnPressed();
    }
    else
        QTextEdit::keyPressEvent (e);
        */
}
//-----------------------------------------------------------------------------
void PythonQtScriptingConsole::handleTabCompletion()
{
  QTextCursor textCursor   = this->textCursor();
  int pos = textCursor.position();
  textCursor.setPosition(commandPromptPosition());
  textCursor.movePosition(QTextCursor::End, QTextCursor::KeepAnchor);
  int startPos = textCursor.selectionStart();

  int offset = pos-startPos;
  QString text = textCursor.selectedText();

  QString textToComplete;
  int cur = offset;
  while(cur--) {
    QChar c = text.at(cur);
    if (c.isLetterOrNumber() || c == '.' || c == '_') {
      textToComplete.prepend(c);
    } else {
      break;
    }
  }


  QString lookup;
  QString compareText = textToComplete;
  int dot = compareText.lastIndexOf('.');
  if (dot!=-1) {
    lookup = compareText.mid(0, dot);
    compareText = compareText.mid(dot+1, offset);
  }
  if (!lookup.isEmpty() || !compareText.isEmpty()) {
    compareText = compareText.toLower();
    QStringList found;
    QStringList l = PythonQt::self()->introspection(_context, lookup, PythonQt::Anything);
    foreach (QString n, l) {
      if (n.toLower().startsWith(compareText)) {
        found << n;
      }
    }
    
    if (!found.isEmpty()) {
      _completer->setCompletionPrefix(compareText);
      _completer->setCompletionMode(QCompleter::PopupCompletion);
      _completer->setModel(new QStringListModel(found, _completer));
      _completer->setCaseSensitivity(Qt::CaseInsensitive);
      QTextCursor c = this->textCursor();
      c.movePosition(QTextCursor::StartOfWord);
      QRect cr = cursorRect(c);
      cr.setWidth(_completer->popup()->sizeHintForColumn(0)
        + _completer->popup()->verticalScrollBar()->sizeHint().width());
      cr.translate(0,8);
      _completer->complete(cr);
    } else {
      _completer->popup()->hide();
    }
  } else {
示例#19
0
void MimeTextEdit::keyPressEvent(QKeyEvent *e)
{
	if (mCompleter && mCompleter->popup()->isVisible()) {
		// The following keys are forwarded by the completer to the widget
		switch (e->key()) {
		case Qt::Key_Enter:
		case Qt::Key_Return:
		case Qt::Key_Escape:
		case Qt::Key_Tab:
		case Qt::Key_Backtab:
			mCompleter->popup()->hide();
			mForceCompleterShowNextKeyEvent=false;
			e->ignore();
			return; // let the completer do default behavior
		default:
			break;
		}
	}

	bool isShortcut = ((e->modifiers() & mCompleterKeyModifiers) && e->key() == mCompleterKey);
	if (isShortcut && !mForceCompleterShowNextKeyEvent) {
		mCompleterStartString.clear();
	}
	isShortcut |= mForceCompleterShowNextKeyEvent;
	if (!mCompleter || !isShortcut) // do not process the shortcut when we have a completer
		QTextEdit::keyPressEvent(e);

	if (!mCompleter) return; //Nothing else to do if not mCompleter initialized

	if (!isShortcut && (mCompleter && !mCompleter->popup()->isVisible())) {
		return;
	}

	if (!mForceCompleterShowNextKeyEvent) {
		static QString eow(" ~!@#$%^&*()_+{}|:\"<>?,./;'[]\\-="); // end of word
		if (!isShortcut && !e->text().isEmpty() && eow.contains(e->text())){
			mCompleter->popup()->hide();
			return;
		}
	}

	QString completionPrefix = textUnderCursor();
	if (completionPrefix != mCompleter->completionPrefix()) {
		mCompleter->setCompletionPrefix(completionPrefix);
		mCompleter->popup()->setCurrentIndex(mCompleter->completionModel()->index(0, 0));
	}

	QRect cr = cursorRect();
	cr.setWidth(mCompleter->popup()->sizeHintForColumn(0) + mCompleter->popup()->verticalScrollBar()->sizeHint().width());
	mCompleter->complete(cr); // popup it up!

	if (mCompleter->completionCount()==0 && isShortcut){
		QTextEdit::keyPressEvent(e);// Process the key if no match
	}
	mForceCompleterShowNextKeyEvent = false;
}
示例#20
0
//--------------------------------------------------------------------------------
void TextZone::centerCursor()
{
    QRect cursor = cursorRect();
    QRect viewport =  this->viewport()->rect();
    if (alwaysCenter || (cursor.bottom() >= viewport.bottom()) || (cursor.top() <= viewport.top())) {
        QPoint offset = viewport.center() - cursor.center();
        QScrollBar* scrollbar = verticalScrollBar();
        scrollbar->setValue(scrollbar->value() - offset.y());
    }
}
示例#21
0
void MLScriptEditor::showAutoComplete( QKeyEvent * /*e*/ )
{	
	QString w = wordUnderTextCursor();
	QTextCursor tc = textCursor();
	comp->setCompletionPrefix(w);
	comp->popup()->setModel(comp->completionModel());
	QRect rect = cursorRect();
	rect.setWidth(comp->popup()->sizeHintForColumn(0) + comp->popup()->verticalScrollBar()->sizeHint().width());
	comp->complete(rect);
}
示例#22
0
void ContactListEdit::onCompleterRequest()
  {
  setFocus();
  showCompleter(QString());
  if(_completer->model()->rowCount() == 0)
    {
    QRect pos = cursorRect();
    QToolTip::showText(mapToGlobal(pos.topLeft()), tr("There is no contact defined"));
    }
  }
示例#23
0
void ShellEdit::updateEditPosition()
{
    resize(size());
    // 构造一个矩形,并返回当前光标
    QRect rect = cursorRect();
    edit->setStyleSheet("QLineEdit{background:black;font:bold;color:#87CEFA;border-width:0;border-style:outset}");
    edit->resize(viewport()->size().width(), edit->size().height());
    // 将edit放在矩形的右上角位置
    edit->move(rect.topRight());
}
示例#24
0
bool ScriptEditorWidget::contextSensitiveHelp() const
{

	QRect r = cursorRect();
	QTextCursor cur = cursorForPosition(QPoint(r.x(), r.y()));
	cur.select(QTextCursor::WordUnderCursor);
	QString szText = cur.selectedText();
	QString szTmp = szText;

	return true;
}
示例#25
0
void QLineEditPrivate::setCursorVisible(bool visible)
{
    Q_Q(QLineEdit);
    if ((bool)cursorVisible == visible)
        return;
    cursorVisible = visible;
    if (control->inputMask().isEmpty())
        q->update(cursorRect());
    else
        q->update();
}
示例#26
0
void QEglFSCursor::paintOnScreen()
{
    const QRectF cr = cursorRect();
    const QRect screenRect(m_screen->geometry());
    const GLfloat x1 = 2 * (cr.left() / screenRect.width()) - 1;
    const GLfloat x2 = 2 * (cr.right() / screenRect.width()) - 1;
    const GLfloat y1 = 1 - (cr.top() / screenRect.height()) * 2;
    const GLfloat y2 = 1 - (cr.bottom() / screenRect.height()) * 2;
    QRectF r(QPointF(x1, y1), QPointF(x2, y2));

    draw(r);
}
示例#27
0
void ContactListEdit::showCompleter(const QString& completionPrefix)
  {
  if (completionPrefix != _completer->completionPrefix())
    {
    _completer->setCompletionPrefix(completionPrefix);
    _completer->popup()->setCurrentIndex(_completer->completionModel()->index(0, 0));
    }
  QRect cr = cursorRect();
  cr.setWidth(_completer->popup()->sizeHintForColumn(0)
              + _completer->popup()->verticalScrollBar()->sizeHint().width());
  _completer->complete(cr);   // popup it up!
  }
示例#28
0
/** Redefined to automatically move cursor outside TagButton. */
void TagLineEdit::mousePressEvent(QMouseEvent *event)
{
	LineEdit::mousePressEvent(event);
	for (TagButton *t : _tags) {
		QRect r = t->frameGeometry();
		if (r.contains(event->pos())) {
			if (r.x() + r.width() / 2 >= event->pos().x()) {
				while (r.contains(cursorRect().center()) && cursorPosition() > 0) {
					cursorBackward(false);
					//qDebug() << "cursorBackward" << "pos" << t->position() << "spaces" << t->spaceCount();
				}
			} else {
				while (r.contains(cursorRect().center()) && cursorPosition() < text().length()) {
					cursorForward(false);
					//qDebug() << "cursorForward" << "pos" << t->position() << "spaces" << t->spaceCount();
				}
			}
			break;
		}
	}
}
示例#29
0
void ExprTextEdit::showTip(const QString& string)
{
    // skip empty strings
    if(string=="") return;
    // skip already shown stuff
    if(_tip && !_tip->isHidden() && _tip->label->text() == string) return;

    QRect cr=cursorRect();
    cr.setX(0);
    cr.setWidth(cr.width()*3);
    if(_tip){delete _tip;_tip=0;}
    _tip=new ExprPopupDoc(this,mapToGlobal(cr.bottomLeft())+QPoint(0,6),string);
}
/*
void ScriptEditorWidget::mouseReleaseEvent(QMouseEvent * e)
{

	return;
		QRect r = cursorRect();
		QTextCursor cur = cursorForPosition(e->pos());
	//	cur.select(


	//completelistbox->hide();
	if (e->button() == Qt::RightButton)
	{
		QString szBuffer;
		/\*
		int iPara = paragraphAt(e->pos());
		int iIndex=charAt(e->pos(),&iPara);
		szBuffer = this->text(iPara);
		getWordOnCursor(szBuffer,iIndex);
		*\/
		QRect r = cursorRect();
		QTextCursor cur = cursorForPosition(e->pos());
		cur.select(QTextCursor::WordUnderCursor);
		szBuffer = cur.selectedText();
		QString szTmp = szBuffer;
		KviPointerList<QString> * pList;
		if(szTmp.left(1) == "$")
		{
			szTmp.remove(0,1);
			pList = KviKvsKernel::instance()->completeCommandAllocateResult(szTmp);
			if (pList->count() != 1)
				szBuffer = "";
			else
				szBuffer = *(pList->at(0));
		} else {
			pList = KviKvsKernel::instance()->completeCommandAllocateResult(szTmp);
			if (pList->count() != 1)
				szBuffer = "";
			else
				szBuffer = *(pList->at(0));
		}

		for (unsigned int i=0; i < pList->count(); i++)
			QString str = *(pList->at(i));

		KviKvsKernel::instance()->freeCompletionResult(pList);
		m_szHelp = szBuffer;
	}

	QTextEdit::mouseReleaseEvent(e);
}
*/
bool ScriptEditorWidget::contextSensitiveHelp() const
{
	/*
	QString szBuffer;
	int iPara, iIndex;
	getCursorPosition(&iPara,&iIndex);
	szBuffer = text(iPara);
	getWordOnCursor(szBuffer,iIndex);
	*/

	QRect r = cursorRect();
	QTextCursor cur = cursorForPosition(QPoint(r.x(),r.y()));
	cur.select(QTextCursor::WordUnderCursor);
	QString szText = cur.selectedText();
	QString szTmp = szText;
	/*
	KviPointerList<QString> * pList;
	if(szTmp.left(1) == "$")
	{
		szTmp.remove(0,1);
		pList = g_pUserParser->completeFunctionAllocateResult(szTmp);
	} else {
		pList = g_pUserParser->completeCommandAllocateResult(szTmp);
	}
	qDebug("command or func %s",szTmp.toUtf8().data());

	bool bOk = false;
	if(pList)
	{
		for(QString * s = pList->first(); s; s = pList->next())
		{
			if(KviQString::equalCI(*s,szBuffer))
			{
				pList->last();
				bOk = true;
			}
		}
	}

	g_pUserParser->freeCompletionResult(pList);
	if(!bOk)return false;

	QString szParse = QString("timer -s (help,0){ help -s %Q; }").arg(szBuffer);
	qDebug("parsing %s",szParse.toLatin1());
	KviKvsScript::run(szParse,(KviWindow*)g_pApp->activeConsole());
	*/

	return true;
}