Esempio n. 1
0
int OpenedFile::insertLineBeforeBracket(const int start_line, const QString &new_line)
{
    QTextCursor parsingCursor = textCursor();
    QString new_text = new_line;

    parsingCursor.setPosition(0);

    while(parsingCursor.blockNumber() != start_line)
    {
        parsingCursor.movePosition(QTextCursor::Down);
    }

    while(!parsingCursor.atEnd())
    {
        if(parsingCursor.block().text().contains('}'))
            break;

        parsingCursor.movePosition(QTextCursor::Down);
    }

    parsingCursor.movePosition(QTextCursor::StartOfLine);

    new_text.remove(".0000", Qt::CaseInsensitive);
    parsingCursor.insertText(new_text);
    parsingCursor.insertText("\n");
    parsingCursor.movePosition(QTextCursor::Up);
    setTextCursor(parsingCursor);
    return parsingCursor.blockNumber();

}
Esempio n. 2
0
/*!
 * \brief TextDoc::commentSelected toggles the comment of selected text
 * See also QucsApp::slotEditActivate
 */
void TextDoc::commentSelected ()
{
  QTextCursor cursor = this->textCursor();

  if(!cursor.hasSelection())
      return; // No selection available

  // get range of selection
  int start = cursor.selectionStart();
  int end = cursor.selectionEnd();

  cursor.setPosition(start);
  int firstLine = cursor.blockNumber();
  cursor.setPosition(end, QTextCursor::KeepAnchor);
  int lastLine = cursor.blockNumber();

  // use comment string indicator depending on language
  QString co;

  switch (language) {
  case LANG_VHDL:
    co = "--";
    break;
  case LANG_VERILOG:
  case LANG_VERILOGA:
    co = "//";
    break;
  case LANG_OCTAVE:
    co = "%";
    break;
  default:
    co = "";
    break;
  }

  QStringList newlines;
  for (int i=firstLine; i<=lastLine; i++) {
      QString line = document()->findBlockByLineNumber(i).text();
      if (line.startsWith(co)){
          // uncomment
          line.remove(0,co.length());
          newlines << line;
      }
      else {
          // comment
          line = line.insert(0, co);
          newlines << line;
      }
  }
  insertPlainText(newlines.join("\n"));
}
Esempio n. 3
0
void OCamlSource::mousePressEvent ( QMouseEvent * e )
{
    QTextCursor current_cur = textCursor();
    QTextCursor cur = cursorForPosition( e->pos() );
    if ( current_cur.hasSelection() )
        cur = current_cur;

    _breakpoint_line   = cur.blockNumber() + 1;
    _breakpoint_column = cur.position() - cur.block().position() + 1;
    if ( ! cur.hasSelection() )
    {
        cur.select(QTextCursor::WordUnderCursor);
        setTextCursor(cur);
    }
    _selected_text = cur.selectedText();
    if ( e->button() == Qt::LeftButton )
    {
        lineSearchArea->hide();
        lineSearchArea->setEnabled(false);
        setFocus();
    }

    if ( e->button() == Qt::MidButton )
    {
        watchVar();
    }
    else
        QPlainTextEdit::mousePressEvent(e);
}
Esempio n. 4
0
void TextView::updatePositionStatus() {
    QTextCursor cursor = textEdit()->textCursor();
    int line = cursor.blockNumber() + 1;
    int column = cursor.columnNumber() + 1;

    Q_EMIT status(tr("Line %1, Column %2").arg(line).arg(column));
}
Esempio n. 5
0
void SkinDocument::cursorChanged()
{
    if(editor->isError(editor->textCursor().blockNumber() + 1))
    {
        QTextCursor line = editor->textCursor();
        line.movePosition(QTextCursor::StartOfLine);
        line.movePosition(QTextCursor::EndOfLine, QTextCursor::KeepAnchor);
        skin_parse(line.selectedText().toAscii());
        if(skin_error_line() > 0)
            parseStatus = tr("Error on line ") +
                          QString::number(line.blockNumber() + 1) + tr(": ") +
                          skin_error_message();
        statusLabel->setText(parseStatus);
    }
    else if(editor->hasErrors())
    {
        parseStatus = tr("Errors in document");
        statusLabel->setText(parseStatus);
    }
    else
    {
        emit lineChanged(editor->textCursor().blockNumber() + 1);
    }

}
Esempio n. 6
0
void KCDocumentRecorder::appendRecord(KCCodeEditor *editor, bool untitled)
{
    UnclosedFileStatus currentStatus;
    QTextCursor cursor;
    currentStatus.untitled=untitled;
    if(untitled)
    {
        //This will treat as a untitled file.
        QString cacheFilePath=QString(unclosedUntitledFileDir +
                                      QString::number(cacheCount++));
        //Save the file as a cache file
        editor->writeCacheFile(cacheFilePath);
        cursor=editor->getTextCursor();
        currentStatus.filePath=cacheFilePath;
    }
    else
    {
        cursor=editor->getTextCursor();
        currentStatus.filePath=editor->getFilePath();
    }
    currentStatus.horizontalCursorPosition=cursor.blockNumber();
    currentStatus.verticalCursorPosition=cursor.columnNumber();
    currentStatus.horizontalScrollPosition=editor->getHScrollValue();
    currentStatus.verticalScrollPosition=editor->getVScrollValue();
    unclosedFileInfos.prepend(currentStatus);
}
Esempio n. 7
0
void TextEditViewImpl::cursorPositionChanged()
{
    QTextCursor cur = textEdit.textCursor();
    std::stringstream s;
    s << cur.blockNumber()+1 << "  :  " << cur.columnNumber()+1 << "  ";
    lineLabel.setText(QString(s.str().c_str()));
}
Esempio n. 8
0
void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data,
                                           CppTools::ProjectPart *projectPart,
                                           RenameCallback &&renameSymbolsCallback)
{
    using CppTools::CompilerOptionsBuilder;

    setRefactoringEngineAvailable(false);

    m_client.setLocalRenamingCallback(std::move(renameSymbolsCallback));

    QString filePath = data.filePath().toString();
    QTextCursor textCursor = data.cursor();
    CompilerOptionsBuilder optionsBuilder{*projectPart, CLANG_VERSION, CLANG_RESOURCE_DIR};
    Utils::SmallStringVector commandLine{optionsBuilder.build(
                    fileKindInProjectPart(projectPart, filePath),
                    CppTools::getPchUsage())};

    commandLine.push_back(filePath);

    RequestSourceLocationsForRenamingMessage message(ClangBackEnd::FilePath(filePath),
                                                     uint(textCursor.blockNumber() + 1),
                                                     uint(textCursor.positionInBlock() + 1),
                                                     textCursor.document()->toPlainText(),
                                                     std::move(commandLine),
                                                     textCursor.document()->revision());


    m_server.requestSourceLocationsForRenamingMessage(std::move(message));
}
Esempio n. 9
0
void QueryPanel::executeQuery() {
    QTextCursor c = editor->textCursor();
    QString stmt = getActiveStatement(c.blockNumber(), c.columnNumber());
    error->hide();
    status->hide();
    model->setQuery(stmt);
    model->select();
}
Esempio n. 10
0
void TikzEditor::showCursorPosition()
{
	QTextCursor cursor = textCursor();
	const int cursorPosition = cursor.position();
	cursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
	const int startPosition = cursor.position();
	emit cursorPositionChanged(cursor.blockNumber() + 1, cursorPosition - startPosition + 1);
}
Esempio n. 11
0
/*!
 * \brief TextDoc::slotCursorPosChanged update status bar with line:column
 */
