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