本文整理汇总了C++中QListView::sizeHintForRow方法的典型用法代码示例。如果您正苦于以下问题:C++ QListView::sizeHintForRow方法的具体用法?C++ QListView::sizeHintForRow怎么用?C++ QListView::sizeHintForRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QListView
的用法示例。
在下文中一共展示了QListView::sizeHintForRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processResults
/** Process results sent back from various search engines (local, remote). */
void SearchDialog::processResults(Request type, const QStandardItemList &results)
{
QListView *listToProcess = nullptr;
switch (type) {
case Artist:
listToProcess = _artists;
break;
case Album:
listToProcess = _albums;
break;
case Track:
listToProcess = _tracks;
break;
}
QStandardItemModel *m = qobject_cast<QStandardItemModel*>(listToProcess->model());
for (int i = 0; i < results.size(); i++) {
m->insertRow(0, results.at(i));
}
m->sort(0);
listToProcess->setFixedHeight(listToProcess->model()->rowCount() * listToProcess->sizeHintForRow(0));
qDebug() << "number of items" << listToProcess->model()->rowCount();
qDebug() << "size h f r 1" << _artists->sizeHintForRow(0) << _albums->sizeHintForRow(0) << _tracks->sizeHintForRow(0);
qDebug() << "size h f r 2" << iconArtists->height() << iconAlbums->height() << iconTracks->height();
int ar = qMax(_artists->model()->rowCount() * _artists->sizeHintForRow(0), iconArtists->height());
int al = qMax(_albums->model()->rowCount() * _albums->sizeHintForRow(0), iconAlbums->height());
int tr = qMax(_tracks->model()->rowCount() * _tracks->sizeHintForRow(0), iconTracks->height());
artistLayoutWidget->setFixedHeight(ar);
albumLayoutWidget->setFixedHeight(al);
trackLayoutWidget->setFixedHeight(tr);
qDebug() << "ar al tr" << ar << al << tr;
int h = ar + al + tr;
//int h = 300;
h += labelSearchMore->height() + aggregated->height() + 3;
int minW = qMax(iconArtists->width() + _artists->sizeHintForColumn(0), 400);
this->resize(minW, h);
}