更新目录
|
@ -1,13 +1,13 @@
|
|||
eclipse.preferences.version=1
|
||||
encoding//ActiveX/QAxWidget/\u663E\u793Aword_excel_pdf.py=utf-8
|
||||
encoding//\u4E0B\u62C9\u9009\u62E9\u8054\u52A8/ComboBox.py=utf-8
|
||||
encoding//\u4EBA\u8138\u63CF\u70B9\u68C0\u6D4B/OpencvWidget.py=utf-8
|
||||
encoding//\u5168\u5C40\u70ED\u952E/HotKey.py=utf-8
|
||||
encoding//\u5176\u5B83/C\u548CC++\u6269\u5C55/py\u8F6Cpyd/pydmod.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest1.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest2.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/res_rc.py=utf-8
|
||||
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/textread.py=utf-8
|
||||
encoding//\u5176\u5B83/\u4EBA\u8138\u63CF\u70B9\u68C0\u6D4B/OpencvWidget.py=utf-8
|
||||
encoding//\u5176\u5B83/\u5168\u5C40\u70ED\u952E/HotKey.py=utf-8
|
||||
encoding//\u5176\u5B83/\u7A0B\u5E8F\u91CD\u542F/AutoRestart.py=utf-8
|
||||
encoding//\u5217\u8868/QListView/\u663E\u793A\u81EA\u5B9A\u4E49Widget.py=utf-8
|
||||
encoding//\u5217\u8868/QListView/\u663E\u793A\u81EA\u5B9A\u4E49Widget\u5E76\u6392\u5E8F.py=utf-8
|
||||
|
@ -49,8 +49,6 @@ encoding//\u5B57\u4F53\u6D4B\u8BD5/TestFontAwesome.py=utf-8
|
|||
encoding//\u5B57\u4F53\u6D4B\u8BD5/TestFontRoboto.py=utf-8
|
||||
encoding//\u5DE6\u4FA7\u9009\u9879\u5361/LeftTabWidget.py=utf-8
|
||||
encoding//\u63A2\u6D4B\u7A97\u53E3\u548C\u653E\u5927\u622A\u56FE/\u7B80\u5355\u63A2\u6D4B\u7A97\u53E3\u548C\u653E\u5927\u622A\u56FE.py=utf-8
|
||||
encoding//\u6570\u636E\u5E93\u67E5\u8BE2\u663E\u793A\u8868\u683C/main.py=utf-8
|
||||
encoding//\u6570\u636E\u5E93\u67E5\u8BE2\u663E\u793A\u8868\u683C/mainui.py=utf-8
|
||||
encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/FramelessWindow.py=utf-8
|
||||
encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/Test.py=utf-8
|
||||
encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/win\u65E0\u8FB9\u6846\u8C03\u6574\u5927\u5C0F.py=utf-8
|
||||
|
@ -100,3 +98,5 @@ encoding//\u81EA\u5B9A\u4E49import/main.py=utf-8
|
|||
encoding//\u81EA\u5B9A\u4E49import/src/test.py=utf-8
|
||||
encoding//\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5/\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5.py=utf-8
|
||||
encoding//\u83DC\u5355/\u83DC\u5355\u591A\u9009\u4E0D\u5173\u95ED.py=utf-8
|
||||
encoding//\u8868\u683C/QTableWidget/\u6570\u636E\u5E93\u67E5\u8BE2\u663E\u793A\u8868\u683C/main.py=utf-8
|
||||
encoding//\u8868\u683C/QTableWidget/\u6570\u636E\u5E93\u67E5\u8BE2\u663E\u793A\u8868\u683C/mainui.py=utf-8
|
||||
|
|
10
README.md
|
@ -40,6 +40,8 @@
|
|||
|
||||
### 1、[QTableWidget](表格/QTableWidget)
|
||||
|
||||
1. [数据库查询显示表格](表格/QTableWidget/数据库查询显示表格)
|
||||
|
||||
### 2、[QTreeView](表格/QTableView)
|
||||
|
||||
1. [表格内容复制](表格/QTableView/表格内容复制.py)
|
||||
|
@ -64,8 +66,12 @@
|
|||
|
||||
3. [简单的窗口贴边隐藏](窗口/简单的窗口贴边隐藏.py)
|
||||
|
||||
4. [嵌入外部窗口](窗口/嵌入外部窗口.py)
|
||||
|
||||
## 多页面
|
||||
|
||||
### 1、[仿QQ设置面板](多页面/仿QQ设置面板)
|
||||
|
||||
## 多线程
|
||||
|
||||
### 1、[线程挂起恢复](多线程/线程挂起恢复)
|
||||
|
@ -112,6 +118,10 @@
|
|||
|
||||
### 5、[调用截图dll(只能用32位)](其它/调用截图dll(只能用32位))
|
||||
|
||||
### 6、[全局热键](其它/全局热键)
|
||||
|
||||
### 7、[人脸描点检测](其它/人脸描点检测)
|
||||
|
||||
### I、 项目型
|
||||
[Qt皮肤生成器 - 持续更新中](https://github.com/892768447/QtSkin)
|
||||
|
||||
|
|
Before Width: | Height: | Size: 306 KiB After Width: | Height: | Size: 306 KiB |
Before Width: | Height: | Size: 245 KiB After Width: | Height: | Size: 245 KiB |
|
@ -1,11 +0,0 @@
|
|||
# 内嵌外部窗口
|
||||
|
||||
### 原理思路:
|
||||
- 1.使用SetParent函数设置外部窗口的parent为Qt的窗口
|
||||
- 2.Qt使用QWidget.createWindowContainer(QWindow.fromWinId(窗口ID))生成QWidget
|
||||
- 3.使用GetWindowLong得到原来窗口的样式属性(style = win32gui.GetWindowLong(hwnd, win32con.GWL_STYLE)和exstyle = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE))
|
||||
- 4.这里还原窗口后不会显示,用spy++发现没有了WS_VISIBLE样式(未解决)
|
||||
|
||||
截图
|
||||
|
||||
![1](ScreenShot/1.gif)
|
14
窗口/README.md
|
@ -32,3 +32,17 @@
|
|||
- 1.mouseReleaseEvent,鼠标弹起事件,用于判断是否需要隐藏窗口
|
||||
- 1.enterEvent,鼠标进入事件,用于窗口隐藏后,是否需要暂时显示预览
|
||||
- 1.leaveEvent,鼠标离开事件,用于窗口暂时显示后自动隐藏效果
|
||||
|
||||
|
||||
|
||||
# 内嵌外部窗口
|
||||
|
||||
### 原理思路:
|
||||
- 1.使用SetParent函数设置外部窗口的parent为Qt的窗口
|
||||
- 2.Qt使用QWidget.createWindowContainer(QWindow.fromWinId(窗口ID))生成QWidget
|
||||
- 3.使用GetWindowLong得到原来窗口的样式属性(style = win32gui.GetWindowLong(hwnd, win32con.GWL_STYLE)和exstyle = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE))
|
||||
- 4.这里还原窗口后不会显示,用spy++发现没有了WS_VISIBLE样式(未解决)
|
||||
|
||||
截图
|
||||
|
||||
![1](ScreenShot/嵌入外部窗口.gif)
|
Before Width: | Height: | Size: 344 KiB After Width: | Height: | Size: 344 KiB |
|
@ -1,93 +1,93 @@
|
|||
from PyQt5.QtGui import QWindow
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListWidget,\
|
||||
QLabel
|
||||
import win32con
|
||||
import win32gui
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Window, self).__init__(*args, **kwargs)
|
||||
self.resize(800, 600)
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
self.myhwnd = int(self.winId()) # 自己的句柄
|
||||
|
||||
layout.addWidget(QPushButton('获取所有可用、可视窗口', self,
|
||||
clicked=self._getWindowList, maximumHeight=30))
|
||||
layout.addWidget(
|
||||
QLabel('双击列表中的项目则进行嵌入目标窗口到下方\n格式为:句柄|父句柄|标题|类名', self, maximumHeight=30))
|
||||
self.windowList = QListWidget(
|
||||
self, itemDoubleClicked=self.onItemDoubleClicked, maximumHeight=200)
|
||||
layout.addWidget(self.windowList)
|
||||
|
||||
def closeEvent(self, event):
|
||||
"""窗口关闭"""
|
||||
if self.layout().count() == 4:
|
||||
self.restore()
|
||||
super(Window, self).closeEvent(event)
|
||||
|
||||
def _getWindowList(self):
|
||||
"""清空原来的列表"""
|
||||
self.windowList.clear()
|
||||
win32gui.EnumWindows(self._enumWindows, None)
|
||||
|
||||
def onItemDoubleClicked(self, item):
|
||||
"""列表双击选择事件"""
|
||||
# 先移除掉item
|
||||
self.windowList.takeItem(self.windowList.indexFromItem(item).row())
|
||||
hwnd, phwnd, _, _ = item.text().split('|')
|
||||
# 开始嵌入
|
||||
|
||||
if self.layout().count() == 4:
|
||||
# 如果数量等于4说明之前已经嵌入了一个窗口,现在需要把它释放出来
|
||||
self.restore()
|
||||
hwnd, phwnd = int(hwnd), int(phwnd)
|
||||
# 嵌入之前的属性
|
||||
style = win32gui.GetWindowLong(hwnd, win32con.GWL_STYLE)
|
||||
exstyle = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
|
||||
print('save', hwnd, style, exstyle)
|
||||
|
||||
widget = QWidget.createWindowContainer(QWindow.fromWinId(hwnd))
|
||||
widget.hwnd = hwnd # 窗口句柄
|
||||
widget.phwnd = phwnd # 父窗口句柄
|
||||
widget.style = style # 窗口样式
|
||||
widget.exstyle = exstyle # 窗口额外样式
|
||||
self.layout().addWidget(widget)
|
||||
|
||||
def restore(self):
|
||||
"""归还窗口"""
|
||||
# 有bug,归还后窗口没有了WS_VISIBLE样式,不可见
|
||||
widget = self.layout().itemAt(3).widget()
|
||||
print('restore', widget.hwnd, widget.style, widget.exstyle)
|
||||
win32gui.SetParent(widget.hwnd, widget.phwnd) # 让它返回它的父窗口
|
||||
win32gui.SetWindowLong(
|
||||
widget.hwnd, win32con.GWL_STYLE, widget.style | win32con.WS_VISIBLE) # 恢复样式
|
||||
win32gui.SetWindowLong(
|
||||
widget.hwnd, win32con.GWL_EXSTYLE, widget.exstyle) # 恢复样式
|
||||
win32gui.ShowWindow(
|
||||
widget.hwnd, win32con.SW_SHOW) # 显示窗口
|
||||
widget.close()
|
||||
self.layout().removeWidget(widget) # 从布局中移出
|
||||
widget.deleteLater()
|
||||
|
||||
def _enumWindows(self, hwnd, _):
|
||||
"""遍历回调函数"""
|
||||
if hwnd == self.myhwnd:
|
||||
return # 防止自己嵌入自己
|
||||
if win32gui.IsWindow(hwnd) and win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
|
||||
phwnd = win32gui.GetParent(hwnd)
|
||||
title = win32gui.GetWindowText(hwnd)
|
||||
name = win32gui.GetClassName(hwnd)
|
||||
self.windowList.addItem(
|
||||
'{0}|{1}|\t标题:{2}\t|\t类名:{3}'.format(hwnd, phwnd, title, name))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
||||
from PyQt5.QtGui import QWindow
|
||||
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QPushButton, QListWidget,\
|
||||
QLabel
|
||||
import win32con
|
||||
import win32gui
|
||||
|
||||
|
||||
class Window(QWidget):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Window, self).__init__(*args, **kwargs)
|
||||
self.resize(800, 600)
|
||||
layout = QVBoxLayout(self)
|
||||
|
||||
self.myhwnd = int(self.winId()) # 自己的句柄
|
||||
|
||||
layout.addWidget(QPushButton('获取所有可用、可视窗口', self,
|
||||
clicked=self._getWindowList, maximumHeight=30))
|
||||
layout.addWidget(
|
||||
QLabel('双击列表中的项目则进行嵌入目标窗口到下方\n格式为:句柄|父句柄|标题|类名', self, maximumHeight=30))
|
||||
self.windowList = QListWidget(
|
||||
self, itemDoubleClicked=self.onItemDoubleClicked, maximumHeight=200)
|
||||
layout.addWidget(self.windowList)
|
||||
|
||||
def closeEvent(self, event):
|
||||
"""窗口关闭"""
|
||||
if self.layout().count() == 4:
|
||||
self.restore()
|
||||
super(Window, self).closeEvent(event)
|
||||
|
||||
def _getWindowList(self):
|
||||
"""清空原来的列表"""
|
||||
self.windowList.clear()
|
||||
win32gui.EnumWindows(self._enumWindows, None)
|
||||
|
||||
def onItemDoubleClicked(self, item):
|
||||
"""列表双击选择事件"""
|
||||
# 先移除掉item
|
||||
self.windowList.takeItem(self.windowList.indexFromItem(item).row())
|
||||
hwnd, phwnd, _, _ = item.text().split('|')
|
||||
# 开始嵌入
|
||||
|
||||
if self.layout().count() == 4:
|
||||
# 如果数量等于4说明之前已经嵌入了一个窗口,现在需要把它释放出来
|
||||
self.restore()
|
||||
hwnd, phwnd = int(hwnd), int(phwnd)
|
||||
# 嵌入之前的属性
|
||||
style = win32gui.GetWindowLong(hwnd, win32con.GWL_STYLE)
|
||||
exstyle = win32gui.GetWindowLong(hwnd, win32con.GWL_EXSTYLE)
|
||||
print('save', hwnd, style, exstyle)
|
||||
|
||||
widget = QWidget.createWindowContainer(QWindow.fromWinId(hwnd))
|
||||
widget.hwnd = hwnd # 窗口句柄
|
||||
widget.phwnd = phwnd # 父窗口句柄
|
||||
widget.style = style # 窗口样式
|
||||
widget.exstyle = exstyle # 窗口额外样式
|
||||
self.layout().addWidget(widget)
|
||||
|
||||
def restore(self):
|
||||
"""归还窗口"""
|
||||
# 有bug,归还后窗口没有了WS_VISIBLE样式,不可见
|
||||
widget = self.layout().itemAt(3).widget()
|
||||
print('restore', widget.hwnd, widget.style, widget.exstyle)
|
||||
win32gui.SetParent(widget.hwnd, widget.phwnd) # 让它返回它的父窗口
|
||||
win32gui.SetWindowLong(
|
||||
widget.hwnd, win32con.GWL_STYLE, widget.style | win32con.WS_VISIBLE) # 恢复样式
|
||||
win32gui.SetWindowLong(
|
||||
widget.hwnd, win32con.GWL_EXSTYLE, widget.exstyle) # 恢复样式
|
||||
win32gui.ShowWindow(
|
||||
widget.hwnd, win32con.SW_SHOW) # 显示窗口
|
||||
widget.close()
|
||||
self.layout().removeWidget(widget) # 从布局中移出
|
||||
widget.deleteLater()
|
||||
|
||||
def _enumWindows(self, hwnd, _):
|
||||
"""遍历回调函数"""
|
||||
if hwnd == self.myhwnd:
|
||||
return # 防止自己嵌入自己
|
||||
if win32gui.IsWindow(hwnd) and win32gui.IsWindowVisible(hwnd) and win32gui.IsWindowEnabled(hwnd):
|
||||
phwnd = win32gui.GetParent(hwnd)
|
||||
title = win32gui.GetWindowText(hwnd)
|
||||
name = win32gui.GetClassName(hwnd)
|
||||
self.windowList.addItem(
|
||||
'{0}|{1}|\t标题:{2}\t|\t类名:{3}'.format(hwnd, phwnd, title, name))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
import sys
|
||||
from PyQt5.QtWidgets import QApplication
|
||||
app = QApplication(sys.argv)
|
||||
w = Window()
|
||||
w.show()
|
||||
sys.exit(app.exec_())
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
|
@ -17,7 +17,7 @@ from sqlalchemy.orm.session import sessionmaker
|
|||
from sqlalchemy.sql.expression import and_
|
||||
from sqlalchemy.sql.schema import Column
|
||||
from sqlalchemy.sql.sqltypes import Integer, Text
|
||||
from 数据库查询显示表格.mainui import Ui_Form
|
||||
from mainui import Ui_Form
|
||||
|
||||
__Author__ = """By: Irony
|
||||
QQ: 892768447
|