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
Qt 6.11 is out! See what's new in the release blog

QTableWidget problem

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 2.0k Views 1 Watching
  • 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 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 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 last edited by
        #3

        thank uuuuuuuuu =)

        Ahmed Kato
        Computer & communications student
        Intern and MSP at Microsoft

        1 Reply Last reply
        0

        • Login

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