Qt实现窗口自动隐藏
来源:互联网 发布:平板软件市场hd 编辑:程序博客网 时间:2024/05/01 12:31
将窗口拖到窗口最上方,或最左方,移开鼠标,窗口自动隐藏。
将鼠标移到窗口边界,窗口自动弹出,类音速启动效果
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class Geometry(QDialog):
def __init__ (self):
QDialog.__init__(self)
self.frame=1
layout=QGridLayout(self)
btnAbout=QToolButton()
btnAbout.setText('About Qt')
btnAbout.setIcon(QIcon('hjz.png'))
btnAbout.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
layout.addWidget(btnAbout,0,0,Qt.AlignTop|Qt.AlignLeft)
self.connect(btnAbout,SIGNAL('clicked()'),self.slotAbout)
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.resize(300,200)
self.show()
def slotAbout(self):
QMessageBox.aboutQt(self)
def enterEvent(self, evt):
self.activateWindow()
if(self.x() == self.frame-self.width()):
self.move(-self.frame,self.y())
elif(self.y() == self.frame-self.height()+self.y()-self.geometry().y()):
self.move(self.x(),-self.frame)
def leaveEvent(self,evt):
cx,cy=QCursor.pos().x(),QCursor.pos().y()
if(cx >= self.x() and cx <= self.x()+self.width()
and cy >= self.y() and cy <= self.geometry().y()):
return#title bar
elif(self.x() < 0 and QCursor.pos().x()>0):
self.move(self.frame-self.width(),self.y())
elif(self.y() < 0 and QCursor.pos().y()>0):
self.move(self.x(), self.frame-self.height()+self.y()-self.geometry().y())
if __name__=='__main__':
app=QApplication([])
win=Geometry()
app.setActiveWindow(win)
app.exec_()
将鼠标移到窗口边界,窗口自动弹出,类音速启动效果
from PyQt4.QtGui imp
from PyQt4.QtCore imp
class Geometry(QDialog):
def __init__ (self):
QDialog.__init__(self)
self.frame=1
layout=QGridLayout(self)
btnAbout=QToolButton()
btnAbout.setText('About Qt')
btnAbout.setIcon(QIcon('hjz.png'))
btnAbout.setToolButtonStyle(Qt.ToolButtonTextUnderIcon)
layout.addWidget(btnAbout,0,0,Qt.AlignTop|Qt.AlignLeft)
self.connect(btnAbout,SIGNAL('clicked()'),self.slotAbout)
self.setWindowFlags(Qt.WindowStaysOnTopHint)
self.resize(300,200)
self.show()
def slotAbout(self):
QMessageBox.aboutQt(self)
def enterEvent(self, evt):
self.activateWindow()
if(self.x() == self.frame-self.width()):
self.move(-self.frame,self.y())
elif(self.y() == self.frame-self.height()+self.y()-self.geometry().y()):
self.move(self.x(),-self.frame)
def leaveEvent(self,evt):
cx,cy=QCursor.pos().x(),QCursor.pos().y()
if(cx >= self.x() and cx <= self.x()+self.width()
and cy >= self.y() and cy <= self.geometry().y()):
return#title bar
elif(self.x() < 0 and QCursor.pos().x()>0):
self.move(self.frame-self.width(),self.y())
elif(self.y() < 0 and QCursor.pos().y()>0):
self.move(self.x(), self.frame-self.height()+self.y()-self.geometry().y())
if __name__=='__main__':
app=QApplication([])
win=Geometry()
app.setActiveWindow(win)
app.exec_()
- Qt实现窗口自动隐藏
- c# winform 窗口实现自动隐藏
- Qt窗口像QQ在屏幕顶端自动隐藏
- Java实现窗体隐藏,功能类似于QQ窗口自动隐藏
- QT实现控件自动适合窗口大小
- QT窗口隐藏
- qt窗口贴边隐藏
- 隐藏QT窗口边框 并且在隐藏后实现窗口拖拽 同时实现透明度
- 隐藏QT窗口边框 并且在隐藏后实现窗口拖拽 同时实现透明度
- 转:隐藏QT窗口边框 并且在隐藏后实现窗口拖拽
- VB.net实现窗口启动时的自动隐藏
- 用WPF实现鼠标移开窗口自动隐藏
- 用WPF实现鼠标移开窗口自动隐藏
- C#实现仿QQ窗口靠边自动隐藏
- qt窗口自动delete
- qt 窗口最小化后隐藏
- QT 窗口最小化后隐藏
- qt怎样隐藏dos窗口
- Raising Modulo Numbers 解题报告
- c#使用post,get请求网页
- poj 3126Prime Path
- 电商创新模式-食品类-LoveWithFood:每月送来一份惊喜的另类电商
- GridSplitter的使用
- Qt实现窗口自动隐藏
- Winfrom c# 两个ComboBox互相联动
- struts2 访问静态常量,静态方法
- linux下vim命令详解
- iBatis配置详解
- Canvas API
- 作为软件工程师,你必须知道的20个常识
- Qt实现当鼠标移动到窗体上,窗体由半透明变为不透明
- POJ 2255 Tree Recovery