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. QTreeWidget layout differs from OS to OS with same code base

QTreeWidget layout differs from OS to OS with same code base

Scheduled Pinned Locked Moved Solved General and Desktop
11 Posts 5 Posters 1.4k Views 3 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    What OS ?
    What version of Qt ?
    Are you providing the translation with your application ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    2
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #3

      Can you try using std::initializer_list instead of operator <<?
      systemData->addChildren(QList<QTreeWidgetItem*>{createTreeWidgetItem(tr("Generator Data")), createTreeWidgetItem(tr("Sensing mode")), createTreeWidgetItem(tr("Grid options"))});

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      N 1 Reply Last reply
      2
      • VRoninV VRonin

        Can you try using std::initializer_list instead of operator <<?
        systemData->addChildren(QList<QTreeWidgetItem*>{createTreeWidgetItem(tr("Generator Data")), createTreeWidgetItem(tr("Sensing mode")), createTreeWidgetItem(tr("Grid options"))});

        N Offline
        N Offline
        nwoki
        wrote on last edited by
        #4

        @VRonin said in QTreeWidget layout differs from OS to OS with same code base:

        Can you try using std::initializer_list instead of operator <<?
        systemData->addChildren(QList<QTreeWidgetItem*>{createTreeWidgetItem(tr("Generator Data")), createTreeWidgetItem(tr("Sensing mode")), createTreeWidgetItem(tr("Grid options"))});

        This seemed to do the trick. So the list initialization order is not respected with the << operator? But most of all, why is it not respected only under windows?

        Thanks by the way.

        kshegunovK 1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #5

          I think it's just due to how multiple operators are resolved. The compiler you are using on windows unusually goes right to left

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          J.HilkJ 1 Reply Last reply
          2
          • VRoninV VRonin

            I think it's just due to how multiple operators are resolved. The compiler you are using on windows unusually goes right to left

            J.HilkJ Offline
            J.HilkJ Offline
            J.Hilk
            Moderators
            wrote on last edited by J.Hilk
            #6

            @VRonin said in QTreeWidget layout differs from OS to OS with same code base:

            I think it's just due to how multiple operators are resolved. The compiler you are using on windows unusually goes right to left

            Thats actually important to know. Is that true for all << operators ?

            for example QTextStream stream(&someFile); stream << "a" << "b" << "c"; actually results in "cba" on windows and "abc" on linux,in the text file ?

            Or is this just for containers ?


            Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


            Q: What's that?
            A: It's blue light.
            Q: What does it do?
            A: It turns blue.

            1 Reply Last reply
            0
            • N nwoki

              @VRonin said in QTreeWidget layout differs from OS to OS with same code base:

              Can you try using std::initializer_list instead of operator <<?
              systemData->addChildren(QList<QTreeWidgetItem*>{createTreeWidgetItem(tr("Generator Data")), createTreeWidgetItem(tr("Sensing mode")), createTreeWidgetItem(tr("Grid options"))});

              This seemed to do the trick. So the list initialization order is not respected with the << operator? But most of all, why is it not respected only under windows?

              Thanks by the way.

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #7

              @nwoki said in QTreeWidget layout differs from OS to OS with same code base:

              But most of all, why is it not respected only under windows?

              Which compiler is that? Can you try something for me, just for kicks?
              Does this work correctly:

              QList<QTreeWidgetItem*> dummy;
              dummy << createTreeWidgetItem(tr("Generator Data")) << createTreeWidgetItem(tr("Sensing mode") << createTreeWidgetItem(tr("Grid options"));
              systemData->addChildren(dummy);
              

              Read and abide by the Qt Code of Conduct

              N 1 Reply Last reply
              0
              • kshegunovK kshegunov

                @nwoki said in QTreeWidget layout differs from OS to OS with same code base:

                But most of all, why is it not respected only under windows?

                Which compiler is that? Can you try something for me, just for kicks?
                Does this work correctly:

                QList<QTreeWidgetItem*> dummy;
                dummy << createTreeWidgetItem(tr("Generator Data")) << createTreeWidgetItem(tr("Sensing mode") << createTreeWidgetItem(tr("Grid options"));
                systemData->addChildren(dummy);
                
                N Offline
                N Offline
                nwoki
                wrote on last edited by
                #8

                @kshegunov said in QTreeWidget layout differs from OS to OS with same code base:

                @nwoki said in QTreeWidget layout differs from OS to OS with same code base:

                But most of all, why is it not respected only under windows?

                Which compiler is that? Can you try something for me, just for kicks?
                Does this work correctly:

                QList<QTreeWidgetItem*> dummy;
                dummy << createTreeWidgetItem(tr("Generator Data")) << createTreeWidgetItem(tr("Sensing mode") << createTreeWidgetItem(tr("Grid options"));
                systemData->addChildren(dummy);
                

                With your test "just for kicks", the output is inverted (see first post). I'm using the msvc2015 32bit compiler for windows

                kshegunovK 1 Reply Last reply
                0
                • N nwoki

                  @kshegunov said in QTreeWidget layout differs from OS to OS with same code base:

                  @nwoki said in QTreeWidget layout differs from OS to OS with same code base:

                  But most of all, why is it not respected only under windows?

                  Which compiler is that? Can you try something for me, just for kicks?
                  Does this work correctly:

                  QList<QTreeWidgetItem*> dummy;
                  dummy << createTreeWidgetItem(tr("Generator Data")) << createTreeWidgetItem(tr("Sensing mode") << createTreeWidgetItem(tr("Grid options"));
                  systemData->addChildren(dummy);
                  

                  With your test "just for kicks", the output is inverted (see first post). I'm using the msvc2015 32bit compiler for windows

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by kshegunov
                  #9

                  @nwoki said in QTreeWidget layout differs from OS to OS with same code base:

                  With your test "just for kicks", the output is inverted (see first post)

                  Did you actually run it with the dummy and not with the anonymous object is the point?
                  The reason I asked is I'd encountered non-compliant behavior with msvc when dealing with anonymous objects, hence the question.

                  Read and abide by the Qt Code of Conduct

                  N 1 Reply Last reply
                  0
                  • kshegunovK kshegunov

                    @nwoki said in QTreeWidget layout differs from OS to OS with same code base:

                    With your test "just for kicks", the output is inverted (see first post)

                    Did you actually run it with the dummy and not with the anonymous object is the point?
                    The reason I asked is I'd encountered non-compliant behavior with msvc when dealing with anonymous objects, hence the question.

                    N Offline
                    N Offline
                    nwoki
                    wrote on last edited by
                    #10

                    @kshegunov yup. I did as you asked

                    kshegunovK 1 Reply Last reply
                    0
                    • N nwoki

                      @kshegunov yup. I did as you asked

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #11

                      @nwoki said in QTreeWidget layout differs from OS to OS with same code base:

                      yup. I did as you asked

                      Then the compiler does not follow the rules for the C++ bitshift operators.

                      Read and abide by the Qt Code of Conduct

                      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