Results 1 to 4 of 4

Thread: Center the text in a QTextEdit

  1. #1
    Join Date
    Apr 2009
    Posts
    87

    Center the text in a QTextEdit

    I am printing the signs in a QTextEdit using the method append () and I'd like to focus my text in the QTextEdit as when enlarging the window, the text is left
    Code:
      result -> setAlignment (Qt:: aligncenter);
    "result" is my QTextEdit but it does not work, my text always at left, i wnat to dislay text at center.

  2. #2
    Join Date
    May 2008
    Posts
    2,297

    Re: Center the text in a QTextEdit

    QTextEdit is an advanced WYSIWYG viewer/editor supporting rich text formatting using HTML-style tags. IQTextEdit can be used as a syntax highlighting editor when used in conjunction with QSyntaxHighlighter.It is optimized to handle large documents and to respond quickly to user input.

  3. #3
    Join Date
    Jan 2009
    Posts
    199

    Re: Center the text in a QTextEdit

    Here is the code that will help you :
    Code:
    the QTextEdit (I stated in a header file by QTextEdit * result) 
     result = new QTextEdit;
     result -> setReadOnly (true);
     result -> setAlignment (Qt:: aligncenter);
     result -> append ("-- <em> New Party </ em> --");

  4. #4
    Join Date
    Dec 2008
    Posts
    177

    Re: Center the text in a QTextEdit

    Code:
     setStyleSheet ( "text-align: center");
    Code:
    setText ( "<center> text </ center");
    Code:
    CREATE Form AS QF
        Caption=App.title+" - "+FilNm 
        Width=815 
        Height=608 
        Center 
        OnClose=MenuQuitter 
        OnShow=Show 
        CREATE Menu as QMAINMENU 
          CREATE Fichier as QMENUITEM 
            Caption="&Fichier" 
            CREATE Nouveau as QMENUITEM 
              Caption="&Nouveau" 
              OnClick=MenuNouveau 
            END CREATE

Similar Threads

  1. Text Center in Cell is not working in Microsoft Excel
    By Genesee in forum MS Office Support
    Replies: 2
    Last Post: 23-02-2012, 01:16 PM
  2. Text in td tag is not aligning in center in asp.net?
    By Dabert in forum Software Development
    Replies: 4
    Last Post: 09-06-2011, 07:04 AM
  3. How to center text layer in Dreamweaver
    By Carson in forum Software Development
    Replies: 5
    Last Post: 09-02-2010, 01:26 AM
  4. Change the background color of QTextEdit
    By Gomeler in forum Software Development
    Replies: 3
    Last Post: 27-11-2009, 01:13 PM
  5. Integration of a QTextEdit
    By Zool in forum Software Development
    Replies: 3
    Last Post: 12-10-2009, 12:08 PM

Tags for this Thread

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
  •  
Page generated in 1,726,934,978.28085 seconds with 17 queries