Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Formatting
Qt 6.11 is out! See what's new in the release blog

Formatting

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vidhya
    wrote on last edited by
    #1

    @
    QTextCharFormat hosname;
    hosname.setForeground(QBrush(QColor(0,255,0)));
    hosname.setFontWeight(QFont::Bold);
    hosname.setFontFamily("Times New Roman");
    hosname.setFontPointSize(18);
    @

    I want to set center alignment using the QTextCharFormat how do i achieve this

    [edit] code wrappers added, koahnig. Check out "this section":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 from Fourm help

    Regards,
    Vidhya

    1 Reply Last reply
    0
    • G Offline
      G Offline
      GortiZ
      wrote on last edited by
      #2

      I think that's a property of the QTextOption and not related to QTextCharFormat.

      .-:|GortiZ|:-.

      1 Reply Last reply
      0
      • V Offline
        V Offline
        Vidhya
        wrote on last edited by
        #3

        thanks for ur reply ,
        but i archive it in another way..

        QTextBlockFormat v;
        v.setAlignment(Qt::AlignHCenter);
        cursor.setBlockFormat(v);

        I think QTextCharFormat is only for character and QTextBlockFormat is used for Block ( Entire String )

        Regards,
        Vidhya

        1 Reply Last reply
        0
        • S Offline
          S Offline
          Sam
          wrote on last edited by
          #4

          Hi,
          Kindly use "code wrapping":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01 for your code, so that it is easily readable. Use @-tags for your code while posting.

          1 Reply Last reply
          0
          • V Offline
            V Offline
            Vidhya
            wrote on last edited by
            #5

            ok thanks for Ur comment i will correct it

            Regards,
            Vidhya

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved