Results 1 to 2 of 2

Thread: Aligning a stringlist

  1. #1
    Join Date
    Jan 2006
    Location
    Riverside, Rhode Island, USA
    Posts
    245
    Thanks
    52
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Aligning a stringlist

    I want to display a QStringList in some form or other. I want each item to be horizontally center aligned.
    What is the best widget, among the vast number of widgets, to use for this?
    Right now I am using QText Edit and QListWidget to display them, but can't align them in either directly.
    If I use added spaces, changing fonts screws it up.
    I need to be able to use the "setReadOnly( true/false )" on the listing.

    Thanks

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

    Default Re: Aligning a stringlist

    For QListWidget you can use
    Qt Code:
    1. setData(Qt::TextAlignmentRole, Qt::AlignHCenter);
    To copy to clipboard, switch view to plain text mode 
    for each item you want to centre horizontally.

  3. The following user says thank you to wysota for this useful post:

    impeteperry (22nd May 2006)

Similar Threads

  1. Aligning message displayed on QStatusbar
    By sanjayshelke in forum Qt Programming
    Replies: 2
    Last Post: 20th November 2008, 10:41
  2. Sorting a StringList
    By Jimmy2775 in forum Qt Programming
    Replies: 4
    Last Post: 10th February 2006, 23:11

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.