Hello!
I have in mind the following "program" to do:
a guy click a button in, let us say, a MainWindow. A QDialog opens with an empty space to write text and a OK button comes together. In the white text field, the guy writes a windows or linux cmd code, and clicks "OK". When he does, the QDialog is closed, a function is called and creates a cmd file, put the text-code he wrote in it and its closed.
Later, the guy clicks a different pushbutton in the MainWindow and a list of various cmd files he created before is shown in a QListWidget. He selects one, clicks a "OK" and the cmd file in questions is called and executed.
My question is: how do I do that?
Essentially I don't think there will be a problem with the window and list part. Essentially I create a class responsible for each "cmd object" and in the MainWindow a vector of that class. That each time the OK button is pressed, an object of the "cmd class" is created and the vector executes a pushback() of that object. When the second PushButton is pressed and a QListWidget appears, it uses a for(;to take all the "cmd objects" created till than and present them as an Item of the list. When the "OK" button is pressed, a connect() with the MainWindow is "called" and a function is executed, namely a function that opens and executes the cmd file in question.
The problem is that I don't know how to do the create/execute part of the cmd file. I have a bit of experience in writing and reading .txt files with QFile and QTextStream, but I don't know how to do something similar with cmd files. Nor I know if the text-code put by the user in the white text place should be copied in a big QString and than put in the cmd, or if a should use another method.
Could somebody help me, please?
Thanks!
Momergil


to take all the "cmd objects" created till than and present them as an Item of the list. When the "OK" button is pressed, a connect() with the MainWindow is "called" and a function is executed, namely a function that opens and executes the cmd file in question.
Reply With Quote



Bookmarks