Skip to content
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

loadUiType usage #237

Closed
Ahuge opened this issue Aug 23, 2017 · 4 comments
Closed

loadUiType usage #237

Ahuge opened this issue Aug 23, 2017 · 4 comments

Comments

@Ahuge
Copy link
Collaborator

Ahuge commented Aug 23, 2017

Hey,

I'm going over some code that we are converting and it uses loadUiType instead of loadUi.

In the examples folder there is some code to implement a load_ui_type wrapper it looks like.

Do you have any plans for that code to make it's way into the core Qt.py module?

@fredrikaverpil
Copy link
Collaborator

fredrikaverpil commented Aug 23, 2017

Do you have any plans for that code to make it's way into the core Qt.py module?

We already support one way of importing .ui files which doesn't require uic or pysideuic; QtCompat.loadUi. We'd like to steer users in this direction since e.g. older Nuke versions doesn't come with pysideuic. I'd be hesitant to implement loadUiType support, to be honest, and I would strongly suggest trying to use QtCompat.loadUi instead, if possible.

@Ahuge However, I'd be happy to know more if you are unable to use QtCompat.loadUi for some reason.

Those examples you found are "leftovers" from implementing Qt.load_ui (now QtCompat.loadUi). Initially, we didn't want to maintain such code but still wanted to provide some alternatives to users who wanted to load .ui files, and so we kept them in the "examples" folder.

I see we should update the README for loadUi:

mapped to a convenience function in Qt.py called loadUi (part of the QtCompat module; QtCompat.loadUi). This function only accepts the filename argument of the .ui file.

This is no longer true, as QtCompat.loadUi does indeed support a baseinstance argument as well.

@dgovil
Copy link
Contributor

dgovil commented Aug 29, 2017

IMHO I'm trying to steer people away from loadUiType towards simply loadUi because it's a lot cleaner to use and implement.

loadUi unfortunately has a slightly higher overhead though if you're instantiating many ui objects because it's loaded multiple times whereas loadUiType can be loaded once in a module and reused.
I'm not sure how many people are really using that to their advantage though because I have yet to encounter it.

@Ahuge
Copy link
Collaborator Author

Ahuge commented Aug 29, 2017

Yeah I did some looking into it for our usage cases and we can just use loadUi.

Thanks for the explanation

@fredrikaverpil
Copy link
Collaborator

Cool. I'll close this then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants