Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTableWidget problem
Forum Update on Monday, May 27th 2025

QTableWidget problem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ahmed kato
    wrote on 14 Oct 2011, 14:38 last edited by
    #1

    i am using qtablewidget and i have a problem that it don't print the string ,only it add an empty row..this is my code
    @JobsTabel = new QTableWidget(0,3);
    QStringList header;
    header<<"Engineer"<<"Client"<<"Path";
    JobsTabel->setHorizontalHeaderLabels(header);
    JobsTabel->verticalHeader()->hide();
    JobsTabel->setShowGrid(false);
    setCentralWidget(JobsTabel);
    QTableWidgetItem *EngineerNameItem = new QTableWidgetItem("Shaleish");
    QTableWidgetItem *ClientNameItem = new QTableWidgetItem("Gupco");
    QTableWidgetItem *PathItem = new QTableWidgetItem("path");
    JobsTabel->insertRow(JobsTabel->rowCount());
    JobsTabel->setItem(JobsTabel->rowCount(),0,EngineerNameItem);
    JobsTabel->setItem(JobsTabel->rowCount(),1,ClientNameItem);
    JobsTabel->setItem(JobsTabel->rowCount(),2,PathItem);@
    thx in advance =)

    Ahmed Kato
    Computer & communications student
    Intern and MSP at Microsoft

    1 Reply Last reply
    0
    • G Offline
      G Offline
      giesbert
      wrote on 14 Oct 2011, 14:42 last edited by
      #2

      You add the items in the wrong row
      rowCount will return 1 if you have one row, but you have to add the items in row number 0 :-)

      Nokia Certified Qt Specialist.
      Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

      1 Reply Last reply
      0
      • A Offline
        A Offline
        ahmed kato
        wrote on 14 Oct 2011, 15:43 last edited by
        #3

        thank uuuuuuuuu =)

        Ahmed Kato
        Computer & communications student
        Intern and MSP at Microsoft

        1 Reply Last reply
        0

        1/3

        14 Oct 2011, 14:38

        • Login

        • Login or register to search.
        1 out of 3
        • First post
          1/3
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved