Results 1 to 3 of 3

Thread: Help ...QTreeView

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    china
    Posts
    13
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy Help ...QTreeView

    I would like to be a sniffer. I have to capture the required data, but data are not binding on the QTreeView...
    Qt Code:
    1. QTreeView* tablepackets=new QTreeView();
    2. model->setHeaderData(0, Qt::Horizontal, QObject::tr("NO."));
    3. model->setHeaderData(1, Qt::Horizontal, QObject::tr("Source IP"));
    4. model->setHeaderData(2, Qt::Horizontal, QObject::tr("Destination IP"));
    5. model->setHeaderData(3, Qt::Horizontal, QObject::tr("Source Port"));
    6. model->setHeaderData(4, Qt::Horizontal, QObject::tr("Destination Port"));
    7. tablepackets->setModel(model);
    8.  
    9. QStandardItemModel* ethmodel=(QStandardItemModel*)tablepackets->Model();
    10. //packet_number is Captured data packets number,and will automatically increase...
    11. item->setText(QString::number(packet_numer));
    12. ethmodel->setItem(packet_number,0,item);
    13. //Other captured data is not displayed
    14. ethmodel->setItem(packet_number,1,new QStandardItem(QString("Protocol")));
    15. .
    16. .
    17. ethmodel->setItem(packet_number,4,new QStandardItem(QString("Port")));
    To copy to clipboard, switch view to plain text mode 
    Please help me ....Thank you...
    Last edited by Raymond; 16th September 2009 at 09:17.

Similar Threads

  1. QTreeView repaint
    By graeme in forum Qt Programming
    Replies: 17
    Last Post: 13th March 2012, 13:27
  2. One Model, Two Views (QTreeView and QTableView)
    By dgarrett97 in forum Newbie
    Replies: 2
    Last Post: 14th September 2009, 18:10
  3. QTreeView help
    By bepaald in forum Qt Programming
    Replies: 1
    Last Post: 15th August 2007, 21:22
  4. background image in QTreeView
    By momesana in forum Qt Programming
    Replies: 2
    Last Post: 11th January 2007, 06:25
  5. paint QTreeView item !!
    By mcenatie in forum Qt Programming
    Replies: 2
    Last Post: 19th March 2006, 14:24

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.