【发布时间】:2011-08-02 22:18:35
【问题描述】:
我有一张表Thingsies,列有id、data1、otherTableId、otherTableRowId。我需要最后两列而不仅仅是外键列,因为根据Thingy,我想要的信息类型会有所不同。otherTableId 引用表id 中的id,它本身有名为id 和tableName 的列。这些tableNames 是其他表的名称,例如OtherTable1、OtherTable2。Thingies 中的列 otherTableRowId 引用了由 otherTableId 给出的 OtherTable 中的 id。 OtherTables 本身有更多的数据。 Thingies 和 OtherTables 之一中的条目之间存在一对一的对应关系。所以Thingies中的行数是所有OtherTables中的总行数。 (这是糟糕的设计吗?)
我想在包含id、data1 和data2 的列的QTableView 中显示Thingies,其中data2 是从otherTableId 和otherTableRowId 以编程方式生成的。我应该如何进行?
谢谢。
【问题讨论】:
标签: database qt relational-database qtableview model-view