Qt 双击获取QListView图标的几何图形以制作动画
我有一个在iconMode中使用QListView的照片浏览器。当双击照片缩略图时,我会显示一个带有全尺寸图像的QWidget 我想为全尺寸图像的显示设置动画,从单击图标的位置缩小,但我无法确定如何访问几何体。我用于显示图像的例程位于底部。我一直在尝试访问几何体,但没有成功。我已经尝试了selectionModel()的一些方法,但我认为这是错误的。我错过的最明显的东西是什么Qt 双击获取QListView图标的几何图形以制作动画,qt,Qt,我有一个在iconMode中使用QListView的照片浏览器。当双击照片缩略图时,我会显示一个带有全尺寸图像的QWidget 我想为全尺寸图像的显示设置动画,从单击图标的位置缩小,但我无法确定如何访问几何体。我用于显示图像的例程位于底部。我一直在尝试访问几何体,但没有成功。我已经尝试了selectionModel()的一些方法,但我认为这是错误的。我错过的最明显的东西是什么 QItemSelection sel = thumbView->selectionModel()->
QItemSelection sel = thumbView->selectionModel()->selection();
qDebug() << "sel.count()" << sel.count();
QItemSelectionRange selItem = sel.first();
qDebug() << "selItem" << selItem.left() <<selItem.top()<< selItem.right()<< selItem.bottom();
您可以使用 例如:
void UrlView::mousePressEvent(QMouseEvent *event) // Derived from QAbstractItemView
{
QModelIndex index = indexAt(event->pos());
QRect rect = visualRect(index);
qDebug() << rect;
}
void UrlView::MousePresseEvent(QMouseEvent*event)//从QAbstractItemView派生
{
QModelIndex index=indexAt(事件->位置());
QRect rect=视觉rect(索引);
qDebug()
void UrlView::mousePressEvent(QMouseEvent *event) // Derived from QAbstractItemView
{
QModelIndex index = indexAt(event->pos());
QRect rect = visualRect(index);
qDebug() << rect;
}