void TextDoc::slotCursorPosChanged()
{
  QTextCursor pos = textCursor();
  int x = pos.blockNumber();
  int y = pos.columnNumber();
  emit signalCursorPosChanged(x+1, y+1);
  tmpPosX = x;
  tmpPosY = y;
}
Esempio n. 12
0
/*!
 * \brief TextDoc::slotCursorPosChanged update status bar with line:column
 */
void TextDoc::slotCursorPosChanged()
{
  QTextCursor pos = textCursor();
  int x = pos.blockNumber();
  int y = pos.columnNumber();
  App->printCursorPosition(x+1, y+1);
  tmpPosX = x;
  tmpPosY = y;
}
Esempio n. 13
0
/*!
  \reimp
*/
bool QScriptDebuggerCodeView::event(QEvent *e)
{
    Q_D(QScriptDebuggerCodeView);
    if (e->type() == QEvent::ToolTip) {
        if (d->editor->executionLineNumber() == -1)
            return false;
        QHelpEvent *he = static_cast<QHelpEvent*>(e);
        QPoint pt = he->pos();
        pt.rx() -= d->editor->extraAreaWidth();
        pt.ry() -= 8;
        QTextCursor cursor = d->editor->cursorForPosition(pt);
        QTextBlock block = cursor.block();
        QString contents = block.text();
        if (contents.isEmpty())
            return false;
        int linePosition = cursor.position() - block.position();
        linePosition -= 3;
        if (linePosition < 0)
            linePosition = 0;

        // ### generalize -- same as in completiontask

        int pos = linePosition;
        if ((pos > 0) && contents.at(pos-1).isNumber()) {
            // tooltips for numbers is pointless
            return false;
        }

        while ((pos > 0) && isIdentChar(contents.at(pos-1)))
            --pos;
        if ((pos > 0) && ((contents.at(pos-1) == QLatin1Char('\''))
                          || (contents.at(pos-1) == QLatin1Char('\"')))) {
            // ignore string literals
            return false;
        }
        int pos2 = linePosition;
        while ((pos2 < contents.size()-1) && isIdentChar(contents.at(pos2+1)))
            ++pos2;
        QString ident = contents.mid(pos, pos2 - pos + 1);

        QStringList path;
        path.append(ident);
        while ((pos > 0) && (contents.at(pos-1) == QLatin1Char('.'))) {
            --pos;
            pos2 = pos;
            while ((pos > 0) && isIdentChar(contents.at(pos-1)))
                --pos;
            path.prepend(contents.mid(pos, pos2 - pos));
        }

        if (!path.isEmpty()) {
            int lineNumber = cursor.blockNumber() + d->editor->baseLineNumber();
            emit toolTipRequest(he->globalPos(), lineNumber, path);
        }
    }
    return false;
}
Esempio n. 14
0
void MdiChild::documentChanged(int position, int charsRemoved, int charsAdded)
{
    if(blockModeData.enabled)
    {
        if(blockModeData.lineNumber == textCursor().blockNumber())
        {
            QTextCursor cursor = textCursor();
            cursor.setPosition(position);
            cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, charsAdded);
            QString text = cursor.selectedText();
            int pos = position - cursor.block().position();
            disconnect(docLayout, SIGNAL(docChanged(int, int, int)), this, SLOT(documentChanged(int, int, int)));
         	  disconnect(document(), SIGNAL(contentsChanged()), this, SLOT(documentContentsChanged()));
            for(int i = blockModeData.startLine+1; i<=blockModeData.endLine; i++)
            {
                // Set cursor position
                int line = cursor.blockNumber();
                while(line < _document->lastBlock().blockNumber() && line < i)
                {
                    cursor.setPosition(cursor.block().next().position());
                    line = cursor.blockNumber();
                }
                while(line > 0 && line > i)
                {
                    cursor.setPosition(cursor.block().previous().position());
                    line = cursor.blockNumber();
                }
                int startPosition = pos;
                if( pos >= cursor.block().length() )
                    //startPosition = cursor.block().length() - 1;
                    continue;
                int charsCount = charsRemoved;
                if( (startPosition + charsRemoved) >= cursor.block().length() )
                    //charsCount = cursor.block().length() - startPosition - 1;
                    continue;
                cursor.setPosition(cursor.block().position() + startPosition);
                cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor, charsCount);
                cursor.insertText(text);
            }
            connect(docLayout, SIGNAL(docChanged(int, int, int)), this, SLOT(documentChanged(int, int, int)));
            connect(document(), SIGNAL(contentsChanged()), this, SLOT(documentContentsChanged()));
        }
        else
