is some special batch processing supported by Qt? - c++

I want to use some special kind of batch processing. Say when executing in the menu system 'File Open filename', I store this text, and next time I "execute" that "batch" file. The File and Open recognized as menu items, and filename is used, without opening a dialog. Is this utilization supported by Qt? Or, at least finding a menu action?

The menu entries are QAction's. Those could easily be stored, but from your description it seems that you want to also store the filename. That means you want to store half a QAction; the part which asks for a filename but not the second part which uses that filename. That's not possible with Qt.
Of course, you can implement that yourself; after all it's your "File Open" menu entry.

Related

change file name when filter changes in Windows file save dialog from c++

In a Windows Save File dialog, I would like to automatically change the extension part of the filename in the edit box when the user changes the filter. That is, if the user is saving an image file, and changes the type to JPEG, the file name automatically changes to .jpg.
IIRC this used to be possible via hooks but that approach is no longer supported. Is there a way to accomplish it now? I'm using C++ (C++Builder if it makes any difference).
Thanks.

Lookup Combo that supports remote data - load data only after user wants to

I'm building a VCL c++ builder application. I would like to see if anyone knows of a component that can load data in the lookup upon drop down only after a user has typed a few letters to limit the rows queried? Preferably after pressing Tab, or Enter.
What I would like best is to get a behaviour similar to what Linux command line has, but that might be wishful thinking. The way it would work is to drop down the combo list after user presses tab only if there is multiple options available, and to fill in additional text till the point where characters are not the same anymore, then if user presses tab again, drop down list.
The next best would be if the drop down would only allow drop down if user has typed a few letters, then pressing a specific button opens the dataset with the parameter of the typed text so far, then drops down the combo.
Does a component like this exist?
You can check out TMS Software. I'm not sure if it has something exactly for you, but their components are quite flexible. And you can send a feature request to them - to consider for next update. If you are lucky they might add it to next release.

Word 2003 Template - document saving

We have a word 2003 template we use as the basis for a configuration sheet for a system. The whole thing is based around form fields and the template is then locked. To write a new document we double click on the template, fill in the form fields, save and off we go.
The problem Ive got is that when finished writing in the "doc" file and closing or saving I always get a dialog asking if I want to save changes to the template as well. Even if I just double click the template "dot" file so that a blank "doc" file based on this is opened and then close that document straightaway I still get the save template query.
Is there anyway I can get rid of it as its damned annoying to everyone who uses the template.
Many thanks
Further note:
I've just had Word 2003 opened with no documents or templates opened. I use file open and open the template. Once it is open I then close it again. No "do you want to save" messages. I then use windows explorer and double click on the same template to create a document. I wait til the document is sitting in word ready to use. I then click close again without typing or changing anything - After the do you want to save changes to "Document 2" which I say no to, I then get the "do you want to save the template" message.
Further further note:
I have now tracked this to some code I have that adds a toolbar and buttons. within this code is a line customizationcontext = Thisdocument and then the toolbar and buttons are created. If I change the line to CustomizationContext = ActiveDocument I then do not get the prompt for saving when I close a document created from the template. I do however now get the prompt if I open the template and close it without changing anything(also the buttons I added do not appear correctly (but they do appear in the document))! I can live with this though as it is preferable than the other way round.
The most common reason for this to happen, is that one of your formats (paragraph or other) is marked to update the source template if changed.
Check all the used formats in your template if the option to save back changes is activated and de-activate this option - the same applies to any .doc already created from this template since it will carry over this option.
To check your formats (in Word 2003), open the sidebar for styles and formatting, change the filter at the bottom to "Used formats". Move your pointer over the format you like to inspect and select the action "Modify..." from the pull down menu at the right.
On the bottom right - just above the OK-button - you'll find the checkbox labeled "Automatically update".
See also Automatically update a paragraph style.

Saving user's data for my application

I was wondering what would be the correct method for saving all user data for an application I am working on. The application is in QT. The user inputs a lot of data into the application and the data will be different for every user. I want the ability for the user to save all the current data to a file that can be user by the loaded by the application again once the user wants to use it again or use it on another computer running the application.
What would be the correct and best way to do this? Do I need to use xml format? And then use the xmlreader for QT? Or do I just need to create my own file format and just use the stream to just read everything in. The data in the file will need to be labeled, because it will need to put the data in certain spots on the gui. And the user has the option to dynamically create boxes and tabs that hold certain information.
If you need any more information, please let me know.
A short example:
I am not only reading gui locations.
But the contents of those. For
instance. The user is able to create
tabs that contain edit text boxes. And
those tabs are associated with items
that are in a list. When the user
clicks on an item in the list the user
will be presented with a whole set of
new tabs. And each tab has some
editing forms. The file will need to
contain what is in the list, what tabs
the user has created under each item
in that list and the contents of each
tab associated with the tab of each
item in the list.
In essense, yes you'll be creating your own file format, but the actual content can just be XML in whatever scheme you need. Then you can use Qt's built-in XML processing capabilities to pull the heavy lifting of parsing the text (I personally prefer the DOM model, so I use QDomDocument as my base point), and you'll just need to worry about parsing things to and from the individual nodes.
The Qt framework has some great XML samples if I remember correctly that helped me get off the ground almost immediately. Hope they help!
Another great solution is to use internal database implementation (QSQL on top of sqlite). Compared to the xml solution, it might be more versatile (update when needed, can use external keys). Qt has some rgeat examples about using it aas well.
In terms of dependencies, XML solution will require you to use xml and xmlpatterns (if you want to validate stuff), whereas sqlite solution will require QSQL + sqlite plugin. I think that sqlite guarantees atomicity of writing , thus preventing corruption of data (think : the user is killing the app while it's saving).

GetOpenFileName Program-Defined Directory

I want to create a dialog box that resembles the one created with GetOpenFileDialog. However, I want the dialog to display a list of filenames that the program provides, and these filenames don't necessarily exist as files in a directory. The purpose is to provide a dialog with a similar look and feel for opening files, but rather inside of a zip file which the program would extract after selection. So, is there any way this is possible?
No, you'll have to write one yourself. You can however find the common dialog box templates in the PlatformSDK\Include directory; you can use the FileOpen.dlg template to build a dialog similar to the standard Open dialog.