0
您可以使用通常的標誌位掩碼來設置dropActions
。從the docs,我們有以下可能的放置動作:Qt DropActions:什麼是ActionMask?
Action Value Result
Qt::CopyAction 0x1 (1) Copy the data to the target.
Qt::MoveAction 0x2 (2) Move the data from the source to the target.
Qt::LinkAction 0x4 (4) Create a link from the source to the target.
Qt::ActionMask 0xff (255) [none given in docs]
Qt::IgnoreAction 0x0 (0) Ignore the action (do nothing with the data).
我被ActionMask
措施混淆。我還沒有找到任何關於它的討論(例如,here或here),甚至沒有任何關於它的例子(比如Nullege)。它的價值是,所以任何時候你按位or
它與任何其他dropActions你只會以ActionMask
再次結束。
那麼,什麼是ActionMask
?何時使用?它在哪裏記錄?
編輯:
正如接受的答案指出,有一個的dropAction我離開了枚舉,而這可能是關鍵:
TargetMoveAction 0x8002 (32770 in dec, 1000000000000010 in bin)
我應該包括在我的枚舉dropaction ...它似乎關鍵:我想知道如果這些被添加到qt在一起使用你的建議。 – neuronet 2014-11-23 19:45:26
有趣的是'TargetMoveAction'以'10'結尾,所以它隱含地包含'MoveAction'。 – neuronet 2014-11-23 19:58:59
@neuronet。 Qt在它的幾個枚舉中提供了掩碼,最常見的用法似乎是提供一種易於維護的方法來包含所有可能的標誌,而不必事先知道它們的實際內容。鑑於'TargetMoveAction'在所有平臺上的使用方式都不相同,它似乎有意義的是它具有超出蒙版範圍的值。 – ekhumoro 2014-11-23 20:35:21