Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to design a beatiful filedialog object?
Qt 6.12 LTS is out! See what's new in the release blog

How to design a beatiful filedialog object?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 740 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.
  • nicker playerN Offline
    nicker playerN Offline
    nicker player
    wrote on last edited by
    #1

    I used the QFileDialog code below.
    I want to choose the file and the path at the same time.But the code seems runed unnormally.The dialog is very ugly cause I used the setOption function,howto do ?By using the qstyle ?
    and by the way,the choose button of the dialog cant work when i choosed the files or paths.I dont know why.

    QFileDialog* _f_dlg =new QFileDialog() ;
    _f_dlg->setFileMode(QFileDialog::Directory);
    _f_dlg->setOption(QFileDialog::DontUseNativeDialog, true);
    
    jsulmJ JonBJ 2 Replies Last reply
    0
    • nicker playerN nicker player

      I used the QFileDialog code below.
      I want to choose the file and the path at the same time.But the code seems runed unnormally.The dialog is very ugly cause I used the setOption function,howto do ?By using the qstyle ?
      and by the way,the choose button of the dialog cant work when i choosed the files or paths.I dont know why.

      QFileDialog* _f_dlg =new QFileDialog() ;
      _f_dlg->setFileMode(QFileDialog::Directory);
      _f_dlg->setOption(QFileDialog::DontUseNativeDialog, true);
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @nicker-player said in How to design a beatiful filedialog object?:

      cause I used the setOption function

      Why do you set QFileDialog::DontUseNativeDialog?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • nicker playerN nicker player

        I used the QFileDialog code below.
        I want to choose the file and the path at the same time.But the code seems runed unnormally.The dialog is very ugly cause I used the setOption function,howto do ?By using the qstyle ?
        and by the way,the choose button of the dialog cant work when i choosed the files or paths.I dont know why.

        QFileDialog* _f_dlg =new QFileDialog() ;
        _f_dlg->setFileMode(QFileDialog::Directory);
        _f_dlg->setOption(QFileDialog::DontUseNativeDialog, true);
        
        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by
        #3

        @nicker-player said in How to design a beatiful filedialog object?:

        I want to choose the file and the path at the same time

        In addition to @jsulm's comment, you cannot choose a file here, only a directory/folder. I would actually expect the dialog to show only directories, not files.

        nicker playerN JonBJ 2 Replies Last reply
        0
        • JonBJ JonB

          @nicker-player said in How to design a beatiful filedialog object?:

          I want to choose the file and the path at the same time

          In addition to @jsulm's comment, you cannot choose a file here, only a directory/folder. I would actually expect the dialog to show only directories, not files.

          nicker playerN Offline
          nicker playerN Offline
          nicker player
          wrote on last edited by
          #4

          @JonB
          In fact ,heres the code Ive used.
          So how to choose the files and the paths at the same time.And the dialog looks normally and not ugly.

           QFileDialog* _f_dlg = this;
          _f_dlg->setFileMode(QFileDialog::Directory);
           _f_dlg->setOption(QFileDialog::DontUseNativeDialog, true);
          QListView *l = _f_dlg->findChild<QListView*>("listView");
          if (l) {
                  l->setSelectionMode(QAbstractItemView::MultiSelection);
          }
          QTreeView *t = _f_dlg->findChild<QTreeView*>();
          if (t) {
                  t->setSelectionMode(QAbstractItemView::MultiSelection);
          }
          
          1 Reply Last reply
          0
          • JonBJ JonB

            @nicker-player said in How to design a beatiful filedialog object?:

            I want to choose the file and the path at the same time

            In addition to @jsulm's comment, you cannot choose a file here, only a directory/folder. I would actually expect the dialog to show only directories, not files.

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @nicker-player

            So how to choose the files and the paths at the same time

            I already said:
            @JonB said in How to design a beatiful filedialog object?:

            you cannot choose a file here, only a directory/folder

            @nicker-player said in How to design a beatiful filedialog object?:

            And the dialog looks normally and not ugly.

            You read what @jsulm wrote. Why do you not act on it rather than ignoring it?

            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
            • Unsolved