Results 1 to 14 of 14

Thread: Changing the Text Pattern?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Changing the Text Pattern?

    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?

  2. #2
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: Changing the Text Pattern?

    Quote Originally Posted by wysota View Post
    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:
    1. void setAnchorNames ( const QStringList & names )
    2. void setFont ( const QFont & font )
    3. void setFontFamily ( const QString & family )
    4. void setFontFixedPitch ( bool fixedPitch )
    5. void setFontItalic ( bool italic )
    6. void setFontOverline ( bool overline )
    7. void setFontPointSize ( qreal size )
    8. void setFontStrikeOut ( bool strikeOut )
    9. void setFontUnderline ( bool underline )
    10. void setFontWeight ( int weight )
    11. void setTextOutline ( const QPen & pen )
    12. void setToolTip ( const QString & text )
    13. void setUnderlineColor ( const QColor & color )
    14. void setUnderlineStyle ( UnderlineStyle style )
    15. void setVerticalAlignment ( VerticalAlignment alignment )
    16. QPen textOutline () const
    17. QString toolTip () const
    18. QColor underlineColor () const
    19. UnderlineStyle underlineStyle () const
    20. VerticalAlignment verticalAlignment () const
    To 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!

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Changing the Text Pattern?

    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.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Changing the Text Pattern?

    Quote Originally Posted by ashukla View Post
    It takes a arguments of QTextCharFormat object.
    That only provides the following features;
    Notice that QTextCharFormat is a QTextFormat.
    J-P Nurmi

  5. #5
    Join Date
    Aug 2007
    Location
    Gorakhpur, India
    Posts
    254
    Thanks
    8
    Thanked 14 Times in 14 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default

    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;
    Qt Code:
    1. QBrush brush(Qt::blue,Qt::HorPattern);
    2. format.setForeground(brush);
    3. QTextCursor cursor = txtScrollEdit->textCursor();
    4. if (!cursor.hasSelection())
    5. cursor.select(QTextCursor::Document);
    6. cursor.mergeCharFormat(format);
    7. txtScrollEdit->setFontPointSize(28);
    8. txtScrollEdit->setFontWeight(QFont::Bold);
    9. txtScrollEdit->mergeCurrentCharFormat(format);
    To copy to clipboard, switch view to plain text mode 
    to get the desired output.

    I am getting the output as attached in the sample.png. So, How a way I get output as I have attached earlier.
    Attached Images Attached Images
    Last edited by wysota; 29th December 2007 at 12:19. Reason: Posts merged

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  3. Replies: 3
    Last Post: 20th November 2007, 07:03
  4. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  5. Changing the text color of a QTreeView leaf.
    By johnny_sparx in forum Qt Programming
    Replies: 3
    Last Post: 22nd March 2006, 23:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.