コード例 #1
0
ファイル: mibeditor.cpp プロジェクト: vertexclique/travertine
MibEditor::MibEditor(Snmpb *snmpb)
{
    s = snmpb;

    // Menu items
    connect( s->MainUI()->fileNewAction, SIGNAL( triggered() ),
             this, SLOT( MibFileNew() ) );
    connect( s->MainUI()->fileOpenAction, SIGNAL( triggered() ),
             this, SLOT( MibFileOpen() ) );
    connect( s->MainUI()->fileSaveAction, SIGNAL( triggered() ),
             this, SLOT( MibFileSave() ) );
    connect( s->MainUI()->fileSaveAsAction, SIGNAL( triggered() ),
             this, SLOT( MibFileSaveAs() ) );
    connect( s->MainUI()->actionVerifyMIB, SIGNAL( triggered() ),
             this, SLOT( VerifyMIB() ) );
    connect( s->MainUI()->actionExtractMIBfromRFC, SIGNAL( triggered() ),
             this, SLOT( ExtractMIBfromRFC() ) );
    connect( s->MainUI()->MIBLog, SIGNAL ( itemDoubleClicked ( QListWidgetItem* ) ),
             this, SLOT( SelectedLogEntry ( QListWidgetItem* ) ) );
    connect( s->MainUI()->MIBFile->document(), SIGNAL(modificationChanged(bool)),
             this, SLOT( MibFileModified(bool) ));
    connect( s->MainUI()->actionGotoLine, SIGNAL( triggered() ),
             this, SLOT( GotoLine() ) );
    connect( s->MainUI()->actionFind, SIGNAL( triggered() ),
             this, SLOT( Find() ) );
    connect( s->MainUI()->actionReplace, SIGNAL( triggered() ),
             this, SLOT( Replace() ) );
    connect( s->MainUI()->actionFindNext, SIGNAL( triggered() ),
             this, SLOT( ExecuteFindNext() ) );

    // Syntax highlighter
    highlighter = new MibHighlighter(s->MainUI()->MIBFile->document());

    // Marker widget
    s->MainUI()->MIBFileMarker->setTextEditor(s->MainUI()->MIBFile);

    // Line number statusbar widget
    lnum = new QLabel();
    s->MainUI()->MIBFileStatus->addPermanentWidget(lnum);

    // Filename statusbar widget
    lfn = new QLabel();
    s->MainUI()->MIBFileStatus->addWidget(lfn);

    SetCurrentFileName("");

    connect( s->MainUI()->MIBFile, SIGNAL( cursorPositionChanged() ),
             this, SLOT( SetLineNumStatus() ) );

    SetLineNumStatus();

    find_string = "";
    replace_string = "";
}
コード例 #2
0
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent){
    lineNumberArea = new LineNumberArea(this);

    findDialog_ = new FindDialog(this);
    findDialog_->setModal(false);
    findDialog_->setTextEdit(this);

    findReplaceDialog_ = new FindReplaceDialog(this);
    findReplaceDialog_->setModal(false);
    findReplaceDialog_->setTextEdit(this);

    qtScriptReservedWords_<<"break"<<"case"<<"catch"<<"continue"<<"debugger"<<"default"<<"delete"<<"do"<<"else"<<"finally"<<\
    "for"<<"function"<<"if"<<"in"<<"instanceof"<<"new"<<"return"<<"switch"<<"this"<<"throw"<<"try"<<\
    "typeof"<<"var"<<"void"<<"while"<<"with";

    syntaxHighlighter_ = new ScriptSyntaxHighlighter(this->document());

    s = Global::guiSettings(this);
    s->beginGroup("CodeEditor");
    QFont font = s->value("font",this->font()).value<QFont>();
    this->setFont(font);
    s->endGroup();

    findAction = new QAction("Find...",this);
    connect(findAction, SIGNAL(triggered()), this, SLOT(findDialog()));
    findAction->setShortcut(tr("Ctrl+F"));
    addAction(findAction);

    findReplaceAction = new QAction("Replace...",this);
    connect(findReplaceAction, SIGNAL(triggered()), this, SLOT(findReplaceDialog()));
    findReplaceAction->setShortcut(tr("Ctrl+R"));
    addAction(findReplaceAction);

    beautifyAction = new QAction("Beautify javascript code",this);
    connect(beautifyAction, SIGNAL(triggered()), this, SLOT(beautify()));
    beautifyAction->setShortcut(tr("Ctrl+B"));
    addAction(beautifyAction);


    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();

    completer_ = new QCompleter(this);
    completer_->setModel(modelFromStringList(qtScriptReservedWords_));
    completer_->setModelSorting(QCompleter::CaseInsensitivelySortedModel);
    completer_->setCaseSensitivity(Qt::CaseInsensitive);
    completer_->setWrapAround(false);
    this->setCompleter(completer_);

}
コード例 #3
0
ファイル: completer.cpp プロジェクト: KevinSupertramp/Wakxy
TextEdit::TextEdit(QWidget *parent) : QPlainTextEdit(parent), c(0)
{
    lineNumberArea = new LineNumberArea(this);

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateLineNumberArea(const QRect &, int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();
}
コード例 #4
0
ファイル: codeeditor.cpp プロジェクト: aidint/PyG
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
{
    lineNumberArea = new LineNumberArea(this);
    this->parent = parent;
    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();
}
コード例 #5
0
ファイル: editor.cpp プロジェクト: brunoruviaro/supercollider
GenericCodeEditor::GenericCodeEditor( Document *doc, QWidget *parent ):
    QPlainTextEdit( parent ),
    mDoc(doc),
    mLastCursorBlock(-1)
{
    Q_ASSERT(mDoc != 0);

    setFrameShape( QFrame::NoFrame );

    viewport()->setAttribute( Qt::WA_MacNoClickThrough, true );

    mLineIndicator = new LineIndicator(this);
    mLineIndicator->move( contentsRect().topLeft() );

    mOverlay = new QGraphicsScene(this);

    QGraphicsView *overlayView = new QGraphicsView(mOverlay, this);
    overlayView->setFrameShape( QFrame::NoFrame );
    overlayView->setBackgroundBrush( Qt::NoBrush );
    overlayView->setStyleSheet("background: transparent");
    overlayView->setFocusPolicy( Qt::NoFocus );
    overlayView->setAttribute(Qt::WA_TransparentForMouseEvents, true);
    overlayView->setSceneRect(QRectF(0,0,1,1));
    overlayView->setAlignment(Qt::AlignLeft | Qt::AlignTop);

    mOverlayWidget = overlayView;

    connect( mDoc, SIGNAL(defaultFontChanged()), this, SLOT(onDocumentFontChanged()) );

    connect( this, SIGNAL(blockCountChanged(int)),
             mLineIndicator, SLOT(setLineCount(int)) );

    connect( mLineIndicator, SIGNAL( widthChanged() ),
             this, SLOT( updateLayout() ) );

    connect( this, SIGNAL(updateRequest(QRect,int)),
             this, SLOT(updateLineIndicator(QRect,int)) );

    connect( this, SIGNAL(selectionChanged()),
             mLineIndicator, SLOT(update()) );
    connect( this, SIGNAL(cursorPositionChanged()),
             this, SLOT(onCursorPositionChanged()) );

    connect( Main::instance(), SIGNAL(applySettingsRequest(Settings::Manager*)),
             this, SLOT(applySettings(Settings::Manager*)) );

    QTextDocument *tdoc = doc->textDocument();
    QPlainTextEdit::setDocument(tdoc);
    onDocumentFontChanged();
    mLineIndicator->setLineCount(blockCount());

    applySettings( Main::settings() );
}
コード例 #6
0
ファイル: textedit.cpp プロジェクト: johnwchadwick/textaxe
/* TextEdit widget */
TextEdit::TextEdit(QWidget *parent)
    : QPlainTextEdit(parent)
{
    gutter = new Gutter(this);

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateGutterWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateGutter(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateGutterWidth(0);
    highlightCurrentLine();
}
コード例 #7
0
bool ViewManager::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: clearErrorMarker(); break;
    case 1: cursorPositionChanged((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 2: showMessage((const QString&)static_QUType_QString.get(_o+1)); break;
    case 3: clearStatusBar(); break;
    default:
	return QWidget::qt_invoke( _id, _o );
    }
    return TRUE;
}
コード例 #8
0
ファイル: qsaeditor.cpp プロジェクト: aschet/qsaqt5
QSAEditor::QSAEditor(QWidget *parent)
    : QTextEdit(parent), qsInterp(0)
{
    setLineWrapMode(NoWrap);
    QSyntaxHighlighter *hl = new QSASyntaxHighlighter(this);
    hl->setDocument(document());
    matcher = new ParenMatcher;
    connect(this, SIGNAL(cursorPositionChanged()), matcher, SLOT(matchFromSender()));
    // #### add completion entries from highlighter

    readSettings();
}
コード例 #9
0
 void resetBinding(){
     if (!active) return;
     QToolTip::hideText();
     editor->setInputBinding(oldBinding);
     editor->setFocus();
     if (completer) {
         completer->list->hide();
         completer->disconnect(editor,SIGNAL(cursorPositionChanged()),completer,SLOT(cursorPositionChanged()));
     }
     active=false;
     curLine=QDocumentLine(); //prevent crash if the editor is destroyed
 }
コード例 #10
0
ファイル: mainwindow.cpp プロジェクト: flyi/LDE
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    isSaved = false;
    curFile = tr("未命名.txt");
    formTitle = curFile + tr(" - Lootepad 0.5");
    setWindowTitle(formTitle);
    init_statusBar();
    connect(ui->textEdit,SIGNAL(cursorPositionChanged()),this,SLOT(do_cursorChanged()));
}
コード例 #11
0
void BashCodeCompletion::setActiveEditorPart(KParts::Part *part)
{
	if (!part || !part->widget())
		return;

	kdDebug() << "BashCodeCompletion::setActiveEditorPart"  << endl;

// We need to think about this
//	if(!(m_config->getCodeCompletion() || m_config->getCodeHinting())){
//		return; // no help
//	}

	m_editInterface = dynamic_cast<KTextEditor::EditInterface*>(part);
	if (!m_editInterface)
	{
		kdDebug() << "editor doesn't support the EditDocumentIface" << endl;
		return;
	}

	m_cursorInterface = dynamic_cast<KTextEditor::ViewCursorInterface*>(part->widget());
	if (!m_cursorInterface)
	{
		kdDebug() << "editor does not support the ViewCursorInterface" << endl;
		return;
	}

	m_codeInterface = dynamic_cast<KTextEditor::CodeCompletionInterface*>(part->widget());
	if (!m_codeInterface) { // no CodeCompletionDocument available
		kdDebug() << "editor doesn't support the CodeCompletionDocumentIface" << endl;
		return;
	}

	disconnect(part->widget(), 0, this, 0 ); // to make sure that it is't connected twice
	connect(part->widget(), SIGNAL(cursorPositionChanged()),
		this, SLOT(cursorPositionChanged()));
	connect(part->widget(), SIGNAL(argHintHidden()), this, SLOT(argHintHidden()));
	connect(part->widget(), SIGNAL(completionAborted()), this, SLOT(completionBoxAbort()));
	connect(part->widget(), SIGNAL(completionDone()), this, SLOT(completionBoxHidden()));

}
コード例 #12
0
ファイル: annotwindow.cpp プロジェクト: Axure/okular
// Qt::SubWindow is needed to make QSizeGrip work
AnnotWindow::AnnotWindow( QWidget * parent, Okular::Annotation * annot, Okular::Document *document, int page )
    : QFrame( parent, Qt::SubWindow ), m_annot( annot ), m_document( document ), m_page( page )
{
    setAutoFillBackground( true );
    setFrameStyle( Panel | Raised );
    setAttribute( Qt::WA_DeleteOnClose );

    const bool canEditAnnotation = m_document->canModifyPageAnnotation( annot );

    textEdit = new KTextEdit( this );
    textEdit->setAcceptRichText( false );
    textEdit->setPlainText( m_annot->contents() );
    textEdit->installEventFilter( this );
    textEdit->setUndoRedoEnabled( false );

    m_prevCursorPos = textEdit->textCursor().position();
    m_prevAnchorPos = textEdit->textCursor().anchor();

    connect(textEdit, SIGNAL(textChanged()),
            this,SLOT(slotsaveWindowText()));
    connect(textEdit, SIGNAL(cursorPositionChanged()),
            this,SLOT(slotsaveWindowText()));
    connect(textEdit, SIGNAL(aboutToShowContextMenu(QMenu*)),
            this,SLOT(slotUpdateUndoAndRedoInContextMenu(QMenu*)));
    connect(m_document, SIGNAL(annotationContentsChangedByUndoRedo(Okular::Annotation*,QString,int,int)),
            this, SLOT(slotHandleContentsChangedByUndoRedo(Okular::Annotation*,QString,int,int)));

    if (!canEditAnnotation)
        textEdit->setReadOnly(true);

    QVBoxLayout * mainlay = new QVBoxLayout( this );
    mainlay->setMargin( 2 );
    mainlay->setSpacing( 0 );
    m_title = new MovableTitle( this );
    mainlay->addWidget( m_title );
    mainlay->addWidget( textEdit );
    QHBoxLayout * lowerlay = new QHBoxLayout();
    mainlay->addLayout( lowerlay );
    lowerlay->addItem( new QSpacerItem( 5, 5, QSizePolicy::Expanding, QSizePolicy::Fixed ) );
    QSizeGrip * sb = new QSizeGrip( this );
    lowerlay->addWidget( sb );

    m_latexRenderer = new GuiUtils::LatexRenderer();
    emit containsLatex( GuiUtils::LatexRenderer::mightContainLatex( m_annot->contents() ) );

    m_title->setTitle( m_annot->window().summary() );
    m_title->connectOptionButton( this, SLOT(slotOptionBtn()) );

    setGeometry(10,10,300,300 );

    reloadInfo();
}
コード例 #13
0
ファイル: codeeditor.cpp プロジェクト: f0ma/hardwareexpert
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
{
    lineNumberArea = new LineNumberArea(this);
    setFont(QFont("Ubuntu Mono"));

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();
    sh = new SLHSyntaxHighlighter(this->document());
}
コード例 #14
0
SemanticMarkupEdition::SemanticMarkupEdition(
                                QTextEdit* textEdit): //krazy:exclude=qclasses
        QObject(textEdit),
    mTextEdit(textEdit) {
    Q_ASSERT(textEdit);

    connect(mTextEdit, SIGNAL(cursorPositionChanged()),
            this, SLOT(updateActionStates()));
    //TODO Needed to update the action states when the user deletes a character;
    //look how to do that without updating twice in any other text change.
    connect(mTextEdit, SIGNAL(textChanged()),
            this, SLOT(updateActionStates()));
}
コード例 #15
0
ファイル: codeeditor.cpp プロジェクト: nikhilgv9/specRTLViz
CodeEditor::CodeEditor(QWidget *parent)
    : QPlainTextEdit(parent)
 {
     m_countCache=QPair<int,int>(-1,-1);
     lineNumberArea = new LineNumberArea((CodeEditor*)this);

     connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
     connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
     connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

     updateLineNumberAreaWidth(0);
     highlightCurrentLine();
 }
コード例 #16
0
ファイル: CCodeEditor.cpp プロジェクト: 6VV/TeachingBox
CCodeEditor::CCodeEditor(QWidget *parent) : QPlainTextEdit(parent)
{
	m_lineNumberArea = new CLineNumberArea(this);

	connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(SlotUpdateCodeAreaWidth(int)));
	connect(this, SIGNAL(updateRequest(QRect, int)), this, SLOT(SlotUpdateLineNumberArea(QRect, int)));
	connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(SlotHighlightCurrentLine()));

	SlotUpdateCodeAreaWidth(0);
	SlotHighlightCurrentLine();

	this->setCursorWidth(0);
}
コード例 #17
0
ファイル: AbstractMargin.cpp プロジェクト: DevMaggio/qodeedit
void AbstractMargin::setEditor( CodeEditor* editor )
{
    CodeEditor* oldEditor = this->editor();
    
    if ( oldEditor ) {
        disconnect( oldEditor->textDocument()->layout(), SIGNAL( update( const QRectF& ) ), this, SLOT( update() ) );
        disconnect( oldEditor, SIGNAL( cursorPositionChanged() ), this, SLOT( update() ) );
        disconnect( oldEditor->verticalScrollBar(), SIGNAL( valueChanged( int ) ), this, SLOT( update() ) );
        disconnect( oldEditor, SIGNAL( blockCountChanged( int ) ), this, SLOT( update() ) );
        disconnect( oldEditor, SIGNAL( blockCountChanged( int ) ), this, SIGNAL( lineCountChanged( int ) ) );
    }
    
    if ( editor ) {
        connect( editor->textDocument()->layout(), SIGNAL( update( const QRectF& ) ), this, SLOT( update() ) );
        connect( editor, SIGNAL( cursorPositionChanged() ), this, SLOT( update() ) );
        connect( editor->verticalScrollBar(), SIGNAL( valueChanged( int ) ), this, SLOT( update() ) );
        connect( editor, SIGNAL( blockCountChanged( int ) ), this, SLOT( update() ) );
        connect( editor, SIGNAL( blockCountChanged( int ) ), this, SIGNAL( lineCountChanged( int ) ) );
    }
    
    updateWidthRequested();
}
コード例 #18
0
ファイル: codeeditor.cpp プロジェクト: EQ4/libaudiotool
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
{
    this->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);

    lineNumberArea = new LineNumberArea(this);

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();
}
コード例 #19
0
ファイル: CodeEditor.cpp プロジェクト: tasosbull/yewtic
CodeEditor::CodeEditor(QWidget *parent)
: QTextEdit(parent)
{
	QFont font;
	font.setFamily("Courier");
	font.setFixedPitch(true);
	font.setPointSize(10);
	this->setFont(font);
	new Highlighter(this->document());

	connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));
	highlightCurrentLine();
}
コード例 #20
0
ファイル: editor.cpp プロジェクト: dgu123/qshaderedit
void Editor::onCurrentChanged(int idx)
{
    if(idx < 0) return;

    emit cursorPositionChanged();

    QTextDocument * document = currentTextEdit()->document();
    QTextCursor cursor = currentTextEdit()->textCursor();

    // update cursor position.
    emit cursorPositionChanged();

    // update copy/undo/redo available.
    emit copyAvailable(cursor.position() != cursor.anchor());
    emit undoAvailable(document->isUndoAvailable());
    emit redoAvailable(document->isRedoAvailable());
    emit pasteAvailable(true);

    connect(currentTextEdit(), SIGNAL(copyAvailable(bool)), this, SLOT(onCopyAvailable(bool)));
    connect(currentTextEdit(), SIGNAL(undoAvailable(bool)), this, SLOT(onUndoAvailable(bool)));
    connect(currentTextEdit(), SIGNAL(redoAvailable(bool)), this, SLOT(onRedoAvailable(bool)));
}
コード例 #21
0
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
{
    DIN
        lineNumberArea = new LineNumberArea(this);
        this->highlighter = new Highlighter(this->document());

        connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
        connect(this, SIGNAL(updateRequest(const QRect &, int)), this, SLOT(updateLineNumberArea(const QRect &, int)));
        connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

        updateLineNumberAreaWidth(0);
        highlightCurrentLine();
    DOUT
}
コード例 #22
0
void MainWindow::fileLoadStarted(QWidget* viewer)
{
    if (currentTabWidget() != viewer)
        return;

    showFileSize(viewer);
    showTotalLine(viewer);
    showWindowTitle(viewer);
    selectionChanged(viewer);
    cursorPositionChanged(viewer);
    showTextEncoding(viewer);
    modelCreated(viewer, 0);
    chartLoaded(viewer, 0);
}
コード例 #23
0
ファイル: mainwindow.cpp プロジェクト: eJuke/RagaEditor
MainWindow::MainWindow(QWidget *parent):
    QMainWindow(parent),
    ui(new Ui::MainWindow){
        ui->setupUi(this);
        this->setWindowTitle("RagaEditor");
        connect(ui->textEdit,SIGNAL(cursorPositionChanged()),
                this,SLOT(buttons()));
        connect(ui->textEdit,SIGNAL(textChanged()),this,SLOT(Save_check()));
        ui->textEdit->setFontFamily("Courier");
        ui->textEdit->setFontPointSize(10);
        ui->textEdit->setTabStopWidth(30);
        save_check = false;
        save_done = false;
}
コード例 #24
0
ファイル: ScriptTextEdit.cpp プロジェクト: ohager/kantalupe
void ScriptTextEdit::setupUi()
{
	QFont font;
	font.setFamily("courier");
	font.setPointSize(10);
	setFont( font );
	setTabStopWidth(40);

	connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth()));
	connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
	connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

	updateLineNumberAreaWidth();
}
コード例 #25
0
ファイル: client.cpp プロジェクト: redfern314/shrec
void Client::startRead()
{
    //@puts("reading");
    char *buffer = (char*)malloc(sizeof(char)*10240);
    int bytesAvail = client.bytesAvailable();
    client.read(buffer, bytesAvail);
    buffer[bytesAvail] = '\0';
    int bytesPushed=0;
    int *size=(int*)malloc(sizeof(int));
    Action *action = (Action*)malloc(sizeof(int));
    char *msg;

    //loop through the available messages
    while(bytesPushed<bytesAvail){
    *size=0;
    popMetadata(&buffer,action,size,&msg);
    bytesPushed+=(*size+8);
    if(bytesPushed<=bytesAvail){

        //@printf("Bytes pushed: %i, Bytes available: %i\n",bytesPushed,bytesAvail);
        if(bytesPushed<bytesAvail){
            //@printf("Msg: %s\nData remaining: %s\n\n",msg,buffer);
        } else {
            //@printf("Msg: %s\n\n",msg);
        }
        switch(*action) {
            case KEY_EVENT:
                receiveEvent(stringToEvent(msg));
                break;
            case INSERT_STRING:
                insertString(msg);
                break;
            case REMOVE_STRING:
                removeString(msg);
                break;
            case INITIAL_SEND:
                initialRead(msg);
                break;
            case CURSOR_MOVE:
                if(moveRemoteCursor(msg)) cursorPositionChanged();
                break;
            default:
                puts("We don't take your kind here.");
                break;
        }
    } else {
        puts("Well, that went badly.");
    }
    }
}
コード例 #26
0
CodeEditor::CodeEditor(QWidget *parent) : QPlainTextEdit(parent)
{
    lineNumberArea = new LineNumberArea(this);

    connect(this, SIGNAL(blockCountChanged(int)), this, SLOT(updateLineNumberAreaWidth(int)));
    connect(this, SIGNAL(updateRequest(QRect,int)), this, SLOT(updateLineNumberArea(QRect,int)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(highlightCurrentLine()));

    QFont font("Monospace");
    font.setStyleHint(QFont::TypeWriter);
    setFont(font);

    updateLineNumberAreaWidth(0);
    highlightCurrentLine();
}
コード例 #27
0
NoteEditWidget::NoteEditWidget(QWidget *parent) :
    QFrame(parent),
    appModel(AppModel::getInstance()),
    textEdit(new QTextEdit(this)),
    visualCover(new QFrame(this)),
    textEditAnimation(new QPropertyAnimation(textEdit, "geometry"))
{
    integrateWithAppModel();
    setupVisualCover();
    connect(textEdit, SIGNAL(textChanged()), this, SLOT(reportNoteState()));
    connect(textEdit, SIGNAL(cursorPositionChanged()), this, SLOT(reportSelectionState()));
    textEdit->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    textEdit->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    textEditAnimation->setDuration(TextEditAnimationDuration);
}
コード例 #28
0
ファイル: plugin_katesymbolviewer.cpp プロジェクト: KDE/kate
void KatePluginSymbolViewerView::slotDocChanged()
{
 slotRefreshSymbol();

 KTextEditor::View *view = m_mainWindow->activeView();
 //qDebug()<<"Document changed !!!!" << view;
 if (view) {
   connect(view, SIGNAL(cursorPositionChanged(KTextEditor::View*,KTextEditor::Cursor)),
           this, SLOT(cursorPositionChanged()), Qt::UniqueConnection);

   if (view->document()) {
     connect(view->document(), SIGNAL(textChanged(KTextEditor::Document*)),
             this, SLOT(slotDocEdited()), Qt::UniqueConnection);
   }
 }
コード例 #29
0
SourceViewerWidget::SourceViewerWidget(QWidget *parent) : QPlainTextEdit(parent),
	m_marginWidget(NULL),
	m_findFlags(WebWidget::NoFlagsFind),
	m_zoom(100)
{
	new SyntaxHighlighter(document());

	setZoom(SettingsManager::getValue(QLatin1String("Content/DefaultZoom")).toInt());
	optionChanged(QLatin1String("SourceViewer/ShowLineNumbers"), SettingsManager::getValue(QLatin1String("SourceViewer/ShowLineNumbers")));
	optionChanged(QLatin1String("SourceViewer/WrapLines"), SettingsManager::getValue(QLatin1String("SourceViewer/WrapLines")));

	connect(this, SIGNAL(textChanged()), this, SLOT(updateSelection()));
	connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(updateTextCursor()));
	connect(SettingsManager::getInstance(), SIGNAL(valueChanged(QString,QVariant)), this, SLOT(optionChanged(QString,QVariant)));
}
コード例 #30
0
ファイル: qgotolinepanel.cpp プロジェクト: BaconGo/alepherp
/*!
	\brief 
*/
void QGotoLinePanel::editorChange(QEditor *e)
{
	if ( editor() )
	{
		disconnect(	editor(), SIGNAL( cursorPositionChanged() ),
					this	, SLOT  ( cursorPositionChanged() ) );
		
		disconnect(	editor()->document(), SIGNAL( lineCountChanged(int) ),
					this				, SLOT  ( lineCountChanged(int) ) );
	}
	
	if ( e )
	{
		connect(e	, SIGNAL( cursorPositionChanged() ),
				this, SLOT  ( cursorPositionChanged() ) );
		
		connect(e->document()	, SIGNAL( lineCountChanged(int) ),
				this			, SLOT  ( lineCountChanged(int) ) );
		
		lineCountChanged(e->document()->lineCount());
		spLine->setValue(e->cursor().lineNumber() + 1);
		slLine->setValue(e->cursor().lineNumber() + 1);
	}
}