[PyQt] QTabWidget tabBar refresh?

Matic Kukovec kukovecmatic at hotmail.com
Tue May 7 20:29:06 BST 2019


Il giorno mar 7 mag 2019 alle ore 20:11 Matic Kukovec <kukovecmatic at hotmail.com<mailto:kukovecmatic at hotmail.com>> ha scritto:
Sure, here is my working example, as it is a bit more code.

Thanks again

I just had a quick look at your code, and it seems like the only issue is in the Type argument of the QMouseEvent you create at line 113: as the doc reports, "The type parameter must be one of QEvent::MouseButtonPress, QEvent::MouseButtonRelease, QEvent::MouseButtonDblClick, or QEvent::MouseMove"; so, using PolishRequest is wrong: the QTabBar wouldn't recognize it and then wouldn't react to it in the right way.
After changing it to MouseMove, it works as expected. The only thing you might need after this is to add a tabBar.update() after the drag.exec_(), but it might be even better to do an unpolish/polish of the style:

        self.style().unpolish(tabBar)
        self.style().polish(tabBar)

Hope this helps.

Maurizio

Thanks Mauricio, works like a charm!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20190507/cf86d3c3/attachment-0001.html>


More information about the PyQt mailing list