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. [SOLVED] Saving custom user settings in Qt
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Saving custom user settings in Qt

Scheduled Pinned Locked Moved General and Desktop
25 Posts 6 Posters 18.6k 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.
  • A Offline
    A Offline
    andre
    wrote on last edited by
    #15

    Read carefully. The errors quite clearly state what the problem is.

    1 Reply Last reply
    0
    • F Offline
      F Offline
      fs_tigre
      wrote on last edited by
      #16

      bq. error: no matching function for call to ‘MainWindow::setColor(QColor&)

      I do have that function!

      Sorry if I dont see the obvious.

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rishygupta
        wrote on last edited by
        #17

        is it possible QmlApplicationViewer can be used or manipulated in other class rather than main.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #18

          [quote author="fs_tigre" date="1344421000"]bq. error: no matching function for call to ‘MainWindow::setColor(QColor&)

          I do have that function!

          Sorry if I dont see the obvious.
          [/quote]

          No, you don't have that function. From your error (my highlight):

          [quote author="fs_tigre" date="1344420694"]error: no matching function for call to 'MainWindow::setColor(QColor&)
          candidates are: void MainWindow::setColor(const QObject&)
          In member function 'void MainWindow::setColor(const QObject&)':
          [/quote]

          What makes you think QColor& is the same as a const QObject&?

          And, while we're at it: QObject cannot be copied, so you cannot use it as a function argument the way you do. Pass around pointers instead.

          1 Reply Last reply
          0
          • F Offline
            F Offline
            fs_tigre
            wrote on last edited by
            #19

            Oh, I see, I do have setColor function but I'm passing a different parameter of what was specified in the header which makes it a completely different function. I was just using the code provided by Josué V. Herrera, and to be quite honest, if that's wrong I wont be able to find a solution or fix the problem. I do understand the error but I do not know the solution.

            Thanks

            1 Reply Last reply
            0
            • A Offline
              A Offline
              andre
              wrote on last edited by
              #20

              Code people give you here on the forum is usually not mend to be used as-is. Often, it is "brain-to-terminal": something you quickly write down in the forum editor itself, untested and probably even not compiling. The idea of such code is that it is a teaching tool; a way of pointing you towards a solution, but often not the solution itself. Copy pasting such snippets is not learning, as it does not promote understanding. If you can only solve your issue by using completely ready-made code offered by others, then you have a serious problem that can only be solved by either really starting to study, or by shelling out some money to start paying a consultant to help you with your project.

              1 Reply Last reply
              0
              • F Offline
                F Offline
                fs_tigre
                wrote on last edited by
                #21

                Understood, Thanks.

                I have said this a few times, I already took a c++ class, read a Qt book but some times is just hard to get everything understood in less than a year. I do programming as a hobby, I actually work full time as Mechanical Engineer.

                On this case I think my problem is a poor understanding of C++ in general but pass by reference and pointers are the main issue in this situation.

                I know I know, sorry for the time you guys wasted here.

                Thanks a lot for all of your previous help.

                1 Reply Last reply
                0
                • F Offline
                  F Offline
                  fs_tigre
                  wrote on last edited by
                  #22

                  I cannot believe it, it's working, after a few hours, I finally made this thing work.

                  Made a few changes including, changing @inline void setColor(const QObject &myCurrentColor);@ to @void setColor(const QColor &myCurrentColor);@

                  Even though it doesn't seem like I want to learn, I do, but sometimes it's hard, especially when you are not a programmer.

                  Thanks a lot to all that helped.

                  1 Reply Last reply
                  0
                  • ? Offline
                    ? Offline
                    A Former User
                    wrote on last edited by
                    #23

                    I didn't say nothing about using inline functions in implementation files, because I was not sure why I always use it at headers. Obviously I read it in some book and now I do it without thinking.

                    I'm sorry about my mistake specifying QObject instead of QColor, as Andre said that was “brain-to-terminal”, just an example, a possible solution.

                    Glad to hear that finally you got it.

                    Note: I'm not sure if I should correct my snippet of code for future readers. I think this could break the sequence of the posts. Andre, what do you think about this?

                    1 Reply Last reply
                    0
                    • A Offline
                      A Offline
                      astodolski
                      wrote on last edited by
                      #24

                      How would you format the color as a QColor entry in an INI type file?

                      I want to read in a value from the file to set the initial color

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        astodolski
                        wrote on last edited by
                        #25

                        How would you format the color as a QColor entry in an INI type file?

                        I want to read in a value from the file to set the initial color

                        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