Hi,
setting tabstops on QTextOption using the setTabArray() method has no effect. When using setTabStop() it works.
Example code:
TabTest
::TabTest(QWidget *parent, Qt
::WFlags flags
){
ui.setupUi(this);
setCentralWidget(edit);
// textOptions.setTabStop(200.0); // works
QList<qreal> tabs;
tabs << 200.0;
textOptions.setTabArray(tabs); // No effect, default 80px
doc->setDefaultTextOption( textOptions );
doc->setPlainText( "Hello\tWorld" );
edit->setDocument( doc );
}
TabTest::TabTest(QWidget *parent, Qt::WFlags flags)
: QMainWindow(parent, flags)
{
ui.setupUi(this);
QTextEdit *edit = new QTextEdit(this);
setCentralWidget(edit);
QTextDocument* doc = new QTextDocument( parent );
QTextOption textOptions = doc->defaultTextOption();
// textOptions.setTabStop(200.0); // works
QList<qreal> tabs;
tabs << 200.0;
textOptions.setTabArray(tabs); // No effect, default 80px
doc->setDefaultTextOption( textOptions );
doc->setPlainText( "Hello\tWorld" );
edit->setDocument( doc );
}
To copy to clipboard, switch view to plain text mode
I would like to set tabstops that a not equal spaced.
I'm using Qt 4.8.1 on Win7.
Thanks for any help
Helmut
Bookmarks