PDA

View Full Version : QTextOption::setTabArray() has no effect



swaczin
27th June 2013, 10:46
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)
: 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 );
}


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