hi,
i need some help creating a multi column rich text editor ( like in the news paper articles). I have tried it with QTextEditor and QTextDocument and QTextFrames, but I don't know if this is the right track. A small part of my code where I want to set up the multi column stuff.
doc->setPageSize( printer.pageRect().size() );
doc->setTextWidth( printer.pageRect().width());
frame_frm.setWidth( qreal( 105 ));
frame_frm.setHeight( qreal( 297));
cur.beginEditBlock();
cur.insertFrame( frame_frm );
if( file.
open( QFile::ReadOnly )) {
cur.insertText( stream.readAll(), txt_frm );
}
QPrinter printer;
QTextDocument *doc = textEdit->document();
QTextCharFormat txt_frm;
QTextCursor cur( doc );
QTextFrameFormat frame_frm;
printer.setPaperSize( QPrinter::A4 );
doc->setPageSize( printer.pageRect().size() );
doc->setTextWidth( printer.pageRect().width());
frame_frm.setWidth( qreal( 105 ));
frame_frm.setHeight( qreal( 297));
cur.beginEditBlock();
cur.insertFrame( frame_frm );
QFile file( QString("./test.txt" ));
if( file.open( QFile::ReadOnly ))
{
QTextStream stream( &file );
cur.insertText( stream.readAll(), txt_frm );
}
To copy to clipboard, switch view to plain text mode
Bookmarks