Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Automatically add suffix to the filename with QFileDialog?
Forum Updated to NodeBB v4.3 + New Features

Automatically add suffix to the filename with QFileDialog?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shalongbasi
    wrote on last edited by
    #1

    under linux, even I set default suffix, it is not added to the filename, such as "xxx", is it normal under linux?
    @ QFileDialog filedialog(this);
    filedialog.setDefaultSuffix("spf");
    QString filename = filedialog.getSaveFileName(this,tr("Save Stepping File"), ".", tr("Stepping files (*.spf)"));
    @

    1 Reply Last reply
    0
    • JeroentjehomeJ Offline
      JeroentjehomeJ Offline
      Jeroentjehome
      wrote on last edited by
      #2

      If I read the docs about the setDefaultSuffix it works just like it should. It is stated that it is normally used to select the file type in the QFileDialog. You also do this with the filter (Stepping files (*.spf)). The suffix is the same as this. What might work is something like setDefaultSuffix("xxx.spf"). Never used it, but might work. Good luck trying!
      Greetz

      Greetz, Jeroen

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shalongbasi
        wrote on last edited by
        #3

        tried the same code under windows, works fine. seems it is not working under linux.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved