Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/qt/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Qt 双击获取QListView图标的几何图形以制作动画_Qt - Fatal编程技术网

Qt 双击获取QListView图标的几何图形以制作动画

Qt 双击获取QListView图标的几何图形以制作动画,qt,Qt,我有一个在iconMode中使用QListView的照片浏览器。当双击照片缩略图时,我会显示一个带有全尺寸图像的QWidget 我想为全尺寸图像的显示设置动画,从单击图标的位置缩小,但我无法确定如何访问几何体。我用于显示图像的例程位于底部。我一直在尝试访问几何体,但没有成功。我已经尝试了selectionModel()的一些方法,但我认为这是错误的。我错过的最明显的东西是什么 QItemSelection sel = thumbView->selectionModel()->

我有一个在iconMode中使用QListView的照片浏览器。当双击照片缩略图时,我会显示一个带有全尺寸图像的QWidget

我想为全尺寸图像的显示设置动画,从单击图标的位置缩小,但我无法确定如何访问几何体。我用于显示图像的例程位于底部。我一直在尝试访问几何体,但没有成功。我已经尝试了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;
}