【问题标题】:What is the difference between itemismovable and drag&drop in QTQT中itemismovable和drag&drop有什么区别
【发布时间】:2012-12-06 13:02:54
【问题描述】:

我在 QGraphicsView 上有一些矩形。我需要将一个拖放到特定位置。将项目设置为可移动或拖放有区别吗?

【问题讨论】:

    标签: qt drag-and-drop


    【解决方案1】:

    Drag and Drop 与物品是否可移动无关。

    拖放提供了一种简单的视觉机制,用户可以使用它在应用程序之间和应用程序内传输信息。 (在文献中这被称为“直接操作模型”。)拖放功能类似于剪贴板的剪切和粘贴机制。

    这就像您将图标从桌面拖到应用程序中一样。单个QGraphicsItems 可以接受拖放事件,您可以通过实现dragEnterEventdragMoveEventdragLeaveEvent 来随意处理它们。

    Qt 中的术语拖放总是用来指​​代这一点,不应与用户使用鼠标在屏幕上移动对象的能力相混淆。

    【讨论】:

    • +1 你说得对,我被By clicking on the item and then dragging, the item will move together with the mouse cursor. 误导了,这实际上只是鼠标拖动而不是拖放。 (如果你想知道,我发布了一个错误的答案,我现在删除了)
    猜你喜欢
    • 2010-12-20
    • 1970-01-01
    • 2011-04-14
    • 2013-05-09
    • 2011-01-14
    • 1970-01-01
    • 2012-03-16
    • 1970-01-01
    相关资源
    最近更新 更多