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. how to add children to the QTree Widget
Qt 6.11 is out! See what's new in the release blog

how to add children to the QTree Widget

Scheduled Pinned Locked Moved Solved General and Desktop
67 Posts 3 Posters 27.5k 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.
  • mrjjM mrjj

    @ManiRon
    Hi
    With ?

    ManiRonM Offline
    ManiRonM Offline
    ManiRon
    wrote on last edited by
    #9

    @mrjj

    Sir i am trying to add

    uinx{
    LIBS+= -L$$PWD/.../lib/linus/-lData
    LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
    }
    win32
    {
    LIBS += path
    }

    I am adding the linux and xenomai library and trying to compile . but it throws error. As it detects the linux library and it couldnt find the xenomai library it throws error.
    My question is i want to define all my library and based on the platform or OS i am running it should detect its particular library.
    For example : linux, xenomai, windiows. These are the platforms i am running the application. Why i ask this is because every time i have to add the corresponding library and compile it and the run the application . So is there any solution for this?

    mrjjM 1 Reply Last reply
    0
    • mrjjM mrjj

      @ManiRon
      Hi
      With ?

      ManiRonM Offline
      ManiRonM Offline
      ManiRon
      wrote on last edited by
      #10

      @mrjj

      One of the person from this forum told me to use "unix" and "win32". But i asked for linux,xenomai what should i define, he told to use "unix" itself. But i have separate library for linux and xenomai. but i want to add both is there any way?

      1 Reply Last reply
      0
      • ManiRonM ManiRon

        @mrjj

        Sir i am trying to add

        uinx{
        LIBS+= -L$$PWD/.../lib/linus/-lData
        LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
        }
        win32
        {
        LIBS += path
        }

        I am adding the linux and xenomai library and trying to compile . but it throws error. As it detects the linux library and it couldnt find the xenomai library it throws error.
        My question is i want to define all my library and based on the platform or OS i am running it should detect its particular library.
        For example : linux, xenomai, windiows. These are the platforms i am running the application. Why i ask this is because every time i have to add the corresponding library and compile it and the run the application . So is there any solution for this?

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #11

        @ManiRon

        Hi it seems ok what you did
        except you missspelled unix (uinx)
        and it sometimes a bit funny with scopes so make sure t to
        unix {
        }
        and not
        unix
        {
        }
        http://doc.qt.io/qt-5/qmake-advanced-usage.html
        http://doc.qt.io/qt-5/third-party-libraries.html

        ManiRonM 1 Reply Last reply
        1
        • mrjjM mrjj

          @ManiRon

          Hi it seems ok what you did
          except you missspelled unix (uinx)
          and it sometimes a bit funny with scopes so make sure t to
          unix {
          }
          and not
          unix
          {
          }
          http://doc.qt.io/qt-5/qmake-advanced-usage.html
          http://doc.qt.io/qt-5/third-party-libraries.html

          ManiRonM Offline
          ManiRonM Offline
          ManiRon
          wrote on last edited by
          #12

          @mrjj

          Ok Sir,

          But my doubt is i am able to add the library.
          But i am adding another library that supports xenomai. while running the application in linux OS it goes to the unix{
          LIBS+= -L$$PWD/.../lib/linus/-lData
          LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
          }
          part and searches for the library which is my problem, I want the application to detect the library based on the platform i run. As one person from Qt forum said unix is common for xenomai, linux. So is there any possibility i can make my application to run that particular library based on OS platform?

          mrjjM 1 Reply Last reply
          0
          • ManiRonM ManiRon

            @mrjj

            Ok Sir,

            But my doubt is i am able to add the library.
            But i am adding another library that supports xenomai. while running the application in linux OS it goes to the unix{
            LIBS+= -L$$PWD/.../lib/linus/-lData
            LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
            }
            part and searches for the library which is my problem, I want the application to detect the library based on the platform i run. As one person from Qt forum said unix is common for xenomai, linux. So is there any possibility i can make my application to run that particular library based on OS platform?

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #13

            @ManiRon
            But is unix not linux for you ?
            You have a unix build and a linux build?

            I would assume you can do it right with

            
            win32 {
            ..
            }
            
            unix {
              ..
            }
            
            ManiRonM 2 Replies Last reply
            1
            • mrjjM mrjj

              @ManiRon
              But is unix not linux for you ?
              You have a unix build and a linux build?

              I would assume you can do it right with

              
              win32 {
              ..
              }
              
              unix {
                ..
              }
              
              ManiRonM Offline
              ManiRonM Offline
              ManiRon
              wrote on last edited by
              #14

              @mrjj

              its linux sir,

              but for xenomai also it is unix i think so
              unix{
              LIBS+= -L$$PWD/.../lib/linus/-lData
              LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
              }

              this is my problem sir,

              I am want to run library if its linux i want linux library and if its xenomai i want xenomai library to run

              mrjjM 1 Reply Last reply
              0
              • mrjjM mrjj

                @ManiRon
                But is unix not linux for you ?
                You have a unix build and a linux build?

                I would assume you can do it right with

                
                win32 {
                ..
                }
                
                unix {
                  ..
                }
                
                ManiRonM Offline
                ManiRonM Offline
                ManiRon
                wrote on last edited by ManiRon
                #15

                @mrjj

                ya i did this but for windows it works fine, and in unix if i define only one library that the platform i am running it works fine.

                but every time i want to add that particular library compile and run the application

                1 Reply Last reply
                0
                • ManiRonM ManiRon

                  @mrjj

                  its linux sir,

                  but for xenomai also it is unix i think so
                  unix{
                  LIBS+= -L$$PWD/.../lib/linus/-lData
                  LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
                  }

                  this is my problem sir,

                  I am want to run library if its linux i want linux library and if its xenomai i want xenomai library to run

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by mrjj
                  #16

                  Hi
                  Now i understand.
                  For qmake both plain linux and xenomai will be the same
                  as far as i know. (unix)

                  you can call .sh script and things like that from the pro file
                  so maybe you can detect your self if linux or xenomai ?
                  http://doc.qt.io/archives/qt-4.8/qmake-function-reference.html#system-command

                  Check what

                  UNAME = $$system(uname -s)
                  contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )
                  

                  will output

                  also did u try what been suggested in
                  https://forum.qt.io/topic/94393/how-to-add-macro-for-the-libs-in-the-pro-file/9

                  ManiRonM 2 Replies Last reply
                  1
                  • mrjjM mrjj

                    Hi
                    Now i understand.
                    For qmake both plain linux and xenomai will be the same
                    as far as i know. (unix)

                    you can call .sh script and things like that from the pro file
                    so maybe you can detect your self if linux or xenomai ?
                    http://doc.qt.io/archives/qt-4.8/qmake-function-reference.html#system-command

                    Check what

                    UNAME = $$system(uname -s)
                    contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )
                    

                    will output

                    also did u try what been suggested in
                    https://forum.qt.io/topic/94393/how-to-add-macro-for-the-libs-in-the-pro-file/9

                    ManiRonM Offline
                    ManiRonM Offline
                    ManiRon
                    wrote on last edited by
                    #17

                    @mrjj said in how to add children to the QTree Widget:

                    UNAME = $$system(uname -s)
                    contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )

                    So thsi is for linux?
                    UNAME = $$system(uname -s)
                    contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )

                    If i want to check for xenomai what should i do sir?

                    1 Reply Last reply
                    0
                    • mrjjM mrjj

                      Hi
                      Now i understand.
                      For qmake both plain linux and xenomai will be the same
                      as far as i know. (unix)

                      you can call .sh script and things like that from the pro file
                      so maybe you can detect your self if linux or xenomai ?
                      http://doc.qt.io/archives/qt-4.8/qmake-function-reference.html#system-command

                      Check what

                      UNAME = $$system(uname -s)
                      contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )
                      

                      will output

                      also did u try what been suggested in
                      https://forum.qt.io/topic/94393/how-to-add-macro-for-the-libs-in-the-pro-file/9

                      ManiRonM Offline
                      ManiRonM Offline
                      ManiRon
                      wrote on last edited by
                      #18

                      @mrjj

                      Is there any way sir?

                      mrjjM 1 Reply Last reply
                      0
                      • ManiRonM ManiRon

                        @mrjj

                        Is there any way sir?

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by mrjj
                        #19

                        @ManiRon
                        Hi
                        Yes you can do it.
                        But you need to find out how. I dont have xenomai
                        installed so i cant say how we can spot the difference between plain linux and
                        xenomai
                        so try
                        UNAME = $$system(uname -s)
                        on both systems and see what it types.
                        If different, you can use that as a flag

                        ManiRonM 1 Reply Last reply
                        1
                        • mrjjM mrjj

                          @ManiRon
                          Hi
                          Yes you can do it.
                          But you need to find out how. I dont have xenomai
                          installed so i cant say how we can spot the difference between plain linux and
                          xenomai
                          so try
                          UNAME = $$system(uname -s)
                          on both systems and see what it types.
                          If different, you can use that as a flag

                          ManiRonM Offline
                          ManiRonM Offline
                          ManiRon
                          wrote on last edited by
                          #20

                          @mrjj

                          contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )

                          This message where it will be printed sir?

                          ManiRonM 1 Reply Last reply
                          0
                          • ManiRonM ManiRon

                            @mrjj

                            contains( UNAME, [lL]inux ):message( This looks like Linux ($$UNAME) to me )

                            This message where it will be printed sir?

                            ManiRonM Offline
                            ManiRonM Offline
                            ManiRon
                            wrote on last edited by
                            #21

                            @ManiRon

                            And i have another doubt ?

                            mrjjM 1 Reply Last reply
                            0
                            • ManiRonM ManiRon

                              @ManiRon

                              And i have another doubt ?

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #22

                              @ManiRon
                              yes message print out the variable name $$UNAME ( what it contains)
                              what is other doubt?

                              ManiRonM 2 Replies Last reply
                              1
                              • mrjjM mrjj

                                @ManiRon
                                yes message print out the variable name $$UNAME ( what it contains)
                                what is other doubt?

                                ManiRonM Offline
                                ManiRonM Offline
                                ManiRon
                                wrote on last edited by
                                #23

                                @mrjj ok where i can see this message sir?

                                mrjjM 1 Reply Last reply
                                0
                                • ManiRonM ManiRon

                                  @mrjj ok where i can see this message sir?

                                  mrjjM Offline
                                  mrjjM Offline
                                  mrjj
                                  Lifetime Qt Champion
                                  wrote on last edited by mrjj
                                  #24

                                  @ManiRon
                                  in the Creator output pane.
                                  below where code is.
                                  alt text

                                  ManiRonM 1 Reply Last reply
                                  1
                                  • mrjjM mrjj

                                    @ManiRon
                                    yes message print out the variable name $$UNAME ( what it contains)
                                    what is other doubt?

                                    ManiRonM Offline
                                    ManiRonM Offline
                                    ManiRon
                                    wrote on last edited by
                                    #25

                                    @mrjj my anogther doubt is

                                    I am trying to view the data in a list . i have specified already

                                    1 Reply Last reply
                                    0
                                    • mrjjM mrjj

                                      @ManiRon
                                      in the Creator output pane.
                                      below where code is.
                                      alt text

                                      ManiRonM Offline
                                      ManiRonM Offline
                                      ManiRon
                                      wrote on last edited by ManiRon
                                      #26

                                      @mrjj

                                      And i have another doubt .
                                      I am trying to see the data which i have inserted into my QList . I can see the size but i cannot see the data.

                                      Code:

                                      QList<QString> m_Data;
                                      for(int i=1;i<3;i++)
                                      {
                                      Data = QString("SubItem"+QString::number(i));
                                      m_Data.append(Data.toLatin1().constData());
                                      QString H = m_Data.at(i); //trying to see data
                                      qDebug()<<"Data"<< m_Data.at(i);
                                      }

                                      while running the application crashesdonno why

                                      mrjjM 1 Reply Last reply
                                      0
                                      • ManiRonM ManiRon

                                        @mrjj

                                        And i have another doubt .
                                        I am trying to see the data which i have inserted into my QList . I can see the size but i cannot see the data.

                                        Code:

                                        QList<QString> m_Data;
                                        for(int i=1;i<3;i++)
                                        {
                                        Data = QString("SubItem"+QString::number(i));
                                        m_Data.append(Data.toLatin1().constData());
                                        QString H = m_Data.at(i); //trying to see data
                                        qDebug()<<"Data"<< m_Data.at(i);
                                        }

                                        while running the application crashesdonno why

                                        mrjjM Offline
                                        mrjjM Offline
                                        mrjj
                                        Lifetime Qt Champion
                                        wrote on last edited by mrjj
                                        #27

                                        @ManiRon
                                        Hi
                                        what you mean u can see the size but not the data?

                                        qDebug()<<"Data"<< m_Data.at(i); <<< u print index from 1,2,3
                                        but u call append so first call, there is data in zero
                                        but u print 1
                                        then next loop
                                        you print from 2, but only data in 0,1
                                        and so on.
                                        it starts in zero. so adjust the for loop.

                                        for(int i=0;i<2;i++)
                                        {
                                        Data = QString("SubItem"+QString::number(i+1));
                                        m_Data.append(Data.toLatin1().constData());
                                        qDebug()<<"Data"<< m_Data.at(i);  //trying to see data
                                        }
                                        
                                        ManiRonM 1 Reply Last reply
                                        1
                                        • mrjjM mrjj

                                          @ManiRon
                                          Hi
                                          what you mean u can see the size but not the data?

                                          qDebug()<<"Data"<< m_Data.at(i); <<< u print index from 1,2,3
                                          but u call append so first call, there is data in zero
                                          but u print 1
                                          then next loop
                                          you print from 2, but only data in 0,1
                                          and so on.
                                          it starts in zero. so adjust the for loop.

                                          for(int i=0;i<2;i++)
                                          {
                                          Data = QString("SubItem"+QString::number(i+1));
                                          m_Data.append(Data.toLatin1().constData());
                                          qDebug()<<"Data"<< m_Data.at(i);  //trying to see data
                                          }
                                          
                                          ManiRonM Offline
                                          ManiRonM Offline
                                          ManiRon
                                          wrote on last edited by
                                          #28

                                          @mrjj said in how to add children to the QTree Widget:

                                          but

                                          if i give

                                          int i = m_data.size();
                                          and print the i value , I can see the data size that which i have inserted in the list.

                                          But if i try to see the data

                                          QString H = m_data.at(i);
                                          and print the H value using qDebug i data is not coming and the application crashes

                                          mrjjM ManiRonM 2 Replies 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