Results 1 to 2 of 2

Thread: QTExtEdit->setAlignment ( int a ) doesnt work with setWrapPolicy ( QTextEdit::Anywher

  1. #1
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default QTExtEdit->setAlignment ( int a ) doesnt work with setWrapPolicy ( QTextEdit::Anywher

    Hi guys,
    I have a textEdit and I have set the wrapPolicy to Anywhere, Now If I'm trying to
    Align the text to Right, or Left or Center, the text doesn't get aligned. Is this a bug in QTextEdit (Qt3.3.5) or Is there something that I'm doing wrong.

    Here is the code snippet


    void TextEdit::textAlign( QAction *a )
    {
    if ( !currentEditor() )
    return;

    currentEditor()->setWrapPolicy( QTextEdit::Anywhere ); //If I remove this
    //the text gets aligned

    if ( a == actionAlignLeft )
    currentEditor()->setAlignment( AlignLeft );
    else if ( a == actionAlignCenter )
    currentEditor()->setAlignment( AlignHCenter );
    else if ( a == actionAlignRight )
    currentEditor()->setAlignment( AlignRight );
    else if ( a == actionAlignJustify )
    currentEditor()->setAlignment( AlignJustify );
    }

    The snippet is a copy of Qt/3.3.5/examples/textedit.

    Please help to rectify this problem

  2. #2
    Join Date
    Sep 2006
    Posts
    339
    Thanks
    15
    Thanked 21 Times in 16 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTExtEdit->setAlignment ( int a ) doesnt work with setWrapPolicy ( QTextEdit::Any

    Quote Originally Posted by vermarajeev View Post
    Hi guys,
    I have a textEdit and I have set the wrapPolicy to Anywhere, Now If I'm trying to
    Align the text to Right, or Left or Center, the text doesn't get aligned. Is this a bug in QTextEdit (Qt3.3.5) or Is there something that I'm doing wrong.

    Here is the code snippet


    void TextEdit::textAlign( QAction *a )
    {
    if ( !currentEditor() )
    return;

    currentEditor()->setWrapPolicy( QTextEdit::Anywhere ); //If I remove this
    //the text gets aligned

    if ( a == actionAlignLeft )
    currentEditor()->setAlignment( AlignLeft );
    else if ( a == actionAlignCenter )
    currentEditor()->setAlignment( AlignHCenter );
    else if ( a == actionAlignRight )
    currentEditor()->setAlignment( AlignRight );
    else if ( a == actionAlignJustify )
    currentEditor()->setAlignment( AlignJustify );
    }

    The snippet is a copy of Qt/3.3.5/examples/textedit.

    Please help to rectify this problem
    Is there any way out????
    Please help....

Similar Threads

  1. QTextEdit Justify align making work
    By dec0ding in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2006, 13:02

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.