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. Multiple data in different columns
Forum Updated to NodeBB v4.3 + New Features

Multiple data in different columns

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 1.3k 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.
  • B Offline
    B Offline
    beowulf
    wrote on last edited by
    #1

    I have a QListWidget and am trying to put data into two different columns, for example:

    !http://i.minus.com/jsJoKbW1Pdqth.png(http://i.minus.com/jsJoKbW1Pdqth.png)!

    @ QTreeWidgetItem *ItemId = new QTreeWidgetItem();

            QTreeWidgetItem *ItemName = new QTreeWidgetItem();
    
            ItemId->setText(0, "12");
    
            ItemName->setText(1, "Hello World");
    
            ui->MyTreeWidget->addTopLevelItem(ItemId);
    
            ui->MyTreeWidget->addTopLevelItem(ItemName);@
    

    But not getting it right.

    !http://i.minus.com/jV2criQHbOC6n.png(http://i.minus.com/jV2criQHbOC6n.png)!

    -- 0x00

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lwx_me
      wrote on last edited by
      #2

      QTreeWidget is not same with QListwidget, addTopLevelItem method always add a top-level item,you can try this:

      @ QStringList list;
      list<<"12"<<"hello world";
      QTreeWidgetItem *ItemId = new QTreeWidgetItem(list);
      ui->treeWidget->addTopLevelItem(ItemId);@

      1 Reply Last reply
      0
      • B Offline
        B Offline
        beowulf
        wrote on last edited by
        #3

        Thanks!
        Solved!

        -- 0x00

        1 Reply Last reply
        0
        • G Offline
          G Offline
          goblincoding
          wrote on last edited by
          #4

          [quote author="l3e0wulf" date="1358829374"]Thanks!
          Solved![/quote]

          Please mark the thread also :)

          http://www.goblincoding.com

          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