Qt item itemAt的区别

QTableWidgetItem * QTableWidget::itemAt ( int ax, int ay ) const
Returns the item at the position equivalent to QPoint(ax, ay) in the table widget's coordinate system, or returns 0 if the specified point is not covered by an item in the table widget.

See also item().

QTableWidgetItem * QTableWidget::item ( int row, int column ) const
Returns the item for the given row and column if one has been set; otherwise returns 0.

See also setItem().

今天用itemAt取QtableWidget的值,怎么取都是取的第一行,所以我一直感觉自己的参数传错了,就找了跟啊,最后还是不行,重新生成还是不行,最后没有办法查助手,发现一个takeitem这个可以得到,可是会到原来表里面的拿走,这样不行啊

所以我又找啊,找到item,最后实现了目的,

可是itemAt为什么不可以呢,仔细看看,可以是坐标系统的问题,itemAt指的可能不是行和列,而你坐标点,如果可以转化为item就返回,如果不能就返回0

item,就是真正的行列坐标系统了。

转载于:https://www.cnblogs.com/ants-double/p/6039966.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值