-
-
Notifications
You must be signed in to change notification settings - Fork 2k
一些汇总 #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
一些汇总 #28
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6fdceac
高亮文本
625781186 f822a38
comboBox自定义下拉list
625781186 a1bf5e6
调用 截图dll(只能用32位)
625781186 6735013
截图dll (只能用32位python)
625781186 3c19dec
treeWidget 支持拖拽 并改变图标样式
625781186 9b9b91d
QWebEngine开启 控制台 扩展工具
625781186 0b1c059
遗漏的目录
625781186 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
105 changes: 105 additions & 0 deletions
partner_625781186/12.1拖拽显示为图片/Custom_DND_image.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
#!/usr/bin/env python2 | ||
import os | ||
import sys | ||
import re | ||
|
||
from PyQt5 import QtGui, QtCore, QtWidgets | ||
from PyQt5.Qt import QDir | ||
|
||
from PyQt5 import QtGui, QtWidgets, QtCore, QtWinExtras | ||
from PyQt5.QtCore import * | ||
from PyQt5.QtGui import * | ||
from PyQt5.QtWidgets import * | ||
|
||
""" | ||
Created on $date$ <br> | ||
description: 树视图支持拖拽 并改变图标样式 <br> | ||
author: 东love方 <br> | ||
|
||
""" | ||
|
||
class MyTreeWidget(QTreeWidget): | ||
|
||
def mouseMoveEvent_xxx(self, e): | ||
mimeData = QtCore.QMimeData() | ||
drag = QDrag(self) | ||
drag.setMimeData(mimeData) | ||
|
||
# pixmap = QPixmap() | ||
# drag.setPixmap(pixmap) | ||
|
||
# drag.setHotSpot(e.pos()) | ||
|
||
# QTreeWidget.mouseMoveEvent(self,e) | ||
drag.exec_(QtCore.Qt.MoveAction) | ||
|
||
def dropEvent(self, e): | ||
QTreeWidget.dropEvent(self, e) | ||
self.expandAll() | ||
e.accept() | ||
|
||
def startDrag(self, supportedActions): | ||
listsQModelIndex = self.selectedIndexes() | ||
if listsQModelIndex: | ||
dataQMimeData = self.model().mimeData(listsQModelIndex) | ||
if not dataQMimeData: | ||
return None | ||
dragQDrag = QDrag(self) | ||
dragQDrag.setPixmap( | ||
QPixmap(QDir.currentPath() + "/if_Cursor_drag_arrow_103039.png")) # <- For put your | ||
# custom image here | ||
dragQDrag.setMimeData(dataQMimeData) | ||
defaultDropAction = QtCore.Qt.IgnoreAction | ||
if ((supportedActions & QtCore.Qt.CopyAction) and (self.dragDropMode() != QAbstractItemView.InternalMove)): | ||
defaultDropAction = QtCore.Qt.CopyAction | ||
dragQDrag.exec_(supportedActions, defaultDropAction) | ||
|
||
|
||
class TheUI(QDialog): | ||
|
||
def __init__(self, args=None, parent=None): | ||
super(TheUI, self).__init__(parent) | ||
self.layout = QVBoxLayout(self) | ||
treeWidget = MyTreeWidget() | ||
|
||
button = QPushButton('Add') | ||
self.layout.addWidget(treeWidget) | ||
self.layout.addWidget(button) | ||
treeWidget.setHeaderHidden(True) | ||
|
||
self.treeWidget = treeWidget | ||
self.button = button | ||
self.button.clicked.connect(lambda *x: self.addCmd()) | ||
|
||
HEADERS = ("script", "chunksize", "mem") | ||
self.treeWidget.setHeaderLabels(HEADERS) | ||
self.treeWidget.setColumnCount(len(HEADERS)) | ||
|
||
self.treeWidget.setColumnWidth(0, 160) | ||
self.treeWidget.header().show() | ||
|
||
self.treeWidget.setDragDropMode(QAbstractItemView.InternalMove) | ||
|
||
self.resize(500, 500) | ||
for i in range(6): | ||
item = self.addCmd(i) | ||
if i in (3, 4): | ||
self.addCmd('%s-1' % i, parent=item) | ||
|
||
self.treeWidget.expandAll() | ||
self.setStyleSheet("QTreeWidget::item{ height: 30px; }") | ||
|
||
def addCmd(self, i, parent=None): | ||
'add a level to tree widget' | ||
|
||
root = self.treeWidget.invisibleRootItem() | ||
if not parent: | ||
parent = root | ||
item = QTreeWidgetItem(parent, ['script %s' % i, '1', '150']) | ||
return item | ||
|
||
if __name__ == '__main__': | ||
app = QApplication(sys.argv) | ||
gui = TheUI() | ||
gui.show() | ||
app.exec_() |
4 changes: 4 additions & 0 deletions
partner_625781186/12.1拖拽显示为图片/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 12.1拖拽显示为图片 | ||
|
||
|
||
 |
Binary file added
partner_625781186/12.1拖拽显示为图片/ScreenShot/1.gif
Binary file added
partner_625781186/12.1拖拽显示为图片/if_Cursor_drag_arrow_103039.png
4 changes: 4 additions & 0 deletions
partner_625781186/13.combo_listwidget/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# comboxBox 自定义下拉 | ||
|
||
|
||
 |
Binary file added
partner_625781186/13.combo_listwidget/ScreenShot/1.gif
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.