Hi Guiseppe,

Here is a quick test case:

#include <QApplication>
#include <QFileDialog>
#include <QDebug>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    QString savePath = QDir::homePath();
    savePath.append("/text.txt");
    QFile saveFile(savePath);
    if(!saveFile.exists())
    {
        saveFile.open(QFile::WriteOnly);
        saveFile.close();
    }
    QFileDialog fileDialog;
    fileDialog.setFileMode(QFileDialog::AnyFile);
    fileDialog.setAcceptMode(QFileDialog::AcceptSave);
    fileDialog.setDirectory(QDir::homePath());
    fileDialog.setDefaultSuffix("txt");
    fileDialog.setNameFilter("Text (*.txt)");
    switch(fileDialog.exec())
    {
        case QDialog::Accepted:
        {
            QString selectedFile = fileDialog.selectedFiles().at(0);
            qDebug() << "Selected File:" << selectedFile;
            break;
        }
    }
    return 0;
}

This creates a file "text.txt" in the home folder.  When the file dialog opens, if you enter "text" in the textbox and click save, the file dialog returns "text.txt" even though the file already exists (and doesn't request a confirmation to overwrite).

Thanks,

Dan.

On 21/10/17 18:16, Giuseppe D'Angelo wrote:
Il 21/10/2017 18:45, Dan Allen ha scritto:
I don't know much about GTK directly.  I had a quick look at the GTK file chooser documentation and I couldn't see anything that suggests GTK supports a default suffix.  Therefore, would that suggest this is probably a Qt issue (i.e. GTK considered it "text" against "text.txt" and therefore different but Qt has added the ".txt" afterwards and made the file name the same)?

If it is a GTK issue, I'm not sure how to report it because I could only detail the issue from usage in a Qt sense.  If I report in in that way, do you think it would be acceptable?

I've just did a quick test here, and with the GTK dialog, inputting "test" just returns "test" _without_ the .txt extension. Could you please write down a minimal testcase? (Should be nothing more than a main.cpp and 40 lines of code.)



_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to