Results 1 to 2 of 2

Thread: QSqlRelationalTable and filters

  1. #1
    Join Date
    Jul 2006
    Posts
    10
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QSqlRelationalTable and filters

    Hi, i am using a QSqlRelationalTableModel like this:

    Qt Code:
    1. modelo->setTable("producto");
    2. modelo->setRelation(1, QSqlRelation("rubro", "idrubro", "nombre"));
    3. modelo->select();
    To copy to clipboard, switch view to plain text mode 

    now after this i want to set a filter but with the related column, in this case the column rubro.nombre from the table rubro. How can i do this? Is this possible? Ive tryed several ways but is not working at all, i ve tried "rubro = sometext" "idrubro = idrubro" and a few more. Can anybody help me?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QSqlRelationalTable and filters

    You have to pass the id and not the name or use a proxy model and do the filtering there.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.