Results 1 to 2 of 2

Thread: QTableView Headers problem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Thanks
    5
    Thanked 7 Times in 6 Posts

    Default Re: QTableView Headers problem

    Hi,

    See my source code, I think that will can help.

    Note that the 'setHeaderData' always should be between the 'select' statement. and setModel().

    Qt Code:
    1. QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
    2. model->setQuery("SELECT LPAD(PV_IDENT,5,'0') AS PV_IDENT, PV_NOME, CONCAT_WS(' ',sys.spISO2EUR(LEFT(PV_DATA,10)),RIGHT(PV_DATA,8) ) AS PV_DATA, PV_OBJ FROM ACPEDVISTA WHERE PV_FLAG = 0 ORDER BY PV_DATA");
    3. model->setHeaderData(0, Qt::Horizontal, tr("Id#"));
    4. model->setHeaderData(1, Qt::Horizontal, tr("Requisitante"));
    5. model->setHeaderData(2, Qt::Horizontal, tr("Data"));
    6. model->setHeaderData(3, Qt::Horizontal, tr("Objeto"));
    7.  
    8. tviewPedidos->setModel(model);
    9. tviewPedidos->show();
    10. QApplication::restoreOverrideCursor();
    To copy to clipboard, switch view to plain text mode 
    Last edited by jpn; 23rd January 2009 at 12:12. Reason: missing [code] tags

Similar Threads

  1. spaning the headers in the QTableView
    By ru_core in forum Qt Programming
    Replies: 6
    Last Post: 11th June 2013, 14:17
  2. How to remove headers from QTableView.
    By rajeshs in forum Qt Programming
    Replies: 7
    Last Post: 18th November 2011, 21:00
  3. Problem with KeyPress event and QTableView
    By ranna in forum Qt Programming
    Replies: 1
    Last Post: 16th January 2009, 21:01
  4. Problem with QTableView
    By BoneCollector in forum Qt Programming
    Replies: 5
    Last Post: 12th March 2008, 13:30
  5. QTableView : headers disappear
    By xavier in forum Qt Programming
    Replies: 2
    Last Post: 8th May 2006, 17:57

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
  •  
Qt is a trademark of The Qt Company.