Home > Mobile >  QT, save the file of the pop-up dialog box file name column can read lineEdit text information how t
QT, save the file of the pop-up dialog box file name column can read lineEdit text information how t

Time:10-07

QT for help, to realize the save file dialog pops up filename there can read the name of the new project name, but what all can't, I am using QFileDialog: : getSaveFileName, could you tell me how great god

CodePudding user response:

QString fileName=QFileDialog: : getSaveFileName (this, tr (" Save File "),
"/home/jana/untitled. PNG",
Tr (" Images (*. PNG *. XPM *. JPG) "));

The file dialog's working directory will be set to dir. If dir includes a file name, The file will be selected. Only files that match The filter are to. The filter selected is set to selectedFilter. The parameters dir, selectedFilter, and The filter may be empty strings. Multiple filters are separated with ';; 'For instance:

CodePudding user response:

I want to the name of the file dialog can read the LineEdit the lines of text information in real time

CodePudding user response:

That still don't use a static method, because the static method is that internal implementation:
 QFileDialog dialog (args); 
Dialog. SetSupportedSchemes (supportedSchemes);
Dialog. SetAcceptMode (AcceptSave);
If (selectedFilter & amp; & ! SelectedFilter - & gt; IsEmpty ())
Dialog. SelectNameFilter (* selectedFilter);
If (dialog. The exec ()==QDialog: : Accepted) {
If (selectedFilter)
* selectedFilter=dialog. SelectedNameFilter ();
Return the dialog. SelectedUrls (). The value (0);
}
Return QUrl ();
  •  Tags:  
  • Qt