Aqao
July 22, 2022, 5:27am
1
I’m developing a plugin.It is possible to quickly make any docker appear under the mouse.But it can’t remember the position of tabs.
Just like this:
Docker was previously displayed in the panel, after finishing floating and docked I want it to still display, instead of being hidden.
QTabBar.cureentIndex
Changing this property can modify the displayed tabs, but I can’t find a way to get QTabBar object.
If you know how to fix it please tell me.
1 Like
AkiR
July 22, 2022, 7:00am
2
QWidget.raise_() works with QTabBar tabs, simply just raise widget at tab to make tab current.
from krita import (
Krita,)
from PyQt5.QtGui import (
QCursor,)
def floatify_docker(docker_name):
app = Krita.instance()
docker = next((d for d in app.dockers() if d.objectName() == docker_name), None)
docker.setFloating(True)
docker.move(QCursor.pos())
docker.setVisible(True)
docker.raise_() # raise docker above other windows
def unfloatify_docker(docker_name):
app = Krita.instance()
docker = next((d for d in app.dockers() if d.objectName() == docker_name), None)
docker.setFloating(False)
docker.raise_() # raise docker above other tabs
# testing
from PyQt5.QtCore import (
QTimer,)
def print_docker_info():
app = Krita.instance()
for d in app.dockers():
print(f'docker name = "{d.objectName()}"\n'
f'docker title = "{d.windowTitle()}"\n'
f'is floating = {d.isFloating()}\n'
f'is visible = {d.isVisible()}\n')
# print names of all dockers
print_docker_info()
# floatify SpecificColorSelector
floatify_docker('SpecificColorSelector')
# 5000 milliseconds later, unfloatify SpecificColorSelector
QTimer.singleShot(5000, lambda : unfloatify_docker('SpecificColorSelector'))
/AkiR
2 Likes
This is very useful. Seeing Shade maker plugin appear near mouse would be great.
1 Like
you can grab the child widget of the docker rather than the qdockwidget itself. this will leave the tabs alone.
Aqao
July 22, 2022, 12:45pm
5
This is good, thank your code.
1 Like
Ransom
July 22, 2022, 4:48pm
7
This is very useful. Seeing Shade maker plugin appear near mouse would be great.
Thanks for mentioning this, it seems feasible. I’ll keep it in mind for the next update!
Additionally, perhaps @Aqao 's solution will also be useful to you.
1 Like