-
Notifications
You must be signed in to change notification settings - Fork 10
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
multi-screen setPositionRelativeToWidget not correct #22
Comments
Hi, thanks for opening this issue. I see your point, but I'm not able to reproduce this issue for some reason. When I call |
Hi, thanks for quit reply. Here is the minimal example. import sys
from PySide6.QtWidgets import QWidget, QApplication, QPushButton, QVBoxLayout, QLabel
from pyqttoast import Toast
class Win(QWidget):
def __init__(self):
super().__init__()
self.resize(800, 600)
layout = QVBoxLayout()
self._label = QLabel("text", self)
layout.addWidget(self._label, stretch=1)
self._btn = QPushButton("click me", self)
self._btn.clicked.connect(self._on_btn_clicked)
layout.addWidget(self._btn)
self.setLayout(layout)
def _on_btn_clicked(self):
toast = Toast()
# FIXME: the problem is here, relative to a sub-widget
toast.setPositionRelativeToWidget(self._label)
toast.setDuration(5000)
toast.setText("I am in primary screen")
toast.show()
def main():
app = QApplication(sys.argv)
screens = app.screens()
# we need two screens to reveal the bug
assert len(screens) > 1
screen = screens[1]
win = Win()
win.setScreen(screen)
win.move(screen.geometry().topLeft())
win.show()
app.exec()
if __name__ == '__main__':
main() |
Thanks, now I understand. I was only thinking about top level widgets where mapping to global isn't necessary. |
Hi,
Thanks for your great job!
When __position_relative_to_widget is not on primaryScreen, the toast will be in wrong screen.
i think we need a global rect here, but according to qt doc
so, maybe the code should be changed to
The text was updated successfully, but these errors were encountered: