Results 1 to 2 of 2

Thread: Unable to see the table created by QTableWidget

  1. #1
    Join Date
    Feb 2013
    Posts
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Unable to see the table created by QTableWidget

    Hi
    I created a QTableWidget with 2columns and 0 rows and am receiving some information from a socket in a while loop. When i tried to add that informtion to table table is not at all displaying.
    Can anyone help .

    Here is my code

    while(1)
    {

    len = zmq_msg_recv (&zmq_msg, zmq_sock_in, ZMQ_DONTWAIT);
    if (len > 0) {
    msg = (char*) zmq_msg_data (&zmq_msg);
    QTableWidgetItem *item_val,*item_name;

    item_name = new QTableWidgetItem;
    item_val = new QTableWidgetItem;

    row = table->rowCount();
    qDebug("Current row is:%d",row);
    table->insertRow(row);

    item_name->setText(name);
    item_val->setText(val);

    table->repaint();
    table->setItem(row,0,item_name);
    table->setItem(row,1,item_val);

    }

    }

  2. #2
    Join Date
    Dec 2008
    Location
    France
    Posts
    93
    Thanked 23 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: Unable to see the table created by QTableWidget

    Have you something like this in your code before this loop :
    Qt Code:
    1. table.setColumnCount(2);
    To copy to clipboard, switch view to plain text mode 
    And
    Qt Code:
    1. table.repaint();
    To copy to clipboard, switch view to plain text mode 
    is not required.

Similar Threads

  1. QSqlTableModel Unable to find table with SQlite
    By qlands in forum Qt Programming
    Replies: 2
    Last Post: 5th July 2011, 14:33
  2. QPSQL: Unable to find table set in a QSqlTableModel
    By andreabiscuola in forum Qt Programming
    Replies: 7
    Last Post: 18th January 2011, 23:33
  3. Unable to view images in an application created for Windows ce
    By mistertwister in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 4th March 2010, 19:23
  4. unable to insert into mysql table
    By mohanakrishnan in forum Newbie
    Replies: 4
    Last Post: 5th December 2009, 05:02
  5. unable to insert into table
    By mohanakrishnan in forum Qt Programming
    Replies: 0
    Last Post: 4th December 2009, 10:52

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.