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,就是真正的行列坐标系统了。


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM