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. QFileDialog: Select file only from a pre-defined directory

QFileDialog: Select file only from a pre-defined directory

Scheduled Pinned Locked Moved Unsolved General and Desktop
qt5.5file dialogfile navigation
2 Posts 2 Posters 1.4k Views
  • 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.
  • A Offline
    A Offline
    Ankit.Jain
    wrote on last edited by
    #1

    Hi,
    I am looking to select a file (of specified type) from a predefined folder. The idea is to not allow the user to browse; just see the files available in the folder and allow him/her to choose from them. I created a basic implementation for the same using QFileDialog, but have been unable to prevent the user from browsing the file system to search for the file.

    Any help would be much appreciated.
    Thanks

    1 Reply Last reply
    0
    • Chris HennesC Offline
      Chris HennesC Offline
      Chris Hennes
      wrote on last edited by Chris Hennes
      #2

      I would be inclined to not use QFileDialog for that task -- it's designed to look and function the way users expect a file selection dialog to work, which includes navigation. I have a similar use-case in a program I'm currently working on, and my solution was to create a very simple custom dialog that simply presents a list of the files they are allowed to select from. It's very easy to get that list from a QDir and drop that QStringList into a QListWidget.

      Chris Hennes, Pioneer Library System

      1 Reply Last reply
      1

      • Login

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