| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformdrag.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | - | |||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | - | |||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | QPlatformDropQtResponse::QPlatformDropQtResponse(bool accepted, Qt::DropAction acceptedAction) | - | ||||||||||||
| 11 | : m_accepted(accepted) | - | ||||||||||||
| 12 | , m_accepted_action(acceptedAction) | - | ||||||||||||
| 13 | { | - | ||||||||||||
| 14 | } never executed: end of block | 0 | ||||||||||||
| 15 | - | |||||||||||||
| 16 | bool QPlatformDropQtResponse::isAccepted() const | - | ||||||||||||
| 17 | { | - | ||||||||||||
| 18 | return never executed: m_accepted;return m_accepted;never executed: return m_accepted; | 0 | ||||||||||||
| 19 | } | - | ||||||||||||
| 20 | - | |||||||||||||
| 21 | Qt::DropAction QPlatformDropQtResponse::acceptedAction() const | - | ||||||||||||
| 22 | { | - | ||||||||||||
| 23 | return never executed: m_accepted_action;return m_accepted_action;never executed: return m_accepted_action; | 0 | ||||||||||||
| 24 | } | - | ||||||||||||
| 25 | - | |||||||||||||
| 26 | QPlatformDragQtResponse::QPlatformDragQtResponse(bool accepted, Qt::DropAction acceptedAction, QRect answerRect) | - | ||||||||||||
| 27 | : QPlatformDropQtResponse(accepted,acceptedAction) | - | ||||||||||||
| 28 | , m_answer_rect(answerRect) | - | ||||||||||||
| 29 | { | - | ||||||||||||
| 30 | } never executed: end of block | 0 | ||||||||||||
| 31 | - | |||||||||||||
| 32 | QRect QPlatformDragQtResponse::answerRect() const | - | ||||||||||||
| 33 | { | - | ||||||||||||
| 34 | return never executed: m_answer_rect;return m_answer_rect;never executed: return m_answer_rect; | 0 | ||||||||||||
| 35 | } | - | ||||||||||||
| 36 | - | |||||||||||||
| 37 | class QPlatformDragPrivate { | - | ||||||||||||
| 38 | public: | - | ||||||||||||
| 39 | QPlatformDragPrivate() : cursor_drop_action(Qt::IgnoreAction) {} never executed: end of block | 0 | ||||||||||||
| 40 | - | |||||||||||||
| 41 | Qt::DropAction cursor_drop_action; | - | ||||||||||||
| 42 | }; | - | ||||||||||||
| 43 | QPlatformDrag::QPlatformDrag() : d_ptr(new QPlatformDragPrivate) | - | ||||||||||||
| 44 | { | - | ||||||||||||
| 45 | } never executed: end of block | 0 | ||||||||||||
| 46 | - | |||||||||||||
| 47 | QPlatformDrag::~QPlatformDrag() | - | ||||||||||||
| 48 | { | - | ||||||||||||
| 49 | delete d_ptr; | - | ||||||||||||
| 50 | } never executed: end of block | 0 | ||||||||||||
| 51 | - | |||||||||||||
| 52 | QDrag *QPlatformDrag::currentDrag() const | - | ||||||||||||
| 53 | { | - | ||||||||||||
| 54 | return never executed: QDragManager::self()->object();return QDragManager::self()->object();never executed: return QDragManager::self()->object(); | 0 | ||||||||||||
| 55 | } | - | ||||||||||||
| 56 | - | |||||||||||||
| 57 | Qt::DropAction QPlatformDrag::defaultAction(Qt::DropActions possibleActions, | - | ||||||||||||
| 58 | Qt::KeyboardModifiers modifiers) const | - | ||||||||||||
| 59 | { | - | ||||||||||||
| 60 | - | |||||||||||||
| 61 | - | |||||||||||||
| 62 | - | |||||||||||||
| 63 | - | |||||||||||||
| 64 | Qt::DropAction default_action = Qt::IgnoreAction; | - | ||||||||||||
| 65 | - | |||||||||||||
| 66 | if (currentDrag()
| 0 | ||||||||||||
| 67 | default_action = currentDrag()->defaultAction(); | - | ||||||||||||
| 68 | } never executed: end of block | 0 | ||||||||||||
| 69 | - | |||||||||||||
| 70 | - | |||||||||||||
| 71 | if (default_action == Qt::IgnoreAction
| 0 | ||||||||||||
| 72 | - | |||||||||||||
| 73 | - | |||||||||||||
| 74 | default_action = Qt::CopyAction; | - | ||||||||||||
| 75 | } never executed: end of block | 0 | ||||||||||||
| 76 | - | |||||||||||||
| 77 | if (modifiers & Qt::ControlModifier
| 0 | ||||||||||||
| 78 | default_action = Qt::LinkAction; never executed: default_action = Qt::LinkAction; | 0 | ||||||||||||
| 79 | else if (modifiers & Qt::ControlModifier
| 0 | ||||||||||||
| 80 | default_action = Qt::CopyAction; never executed: default_action = Qt::CopyAction; | 0 | ||||||||||||
| 81 | else if (modifiers & Qt::ShiftModifier
| 0 | ||||||||||||
| 82 | default_action = Qt::MoveAction; never executed: default_action = Qt::MoveAction; | 0 | ||||||||||||
| 83 | else if (modifiers & Qt::AltModifier
| 0 | ||||||||||||
| 84 | default_action = Qt::LinkAction; never executed: default_action = Qt::LinkAction; | 0 | ||||||||||||
| 85 | - | |||||||||||||
| 86 | - | |||||||||||||
| 87 | - | |||||||||||||
| 88 | - | |||||||||||||
| 89 | - | |||||||||||||
| 90 | - | |||||||||||||
| 91 | if (!(possibleActions & default_action)
| 0 | ||||||||||||
| 92 | if (possibleActions & Qt::CopyAction
| 0 | ||||||||||||
| 93 | default_action = Qt::CopyAction; never executed: default_action = Qt::CopyAction; | 0 | ||||||||||||
| 94 | else if (possibleActions & Qt::MoveAction
| 0 | ||||||||||||
| 95 | default_action = Qt::MoveAction; never executed: default_action = Qt::MoveAction; | 0 | ||||||||||||
| 96 | else if (possibleActions & Qt::LinkAction
| 0 | ||||||||||||
| 97 | default_action = Qt::LinkAction; never executed: default_action = Qt::LinkAction; | 0 | ||||||||||||
| 98 | else | - | ||||||||||||
| 99 | default_action = Qt::IgnoreAction; never executed: default_action = Qt::IgnoreAction; | 0 | ||||||||||||
| 100 | } | - | ||||||||||||
| 101 | - | |||||||||||||
| 102 | - | |||||||||||||
| 103 | - | |||||||||||||
| 104 | - | |||||||||||||
| 105 | - | |||||||||||||
| 106 | return never executed: default_action;return default_action;never executed: return default_action; | 0 | ||||||||||||
| 107 | } | - | ||||||||||||
| 108 | - | |||||||||||||
| 109 | - | |||||||||||||
| 110 | - | |||||||||||||
| 111 | - | |||||||||||||
| 112 | - | |||||||||||||
| 113 | void QPlatformDrag::updateAction(Qt::DropAction action) | - | ||||||||||||
| 114 | { | - | ||||||||||||
| 115 | QPlatformDragPrivate * const d = d_func(); | - | ||||||||||||
| 116 | if (d->cursor_drop_action != action
| 0 | ||||||||||||
| 117 | d->cursor_drop_action = action; | - | ||||||||||||
| 118 | currentDrag()->actionChanged(action); | - | ||||||||||||
| 119 | } never executed: end of block | 0 | ||||||||||||
| 120 | } never executed: end of block | 0 | ||||||||||||
| 121 | - | |||||||||||||
| 122 | static const char *const default_pm[] = { | - | ||||||||||||
| 123 | "13 9 3 1", | - | ||||||||||||
| 124 | ". c None", | - | ||||||||||||
| 125 | " c #000000", | - | ||||||||||||
| 126 | "X c #FFFFFF", | - | ||||||||||||
| 127 | "X X X X X X X", | - | ||||||||||||
| 128 | " X X X X X X ", | - | ||||||||||||
| 129 | "X ......... X", | - | ||||||||||||
| 130 | " X.........X ", | - | ||||||||||||
| 131 | "X ......... X", | - | ||||||||||||
| 132 | " X.........X ", | - | ||||||||||||
| 133 | "X ......... X", | - | ||||||||||||
| 134 | " X X X X X X ", | - | ||||||||||||
| 135 | "X X X X X X X", | - | ||||||||||||
| 136 | }; | - | ||||||||||||
| 137 | - | |||||||||||||
| 138 | namespace { namespace Q_QGS_qt_drag_default_pixmap { typedef QPixmap Type; QBasicAtomicInt guard = { QtGlobalStatic::Uninitialized }; __attribute__((visibility("hidden"))) inline Type *innerFunction() { struct HolderBase { ~HolderBase() noexcept { if (guard.load() == QtGlobalStatic::Initialized
never executed: }guard.store(QtGlobalStatic::Destroyed);never executed: }; static struct Holder : public HolderBase { Type value; Holder() noexcept(noexcept(Type (default_pm))) : value (default_pm) { guard.store(QtGlobalStatic::Initialized); } } holder; returnend of blocknever executed: &holder.value;return &holder.value;never executed: } } } static QGlobalStatic<QPixmap, Q_QGS_qt_drag_default_pixmap::innerFunction, Q_QGS_qt_drag_default_pixmap::guard> qt_drag_default_pixmap;return &holder.value; | 0 | ||||||||||||
| 139 | - | |||||||||||||
| 140 | QPixmap QPlatformDrag::defaultPixmap() | - | ||||||||||||
| 141 | { | - | ||||||||||||
| 142 | return never executed: *qt_drag_default_pixmap();return *qt_drag_default_pixmap();never executed: return *qt_drag_default_pixmap(); | 0 | ||||||||||||
| 143 | } | - | ||||||||||||
| 144 | bool QPlatformDrag::ownsDragObject() const | - | ||||||||||||
| 145 | { | - | ||||||||||||
| 146 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||
| 147 | } | - | ||||||||||||
| 148 | - | |||||||||||||
| 149 | - | |||||||||||||
| 150 | - | |||||||||||||
| 151 | - | |||||||||||||
| Switch to Source code | Preprocessed file |