Results 1 to 3 of 3

Thread: Text Alignment in a ListWidget

  1. #1
    Join Date
    Jul 2007
    Posts
    57
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Text Alignment in a ListWidget

    I want to align the text items in the listwidget to center of the widget.Is that possible without using QlistWidgetItem/Delegates.I am adding all the items from a QList into the QListWidget using addItems() method.Any other options???

  2. #2
    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: Text Alignment in a ListWidget

    It's very simple to do with a delegate. I don't know any other sensible way to do this.
    J-P Nurmi

  3. #3
    Join Date
    Jan 2007
    Posts
    68
    Thanks
    9
    Thanked 8 Times in 8 Posts

    Default Re: Text Alignment in a ListWidget

    it's also pretty simple without a delegate:
    Qt Code:
    1. QListWidgetItem *newItem = new QListWidgetItem(parent);
    2. newItem->setTextAlignment(Qt::AlignCenter);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. QPushButton, stylesheets, text alignment
    By SiLiZiUMM in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2007, 19:53
  3. QToolButton text alignment
    By Vladimir in forum Qt Programming
    Replies: 6
    Last Post: 2nd March 2007, 07:42
  4. Icon Text Alignment
    By nupul in forum Newbie
    Replies: 3
    Last Post: 1st May 2006, 04:47
  5. Rightjustify text in listwidget
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 24th March 2006, 10:17

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.