feat(searchList): Set height for listview.

Description: 设置搜索结果列表的高度(动态改变)

Log: 设置搜索结果列表的高度
This commit is contained in:
zhangjiaping 2020-12-26 19:50:11 +08:00
parent abd521f3ab
commit 5d74a805f6
1 changed files with 2 additions and 1 deletions

View File

@ -14,7 +14,8 @@ SearchListView::SearchListView(QWidget * parent, const QStringList& list, const
this->setHeaderHidden(true); this->setHeaderHidden(true);
this->setColumnWidth(0, 20); this->setColumnWidth(0, 20);
this->setColumnWidth(1, 80); this->setColumnWidth(1, 80);
this->setFixedHeight(list.count() * 47 + 2); int rowHeight = this->rowHeight(this->model()->index(0,1, QModelIndex())) + 1;
this->setFixedHeight(list.count() * rowHeight + 2);
this->setAttribute(Qt::WA_TranslucentBackground, true); this->setAttribute(Qt::WA_TranslucentBackground, true);
this->setAutoFillBackground(false); this->setAutoFillBackground(false);
this->setStyleSheet("QWidget{background:transparent;}"); this->setStyleSheet("QWidget{background:transparent;}");