即使结果为null,我也希望返回一个查询。
我这样做了:
class thumbnail_item: public QListWidgetItem {
using super = QListWidgetItem;
public:
explicit thumbnail_item (const QString &filename)
: super(filename)
{}
virtual QVariant data (int role) const override
{
if (role == Qt::DecorationRole) {
QIcon i = super::icon();
if (i.isNull()) {
/*
* The existing thumbnail (if any) is empty so create one
* from the file name and use it -- remembering to call
* setIcon so we don't need to go through all this again
* next time.
*/
i = QIcon(data(Qt::DisplayRole));
setIcon(i);
}
return(i);
}
return(super::data(role));
}
};
从那以后,我有一个名为orders的表有一个列orderStatus而另一个表叫做order_status。
...谢谢