What did you already try?
What did you already try?
Dear Sir!
As you said earlier I have searched many classes for that but I am unanble to found any useful function for this.
Mr. JPN has said use
but It's not usful in this case.See for example QTextEdit::setCurrentCharFormat().
__________________
Merry Christmas -- J-P Nurmi
Please give me any suggestion in right direction to acheive the goal.
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
Have you written any code to test any of the given ideas?
If not, then how come you say the given answers are useless if you didn't even bother to try them out? Have you acceessed the document of the text edit? Have you accessed the text block you want to change? Did you have a look at available options for the block of text?
Dear Sir!
I depicted carefully above ideas.
void QTextEdit::setCurrentCharFormat ( const QTextCharFormat & format )
It takes a arguments of QTextCharFormat object.
That only provides the following features;
Qt Code:
void setFontFixedPitch ( bool fixedPitch ) void setFontItalic ( bool italic ) void setFontOverline ( bool overline ) void setFontPointSize ( qreal size ) void setFontStrikeOut ( bool strikeOut ) void setFontUnderline ( bool underline ) void setFontWeight ( int weight ) void setUnderlineStyle ( UnderlineStyle style ) void setVerticalAlignment ( VerticalAlignment alignment ) UnderlineStyle underlineStyle () const VerticalAlignment verticalAlignment () constTo copy to clipboard, switch view to plain text mode
And the QTextBlock and QTextBlockFormat only provides the facility of indentation, pargraph settings etc.
So, that's the reason I have not wriiten any line of code for that b/z I am unable to find the right function until now.
So, If any function exists; please advice me for that.
Thanking you!
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
And what does QPen provide?
BTW. I was talking about the document, not the widget that display it.
Last edited by wysota; 28th December 2007 at 12:46.
Dear JPN!
Thanks for your reply!
However It is working well for Qt::TexturePattern, Qt:enseXPattern (here X means 1,2,3 ....7);
But I am not getting the horizontal pattern as I have attached the previous file.
So, What I change in my code;
to get the desired output.Qt Code:
QTextCharFormat format; format.setForeground(brush); if (!cursor.hasSelection()) cursor.mergeCharFormat(format); txtScrollEdit->setFontPointSize(28); txtScrollEdit->mergeCurrentCharFormat(format);To copy to clipboard, switch view to plain text mode
I am getting the output as attached in the sample.png. So, How a way I get output as I have attached earlier.
Last edited by wysota; 29th December 2007 at 12:19. Reason: Posts merged
Bookmarks