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. Weird behavior of QList<T>
Forum Updated to NodeBB v4.3 + New Features

Weird behavior of QList<T>

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 6.8k 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.
  • VRoninV VRonin

    I'm speechless... I can only thing of something weird going on in building

    ok, let's try with an alternative.
    replace

    for (int i = 0; i < roomCount; i++)
       {
           printf(QString::number(i).toLatin1().data());
           printf(QString("Room #" + QString::number(i) + ", " + building->rooms.at(i).name + "\n\r").toLatin1().data());
           printf(QString("Switches: " + QString::number(building->rooms.at(i).switches.count()) + "\n\r").toLatin1().data());
           printf(QString("Blinds: " + QString::number(building->rooms.at(i).blinds.count()) + "\n\r").toLatin1().data());
           printf("+---------------------------+\n\r");
       }
    

    with

    foreach(const kRoom& singleRoom, building->rooms){
    qDebug() << singleRoom.name;
    }
    
    A Offline
    A Offline
    advtaco
    wrote on last edited by
    #21

    @VRonin The qDebug-Variant works! Still don't understand why the old version doesn't but at least it does something now!

    @jsulm @VRonin I am looking into other methods to output now

    @Taz742 Yes, I am using Qt 5.9

    Taz742T 1 Reply Last reply
    0
    • A advtaco

      @VRonin The qDebug-Variant works! Still don't understand why the old version doesn't but at least it does something now!

      @jsulm @VRonin I am looking into other methods to output now

      @Taz742 Yes, I am using Qt 5.9

      Taz742T Offline
      Taz742T Offline
      Taz742
      wrote on last edited by
      #22

      @advtaco
      The problem was qDebug () or foreach (const kRoom & singleRoom, building-> rooms) ?

      Do what you want.

      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