-
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
Exchange Qt code file with a file from Qt Designer #175
Comments
Before working on this, it would be good to understand better how magicgui and qt can be combined. E.g. designing a pulldown with all image layers that are open in Napari might be tricky with the Qt designer, however it's a one-liner using magicgui. |
@haesleinhuepf, I think @jo-mueller combined Designer with magicgui in napari-stress, it is possible to "reserve" some space for magicgui widgets that are added then later if I got the explanation right :) |
But how can I include a magicgui-based pulldown into a user-interface that comes from a .ui file? |
I do it here, for instance. The general code base doesn't change that much and follows the following pattern: class my_widget(QWidget):
def __init__(self, napari_viewer):
super().__init__()
self.viewer = napari_viewer
uic.loadUi(os.path.join(Path(__file__).parent, './toolbox.ui'), self) # this loads the ui file
# this adds a magicgui widget to the widget
self.image_layer_select = create_widget(annotation=Image, label="Image_layer")
self.layout().addWidget(self.image_layer_select.native, 0, 1) In principle, the The only thing to be kept in mind is to leave a blank space in the designer (i.e. an empty widget) where the magicgui should later go. |
That's the interesting part! How can I replace an empty widget, that was created using the designer, with a magicgui generated widget? I imagine it's hard to replace a widget in the middle of other widgets surrounded by buttons and tabs with a custom widget and make sure the magicgui functionality still works. Do you think it makes sense to demonstrate this in a short blog post? 🙃 |
https://doc.qt.io/qt-6/qtdesigner-manual.html
The text was updated successfully, but these errors were encountered: