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] Strange error
QtWS25 Last Chance

[Solved] Strange error

Scheduled Pinned Locked Moved General and Desktop
6 Posts 5 Posters 2.9k Views
  • 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.
  • R Offline
    R Offline
    Ruzik
    wrote on last edited by
    #1

    Hellow when i try compile this code:
    @QString str = QDir::currentPath + "\settings.ini";@
    I get strange error: Error 2 error C2296: +: invalid, the left operand is of type "QString (__cdecl *) (void)" c: \ Documents and Settings \ rustam \ My Documents \ Visual Studio 2008 \ Projects \ RizekColorManager \ RizekColorManager \ Settings \ Settings.cpp 30
    But there are "QString QDir::currentPath ()" in assistant
    Why is this happening?
    Advance many thanks for uour help!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      soroush
      wrote on last edited by
      #2

      QDir::currentPath is the name of a static method of QDir class. so:
      @
      QString str = QDir::currentPath() + "\settings.ini";
      @

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andreas.hammerschmidtgmx.net
        wrote on last edited by
        #3

        and don't forget to use double backslash in your static filename.

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Ruzik
          wrote on last edited by
          #4

          Oh, sorry completion went wrong, and I did not notice
          Many thanks for your help!

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

            [quote author="Andreas Hammerschmidt" date="1309281322"]and don't forget to use double backslash in your static filename.[/quote]

            Better yet, use a single forward slash. If you want to display the path as a string, you can use QDir::toNativeSeparators().

            1 Reply Last reply
            0
            • T Offline
              T Offline
              TobbY
              wrote on last edited by
              #6

              thats same problem with me, solved mine either.. thanks

              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