Can I implement this example in my program?



  • "Your text to link here...":http://qt-project.org/doc/qt-4.8/widgets-codeeditor-codeeditor-h.html

    I have a other program (other form, buttons, plaintextedites), and I would implement this to my plaintext.

    How to?


  • Moderators

    Which part do you want to implement? What do you want your program to do?

    You can copy the code, as long as you follow the license at the top of the file.



  • The all.

    @
    .....
    ui->setupUi(this);

    CodeEditor editor1;
    editor1.setGeometry (15, 15, 300, 150);
    editor1.show ();
    

    }

    MainWindow::~MainWindow()
    {
    delete ui;
    }

    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()));
    
     updateLineNumberAreaWidth(0);
     highlightCurrentLine();
    

    }@

    This is my code. But does not appear nothing. :(



  • Okay, I solved.

    @//it creates the two text boxes
    CodeEditor *editor0 = new CodeEditor; //left side box
    CodeEditor *editor1 = new CodeEditor; //right side box
    //it uploads the text boxes in the main window
    ui->textBoxLayout->addWidget (editor0, 0, 0);
    ui->textBoxLayout->addWidget (editor1, 0, 0);@


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.