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