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. What does it mean this error
Forum Updated to NodeBB v4.3 + New Features

What does it mean this error

Scheduled Pinned Locked Moved Unsolved General and Desktop
32 Posts 2 Posters 7.2k 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.
  • SGaistS SGaist

    You are going to work on the exact same item in all the function then why search for it every time you are going to use it ?

    Same goes for the presence type,

    J Offline
    J Offline
    Jeronimo
    wrote on last edited by
    #11

    @SGaist said in What does it mean this error:

    You are going to work on the exact same item in all the function then why search for it every time you are going to use it ?
    Same goes for the presence type,

    so i delete the presence it's not necessary ok's

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #12

      That's not what I was saying.

      You are writing code that's difficult to read and understand. e.g. there's no need to call cliente.rosterManager().getPresence(barejid,resource).type() several time. Just put the returned value in a variable and test that one.

      Same goes for the QTreeWidgetItem, you need to get the one you are interested in and then only work with that one. This will avoid to have ui->arbolConectados->findItems(barejid,Qt::MatchExactly)[0] through out your method

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

      J 1 Reply Last reply
      1
      • SGaistS SGaist

        That's not what I was saying.

        You are writing code that's difficult to read and understand. e.g. there's no need to call cliente.rosterManager().getPresence(barejid,resource).type() several time. Just put the returned value in a variable and test that one.

        Same goes for the QTreeWidgetItem, you need to get the one you are interested in and then only work with that one. This will avoid to have ui->arbolConectados->findItems(barejid,Qt::MatchExactly)[0] through out your method

        J Offline
        J Offline
        Jeronimo
        wrote on last edited by
        #13

        @SGaist Ok i saved the result of presence in a var this works. But when i create a new qtreewidget, this is the code recoded:

        void MainWindow::cambioRoster(QString barejid, QString resource)
        {
            if(cliente.rosterManager().isRosterReceived() == true)
            {
                QXmppPresence::Type a = cliente.rosterManager().getPresence(barejid,resource).type();
                QTreeWidgetItem *element = new QTreeWidgetItem(ui->arbolConectados->findItems(barejid,Qt::MatchExactly)[0]);
                QIcon online;
                online.addFile(":/icons/user-online.png");
                if(ui->arbolConectados->findItems(barejid,Qt::MatchExactly).size() == 0)
                {
                    QTreeWidgetItem *item = new QTreeWidgetItem();
                    item->setText(0,barejid);
                    ui->arbolConectados->addTopLevelItem(item);
                }
                if(a == QXmppPresence::Available)
                {
                    QTreeWidgetItem *item = new QTreeWidgetItem();
                    item->setText(0,resource);
                    item->setIcon(0,online);
                    element->addChild(item);
                }else{
                    int i=0;
                    while(i<element->childCount() && element->child(i)->text(0) != resource) //busqueda lineal
                    {
                        i++;
                    }
                    element->takeChild(i);
                    if(element->childCount() == 0)
                    {
                        online.addFile(":/icons/user-offline.png");
                    }
                }
                element->setIcon(0,online);
            }
        }
        

        Show me the before error:
        https://i.imgsafe.org/13d50793d8.png

        I think because return me a element of one list?

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #14

          Run your application through the debugger, you'll see what triggers that.

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

          J 2 Replies Last reply
          0
          • SGaistS SGaist

            Run your application through the debugger, you'll see what triggers that.

            J Offline
            J Offline
            Jeronimo
            wrote on last edited by Jeronimo
            #15

            @SGaist i think in one qtreewidgetitem i can't find element. So i can't use qtreewidget because if i use show me this error ASSERT failure in QList<T>::operator[]: "index out of range", file C:\Qt\5.5\msvc2013_static\include\QtCore/qlist.h, line 545

            And when i run with debug show me this:
            https://i.imgsafe.org/35f6161b6a.png

            I can't use mode debugger ->> this is other problem that i had i dont know why show me this.

            But my problem basically is i need to check all time because the values change ? you understand so if i save in one var i dont know the actual value i think . Or i'm wrong?

            1 Reply Last reply
            0
            • SGaistS SGaist

              Run your application through the debugger, you'll see what triggers that.

              J Offline
              J Offline
              Jeronimo
              wrote on last edited by
              #16

              @SGaist In other words the presence change and when i try to access and the presence is unvailable take me this error. Because i'm trying to access with the presence unvailable.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #17

                As silly as it may sound: don't access it when you know it's not there.

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

                J 2 Replies Last reply
                0
                • SGaistS SGaist

                  As silly as it may sound: don't access it when you know it's not there.

                  J Offline
                  J Offline
                  Jeronimo
                  wrote on last edited by Jeronimo
                  #18
                  This post is deleted!
                  1 Reply Last reply
                  0
                  • SGaistS SGaist

                    As silly as it may sound: don't access it when you know it's not there.

                    J Offline
                    J Offline
                    Jeronimo
                    wrote on last edited by Jeronimo
                    #19

                    @SGaist I dont know when i run debug mode show me error:
                    https://i.imgsafe.org/35f6161b6a.png

                    Other thing i dont know why when i add new item the old doesnt appear???????????? in my qtreeview¿?

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #20

                      Because you're likely using Visual Studio and you didn't install its debugger.

                      One simple way to avoid that kind of crash is to check the list size before accessing any of its element.

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

                      J 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        Because you're likely using Visual Studio and you didn't install its debugger.

                        One simple way to avoid that kind of crash is to check the list size before accessing any of its element.

                        J Offline
                        J Offline
                        Jeronimo
                        wrote on last edited by
                        #21

                        @SGaist one question the path of debug when i installed where is?

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #22

                          Did you grab the debugger from Microsoft web site ? If so and you didn't modify the defaults when installing, it will be automatically detected.

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

                          J 1 Reply Last reply
                          0
                          • SGaistS SGaist

                            Did you grab the debugger from Microsoft web site ? If so and you didn't modify the defaults when installing, it will be automatically detected.

                            J Offline
                            J Offline
                            Jeronimo
                            wrote on last edited by
                            #23

                            @SGaist i downloaded from here:
                            http://msdn.microsoft.com/en-us/windows/hardware/bg162891.aspx
                            and installed only the option debugger tools
                            but not seems to work

                            1 Reply Last reply
                            0
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #24

                              Which version of Visual Studio and and Windows are you using ?

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

                              J 2 Replies Last reply
                              0
                              • SGaistS SGaist

                                Which version of Visual Studio and and Windows are you using ?

                                J Offline
                                J Offline
                                Jeronimo
                                wrote on last edited by
                                #25

                                @SGaist I'm using windows 10 and visual studio 2013

                                1 Reply Last reply
                                0
                                • SGaistS SGaist

                                  Which version of Visual Studio and and Windows are you using ?

                                  J Offline
                                  J Offline
                                  Jeronimo
                                  wrote on last edited by
                                  #26

                                  @SGaist before was working i installed codeblocks and now appear mingw not my debugger of my visual studio

                                  1 Reply Last reply
                                  0
                                  • SGaistS Offline
                                    SGaistS Offline
                                    SGaist
                                    Lifetime Qt Champion
                                    wrote on last edited by
                                    #27

                                    Then why are you installing tools for Windows8.1 ?

                                    Start here

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

                                    J 1 Reply Last reply
                                    0
                                    • SGaistS SGaist

                                      Then why are you installing tools for Windows8.1 ?

                                      Start here

                                      J Offline
                                      J Offline
                                      Jeronimo
                                      wrote on last edited by Jeronimo
                                      #28

                                      @SGaist I was wrong still show me the same error... idk why

                                      1 Reply Last reply
                                      0
                                      • J Offline
                                        J Offline
                                        Jeronimo
                                        wrote on last edited by
                                        #29

                                        it's because i installed for visual studio 2015 windows 10 i'mtrying to search sdk visual studio 2013 and check if i can install debugger

                                        1 Reply Last reply
                                        0
                                        • SGaistS Offline
                                          SGaistS Offline
                                          SGaist
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #30

                                          What is your exact setup ?

                                          You wrote that you were using Qt for VS2013 and now you are looking for VS2015 ? You know that you can't mix and match libraries built with different version of Visual Studio ? These compilers are not compatible one with the other.

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

                                          J 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