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. How to using Qt classes private like QSqlRelationalTableModelPrivate to my own model
QtWS25 Last Chance

How to using Qt classes private like QSqlRelationalTableModelPrivate to my own model

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 3 Posters 2.2k 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.
  • Q Offline
    Q Offline
    Qt Single programmer
    wrote on last edited by Qt Single programmer
    #1

    i need to create my own model in Qt to support some features like “returning values” in firebird database and storeprocedures and etc. for this purpose I need to access private classes like “QSqlrelationalTableModelPrivate” and “QSqlTableMoelPrivate” to accessing methods in these classes.now My question is that, is there any way to accessing these classes whiteout re-implementing them in my model?

    Thanks for your answering.

    ValentinMicheletV 1 Reply Last reply
    0
    • Q Qt Single programmer

      i need to create my own model in Qt to support some features like “returning values” in firebird database and storeprocedures and etc. for this purpose I need to access private classes like “QSqlrelationalTableModelPrivate” and “QSqlTableMoelPrivate” to accessing methods in these classes.now My question is that, is there any way to accessing these classes whiteout re-implementing them in my model?

      Thanks for your answering.

      ValentinMicheletV Offline
      ValentinMicheletV Offline
      ValentinMichelet
      wrote on last edited by ValentinMichelet
      #2

      Hi,

      Maybe this article will answer your questions about Qt architecture. It explains how D-pointer and Q-pointer are used as well as how to inherit Qt class using their D-pointer:
      https://wiki.qt.io/D-Pointer

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

        Hi and welcome to devnet,

        You can use QT += sql-private to add them but beware, these can drastically change between two Qt versions.

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

        1 Reply Last reply
        0
        • Q Offline
          Q Offline
          Qt Single programmer
          wrote on last edited by
          #4

          thank for your Answering
          i want to Access to data in "QSqlRelationalTableModelPrivate" class and this class define in "qsqlrelationaltablemodel.cpp" file, so how can i access to this class?

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

            What data are you interested in ?

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

            Q 1 Reply Last reply
            0
            • SGaistS SGaist

              What data are you interested in ?

              Q Offline
              Q Offline
              Qt Single programmer
              wrote on last edited by
              #6

              @SGaist
              for example i created my own class named "dbModel" that inherited from QSqlRealationalTableModel class and also i have my own exec method to execute sql Query like insert, update and delete instead of QSqlTableModel'exec method . for this i overwrite "insertRowIntoTable()" method but i want the parent class(QSqlRealationalTableModel) does its jobs without execute the line " return QSqlTableModel::insertRowIntoTable(rec);" and instead of it i want execute my own method(exec). so if i do all jobs of QSqlRelationalTableModel i need to access to QSqlRelationalTableModel Private class and as you know this class define in "qsqlrealationaltablemodel.cpp" file, thus i can't access to it. so i hove to re-implement "QSqlRealatinalTableModel" class in my own class. now, i want to know is there any way to do this without re-implement QSqlRealatinalTableModel class.

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

                What does your custom exec method do that is different ?

                You can't call a base class method in a partial way.

                AFAIK there's not, but one possibility would to have your own build of Qt.

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

                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