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. Loop for ui object
QtWS25 Last Chance

Loop for ui object

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

    I have to add a for loop Condition for this

    @ui->l1_mono->addItem(item1,0);
    ui->l1_mono->addItem(item2,1);
    ui->l1_mono->addItem(item3,2);
    ui->l2_mono->addItem(item1,0);
    ui->l2_mono->addItem(item2,1);
    ui->l2_mono->addItem(item3,2);
    ui->l3_mono->addItem(item1,0);
    ui->l3_mono->addItem(item2,1);
    ui->l3_mono->addItem(item3,2);
    ui->l4_mono->addItem(item1,0);
    ui->l4_mono->addItem(item2,1);
    ui->l4_mono->addItem(item3,2);
    ui->l5_mono->addItem(item1,0);
    ui->l5_mono->addItem(item2,1);
    ui->l5_mono->addItem(item3,2);
    ui->l6_mono->addItem(item1,0);
    ui->l6_mono->addItem(item2,1);
    ui->l6_mono->addItem(item3,2);
    ui->l7_mono->addItem(item1,0);
    ui->l7_mono->addItem(item2,1);
    ui->l7_mono->addItem(item3,2);
    ui->l8_mono->addItem(item1,0);
    ui->l8_mono->addItem(item2,1);
    ui->l8_mono->addItem(item3,2);@

    I need a help Please.....

    Regards,

    Nithya.

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stukdev
      wrote on last edited by
      #2

      The same to us to understand your problem. Please give some info about what you are trying to do.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        franku
        wrote on last edited by
        #3

        What I understood... Try to store the lX_mono and the itemY in arrays or similar and iterate over them. (X:=0..5, Y:=0..2) You understand? ;-)

        This, Jen, is the internet.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          @
          for (int i = 1; i <= 8; i++)
          {
          QListWidget widget = findChild<QListWidget>(QString("l%1_mono").arg(i));
          if (widget != 0)
          {
          widget->addItem(item2, 0);
          widget->addItem(item3, 1);
          widget->addItem(item1, 2);
          }
          }
          @
          Brain to terminal.

          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