Syntax - passing "x.ui" file to uic ?
-
I am using "qt5-tools" with "uic" options and I need to add a variable ui file to let "uic" to convert it to C++ code.
I did check uic --help , however, I do not know how to add "variable file" argument to the "uic".
"qt5-tools uic [variable file ui ?? ]"
I need help with actual syntax.
Help would be greatly appreciated
Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. -v, --version Displays version information. -d, --dependencies Display the dependencies. -o, --output <file> Place the output into <file> -a, --no-autoconnection Do not generate a call to QObject::connectSlotsByName(). -p, --no-protection Disable header protection. -n, --no-implicit-includes Disable generation of #include-directives. -s, --no-stringliteral Deprecated. The use of this option won't take any effect. --postfix <postfix> Postfix to add to all generated classnames. --tr, --translate <function> Use <function> for i18n. --include <include-file> Add #include <include-file> to <file>. -g, --generator <python|cpp> Select generator. --idbased Use id based function for i18n --from-imports Python: generate imports relative to '.' Arguments: [uifile] Input file (*.ui), otherwise stdin. Process finished with exit code 0
-
@AnneRanch
What "variable file"?
You need to put a valid ui file there, otherwise how should this work?qt5-tools uic file.ui
This should be the correct command. Other options/arguments you can see using the help (as you did) -
@Pl45m4 Thanks for the reply.
"variable file" is when I select the actual ui file in PyCharm IDE.
But I have to "configure " uic with unknown / variable file.And I did not want to get into "this is not python forum" , hence I was not specifying that.
I am really not sure if PyCharm will properly pass the file, but I did try "hard coded " ui file , same as you suggested , and the result , posted by PyCharm, is not something I expected - but it DOES NOT complain about invalid file.
But I need to pass this first
"qt5-tool uic + argument "variable ui file " and hope PyCharm will actually use the variable file argument.In an essence - I am asking how to add argument to the "command "
"qt5-tools uic + variable file argument " irregardless where does the argument , which indeed is variable , comes from.I was hoping for something like :
"qt5-tools uic *.ui"
Hope this makes some sense.Cheers
FYI this is where I do the configuration of the external tool - uic option
-
@AnneRanch
Since this is a question about PyCharm you need to look in its documentation to see whether/how it has some "variables syntax" to allow you to pass (the path of) whatever you want there. For example, above for Working directory I see$ProjectFileDir$
, which is clearly something PyCharm supplies, to expand to a path. It may let you specify something similar you could use in place ofx.ui
which looks perhaps like$...$
, I don't know. But whatever it lies in the PyCharm documentation for Tool Settings > Arguments. This is 100% purely a PyCharm question, there is nothing you can pass touic
itself to do any magic, only PyCharm can let you pass the desired path (via whatever its "variable" mechanism allows).I see this is discussed in PyCharm docuymenation at https://www.jetbrains.com/help/pycharm/configuring-third-party-tools.html#use-custom-profile, and the full set of "macros" it understands are documented at https://www.jetbrains.com/help/pycharm/built-in-macros.html. Just as an example: if, say, the current filename is the
....py
to be generated by runninguic
on the.ui
file then something like$FileDir$\$FileNameWithoutExtension$.ui
would produce the.ui
file name from the.py
file name.In your actual attempt I believe you will not want the words
option
orargument
in Arguments. I think you may need another argument to telluic
you want it to generate a Python.py
file since the default is probably a C++.h
file.You should be able to play with the command from a shell quite outside PyCharm while you discover exactly what is wanted for the arguments before the file path.
I have not watched it, but YouTube has video Convert Qt Designer ui file to Python file using Pycharm External Tools (also another one at https://www.youtube.com/watch?v=8jI_B0Dnu4E) which might show you just what you need to do?
-
@JonB Thanks for the reply. I have few problems - number one is - when I posted my question to PyCharm "forum" I received very simple reply " this is not PyCharm issue... " . So in my opinion / interpretation = asking PyCharm for "support " is a dead end.
Back to the real issue
again in my opinion
this is a simple "passing option / arguments" to application - in this case to " qt5-tools" .
It is immaterial that "qt5-tools" is used as "external tool" in PyCharm.
I know passing " designer" ( valid ) option to "qt5-tools"
is OK since PyCharm accepts it.I know this also works - in terminal , outside python
"qt5-tools uic test.ui"what is need is this
"qt5-toosl uic "variable ui file " "
I do not know HOW to actually write
" variable ui file "ADDENDUM
Here is how it behaves in terminal.
Note the end of "help".
How am I to extract the correct argument format ?
I guess it is "option space argument ( with .ui extension ) " , no [ pr ( ....nov25-1@nov251-desktop:~$ qt5-tools uic ^X^C Aborted! nov25-1@nov251-desktop:~$ qt5-tools uic test.ui File 'test.ui' is not valid nov25-1@nov251-desktop:~$ qt5-tools uic *.ui File '*.ui' is not valid nov25-1@nov251-desktop:~$ qt5-tools uic --help Usage: /home/nov25-1/.local/lib/python3.10/site-packages/qt5_applications/Qt/bin/uic [options] [uifile] Qt User Interface Compiler version 5.15.2 Options: -h, --help Displays help on commandline options. --help-all Displays help including Qt specific options. -v, --version Displays version information. -d, --dependencies Display the dependencies. -o, --output <file> Place the output into <file> -a, --no-autoconnection Do not generate a call to QObject::connectSlotsByName(). -p, --no-protection Disable header protection. -n, --no-implicit-includes Disable generation of #include-directives. -s, --no-stringliteral Deprecated. The use of this option won't take any effect. --postfix <postfix> Postfix to add to all generated classnames. --tr, --translate <function> Use <function> for i18n. --include <include-file> Add #include <include-file> to <file>. -g, --generator <python|cpp> Select generator. --idbased Use id based function for i18n --from-imports Python: generate imports relative to '.' Arguments: [uifile] Input file (*.ui), otherwise stdin. nov25-1@nov251-desktop:~$
Cheers
PS
Thanks for the references , I think one of them has the answer, but I have "honey do..." task to do first . -
@AnneRanch ....and here is the solution
the "final " command :
"qt5-tools uic $FileName$"
TODO
find out about all these $xxx$ symbols.AND
find out how it "converts" ui to C++ -
@AnneRanch OK, here I go trying to actually run qt5....and getting this error.
I could post this on python subforum since this same error has been around....
I am not interested whose tool problem , but it appears as a version issue of unknown tool.I cannot decode the error - so I am asking for anybody who can to help me to get some idea to find where is the problem .
Please refrain from recommending other forum - I need solution , not referrals.
Running uic on valid test file :
/home/nov25-1/.local/bin/qt5-tools uic A.ui
/home/nov25-1/.local/lib/python3.10/site-packages/qt5_applications/Qt/bin/uic: symbol lookup error: /home/nov25-1/.local/lib/python3.10/site-packages/qt5_applications/Qt/bin/uic: undefined symbol: _ZdlPvm, version Qt_5Process finished with exit code 0
-
@AnneRanch ...and there is more
uic converts file ( ui ) to C++ , however, after more research it looks as it can be converted to .py file (why ?) with this "command "qt5-tools uic $FileName$ -o $FileNameWithoutAllExtensions$.
These "$ text $" are PyCharm IDE macros !! ( No PyCharm documentation found so far ) -
@AnneRanch said in Syntax - passing "x.ui" file to uic ?:
These "$ text $" are PyCharm IDE macros !! ( No PyCharm documentation found so far )
If you read my reply earlier I supplied you with precisely the documentation link for these.
-
C Christian Ehrlicher moved this topic from General and Desktop on
-
@AnneRanch I don't know why you stick with qt5-tools and why you speak about C++ if you use PyCharm and python.
But here is a working example ofuic
from PySide6 usage withPyCharm
if you need it
I tried it and it works. But I don't think this is a good and convenint way.
For example I have 20+ UI-files and pressing right click, selecting tool, executing it... it just too big overhead for me. So I have a simple script that runsuic
for all my ui-files at once. I found it to be much quicker and more convenient way.P.S. Just remove
-g python
if you need C++ output -
@JonB actually all these symbols are available if you push a plus sign button to the right of the field for command arguments editing - you may choose from a list there.
I just think thatuic
isn't the best tool to use this way...P.S. Offtopic. I can't stop wondering how people can do 5 min video from a thing that may be explained in 5 lines of text or 1 picture... But anyway, thanks for your links.
-
@StarterKit said in Syntax - passing "x.ui" file to uic ?:
P.S. Offtopic. I can't stop wondering how people can do 5 min video from a thing that may be explained in 5 lines of text or 1 picture... But anyway, thanks for your links.
Monetarization....
Esp. on YouTube... Most people stretch their videos to 5, 10 or more minutes in order to get more rewards (YT can put in more ads = more profit) -
@Pl45m4 said in Syntax - passing "x.ui" file to uic ?:
Monetarization....
Esp. on YouTube... Most people stretch their videos to 5, 10 or more minutes in order to get more rewards (YT can put in more ads = more profit)Ok, you cleared my conscience a little :) (there are some pretty useful things go cut ads on YT... I felt a bit guilty using it... Now I'm feeling less guilty :) )
-
@StarterKit I don't know why you stick with qt5-tools
because what you suggested - using uic directly is just another way to "skin the cat ".- I still do not have a clear definition of passing $text$ to parent application.
- I am thrilled with hijacking the thread with irrelevant chit chat about u-tube. I guess
a) it won't get "moved"
b) there is definite show of lack of knowledge of "lounge" here
Cheers
-
@AnneRanch, the person who use idioms complains about "hijacking the thread"... interesing... ;)
Ok, with regards to your bold text in item #1 - if you able to read then you would see 2 (two) answers to this question in messages above.- you may look into official documentation
- you may press a plus ("+") button in PyCharm IDE and see available values with hints.
I promis you not to move this topic any further with my lack of knowledge :)
-
@AnneRanch: Please stop deleting your posts just because others trying to help you (I really wonder that there are some people left here) and then tell you what you don't want to hear...
-
C Christian Ehrlicher locked this topic on