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. little precision on the for loop
Forum Updated to NodeBB v4.3 + New Features

little precision on the for loop

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 635 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.
  • billy.NB Offline
    billy.NB Offline
    billy.N
    wrote on last edited by
    #1

    watch the code please ....

    it displays a QString in a Qlabel

    suppose we created a label calling eg "text" that will contain what must affcher on the window that is displayed when the program and also a QString QList that will contain a display in the label like this:

    QList <QString> list;
    << list "one" << "two" << "three";
    the loop below displays the text in the table from a for loop as you can see ...

    for (int i (0), list.size (), ++ i)

    {

    Texte.setText (list [i])

    }

    my question is how to skip the display of a table value ... I want to show by example "one" and "three" but not "two" which command should i use please? ??

    1 Reply Last reply
    0
    • billy.NB Offline
      billy.NB Offline
      billy.N
      wrote on last edited by
      #2

      i found !!!
      i should use the keyword "continue"

      1 Reply Last reply
      1
      • AlkoouA Offline
        AlkoouA Offline
        Alkoou
        wrote on last edited by Alkoou
        #3

        Here's an example for skipping the "two":

        for (int i (0), list.size (), ++ i)
        {
            if(list [i] != "two")
            {
                Texte.setText (list [i]);
            }
        }
        

        You could also use the keyword "continue" to skip an iteration :

        for (int i (0), list.size (), ++ i)
        {
            if(...)
            {
                continue;
            }
            Texte.setText (list [i]);
        }
        
        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