Results 1 to 2 of 2

Thread: QTableView Alignment

  1. #1
    Join Date
    Feb 2014
    Posts
    94
    Thanks
    5
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default QTableView Alignment

    Hello everyone!

    I am trying to align a QTableView column and its is not working.

    When I do this it works fine:
    Qt Code:
    1. modeloLancamentosInvestimento->setData(modeloLancamentosInvestimento->index(modeloLancamentosInvestimento->rowCount()-1, 0), Qt::AlignRight, Qt::TextAlignmentRole);
    To copy to clipboard, switch view to plain text mode 

    But I need to align it vertically at the center to and when i try it does not work:
    Qt Code:
    1. modeloLancamentosInvestimento->setData(modeloLancamentosInvestimento->index(modeloLancamentosInvestimento->rowCount()-1, 0), Qt::AlignRight | Qt::AlignVCenter, Qt::TextAlignmentRole);
    To copy to clipboard, switch view to plain text mode 

    How can I do that?

    Thanks all.

  2. #2
    Join Date
    Feb 2014
    Posts
    94
    Thanks
    5
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QTableView Alignment

    Solved

    Qt Code:
    1. QStandardItem *itemTabela = modeloLancamentosInvestimento->item(modeloLancamentosInvestimento->rowCount()-1, 0);
    2. itemTabela->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Alignment of HORIZONTAL HEADERS in a QTableView
    By sattu in forum Qt Programming
    Replies: 9
    Last Post: 12th January 2012, 16:21
  2. QTableView Alignment
    By AlexSudnik in forum Newbie
    Replies: 2
    Last Post: 22nd January 2011, 12:12
  3. QTableView alignment items
    By repaco in forum Qt Programming
    Replies: 5
    Last Post: 13th January 2010, 22:27
  4. QTableView - alignment/selection problem
    By Nesbitt in forum Qt Programming
    Replies: 7
    Last Post: 30th November 2009, 02:37
  5. QTableView + QSqlQueryModel column alignment
    By frido in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2008, 06:12

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