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. Qt Proxy with type of source object
Forum Updated to NodeBB v4.3 + New Features

Qt Proxy with type of source object

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 980 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.
  • E Offline
    E Offline
    eckler
    wrote on last edited by
    #1

    Hi,
    I have class, say MyClass, inherited from QSqlRelationalTableModel and I need to transpose it (change rows with columns). "This":http://www.qtcentre.org/wiki/index.php?title=Transpose_proxy_model solution was found. Is it possible to get object of type MyClass after transposing using the proxy? If not, are there any other ways to do it?

    Thank you!

    EDIT
    I wanna use is like this:
    @
    MyClass* myObject = new MyClass(this, db);
    TransposeProxyModel* trans = new TransposeProxyModel(this);
    trans->setSourceModel(myObject);
    ui->tableViewDb->setModel(trans);
    ui->tableViewDb->setItemDelegate(new QSqlRelationalDelegate(ui->tableViewDb));@

    It is necessary to paste object of MyClass (or QSqlRelationalTableModel) into QSqlRelationalDelegate.

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

      Hi,

      Something's not really clear, when/where would you need to get that object ?

      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
      • E Offline
        E Offline
        eckler
        wrote on last edited by
        #3

        [quote author="SGaist" date="1424871585"]Hi,

        Something's not really clear, when/where would you need to get that object ?[/quote]

        Hi,
        Thank you for reply!
        I wanna use is like this:
        @
        MyClass myObject = new MyClass(this, db);
        TransposeProxyModel
        trans = new TransposeProxyModel(this);
        trans->setSourceModel(myObject);
        ui->tableViewDb->setModel(trans);
        ui->tableViewDb->setItemDelegate(new QSqlRelationalDelegate(ui->tableViewDb));@

        It is necessary to paste object of MyClass (or QSqlRelationalTableModel) into QSqlRelationalDelegate.

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

          Sorry for the late reply, the delegate takes a parent in order to benefit from parent/child handling from Qt, it doesn't need to you to give him your model.

          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