techartorg / bqt

A Blender add-on to support & manage Qt Widgets in Blender (PySide2)
https://github.com/techartorg/bqt/wiki
Mozilla Public License 2.0
161 stars 23 forks source link

auto close same widget #88

Closed hannesdelbeke closed 1 year ago

hannesdelbeke commented 1 year ago

now that we can manage widgets with bqt.add, add feature to not open a new widget, if the widget is already open.

instead set widget active. can be done based on name? forcing devs to use a nice qt name for their tools

hannesdelbeke commented 1 year ago
from PySide2.QtWidgets import QApplication, QMainWindow, QPushButton

app = QApplication([])
window = QMainWindow()

button = QPushButton("Click me", window, objectName="jezus")

window.show()
app.exec_()
hannesdelbeke commented 1 year ago

objectame is always unique, and makes for nicer print statements when debugging. we can use this to compare

hannesdelbeke commented 1 year ago

test widget, paste in blender console, assumes bqt is active

from PySide2.QtWidgets import QWidget, QSlider, QVBoxLayout, QApplication

widget = QWidget(objectName="sliderboy")
slider = QSlider()
layout = QVBoxLayout()
layout.addWidget(slider)
widget.setLayout(layout)
widget.show()