I am using QT under windows and have an application where I want to use the arguments to determine if this comes from a bat file and so all data is in the arguments, or if it should pop us the menu window to allow the user to input the data.
Any examples of how to do this?
Thanks
Simply don't create or show the QMainWindow
There are a few extra complexities about event loops and signals/slots. There is also an issue on Windows that whether the create a console or not is a linker not a runtime option.
See How do I create a simple Qt console application in C++?
I think you want to check if your application is lauched with command line argument or not. If not then display some dialogbox to get input.
main function of c++ program has two argument, first is the number of arguments and other is an argument array. you can use these two parameters to decide it you got the command line parameter the from user or not.
Related
With Robot Framework I automatizate a connexion to a website.
To do this, I used Dialogs Library to ask for a username and a password with the command "Get Value From User". The thing is, the library let the user enter only one by one value (a first popup where robot ask Username then a second where it ask the password). Dialogs Library do not support to ask several values in the same popup or window. But is there a way to do it ? (I do not find anything, and I almost never learn python to creat my own library (it is in my plan to do it asap)). Thank you for help !
Possible, yes. If you need to ask, not easy.
Dialogs uses tkinter toolkit, when you call a keyword from dialogs keyword library, library will create a temporary gui element and runs the event loop until its either dismissed or value is provided.
You can make similar keyword that creates tkinter dialog with multiple ui elements, process the event loop until user has indicated that all is fine, exit the event loop and return the field values to the caller.
I'm trying to build a GUI wrapper over an external command line application. Everything is fine until this application wants to get an input from user. How to know if the process is asking for an input? For example, so I could show the GUI input dialog for the end user.
Also, the fact is I don't need this input functionality at all, so it would also be fine to simply omit / suppress the input.
While trying to add D&D support to a gnome-shell-extension that I'm writing I ran into a bit of trouble. I can create drop targets to any open window, but that's all I've managed to pull off.
I can't differentiate between the windows. I tried to use global.get_stage().get_actor_at_pos(Clutter.PickMode.ALL, x, y).get_parent().get_parent().get_meta_window().get_wm_class(), but half the time it gives me the wrong window and every now and again it just returns null. Also I'm not sure how to drop the information into the target.
All I'm trying to do is drop a file URI into a browser window or the file into a file manager.
Is it even possible in gnome-shell-extensions and how would I pull it off? Any advice would be welcome!
Here is the current available shell code about DND between windows: https://github.com/GNOME/gnome-shell/blob/master/js/ui/xdndHandler.js You can do practically nothing with it.
In Mutter, there are more than one procedure to handled a drag and drop in a window, because there are one implementation for X11-windows and another implementation for Wayland-windows.
To be honest, i don't know if there are a way on Wayland and how will be.
I can tell you that in gnome-shell (Mutter to be specific) there are not a fully implementation of this ability on X11. Most you can know, it's if a drag and drop occurs from a window to the shell and the position of the dragged actor, but the shell dosen't provide any api to create an internal drag and drop from the shell to a particular window.
The shell drag and drop that you can fully used, it's only an internal (just the shell) drag and drop from and to the shell (only for clutter actors) and not an external one between different windows.
In X11, the drag and drop process occurs between windows only. One window provide the dragged object and the information that it's associate to that object. The another window (could be the same) will accept the drop of the object, taking on account the information that the first window provide.
As there are not way in the shell to be possible setting the requiered information to the target-window and like your GUI is inside a big top window (The window that represent the shell global stage: https://github.com/GNOME/mutter/blob/6c18bae83cd27a7397a1ed0c1c0c81b282f1b44e/src/compositor/meta-dnd.c#L152) and like you don't have access to this big internal window, finally you can not do anything to interact directly with other windows.
Here (https://github.com/swayfreeda/blender-2.77a/tree/5969d704f44952ea8cbecba2ba4150fb4a48e6de/extern/xdnd) you can find a fully implementation of drag and drop on X11, you will need to modify the code to be adapted to the Mutter workflow and then add this code to Mutter. After that you will have support, but you will need to create the corresponding procedured to then invoked the functionalities, provide information and recive usefull events from the shell to the window, to be possible finally control it in gjs, but it will be only for X11, not for Wayland. I suppose you will need to do something similar if you want support on Wayland.
Good loock.
I need to launch another program from my code but I also need to set its screen position?
Is this possible using QT?
Very simple In principal but as usual extremely difficult in QT...
If the program you are calling allows it through the command line arguments then it is definitely possible.
in windows there is the option of providing the STARTUPINFO but that only works if the program uses CW_USEDEFAULT for its location
Otherwise you would need to use a debugger to hook into the relevant setLocation call and change the arguments, this is very hard without intimate knowledge of the program in question.
This can be done by setting the dwX and dwY varibles In the STARTUPINFO struct and then setting dwFlags to STARTF_USEPOSITION.
Then call CreateProcess
I must embedd the shell of an interpreter language (most likely it will be python) inside my application. So i need a console widget in my GUI toolkit. I want to write this from ground up myself.
I know that i must start the process with pipes redirecting the standard input/output/error to my console widget. I have to set the environment variable TERM=vt100 and send a SIGWINCH signal whenever i resize my terminal.
For the output of the program i have to check the octet stream for vt100 control characters as explained here VT100 commands.
This sounds to be easy and a nice weekend hack.
But what do i do about the input? Who is responsible for echoing the characters and the line mode editing?
Do i miss something else which is serious?
To control the input in console, you have set it to canonical mode. Please check this like link, it may help you:
Canonical vs. non-canonical terminal input