[問題] Qt使用:TreeView上加編輯元件
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Qt Creator
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
Qt
問題(Question):
我想要在QTreeView上加入combobox 和 editText
讓清單內容可以編輯
餵入的資料(Input):
我是過用在QTreeView上
this->setItemDelegate(new ComboBoxDelegate(this));
加入自己定義的QItemDelegate
但還是無法作用
有人有完整的範例嗎?
預期的正確結果(Expected Output):
希望可以在TreeView上能有可編輯的combobox和editText
錯誤結果(Wrong Output):
無法達到要求
程式碼(Code):(請善用置底文網頁, 記得排版)
我在QTreeView內加入以下內容
model = new QStandardItemModel(1,2);
...
model->setItem(0, 1, new QStandardItem("A"));
...
this->setItemDelegate(new ComboBoxDelegate(this));
ComboBoxDelegate是依照下面網址
補充說明(Supplement):
我的主要作法是根據這個
http://stackoverflow.com/questions/3135505/qstandarditem-qcombobox
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 180.176.120.207
※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1438685118.A.974.html
推
08/07 16:40, , 1F
08/07 16:40, 1F