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. Why i can't change color of QString?
Qt 6.11 is out! See what's new in the release blog

Why i can't change color of QString?

Scheduled Pinned Locked Moved Unsolved General and Desktop
46 Posts 7 Posters 26.9k 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.
  • VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by VRonin
    #22

    Exact same answer.
    There's a section in the readme that explains how to use the library: https://vsronin.github.io/QtModelUtilities/md__i_n_s_t_a_l_l.html

    "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

    EngelardE 1 Reply Last reply
    1
    • VRoninV VRonin

      Exact same answer.
      There's a section in the readme that explains how to use the library: https://vsronin.github.io/QtModelUtilities/md__i_n_s_t_a_l_l.html

      EngelardE Offline
      EngelardE Offline
      Engelard
      wrote on last edited by
      #23

      @VRonin I added that macro to .pro file and nothing changed, same 4 errors.

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

        You have to manually click on build-> rerun qmake every time you change something in the .pro file

        "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

        EngelardE 1 Reply Last reply
        1
        • VRoninV VRonin

          You have to manually click on build-> rerun qmake every time you change something in the .pro file

          EngelardE Offline
          EngelardE Offline
          Engelard
          wrote on last edited by
          #25

          @VRonin of course i did that. Still same 4 errors

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

            let's do it manually then: remove all the MODELUTILITIES_EXPORT

            "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

            EngelardE 1 Reply Last reply
            0
            • VRoninV VRonin

              let's do it manually then: remove all the MODELUTILITIES_EXPORT

              EngelardE Offline
              EngelardE Offline
              Engelard
              wrote on last edited by
              #27

              @VRonin said in Why i can't change color of QString?:

              MODELUTILITIES_EXPORT

              How? you mean edit your src files?

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

                yep!
                All DEFINES += MODELUTILITIES_STATIC does is transforming MODELUTILITIES_EXPORT into an empty string. if that doesn't work then just manually do a find and replace

                "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

                EngelardE 1 Reply Last reply
                0
                • VRoninV VRonin

                  yep!
                  All DEFINES += MODELUTILITIES_STATIC does is transforming MODELUTILITIES_EXPORT into an empty string. if that doesn't work then just manually do a find and replace

                  EngelardE Offline
                  EngelardE Offline
                  Engelard
                  wrote on last edited by
                  #29

                  @VRonin oKay. In what files that stuff which i should to replace? I only can assume that such stuff MODELUTILITIES_EXPORT is macro, so it must be in some .h files, right?

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

                    Actually, it probably just easier to replace the entire modelutilities_global.h with

                    #ifndef modelutilities_global_h__
                    #define modelutilities_global_h__
                    #define MODELUTILITIES_EXPORT
                    #endif // modelutilities_global_h__
                    

                    "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

                    EngelardE 1 Reply Last reply
                    0
                    • VRoninV VRonin

                      Actually, it probably just easier to replace the entire modelutilities_global.h with

                      #ifndef modelutilities_global_h__
                      #define modelutilities_global_h__
                      #define MODELUTILITIES_EXPORT
                      #endif // modelutilities_global_h__
                      
                      EngelardE Offline
                      EngelardE Offline
                      Engelard
                      wrote on last edited by
                      #31

                      @VRonin Done. But still that four errors(

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

                        Hi,

                        Do you mean the symbol missing error ?

                        Did you build @VRonin library statically ?

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

                        EngelardE 1 Reply Last reply
                        0
                        • SGaistS SGaist

                          Hi,

                          Do you mean the symbol missing error ?

                          Did you build @VRonin library statically ?

                          EngelardE Offline
                          EngelardE Offline
                          Engelard
                          wrote on last edited by
                          #33

                          @SGaist said in Why i can't change color of QString?:

                          Did you build @VRonin library statically ?

                          0_1553942357112_statt.jpg

                          @SGaist said in Why i can't change color of QString?:

                          Do you mean the symbol missing error ?

                          0_1553942408999_errr.jpg

                          I tried multiple times: Build>Clean all>Run qmake>Rebuild all.

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

                            Do you have a .dll file matching that library ?

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

                            EngelardE 1 Reply Last reply
                            0
                            • SGaistS SGaist

                              Do you have a .dll file matching that library ?

                              EngelardE Offline
                              EngelardE Offline
                              Engelard
                              wrote on last edited by
                              #35

                              @SGaist What .dll? I just downloaded src folder, did'nt saw any dll in there

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

                                The .dll if you have built @VRonin's library.

                                Otherwise, how did you integrate it in 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

                                EngelardE 1 Reply Last reply
                                1
                                • SGaistS SGaist

                                  The .dll if you have built @VRonin's library.

                                  Otherwise, how did you integrate it in your application ?

                                  EngelardE Offline
                                  EngelardE Offline
                                  Engelard
                                  wrote on last edited by
                                  #37

                                  @SGaist said in Why i can't change color of QString?:

                                  Otherwise, how did you integrate it in your application ?

                                  Just included rolemaskproxymodel.h and start using that stuff what he showed in example

                                  mrjjM VRoninV 2 Replies Last reply
                                  0
                                  • EngelardE Engelard

                                    @SGaist said in Why i can't change color of QString?:

                                    Otherwise, how did you integrate it in your application ?

                                    Just included rolemaskproxymodel.h and start using that stuff what he showed in example

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

                                    @Engelard
                                    Also the .cpp files , i hope ?

                                    1 Reply Last reply
                                    1
                                    • EngelardE Engelard

                                      @SGaist said in Why i can't change color of QString?:

                                      Otherwise, how did you integrate it in your application ?

                                      Just included rolemaskproxymodel.h and start using that stuff what he showed in example

                                      VRoninV Offline
                                      VRoninV Offline
                                      VRonin
                                      wrote on last edited by VRonin
                                      #39

                                      @Engelard said in Why i can't change color of QString?:

                                      Just included rolemaskproxymodel.h and start using that stuff what he showed in example

                                      @VRonin said in Why i can't change color of QString?:

                                      There's a section in the readme that explains how to use the library: https://github.com/VSRonin/QtModelUtilities/tree/dev#installation

                                      And it states:

                                      if you use qmake (Qt Creator), you can include the entire source of the library directly in your code by adding include(path/to/source/modelutilities.pri) in your .pro file.

                                      "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

                                      EngelardE 1 Reply Last reply
                                      2
                                      • VRoninV VRonin

                                        @Engelard said in Why i can't change color of QString?:

                                        Just included rolemaskproxymodel.h and start using that stuff what he showed in example

                                        @VRonin said in Why i can't change color of QString?:

                                        There's a section in the readme that explains how to use the library: https://github.com/VSRonin/QtModelUtilities/tree/dev#installation

                                        And it states:

                                        if you use qmake (Qt Creator), you can include the entire source of the library directly in your code by adding include(path/to/source/modelutilities.pri) in your .pro file.

                                        EngelardE Offline
                                        EngelardE Offline
                                        Engelard
                                        wrote on last edited by
                                        #40

                                        @VRonin Done. It compiles. But it seems like proxyModel eventually empty. tempBx - is pointer to existed ComboBox:

                                        QStringListModel *tempStrMod = new QStringListModel(personalList);
                                        RoleMaskProxyModel proxyModel;
                                        proxyModel.setSourceModel(tempStrMod);
                                        tempBx->setModel(&proxyModel);
                                        

                                        But if i'd change ->setModel to tempStrMod it works.

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

                                          You are creating the proxy model on the stack. it is most likely going out of scope.

                                          QStringListModel *tempStrMod = new QStringListModel(personalList);
                                          RoleMaskProxyModel* proxyModel =new RoleMaskProxyModel(personalList);
                                          proxyModel->setSourceModel(tempStrMod);
                                          tempBx->setModel(proxyModel);
                                          

                                          "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

                                          EngelardE 1 Reply Last reply
                                          4

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved