Details
Description
If the user call pyside6-designer living in a virtual environment directly without activating the environment via scripts (e.g. activate.ps1), no custom widgets (& plugins) is loaded.
However, if I manually set the VIRTUAL_ENV environment variable and then invoke pyside6-designer directly, it correctly loads the plugins.
Though it is unusual to invoke Qt tools living in a virtual environment directly without activating the environment first, this defeats the possibilities to integrate the tool scripts into editor extension or other services. Also, checking if the current Python is in a virtual environment by checking the VIRTUAL_ENV environment variable is unreliable, which is mentioned in the official documentation: https://docs.python.org/3/library/venv.html#how-venvs-work. Namely, we should not use VIRTUAL_ENV at all in pyside-tools/pyside_tool.py and pyside-tools/deploy_lib/python_helper.py (https://github.com/search?q=repo%3Aqtproject%2Fpyside-pyside-setup%20VIRTUAL_ENV&type=code). Checking sys.prefix == sys.base_prefix might be an alternative here (https://stackoverflow.com/questions/1871549/determine-if-python-is-running-inside-virtualenv).