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. Problem with qmap.h from QT5.6.3 for MSVC2013 (64bit)

Problem with qmap.h from QT5.6.3 for MSVC2013 (64bit)

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 6 Posters 2.2k Views 2 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 and welcome to devnet,

    How are you using QMap ?

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

    D 1 Reply Last reply
    0
    • SGaistS SGaist

      Hi and welcome to devnet,

      How are you using QMap ?

      D Offline
      D Offline
      Domenico
      wrote on last edited by
      #3

      @SGaist Trank you,
      excuse my ignorance in what sense how am I using QMap?

      if I understand correctly I'm using it in various ways in various sources:

      1. QMap<int,QString> ....
      2. QMap<int,int> ....
      3. QMap<int,RoleData> ....

      RoleData is a class where they contain a series of parameters to be assigned one of the complex one there is also the parameter of type QVector<QString>

      if that was what he wanted to know how I'm using QMap, then what problem can it be?

      kshegunovK 1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #4

        I would try to create a simple main which just instantiates a QMap instance to see if this works. I'm not really sure if Qt5 64bit with msvc2013 ever worked but it's rather old so I might be wrong.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        D 1 Reply Last reply
        1
        • Christian EhrlicherC Christian Ehrlicher

          I would try to create a simple main which just instantiates a QMap instance to see if this works. I'm not really sure if Qt5 64bit with msvc2013 ever worked but it's rather old so I might be wrong.

          D Offline
          D Offline
          Domenico
          wrote on last edited by
          #5

          @Christian-Ehrlicher

          I tried with various versions of Qt, the problem persists !! I do not understand what you're from ... do you think it's badly instanced?

          does anyone know the solution to this problem?

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

            Do you mean that you have the same problem with something like:

            #include <QMap>
            #include <QString>
            #include <QtDebug>
            
            int main(int /*argc*/, char **/*argv*/)
            {
                QMap<int, QString> map;
                map[1] = QStringLiteral("test");
                qDebug() << map;
                return 0;
            }
            

            [edit: Fixed includes SGaist]

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

            D 1 Reply Last reply
            3
            • D Domenico

              @SGaist Trank you,
              excuse my ignorance in what sense how am I using QMap?

              if I understand correctly I'm using it in various ways in various sources:

              1. QMap<int,QString> ....
              2. QMap<int,int> ....
              3. QMap<int,RoleData> ....

              RoleData is a class where they contain a series of parameters to be assigned one of the complex one there is also the parameter of type QVector<QString>

              if that was what he wanted to know how I'm using QMap, then what problem can it be?

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

              Did you include QString and the QVariant headers? Please provide the snippet which induces this error.

              Read and abide by the Qt Code of Conduct

              D 1 Reply Last reply
              1
              • SGaistS SGaist

                Do you mean that you have the same problem with something like:

                #include <QMap>
                #include <QString>
                #include <QtDebug>
                
                int main(int /*argc*/, char **/*argv*/)
                {
                    QMap<int, QString> map;
                    map[1] = QStringLiteral("test");
                    qDebug() << map;
                    return 0;
                }
                

                [edit: Fixed includes SGaist]

                D Offline
                D Offline
                Domenico
                wrote on last edited by
                #8

                @SGaist

                Sorry for the delay.

                I tried with codes from as you indicated below QT5.6 with MSVC2013 64bit and it works.

                the error that brings me back to my code gives it to me when I compile in Debug mode while in Release mode it works, only I need it in Debug mode to do analysis in Debbugers.

                I do not understand why it gives me error in Debug mode and not in Release mode. in your opinion what can be wrong with Debug about QMap ??

                aha_1980A 1 Reply Last reply
                0
                • D Domenico

                  @SGaist

                  Sorry for the delay.

                  I tried with codes from as you indicated below QT5.6 with MSVC2013 64bit and it works.

                  the error that brings me back to my code gives it to me when I compile in Debug mode while in Release mode it works, only I need it in Debug mode to do analysis in Debbugers.

                  I do not understand why it gives me error in Debug mode and not in Release mode. in your opinion what can be wrong with Debug about QMap ??

                  aha_1980A Offline
                  aha_1980A Offline
                  aha_1980
                  Lifetime Qt Champion
                  wrote on last edited by
                  #9

                  @Domenico Check the includes @kshegunov mentioned. Most likely that's the problem.

                  Qt has to stay free or it will die.

                  1 Reply Last reply
                  0
                  • kshegunovK kshegunov

                    Did you include QString and the QVariant headers? Please provide the snippet which induces this error.

                    D Offline
                    D Offline
                    Domenico
                    wrote on last edited by
                    #10

                    @kshegunov @aha_1980

                    Thank you so much for the solution !!

                    I tried as you said, including QString and QVariant in headers where it is using QMap .. the error persists .. :(

                    J.HilkJ 1 Reply Last reply
                    0
                    • D Domenico

                      @kshegunov @aha_1980

                      Thank you so much for the solution !!

                      I tried as you said, including QString and QVariant in headers where it is using QMap .. the error persists .. :(

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

                      @Domenico can you post the files /classes where you use QMap and the error occurs?


                      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
                      • D Offline
                        D Offline
                        Domenico
                        wrote on last edited by Domenico
                        #12

                        I try to publish the sources, as it is too long. public part .h e .cpp where and how is using QMap, I hope it is understandable. if it is not, please let me know that I will try to publish more.

                        in the class .h

                        #ifndef ROLEADMINISTRATIONMODEL_H
                        #define ROLEADMINISTRATIONMODEL_H

                        #include <QMap>
                        #include <QString>
                        #include <QVariant>
                        #include <QList>

                        #include "ErrorTypeDefinition.h"
                        #include "RoleData.h"
                        #include "DBManager.h"

                        class RoleAdministrationModel
                        {
                        private:
                        RoleData m_currentRoleSelected;
                        QMap<int,RoleData> m_roleList;

                        RoleAdminErrorType deleteRole(RoleData roleData);
                        RoleAdminErrorType modifyRole(RoleData roleData);
                        RoleAdminErrorType newRole(RoleData roleData);
                        

                        public:
                        RoleAdministrationModel();
                        QList<QString> getFuncList();
                        QList<RoleData> getRoleData();

                        void roleSelected(RoleData rolSel);
                        RoleAdminErrorType saveRole(RoleData role);
                        

                        };

                        #endif // ROLEADMINISTRATIONMODEL_H

                        in the class .cpp

                        #include "RoleAdministrationModel.h"

                        RoleAdministrationModel::RoleAdministrationModel()
                        {
                        m_roleList.clear();
                        }

                        QList<QString> RoleAdministrationModel::getFuncList()
                        {
                        return DBManager::getInstance()->getFuncList();
                        }

                        QList<RoleData> RoleAdministrationModel::getRoleData()
                        {
                        QList<RoleData> roleList;
                        QList<RoleData>::iterator it;

                        m_roleList.clear();
                        
                        roleList = DBManager::getInstance()->getRoleData();
                        
                        for(it = roleList.begin(); it != roleList.end(); it++)
                        {
                            m_roleList.insert((*it).getRoleId(),*it);
                        }
                        
                        return roleList;
                        

                        }

                        void RoleAdministrationModel::roleSelected(RoleData rolSel)
                        {
                        m_currentRoleSelected = rolSel;
                        }

                        RoleAdminErrorType RoleAdministrationModel::deleteRole(RoleData roleData)
                        {
                        ...not use QMap...
                        }

                        RoleAdminErrorType RoleAdministrationModel::modifyRole(RoleData roleData)
                        {
                        ...not use QMap...
                        }

                        RoleAdminErrorType RoleAdministrationModel::newRole(RoleData roleData)
                        {
                        ...not use QMap...
                        }

                        RoleAdminErrorType RoleAdministrationModel::saveRole(RoleData role)
                        {
                        ...not use QMap...
                        }

                        this is class of Roledata.h

                        #ifndef ROLEDATA_H
                        #define ROLEDATA_H

                        #include <QString>
                        #include <QVector>

                        #include "EnumTypeDefinition.h"

                        class RoleData
                        {
                        public:
                        RoleData();
                        RoleData(int roleId,QString roleName,RoleOperationType op);
                        RoleData(QString roleName);
                        RoleData(int roleId,QString roleName);
                        QString getRoleName();
                        RoleOperationType getOperationType();
                        int getRoleId();
                        void addFuncionality(QString name);
                        QVector<QString> getFuncionalityList();
                        bool isValid();
                        bool isFuncIsAssociatedToRole(QString funcName);

                        private:
                        int m_RoleId;
                        QString m_RoleName;
                        QVector<QString> m_FunctionalityNameList;
                        RoleOperationType m_Operation;
                        };

                        Roledata.cpp

                        #include "RoleData.h"

                        RoleData::RoleData()
                        {
                        m_RoleName = "";
                        m_Operation = R_INVALID_OPERATION;
                        m_FunctionalityNameList.clear();
                        m_RoleId = -1;
                        }

                        RoleData::RoleData(int roleId, QString roleName, RoleOperationType op)
                        {
                        m_RoleName = roleName;
                        m_Operation = op;
                        m_RoleId = roleId;
                        }

                        RoleData::RoleData(QString roleName)
                        {
                        m_RoleName = roleName;
                        m_Operation = R_INVALID_OPERATION;
                        m_RoleId = -1;
                        }

                        RoleData::RoleData(int roleId, QString roleName)
                        {
                        m_RoleId = roleId;
                        m_RoleName = roleName;
                        }

                        QString RoleData::getRoleName()
                        {
                        return m_RoleName;
                        }

                        RoleOperationType RoleData::getOperationType()
                        {
                        return m_Operation;
                        }

                        int RoleData::getRoleId()
                        {
                        return m_RoleId;
                        }

                        void RoleData::addFuncionality(QString name)
                        {
                        m_FunctionalityNameList.append(name);
                        }

                        QVector<QString> RoleData::getFuncionalityList()
                        {
                        return m_FunctionalityNameList;
                        }

                        bool RoleData::isValid()
                        {
                        return !(m_RoleName.isEmpty());
                        }

                        bool RoleData::isFuncIsAssociatedToRole(QString funcName)
                        {
                        bool result = false;

                        result = m_FunctionalityNameList.contains(funcName);
                        
                        return result;
                        

                        }

                        the error that brings me back into Debug mode:

                        0_1549270525115_3e279a86-9cab-4b11-b6f9-5fb3e546d321-image.png

                        while the other QMap I'm using (QMap <int, String> and QMap <int, int>) I do not publish it because it's too long, but I think the error comes more from code as indicated above, according to you if something wrong with code above? if everything is perfect I try to publish the codes that are using QMap <int, QString> and QMap <int, int>.

                        thank you very much for those who give me a solution !!!

                        aha_1980A 1 Reply Last reply
                        0
                        • D Domenico

                          I try to publish the sources, as it is too long. public part .h e .cpp where and how is using QMap, I hope it is understandable. if it is not, please let me know that I will try to publish more.

                          in the class .h

                          #ifndef ROLEADMINISTRATIONMODEL_H
                          #define ROLEADMINISTRATIONMODEL_H

                          #include <QMap>
                          #include <QString>
                          #include <QVariant>
                          #include <QList>

                          #include "ErrorTypeDefinition.h"
                          #include "RoleData.h"
                          #include "DBManager.h"

                          class RoleAdministrationModel
                          {
                          private:
                          RoleData m_currentRoleSelected;
                          QMap<int,RoleData> m_roleList;

                          RoleAdminErrorType deleteRole(RoleData roleData);
                          RoleAdminErrorType modifyRole(RoleData roleData);
                          RoleAdminErrorType newRole(RoleData roleData);
                          

                          public:
                          RoleAdministrationModel();
                          QList<QString> getFuncList();
                          QList<RoleData> getRoleData();

                          void roleSelected(RoleData rolSel);
                          RoleAdminErrorType saveRole(RoleData role);
                          

                          };

                          #endif // ROLEADMINISTRATIONMODEL_H

                          in the class .cpp

                          #include "RoleAdministrationModel.h"

                          RoleAdministrationModel::RoleAdministrationModel()
                          {
                          m_roleList.clear();
                          }

                          QList<QString> RoleAdministrationModel::getFuncList()
                          {
                          return DBManager::getInstance()->getFuncList();
                          }

                          QList<RoleData> RoleAdministrationModel::getRoleData()
                          {
                          QList<RoleData> roleList;
                          QList<RoleData>::iterator it;

                          m_roleList.clear();
                          
                          roleList = DBManager::getInstance()->getRoleData();
                          
                          for(it = roleList.begin(); it != roleList.end(); it++)
                          {
                              m_roleList.insert((*it).getRoleId(),*it);
                          }
                          
                          return roleList;
                          

                          }

                          void RoleAdministrationModel::roleSelected(RoleData rolSel)
                          {
                          m_currentRoleSelected = rolSel;
                          }

                          RoleAdminErrorType RoleAdministrationModel::deleteRole(RoleData roleData)
                          {
                          ...not use QMap...
                          }

                          RoleAdminErrorType RoleAdministrationModel::modifyRole(RoleData roleData)
                          {
                          ...not use QMap...
                          }

                          RoleAdminErrorType RoleAdministrationModel::newRole(RoleData roleData)
                          {
                          ...not use QMap...
                          }

                          RoleAdminErrorType RoleAdministrationModel::saveRole(RoleData role)
                          {
                          ...not use QMap...
                          }

                          this is class of Roledata.h

                          #ifndef ROLEDATA_H
                          #define ROLEDATA_H

                          #include <QString>
                          #include <QVector>

                          #include "EnumTypeDefinition.h"

                          class RoleData
                          {
                          public:
                          RoleData();
                          RoleData(int roleId,QString roleName,RoleOperationType op);
                          RoleData(QString roleName);
                          RoleData(int roleId,QString roleName);
                          QString getRoleName();
                          RoleOperationType getOperationType();
                          int getRoleId();
                          void addFuncionality(QString name);
                          QVector<QString> getFuncionalityList();
                          bool isValid();
                          bool isFuncIsAssociatedToRole(QString funcName);

                          private:
                          int m_RoleId;
                          QString m_RoleName;
                          QVector<QString> m_FunctionalityNameList;
                          RoleOperationType m_Operation;
                          };

                          Roledata.cpp

                          #include "RoleData.h"

                          RoleData::RoleData()
                          {
                          m_RoleName = "";
                          m_Operation = R_INVALID_OPERATION;
                          m_FunctionalityNameList.clear();
                          m_RoleId = -1;
                          }

                          RoleData::RoleData(int roleId, QString roleName, RoleOperationType op)
                          {
                          m_RoleName = roleName;
                          m_Operation = op;
                          m_RoleId = roleId;
                          }

                          RoleData::RoleData(QString roleName)
                          {
                          m_RoleName = roleName;
                          m_Operation = R_INVALID_OPERATION;
                          m_RoleId = -1;
                          }

                          RoleData::RoleData(int roleId, QString roleName)
                          {
                          m_RoleId = roleId;
                          m_RoleName = roleName;
                          }

                          QString RoleData::getRoleName()
                          {
                          return m_RoleName;
                          }

                          RoleOperationType RoleData::getOperationType()
                          {
                          return m_Operation;
                          }

                          int RoleData::getRoleId()
                          {
                          return m_RoleId;
                          }

                          void RoleData::addFuncionality(QString name)
                          {
                          m_FunctionalityNameList.append(name);
                          }

                          QVector<QString> RoleData::getFuncionalityList()
                          {
                          return m_FunctionalityNameList;
                          }

                          bool RoleData::isValid()
                          {
                          return !(m_RoleName.isEmpty());
                          }

                          bool RoleData::isFuncIsAssociatedToRole(QString funcName)
                          {
                          bool result = false;

                          result = m_FunctionalityNameList.contains(funcName);
                          
                          return result;
                          

                          }

                          the error that brings me back into Debug mode:

                          0_1549270525115_3e279a86-9cab-4b11-b6f9-5fb3e546d321-image.png

                          while the other QMap I'm using (QMap <int, String> and QMap <int, int>) I do not publish it because it's too long, but I think the error comes more from code as indicated above, according to you if something wrong with code above? if everything is perfect I try to publish the codes that are using QMap <int, QString> and QMap <int, int>.

                          thank you very much for those who give me a solution !!!

                          aha_1980A Offline
                          aha_1980A Offline
                          aha_1980
                          Lifetime Qt Champion
                          wrote on last edited by
                          #13

                          @Domenico And what is in EnumTypeDefinition.h ?

                          Qt has to stay free or it will die.

                          1 Reply Last reply
                          0
                          • D Offline
                            D Offline
                            Domenico
                            wrote on last edited by
                            #14

                            @aha_1980

                            you're right, sorry, the class of EnumTypeDefinition.h is

                            #ifndef ENUMTYPEDEFINITION_H
                            #define ENUMTYPEDEFINITION_H

                            typedef enum _UserAccountOperationType
                            {
                            UAC_NEW_USER = 0,
                            UAC_MODIFY_USER,
                            UAC_DELETE_USER,
                            UAC_INVALID_OPERATION

                            }UserAccountOperationType;

                            typedef enum _RoleOperationType
                            {
                            R_NEW_ROLE = 0,
                            R_MODIFY_ROLE,
                            R_DELETE_ROLE,
                            R_INVALID_OPERATION

                            }RoleOperationType;

                            typedef enum _ObjectSensitivity
                            {
                            OS_UNSENSIBLE,
                            OS_SENSIBLE

                            }ObjectSensitivity;

                            typedef enum _ObjectActDeact
                            {
                            OAD_ACTIVE,
                            OAD_DEACTIVE

                            }ObjectActDeact;

                            typedef enum _SystemStatus
                            {
                            SS_UNKNOWN,
                            SS_READY,
                            SS_DEFAULT,
                            SS_OFFLINE,
                            SS_ACTIVE,
                            SS_CONFIG,
                            SS_FAILURE,
                            SS_DEGRADED

                            }SystemStatus;

                            #endif // ENUMTYPEDEFINITION_H

                            what do you think of the codes above?

                            1 Reply Last reply
                            0
                            • J.HilkJ Offline
                              J.HilkJ Offline
                              J.Hilk
                              Moderators
                              wrote on last edited by
                              #15

                              The only place where you actually use QMap is here

                              QList<RoleData> RoleAdministrationModel::getRoleData()
                              {
                              QList<RoleData> roleList;
                              QList<RoleData>::iterator it;
                              
                              m_roleList.clear();
                              
                              roleList = DBManager::getInstance()->getRoleData();
                              
                              for(it = roleList.begin(); it != roleList.end(); it++)
                              {
                                  m_roleList.insert((*it).getRoleId(),*it);
                              }
                              
                              return roleList;
                              }
                              

                              which doesn't seem quite right, I'm unsure.

                              Can you try it with a more simplified version?

                              QList<RoleData> RoleAdministrationModel::getRoleData()
                              {
                              QList<RoleData> roleList = DBManager::getInstance()->getRoleData();
                              
                              m_roleList.clear();
                              
                              for(const RoleData &data : roleList)
                              {
                                  m_roleList.insert(data.getRoleId(), data);
                              }
                              
                              return roleList;
                              }
                              

                              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
                              1
                              • D Offline
                                D Offline
                                Domenico
                                wrote on last edited by Domenico
                                #16

                                I have done a deep study the problem of the error does not concern in the codes .. but the error comes from the macro of the _DEBUG in fact compile in RELEASE mode works while compiling in DEBUG mode gives me error as indicated above, then going to look at the macro:

                                #ifdef _DEBUG
                                #define new DEBUG_NEW
                                #endif

                                this macro of _DEBUG does not convince me the error I think it is connected to this macro .. someone can define a macro that can fill in the right way under Qt5.6 with MSVC2013 64bit without giving errors on qmap.h and qlist.h ??

                                Thanks again

                                1 Reply Last reply
                                0
                                • D Offline
                                  D Offline
                                  Domenico
                                  wrote on last edited by Domenico
                                  #17

                                  I solved!

                                  the problem was of the macro:

                                  #ifdef _DEBUG
                                  #define new DEBUG_NEW
                                  #endif

                                  this macro only works if compiled under the Visual Studio development environment in DEBUG mode.
                                  just change the macro in:

                                  #ifdef QT_DEBUG
                                  #endif

                                  and add in .pro file:

                                  CONFIG(debug, release|debug):DEFINES += QT_DEBUG

                                  and Hola works with this macro under the Qt Creator development environment in DEBUG mode

                                  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