Qt 如何在放大一个gridview item 放大的时候移动该gridview item 放大

课程名称读取中
支付宝支付
由百度开放云提供技术支持
&学院APP&&
扫描微信二维码精彩活动、课程更新抢先知
下载客户端,离线视频任您学
1.&Qt图形视图框架详解(上)
2.&Qt图形视图框架详解(下)
【课程类型】技术教程
【难度级别】高级
【适合人群】所有人
【课程介绍】 介绍Qt中的Graphics View Framework,涉及View、Scene、Item的关系,如何自定义QGraphicsItem、处理Item之间的关联、如何布局及定义自己的布局Item、如何变幻Item、如何应用动画、如何处理拖放、如何给Item应用图形效果。 (我的同名视频课程地址:http://edu.csdn.net/course/detail/3240)
【课程目标】 1.自定义QGraphicsItem
2.QGraphicsItem的拖放
【课程计划】 本期授课老师为安晓辉,经历过技术支持、程序员、项目经理、部门经理、项目总监、技术副总等各种岗位的老程序员,在网络机顶盒、智能机顶盒、应用服务器、手机App等领域有成功经验,著有《Qt on Android核心编程》和《Qt Quick核心编程》。
全部评价(0)
239课程577876学员
所属机构:
参考知识库
为您推荐课程
讲师:CSDN公开课 3课时
讲师:CSDN公开课 2课时
讲师:CSDN公开课 2课时
讲师:CSDN公开课 2课时
讲师:CSDN公开课 2课时Qt学习笔记-1_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
Qt学习笔记-1
上传于||文档简介
&&这是我在Qt的学习中搜集到得资料 希望对大家有所帮助!
阅读已结束,如果下载本文需要使用1下载券
想免费下载本文?
定制HR最喜欢的简历
下载文档到电脑,查找使用更方便
还剩21页未读,继续阅读
定制HR最喜欢的简历
你可能喜欢An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click
to find out more about this error.一个Qt新手的有关问题_关于C#接收跟发送串口数据_怎么修改listview中某一个item的值__脚本百事通
稍等,加载中……
^_^请注意,有可能下面的2篇文章才是您想要的内容:
一个Qt新手的有关问题
关于C#接收跟发送串口数据
怎么修改listview中某一个item的值
一个Qt新手的有关问题
一个Qt新手的问题我装了qt4.7.2的开发包,在vs2005上装了qt addin 1.1.7。我新建了一个Qt Application项目后直接生成。可是程序运行不了,直接说“应用程序配置不正确,未能启动此程序”。请问各位高手,我如何能让我的第一个Qt程序成功运行?
------解决方案--------------------1 确认qt4.7.2是 vs版本不是 mingw版本
2 确认qt addin 1.1.7是否安装成功。 vs2005上是否有Qt 菜单选项。
3 是否正确配置Qt环境。Qt菜单下有配置。是否成功配置。
关于C#接收跟发送串口数据
关于C#接收和发送串口数据我把两台电脑对接,两台电脑都装上串口调试软件,然后用串口调试软件是能通信的。
但是我在程序里写了发送和接收的代码,然后和另外一台电脑通信,发现发送出去的数据在那台电脑的调试软件里面显示的全是00 00 00...,然后我在调试软件里给我的程序发送数据,程序没有任何输出。第一次接触这东西啊,表示搞不懂哪里出了问题了。哪位大神帮忙解释一下呀,先谢谢了,好人一生平安!
------解决方案--------------------串口参数设置不对吧
串口号、波特率、奇偶校验等参数
怎么修改listview中某一个item的值
如何修改listview中某一个item的值我写了一个listview 包含多个显示图片的item,我如何才能只改变其中某item的一个图片其他的不变,假设我知道该item的id。。PS:并不是点击该item才改变,而是通过我的程序其他部分产生的一个值来判断是否要改变的
------解决方案--------------------假如 你点击以后 会获取到一个位置信息 ,然后通过listview 获取到那个 item 的layout 然后获取那个控件 然后改变信息 就OK了
如果您想提高自己的技术水平,欢迎加入本站官方1号QQ群:&&,&&2号QQ群:,在群里结识技术精英和交流技术^_^
本站联系邮箱:qt QGraphicsItem move event get absolute position [QT qgraphicsitem移动事件得到的绝对位置] - 问题-字节技术
qt QGraphicsItem move event get absolute position
QT qgraphicsitem移动事件得到的绝对位置
问题 (Question)
i have a QGraphicsEllipseItem that i want to be movable and triggering signals on moving.
So i subclassed QGraphicsEllipseItem
and QObject and override the itemChange method to trigger a signal. That all seems to work but the positions that are reported seem to be relative to the old position of the Item. even if asking the item for its position seems only to retrieve the relative coordinates.
here some code to make clear that i had done:
class MyGraphicsEllipseItem: public QObject, public QGraphicsEllipseItem
MyGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0, QGraphicsScene *scene = 0)
:QGraphicsEllipseItem(x,y,w,h, parent, scene)
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void itemMoved(QPointF p);
QVariant MyGraphicsEllipseItem::itemChange( GraphicsItemChange change, const QVariant
// value seems to contain position relative start of moving
if (change == ItemPositionChange){
emit itemMoved(value.toPointF());
return QGraphicsEllipseItem::itemChange(change, value); // i allso tried to call this before the emiting
this is the item creation:
MyGraphicsEllipseItem* ellipse = new MyGraphicsEllipseItem(someX, someY, someW, someH);
ellipse-&setFlag(QGraphicsItem::ItemIsMovable, true);
ellipse-&setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
connect(ellipse, SIGNAL(itemMoved(QPointF)), SLOT(on_itemMoved(QPointF)));
graphicsView-&scene()-&addItem(ellipse);
and the slot:
void MainWindow::on_itemMoved( QPointF p)
MyGraphicsEllipseItem* el = dynamic_cast&MyGraphicsEllipseItem*&(QObject::sender());
QPointF newPos = el-&scenePos();
scaleLbl-&setText(QString("(%1, %2) - (%3, %4)").arg(newPos.x()).arg(newPos.y()).arg(p.x()).arg(p.y()));
the strange thing is, that newpos and p are almost equal but contain relative coordinates to the beginning of the movement.
How to get the current position of the dragged object?
or is there another way to achieve the goal?
thanks in advance for your help
我有一个qgraphicsellipseitem,我想在移动的移动和触发信号。所以我qgraphicsellipseitem QObject继承和重写itemChange触发信号的方法。这一切似乎工作,但位置报告似乎是相对于项目的老位置。即使要求项目的位置似乎只检索相对坐标。这里的一些代码来表明我所做的:class MyGraphicsEllipseItem: public QObject, public QGraphicsEllipseItem
MyGraphicsEllipseItem(qreal x, qreal y, qreal w, qreal h, QGraphicsItem *parent = 0, QGraphicsScene *scene = 0)
:QGraphicsEllipseItem(x,y,w,h, parent, scene)
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
void itemMoved(QPointF p);
QVariant MyGraphicsEllipseItem::itemChange( GraphicsItemChange change, const QVariant
// value seems to contain position relative start of moving
if (change == ItemPositionChange){
emit itemMoved(value.toPointF());
return QGraphicsEllipseItem::itemChange(change, value); // i allso tried to call this before the emiting
这是项目的创建:
MyGraphicsEllipseItem* ellipse = new MyGraphicsEllipseItem(someX, someY, someW, someH);
ellipse-&setFlag(QGraphicsItem::ItemIsMovable, true);
ellipse-&setFlag(QGraphicsItem::ItemSendsScenePositionChanges, true);
connect(ellipse, SIGNAL(itemMoved(QPointF)), SLOT(on_itemMoved(QPointF)));
graphicsView-&scene()-&addItem(ellipse);
与槽:void MainWindow::on_itemMoved( QPointF p)
MyGraphicsEllipseItem* el = dynamic_cast&MyGraphicsEllipseItem*&(QObject::sender());
QPointF newPos = el-&scenePos();
scaleLbl-&setText(QString("(%1, %2) - (%3, %4)").arg(newPos.x()).arg(newPos.y()).arg(p.x()).arg(p.y()));
奇怪的是,这newpos和P几乎相等,但包含相对坐标系中的运动的开始。如何获得被拖动的对象的当前位置?还是有另一种方式来实现这一目标感谢您的帮助
最佳答案 (Best Answer)
I found the reason:
the constructor QGraphicsEllipseItem::QGraphicsEllipseItem ( qreal x, qreal y, qreal width, qreal height, QGraphicsItem * parent = 0 ) does not work as expected. after calling it with some x and y the item still reports 0,0 as its position. giving 0,0 to constructor and explicitly setting position with setPos(x,y) solves the thing.
I really wonder that was the intention for this behaviour. The documentation gives no hint for this.
我找到了原因:的QGraphicsEllipseItem::QGraphicsEllipseItem ( qreal x, qreal y, qreal width, qreal height, QGraphicsItem * parent = 0 )没有象预期的那样工作。在调用它的一些X和Y项目仍然报道0,0为位置。给予0,0构造函数和显式设置的位置setPos(x,y)解决这件事。我真想知道,这种行为的意图。文档不出这。
本文翻译自StackoverFlow,英语好的童鞋可直接参考原文:}

我要回帖

更多关于 gridview item 放大 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信