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. The right way to include private h file
Forum Updated to NodeBB v4.3 + New Features

The right way to include private h file

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 2.1k 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.
  • Oleg ZyryanovO Offline
    Oleg ZyryanovO Offline
    Oleg Zyryanov
    wrote on last edited by Oleg Zyryanov
    #1

    Hello!
    I try to include private h file in my project (library).

    In source code i see the line (for example)

    #include <QtSql/private/qsqldriver_p.h>
    

    But when i insert such line i have got an error

    No such file ot directory.
    

    Looks like i should add include path in the project

    C:\Qt\Qt5.5.1\5.5\mingw492_32\include\QtSql\5.5.1\ 
    

    What is the right way to do this in my library?

    Oleg ZyryanovO 1 Reply Last reply
    0
    • Oleg ZyryanovO Oleg Zyryanov

      Hello!
      I try to include private h file in my project (library).

      In source code i see the line (for example)

      #include <QtSql/private/qsqldriver_p.h>
      

      But when i insert such line i have got an error

      No such file ot directory.
      

      Looks like i should add include path in the project

      C:\Qt\Qt5.5.1\5.5\mingw492_32\include\QtSql\5.5.1\ 
      

      What is the right way to do this in my library?

      Oleg ZyryanovO Offline
      Oleg ZyryanovO Offline
      Oleg Zyryanov
      wrote on last edited by
      #2

      @Oleg-Zyryanov

      I add to my project file

      QT       += core gui sql sql-private core-private
      

      and include files have been resolved automatically.

      Looks like the right way.

      kshegunovK 1 Reply Last reply
      0
      • Oleg ZyryanovO Oleg Zyryanov

        @Oleg-Zyryanov

        I add to my project file

        QT       += core gui sql sql-private core-private
        

        and include files have been resolved automatically.

        Looks like the right way.

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

        @Oleg-Zyryanov
        Hello,

        I try to include private h file in my project (library).

        Why do you need to do that?

        Read and abide by the Qt Code of Conduct

        1 Reply Last reply
        0
        • Oleg ZyryanovO Offline
          Oleg ZyryanovO Offline
          Oleg Zyryanov
          wrote on last edited by
          #4

          Now I try to develop my own sql driver. It is platform specific.

          kshegunovK 1 Reply Last reply
          0
          • Oleg ZyryanovO Oleg Zyryanov

            Now I try to develop my own sql driver. It is platform specific.

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

            @Oleg-Zyryanov

            Now I try to develop my own sql driver. It is platform specific.

            Okay, this is fine, but I recon it's just better to use the public API. QSqlDriver and QSqlResult are both abstract, so why not derive from them and implement the methods? I was asking because I'm unsure whether you're aware of the implications following the usage of the private API. For example, by using the private API you're tying your code to the exact Qt version (i.e. you break the binary compatibility between your library and Qt).

            Kind regards.

            Read and abide by the Qt Code of Conduct

            1 Reply Last reply
            0
            • Oleg ZyryanovO Offline
              Oleg ZyryanovO Offline
              Oleg Zyryanov
              wrote on last edited by
              #6

              Thank you for advice.
              I explore existing sources where used private API. And now make by analog. I know about version problem and will try to avoid using private API later.

              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