How to set percentage width to a paragraph in Qt?

  c++, fb2, kde, okular, qt

How do I insert a Frame with 70% width of the document and then align the frame to the right of the page?

QTextFrameFormat currentFrameFormat = mCursor.currentFrame().frameFormat();

QTextFrameFormat percetageFrame;
percetageFrame.setPosition(QTextFrameFormat::FloatRight);
percetageFrame.setWidth(currentFrameFormat.width() * 70 / 100);
mCursor->insertFrame(percetageFrame);

QTextBlockFormat format;
format.setAlignment(Qt::AlignJustify);
mCursor->insertBlock(format);

May I insert a Frame inside a Frame?

PS. If it is of any interest to you, I am trying to improve fb2 support in Okular/KDE.

Source: Windows Questions C++

LEAVE A COMMENT