Python PyQt5.QtCore.Qt.MoveAction() Examples
The following are 21
code examples of PyQt5.QtCore.Qt.MoveAction().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtCore.Qt
, or try the search function
.
Example #1
Source File: cue_widget.py From linux-show-player with GNU General Public License v3.0 | 6 votes |
def mouseMoveEvent(self, event): if (event.buttons() == Qt.LeftButton and (event.modifiers() == Qt.ControlModifier or event.modifiers() == Qt.ShiftModifier)): mime_data = QMimeData() mime_data.setText(PageWidget.DRAG_MAGIC) drag = QDrag(self) drag.setMimeData(mime_data) drag.setPixmap(self.grab(self.rect())) if event.modifiers() == Qt.ControlModifier: drag.exec_(Qt.MoveAction) else: drag.exec_(Qt.CopyAction) event.accept() else: event.ignore()
Example #2
Source File: elementmaster.py From Pythonic with GNU General Public License v3.0 | 6 votes |
def mousePressEvent(self, event): logging.debug('ElementMaster::mousePressEvent() called') # uncomment this for debugging purpose #self.listChild() if event.buttons() != Qt.LeftButton: return icon = QLabel() mimeData = QMimeData() mime_text = str(self.row) + str(self.column) + str(self.__class__.__name__) mimeData.setText(mime_text) drag = QDrag(self) drag.setMimeData(mimeData) drag.setPixmap(self.pixmap) drag.setHotSpot(event.pos() - self.rect().topLeft()) if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction: icon.close() else: icon.show() icon.setPixmap(self.pixmap)
Example #3
Source File: basictools.py From Pythonic with GNU General Public License v3.0 | 6 votes |
def mousePressEvent(self, event): child = self.childAt(event.pos()) if not child: return mimeData = QMimeData() mimeData.setText(child.type) logging.debug('mousePressEvent() called: {}'.format(event.pos())) drag = QDrag(self) drag.setPixmap(child.pixmap()) drag.setMimeData(mimeData) drag.setHotSpot(event.pos() - child.pos()) if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction: child.close() else: child.show() child.setPixmap(child.pixmap())
Example #4
Source File: network_node_creation_panel.py From pyNMS with GNU General Public License v3.0 | 5 votes |
def dragMoveEvent(self, event): if event.mimeData().hasFormat('application/x-dnditemdata'): if event.source() == self: event.setDropAction(Qt.MoveAction) event.accept() else: event.acceptProposedAction() else: event.ignore()
Example #5
Source File: gui_tabMain.py From PIVX-SPMT with MIT License | 5 votes |
def initBody(self): ###-- CENTRAL PART self.body = QGroupBox() self.body.setTitle("My Masternodes") # masternode list self.myList = QListWidget() self.myList.setUpdatesEnabled(True) self.myList.setDragDropMode(QAbstractItemView.InternalMove) self.myList.setDefaultDropAction(Qt.MoveAction) self.current_mn = {} self.mnLed = {} self.mnLabel = {} self.mnBalance = {} self.btn_details = {} self.mnStatusLabel = {} self.mnStatusProgress = {} self.btn_remove = {} self.btn_edit = {} self.btn_start = {} self.btn_rewards = {} for masternode in self.caller.masternode_list: name = masternode['name'] self.insert_mn_list(name, masternode['ip'], masternode['port'], isHardware=masternode['isHardware']) vBox = QVBoxLayout() vBox.addWidget(self.myList) self.button_addMasternode = QPushButton("New Masternode") vBox.addWidget(self.button_addMasternode) vBox.stretch(1) self.body.setLayout(vBox)
Example #6
Source File: test_modulator_gui.py From urh with GNU General Public License v3.0 | 5 votes |
def test_signal_view(self): self.add_signal_to_form("esaver.complex16s") signal = self.form.signal_tab_controller.signal_frames[0].signal tree_view = self.dialog.ui.treeViewSignals tree_model = tree_view.model() item = tree_model.rootItem.children[0].children[0] index = tree_model.createIndex(0, 0, item) rect = tree_view.visualRect(index) QTest.mousePress(tree_view.viewport(), Qt.LeftButton, pos=rect.center()) mime_data = tree_model.mimeData([index]) drag_drop = QDropEvent(rect.center(), Qt.CopyAction | Qt.MoveAction, mime_data, Qt.LeftButton, Qt.NoModifier) drag_drop.acceptProposedAction() self.dialog.ui.gVOriginalSignal.dropEvent(drag_drop) self.assertEqual(self.dialog.ui.gVOriginalSignal.sceneRect().width(), signal.num_samples) self.dialog.ui.cbShowDataBitsOnly.click() self.dialog.ui.chkBoxLockSIV.click() self.assertEqual(int(self.dialog.ui.gVOriginalSignal.view_rect().width()), int(self.dialog.ui.gVModulated.view_rect().width())) freq = self.dialog.ui.doubleSpinBoxCarrierFreq.value() self.dialog.ui.btnAutoDetect.click() self.assertNotEqual(freq, self.dialog.ui.doubleSpinBoxCarrierFreq.value()) self.dialog.ui.comboBoxModulationType.setCurrentText("Frequency Shift Keying (FSK)") self.dialog.ui.btnAutoDetect.click() self.assertEqual(self.dialog.ui.lCurrentSearchResult.text(), "1") self.dialog.ui.btnSearchNext.click() self.assertEqual(self.dialog.ui.lCurrentSearchResult.text(), "2") self.dialog.ui.btnSearchPrev.click() self.assertEqual(self.dialog.ui.lCurrentSearchResult.text(), "1")
Example #7
Source File: QtTestCase.py From urh with GNU General Public License v3.0 | 5 votes |
def add_all_signals_to_simulator(self): assert isinstance(self.form, MainController) sim_frame = self.form.simulator_tab_controller sim_frame.ui.treeProtocols.selectAll() self.assertGreater(len(sim_frame.ui.treeProtocols.selectedIndexes()), 0) mimedata = sim_frame.tree_model.mimeData(sim_frame.ui.treeProtocols.selectedIndexes()) drop_event = QDropEvent(sim_frame.ui.gvSimulator.rect().center(), Qt.CopyAction | Qt.MoveAction, mimedata, Qt.LeftButton, Qt.NoModifier) drop_event.acceptProposedAction() sim_frame.ui.gvSimulator.dropEvent(drop_event)
Example #8
Source File: test_analysis_tab_GUI.py From urh with GNU General Public License v3.0 | 5 votes |
def test_tree_view_drop_mime_data(self): # Drop signal to new group self.cfc.proto_tree_model.addGroup("Test group") self.assertEqual(len(self.cfc.groups), 2) self.assertEqual(self.cfc.groups[0].num_protocols, 1) self.assertEqual(self.cfc.groups[1].num_protocols, 0) self.cfc.proto_tree_model.update() self.cfc.show() model = self.cfc.proto_tree_model group_1_index = model.index(0, 0, QModelIndex()) signal_index = model.index(0, 0, group_1_index) group_2_index = model.index(1, 0, QModelIndex()) self.assertEqual(group_2_index.internalPointer().group.name, "Test group") mimedata = model.mimeData([signal_index]) model.dropMimeData(mimedata, Qt.MoveAction, 0, 0, group_2_index) self.assertEqual(self.cfc.groups[0].num_protocols, 0) self.assertEqual(self.cfc.groups[1].num_protocols, 1) # Drop group to another position self.assertEqual(self.cfc.groups[0].name, "New Group") self.assertEqual(self.cfc.groups[1].name, "Test group") mimedata = model.mimeData([group_2_index]) model.dropMimeData(mimedata, Qt.MoveAction, 0, 0, group_1_index) self.assertEqual(self.cfc.groups[0].name, "Test group") self.assertEqual(self.cfc.groups[0].num_protocols, 1) self.assertEqual(self.cfc.groups[1].name, "New Group") self.assertEqual(self.cfc.groups[1].num_protocols, 0)
Example #9
Source File: ProtocolTreeModel.py From urh with GNU General Public License v3.0 | 5 votes |
def supportedDragActions(self): return Qt.MoveAction | Qt.CopyAction
Example #10
Source File: dropbox.py From Pythonic with GNU General Public License v3.0 | 5 votes |
def mousePressEvent(self, event): logging.debug('DropBox::mousePressEvent() called: {}'.format(event.pos())) try: mimeData = QMimeData() mimeData.setText(self.type) # load config into memory tmp_config of storabar self.parent.tmp_config = self.config self.parent.tmp_element = self # push config to active workingarea self.parent.loadConfig() except Exception as e: logging.error('DropBox::mousePressEvent() Exception caught: {}'.format(str(e))) return drag = QDrag(self) drag.setHotSpot(event.pos()) drag.setPixmap(self.label.pixmap()) drag.setMimeData(mimeData) if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction: self.close() else: self.show() self.label.setPixmap(self.label.pixmap()) logging.debug('DropBox::mousePressEvent() dropped')
Example #11
Source File: mltools.py From Pythonic with GNU General Public License v3.0 | 5 votes |
def mousePressEvent(self, event): child = self.childAt(event.pos()) if not child: return pixmap = QPixmap(child.pixmap()) mimeData = QMimeData() mimeData.setText(child.type) drag = QDrag(self) drag.setPixmap(child.pixmap()) drag.setMimeData(mimeData) drag.setHotSpot(event.pos() - child.pos()) tempPixmap = QPixmap(pixmap) painter = QPainter() painter.begin(tempPixmap) painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127)) painter.end() child.setPixmap(tempPixmap) if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction: child.close() else: child.show() child.setPixmap(pixmap)
Example #12
Source File: connectivitytools.py From Pythonic with GNU General Public License v3.0 | 5 votes |
def mousePressEvent(self, event): child = self.childAt(event.pos()) if not child: return pixmap = QPixmap(child.pixmap()) mimeData = QMimeData() mimeData.setText(child.type) drag = QDrag(self) drag.setPixmap(child.pixmap()) drag.setMimeData(mimeData) drag.setHotSpot(event.pos() - child.pos()) tempPixmap = QPixmap(pixmap) painter = QPainter() painter.begin(tempPixmap) painter.fillRect(pixmap.rect(), QColor(127, 127, 127, 127)) painter.end() child.setPixmap(tempPixmap) if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction: child.close() else: child.show() child.setPixmap(pixmap)
Example #13
Source File: mainwindow.py From execution-trace-viewer with MIT License | 5 votes |
def dragEnterEvent(self, event): """QMainWindow method reimplementation for file drag.""" event.setDropAction(Qt.MoveAction) super().dragEnterEvent(event) event.accept()
Example #14
Source File: internal_node_creation_panel.py From pyNMS with GNU General Public License v3.0 | 5 votes |
def mousePressEvent(self, event): # retrieve the label child = self.childAt(event.pos()) if not child: return self.controller.mode = 'selection' # update the creation mode to the appropriate subtype self.controller.creation_mode = child.subtype pixmap = QPixmap(child.pixmap().scaled( QSize(50, 50), Qt.KeepAspectRatio, Qt.SmoothTransformation )) mime_data = QtCore.QMimeData() mime_data.setData('application/x-dnditemdata', QtCore.QByteArray()) drag = QtGui.QDrag(self) drag.setMimeData(mime_data) drag.setPixmap(pixmap) drag.setHotSpot(event.pos() - child.pos() + QPoint(-3, -10)) if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction: child.close() else: child.show()
Example #15
Source File: internal_node_creation_panel.py From pyNMS with GNU General Public License v3.0 | 5 votes |
def dragMoveEvent(self, event): if event.mimeData().hasFormat('application/x-dnditemdata'): if event.source() == self: event.setDropAction(Qt.MoveAction) event.accept() else: event.acceptProposedAction() else: event.ignore()
Example #16
Source File: site_panel.py From pyNMS with GNU General Public License v3.0 | 5 votes |
def mousePressEvent(self, event): # retrieve the label child = self.childAt(event.pos()) if not child: return self.controller.mode = 'selection' # update the creation mode to the appropriate subtype self.controller.creation_mode = child.subtype pixmap = QPixmap(child.pixmap().scaled( QSize(50, 50), Qt.KeepAspectRatio, Qt.SmoothTransformation )) mime_data = QtCore.QMimeData() mime_data.setData('application/x-dnditemdata', QtCore.QByteArray()) drag = QtGui.QDrag(self) drag.setMimeData(mime_data) drag.setPixmap(pixmap) drag.setHotSpot(event.pos() - child.pos() + QPoint(-3, -10)) if drag.exec_(Qt.CopyAction | Qt.MoveAction, Qt.CopyAction) == Qt.MoveAction: child.close() else: child.show()
Example #17
Source File: site_panel.py From pyNMS with GNU General Public License v3.0 | 5 votes |
def dragMoveEvent(self, event): if event.mimeData().hasFormat('application/x-dnditemdata'): if event.source() == self: event.setDropAction(Qt.MoveAction) event.accept() else: event.acceptProposedAction() else: event.ignore()
Example #18
Source File: dragbutton.py From python with Apache License 2.0 | 5 votes |
def dropEvent(self, e): position = e.pos() self.button.move(position) e.setDropAction(Qt.MoveAction) e.accept()
Example #19
Source File: dragbutton.py From python with Apache License 2.0 | 5 votes |
def mouseMoveEvent(self, e): if e.buttons() != Qt.RightButton: # 只操作右键事件 return mimeData = QMimeData() drag = QDrag(self) # 创建一个QDrag对象,用来传输MIME-based数据 drag.setMimeData(mimeData) drag.setHotSpot(e.pos() - self.rect().topLeft()) dropAction = drag.exec_(Qt.MoveAction)
Example #20
Source File: layout.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def dragEnterEvent(self, event): if qApp.keyboardModifiers() == Qt.ControlModifier: event.setDropAction(Qt.MoveAction) event.accept() elif qApp.keyboardModifiers() == Qt.ShiftModifier: event.setDropAction(Qt.MoveAction) event.accept() else: event.ignore()
Example #21
Source File: page_widget.py From linux-show-player with GNU General Public License v3.0 | 5 votes |
def dropEvent(self, event): row, column = self._event_index(event) if self.layout().itemAtPosition(row, column) is None: if qApp.keyboardModifiers() == Qt.ControlModifier: event.setDropAction(Qt.MoveAction) event.accept() self.move_drop_event.emit(event.source(), row, column) elif qApp.keyboardModifiers() == Qt.ShiftModifier: event.setDropAction(Qt.CopyAction) self.copy_drop_event.emit(event.source(), row, column) event.accept() event.ignore()