Esempio n. 15
0
int OpenedFile::findLineNumber(const QString &str, const int start_line_number)
{
    QTextCursor parsingCursor = textCursor();
    
    parsingCursor.setPosition(0);
    
    while(parsingCursor.blockNumber() != start_line_number)
    {
        parsingCursor.movePosition(QTextCursor::Down);
    }

    while(!parsingCursor.atEnd())
    {
        if(parsingCursor.block().text().contains(str))
            return parsingCursor.blockNumber();

        parsingCursor.movePosition(QTextCursor::Down);
    }

    return -1;
}
Esempio n. 16
0
static void from_pos(CTEXTAREA *_object, int pos, int *par, int *car)
{
	QTextCursor cursor = WIDGET->textCursor();
	
	if (pos >= get_length(THIS))
		cursor.movePosition(QTextCursor::End);
	else
		cursor.setPosition(pos);
	
	*par = cursor.blockNumber();
	*car = cursor.position() - cursor.block().position();
}
Esempio n. 17
0
void MdiChild::cursorPositionChanged()
{
	QTextCursor cursor      = this->textCursor();

	// Current line text
	//QString cur_line_text   = cursor.block().text().trimmed();

	std::ostringstream oss;
	oss <<"Line:"<< cursor.blockNumber()+1 <<"  Colum:"<<cursor.columnNumber();
	statusBar->showMessage( QString::fromStdString(oss.str()));

}
Esempio n. 18
0
void Wt_TextEdit::wt_forEachSelectedBlock(void handleEachBlock(QTextCursor &))
{
	QTextCursor textCursor = this->textCursor();
	textCursor.beginEditBlock();
	if (!textCursor.hasSelection()) {
		handleEachBlock(textCursor);
	} else {
		int selectStart = textCursor.selectionStart();
	    	int selectEnd = textCursor.selectionEnd();
	    	textCursor.setPosition(selectEnd, QTextCursor::MoveAnchor);
	    	int blockEnd = textCursor.blockNumber();
	    	textCursor.setPosition(selectStart, QTextCursor::MoveAnchor);
	    	int blockStart = textCursor.blockNumber();
	    	for(int i = blockStart ; i <= blockEnd ; i++) {
	    		textCursor.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
				handleEachBlock(textCursor);
	    		textCursor.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor);
	    	}
	}
	textCursor.endEditBlock();
}
/**
 * @brief Inserts tabulation(s) at the cursor position.
 */
