Can I implement this example in my program?
-
wrote on 6 Oct 2012, 19:07 last edited by
"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?
-
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.
-
wrote on 7 Oct 2012, 12:56 last edited by
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. :(
-
wrote on 7 Oct 2012, 15:33 last edited by
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);@
1/4