0

with pyside(qt4) I can use QDeclarativeView make character be transparent easily .

like this image

enter image description here

I can also drag these text by click the character accurately

from PySide.QtCore import Qt
from PySide.QtGui import QApplication, QWidget, QMenu, QSystemTrayIcon
from PySide.QtDeclarative import QDeclarativeView


app = QApplication([])

tray = QSystemTrayIcon()
menu = QMenu()
menu.addAction("Quit").triggered.connect(app.quit)
tray.setContextMenu(menu)

view = QDeclarativeView()
view.setSource('main.qml')
view.setAttribute(Qt.WA_TranslucentBackground)

view.setStyleSheet("background-color:transparent")
view.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
view.showFullScreen()

tray.show()

app.exec_()

the qml code here

I tried to use QQuickView and QQuickWidget in Pyside2 with the same code.And I can't make the mouse event pass through the window.

Edit:

still not solved. related to

QQuickView (QML) transparent for mouse events

How to make a "True Transparent" window to cursor, preferably on a pure QML? (Qt 5.7)

I also tried Qt.WA_TransparentForMouseEvents but this will transparent every thing of the qml file.

  • What do you mean by *make the mouse event pass through the window.*? – eyllanesc Mar 13 '20 at 06:47
  • It means that my left mouse button and right mouse button can pass through the transparent blank part of the QML component, sorry for my formulation. I use google translation – Junyuan Luo Mar 13 '20 at 06:59
  • How strange, I have tested it on Arch Linux with a KDE window manager and I don't see that happening. In which OS and what is the window manager you use? – eyllanesc Mar 13 '20 at 07:11
  • @eyllanesc I use win10. I can only make a [transparent window](https://i.loli.net/2020/03/13/vb59JnOHiRqyd8g.png) but mouse can't cross it. test file: [qml](https://paste.ubuntu.com/p/Rw4K3vGbVG/) [py](https://paste.ubuntu.com/p/W4jwGzCVqG/) – Junyuan Luo Mar 13 '20 at 08:24
  • And with pyside can you make it transparent to the mouse? – eyllanesc Mar 13 '20 at 08:27
  • @eyllanesc Yes, use QDeclarativeView can archieve [this](https://i.loli.net/2020/03/13/lE3KBpdaQ1r5Um7.png) – Junyuan Luo Mar 13 '20 at 08:34

0 Answers0