void TextEditorWidget::insert_tab () {

  QTextCursor cursor = textCursor();

  // Get tabulation character(s).
  QString tab = "\t";
  if (replace_tab_by_spaces) {

    int length = tab_length;
    if (!cursor.hasSelection()) {
      length -= (cursor.columnNumber() % tab_length);
    }
    tab = QString(" ").repeated(length);
  }

  cursor.beginEditBlock();

  // Insert tab for all selected lines.
  if (cursor.hasSelection()) {

    // Get the end block number dans set position to start.
    int start_pos = cursor.selectionStart();
    cursor.setPosition(cursor.selectionEnd());
    int block_number = cursor.blockNumber();
    cursor.setPosition(start_pos);

    // Loop on each blocks.
    while (cursor.blockNumber() <= block_number) {
      cursor.movePosition(QTextCursor::StartOfLine);
      cursor.insertText(tab);
      cursor.movePosition(QTextCursor::NextBlock);
    }
  }
  // Insert tab before the cursor.
  else {
    cursor.insertText(tab);
  }

  cursor.endEditBlock();
}
Esempio n. 20
0
void WareSrcMsgViewer::writeMessage(const openfluid::waresdev::WareSrcMsgParser::WareSrcMsg& Msg)
{
  QTextCursor Cursor = textCursor();

  Cursor.setCharFormat(m_FormatByMsgType.value(Msg.m_Type, QTextCharFormat()));

  if (Msg.m_LineNb > 0)
    m_MessagesByBlockNumber.insert(Cursor.blockNumber(), Msg);

  Cursor.insertText(QString::fromUtf8(Msg.m_OriginalMsgLine));

  ensureCursorVisible();
}
Esempio n. 21
0
QPoint Editor::keyPopPoint(QTextCursor cursor)
{
    int ht = fontMetrics().height();
    int wd = fontMetrics().width(QLatin1Char('9'));
    int col = cursor.columnNumber();
    int row = cursor.blockNumber()+2; // show just below line

    QTextBlock block = firstVisibleBlock();
    int top = block.firstLineNumber();

    QPoint pt = QPoint(lineNumberAreaWidth()+col*wd,(row-top)*ht);
    return pt;
}
void FunctionDeclDefLinkFinder::startFindLinkAt(
        QTextCursor cursor, const Document::Ptr &doc, const Snapshot &snapshot)
{
    // check if cursor is on function decl/def
    DeclarationAST *parent = 0;
    FunctionDeclaratorAST *funcDecl = 0;
    DeclaratorAST *declarator = 0;
    if (!findDeclOrDef(doc, cursor.blockNumber() + 1, cursor.columnNumber() + 1,
                       &parent, &declarator, &funcDecl))
        return;

    // find the start/end offsets
    CppRefactoringChanges refactoringChanges(snapshot);
    CppRefactoringFilePtr sourceFile = refactoringChanges.file(doc->fileName());
    sourceFile->setCppDocument(doc);
    int start, end;
    declDefLinkStartEnd(sourceFile, parent, funcDecl, &start, &end);

    // if already scanning, don't scan again
    if (!m_scannedSelection.isNull()
            && m_scannedSelection.selectionStart() == start
            && m_scannedSelection.selectionEnd() == end) {
        return;
    }

    // build the selection for the currently scanned area
    m_scannedSelection = cursor;
    m_scannedSelection.setPosition(end);
    m_scannedSelection.setPosition(start, QTextCursor::KeepAnchor);
    m_scannedSelection.setKeepPositionOnInsert(true);

    // build selection for the name
    DeclaratorIdAST *declId = getDeclaratorId(declarator);
    m_nameSelection = cursor;
    m_nameSelection.setPosition(sourceFile->endOf(declId));
    m_nameSelection.setPosition(sourceFile->startOf(declId), QTextCursor::KeepAnchor);
    m_nameSelection.setKeepPositionOnInsert(true);

    // set up a base result
    QSharedPointer<FunctionDeclDefLink> result(new FunctionDeclDefLink);
    result->nameInitial = m_nameSelection.selectedText();
    result->sourceDocument = doc;
    result->sourceFunction = funcDecl->symbol;
    result->sourceDeclaration = parent;
    result->sourceFunctionDeclarator = funcDecl;

    // handle the rest in a thread
    m_watcher.reset(new QFutureWatcher<QSharedPointer<FunctionDeclDefLink> >());
    connect(m_watcher.data(), SIGNAL(finished()), this, SLOT(onFutureDone()));
    m_watcher->setFuture(QtConcurrent::run(&findLinkHelper, result, refactoringChanges));
}
void MarginWidget::mouseMoveEvent(QMouseEvent *event)
{
	QTextCursor textCursor = m_sourceViewer->cursorForPosition(QPoint(1, event->y()));
	int currentLine = textCursor.blockNumber();

	if (currentLine == m_lastClickedLine)
	{
		return;
	}

	textCursor.movePosition(((currentLine > m_lastClickedLine) ? QTextCursor::Up : QTextCursor::Down), QTextCursor::KeepAnchor, qAbs(m_lastClickedLine - currentLine));

	m_sourceViewer->setTextCursor(textCursor);
}
Esempio n. 24
0
void TextEditWidget::onTextCursorMoved()
{
   // write the line we're in
   QTextCursor cursor = m_editor->textCursor();
   
   int lineNumber = cursor.blockNumber() + 1;

   char tmpStr[256];
   sprintf( tmpStr, "Row: %d, Col: %d", lineNumber, cursor.columnNumber() );
   m_statusBar->setText( tmpStr );

   // highlight the line we're currently editing
   highlightCurrentLine();
}
void UnifiedDiffEditorWidget::contextMenuEvent(QContextMenuEvent *e)
{
    QPointer<QMenu> menu = createStandardContextMenu();

    QTextCursor cursor = cursorForPosition(e->pos());
    const int blockNumber = cursor.blockNumber();

    addContextMenuActions(menu, fileIndexForBlockNumber(blockNumber),
                          chunkIndexForBlockNumber(blockNumber));

    connect(this, SIGNAL(destroyed()), menu, SLOT(deleteLater()));
    menu->exec(e->globalPos());
    delete menu;
}
void UnifiedDiffEditorWidget::jumpToOriginalFile(const QTextCursor &cursor)
{
    if (m_fileInfo.isEmpty())
        return;

    const int blockNumber = cursor.blockNumber();
    const int fileIndex = fileIndexForBlockNumber(blockNumber);
    if (fileIndex < 0)
        return;

    const FileData fileData = m_contextFileData.at(fileIndex);
    const QString leftFileName = fileData.leftFileInfo.fileName;
    const QString rightFileName = fileData.rightFileInfo.fileName;

    const int columnNumber = cursor.positionInBlock() - 1; // -1 for the first character in line

    const int rightLineNumber = m_rightLineNumbers.value(blockNumber, -1);
    if (rightLineNumber >= 0) {
        jumpToOriginalFile(rightFileName, rightLineNumber, columnNumber);
        return;
    }

    const int leftLineNumber = m_leftLineNumbers.value(blockNumber, -1);
    if (leftLineNumber >= 0) {
        if (leftFileName == rightFileName) {
            for (int i = 0; i < fileData.chunks.count(); i++) {
                const ChunkData chunkData = fileData.chunks.at(i);

                int newLeftLineNumber = chunkData.leftStartingLineNumber;
                int newRightLineNumber = chunkData.rightStartingLineNumber;

                for (int j = 0; j < chunkData.rows.count(); j++) {
                    const RowData rowData = chunkData.rows.at(j);
                    if (rowData.leftLine.textLineType == TextLineData::TextLine)
                        newLeftLineNumber++;
                    if (rowData.rightLine.textLineType == TextLineData::TextLine)
                        newRightLineNumber++;
                    if (newLeftLineNumber == leftLineNumber) {
                        jumpToOriginalFile(leftFileName, newRightLineNumber, 0);
                        return;
                    }
                }
            }
        } else {
            jumpToOriginalFile(leftFileName, leftLineNumber, columnNumber);
        }
        return;
    }
}
Esempio n. 27
0
void MainWindow::editGotoLine()
{
    const int STEP = 1;
    const int MIN_VALUE = 1;

    QTextCursor cursor = ui->plainTextEdit->textCursor();
    int currentLine = cursor.blockNumber()+1;
    int maxValue = ui->plainTextEdit->document()->blockCount();

    bool ok;
    int line = QInputDialog::getInt(this, tr("Go to..."),
                                          tr("Line: ", "Line number in the Markdown editor"), currentLine, MIN_VALUE, maxValue, STEP, &ok);
    if (!ok) return;
    ui->plainTextEdit->gotoLine(line);
}
Esempio n. 28
0
/*
  The cursor has moved.
  Highlight the current line, if appropriate.
  Update the line/column display in the status bar.
*/
void MainWindow::onCursorMoved( )
{
  QTextCursor c = editor->textCursor();
  if(c.hasSelection()) // don't highlight the line if text is selected
    return editor->setExtraSelections(QList<QTextEdit::ExtraSelection>());
  QTextEdit::ExtraSelection highlight;
  highlight.cursor = c;
  highlight.format.setProperty(QTextFormat::FullWidthSelection, true);
  highlight.format.setBackground( QColor::fromRgb(235, 235, 235) ); // light gray

  QList<QTextEdit::ExtraSelection> extras;
  extras << highlight;
  editor->setExtraSelections( extras );
  
  statusBar()->showMessage( QString("Line: %1  Column: %2").arg(c.blockNumber()+1).arg(c.columnNumber()));
}
Esempio n. 29
0
void TextModelLavaan::cursorPositionChangedHandler(QTextCursor cursor)
{
	int currentBlock = cursor.blockNumber();

	if (currentBlock != _currentBlock)
	{
		//checkEverything();
		_currentBlock = currentBlock;

		if (_changed)
		{
			//if ( ! inError())
			//	apply();
			_changed = false;
		}
	}
}
void MarginWidget::mousePressEvent(QMouseEvent *event)
{
	if (event->button() == Qt::LeftButton)
	{
		QTextCursor textCursor = m_sourceViewer->cursorForPosition(QPoint(1, event->y()));
		textCursor.select(QTextCursor::LineUnderCursor);
		textCursor.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor);

		m_lastClickedLine = textCursor.blockNumber();

		m_sourceViewer->setTextCursor(textCursor);
	}
	else
	{
		QWidget::mousePressEvent(event);
	}
}