Opensource rich text editor whose output QTextBrowser accepts
Hi,
I am using QTextBrowser to display a rich text file, .rtf, but I am having trouble finding an editor that will produce a file that QTextBrowser will accept.
E.g. I tried oowriter but QTextBrowser will not display that as RTF but just displays plain text (all the control statements).
I tried the startup file from http://www.nllgg.nl/Ted/ but it will not display that either.
I can put simple rtf code in a file and it does display that, but I want to use an editor and not have to code all the rtf stuff.
Re: Opensource rich text editor whose output QTextBrowser accepts
Quote:
but I want to use an editor and not have to code all the rtf stuff.
From the docs:
Quote:
If you want to provide your users with an editable rich text editor, use QTextEdit. If you want a text browser without hypertext navigation use QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QLabel.
And how exactly are you adding the text to the QTextBrowser?
Re: Opensource rich text editor whose output QTextBrowser accepts
Like in line 38:
Code:
void ApplicationWindow::Editor_2()
{
char name[32]="AppWin::Editor_2";
if( rtfAct->isChecked() ) {
QString tt
= xlist
->get_desc
(xlist
->get_varno
("about_rtf_file"));
about_rtf_file.setName(tt);
if ( !about_rtf_file.exists() ) {
midget("%s does not exist %d %s\n",qPrintable(tt),__LINE__,__FILE__);
return;
}
if ( !about_rtf_file.
open( QIODevice::ReadOnly ) ) { midget("Could not open about_rtf_file: %s %d %s\n",qPrintable(tt),__LINE__,__FILE__);
return;
}
setCursor(Qt::waitCursor);
e_2->setGeometry(get_int("xxe"), get_int("yye"), get_int("wwe"), get_int("hhe"));
midget("debugger x=%d y=%d w=%d h=%d %d %s\n",get_int("xxe"), get_int("yye"), get_int("wwe"), get_int("hhe"),__LINE__,__FILE__);
// e->setDocumentTitle(debug_file);
e_2->setReadOnly(TRUE);
e_2->setAcceptRichText(TRUE);
e_2->setFocus();
e_2->clear();
int kk =0;
while ( !t_t.atEnd() ) {
qApp->processEvents();
e_2->append( s );
kk++;
}
midget("Read %d lines of about_rtf_file: %d %s\n",kk,__LINE__,__FILE__);
about_rtf_file.close();
setCursor(Qt::arrowCursor);
e_2->show();
}
else {
about_rtf_file.close();
delete e_2;
xdeb->hide();
ss->repaint();
}
emit(setStat());
Re: Opensource rich text editor whose output QTextBrowser accepts
try and see what does acceptRichText () return, you could also try and explicitly call setAcceptRichText ( true)