[問題] Qt 設定tableview內combobox的currentindex

看板C_and_CPP (C/C++)作者 (aa)時間15年前 (2011/06/10 22:18), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
最近剛開始學Qt,試寫的一個程式 之前沒有寫過UI,不太確定架構好不好 程式簡介: 1.class MyUI 主要有一個tableview和一個button 2.class MyDelegate column index為0時是一個combobox column index為1時是一個spinbox 目前我把一個model設到tableview 以及利用setItemDelegate把MyDelegate也設到tableview 更新model時tableview上看到的值的確會跟著變 可是combobox的current index一直不知道怎麼設 每次user setEditorData時 都沒辦法一開始先停在原來tableview上看到的值 目前的想法是如果可以正確的拿到tableview上某一格的QWidget 應該可以仿照setEditorData 寫一個UpdateComboxCurrentIndex之類的function 有試過用indexWidget不過行不通? 不知道應該怎麼做才可以設定tableview裡combobox的current index? 謝謝 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 1.169.132.24
文章代碼(AID): #1DyYUj9x (C_and_CPP)
文章代碼(AID): #1DyYUj9x (C_and_CPP)