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 > look In as editable entry
Forum Updated to NodeBB v4.3 + New Features

QFileDialog > look In as editable entry

Scheduled Pinned Locked Moved Unsolved General and Desktop
qfiledialog
11 Posts 3 Posters 1.9k 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.
  • D Offline
    D Offline
    Dariusz
    wrote on 7 Nov 2020, 12:11 last edited by
    #1

    Hey

    How can I configure / can I even do it? the Look in combo box to be an editable entry so I can copy/paste paths in to it ?

    TIA

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 8 Nov 2020, 15:35 last edited by
      #2

      Hi
      You can use
      dialog->selectFile("myFileName");

      To give it a default name for saving.

      D 1 Reply Last reply 9 Nov 2020, 13:47
      0
      • M mrjj
        8 Nov 2020, 15:35

        Hi
        You can use
        dialog->selectFile("myFileName");

        To give it a default name for saving.

        D Offline
        D Offline
        Dariusz
        wrote on 9 Nov 2020, 13:47 last edited by
        #3

        @mrjj No, I want to be able to click on the top combo box that has paths and be able to copy/paste new path in to it. Like windows explorer.

        M 1 Reply Last reply 9 Nov 2020, 13:54
        0
        • D Dariusz
          9 Nov 2020, 13:47

          @mrjj No, I want to be able to click on the top combo box that has paths and be able to copy/paste new path in to it. Like windows explorer.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 9 Nov 2020, 13:54 last edited by
          #4

          @Dariusz

          Do you mean when using Qt own dialogs and NOT the OS supplied ones ?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mrjj
            Lifetime Qt Champion
            wrote on 9 Nov 2020, 13:57 last edited by
            #5

            Hi
            For me QFileDialog looks like this
            ![alt text](86984be4-2ead-443f-86b3-3c7c5778f359-image.png image url)

            and I can just paste a new path on top if i want.

            But when you say copy and paste.. do you then mean from code and not like a user ?

            D 1 Reply Last reply 9 Nov 2020, 21:18
            0
            • M mrjj
              9 Nov 2020, 13:57

              Hi
              For me QFileDialog looks like this
              ![alt text](86984be4-2ead-443f-86b3-3c7c5778f359-image.png image url)

              and I can just paste a new path on top if i want.

              But when you say copy and paste.. do you then mean from code and not like a user ?

              D Offline
              D Offline
              Dariusz
              wrote on 9 Nov 2020, 21:18 last edited by Dariusz 11 Sept 2020, 21:19
              #6

              @mrjj Hey Oh may, yeah my bad!! I should have tested it more before posting... I'm using

              saveWidget->setOption(QFileDialog::DontUseNativeDialog, true);
              

              The Qt one just has it as non editable combo box :- (((

              Copy paste, I mean in ur C:\wa\qthttpserver\ to be able to type in there/copy/paste/go to other link etc etc.

              1 Reply Last reply
              0
              • D Offline
                D Offline
                Dariusz
                wrote on 12 Nov 2020, 08:23 last edited by
                #7

                Bump... any idea how to do it with qt widget not native os one?

                M 1 Reply Last reply 12 Nov 2020, 08:33
                0
                • D Dariusz
                  12 Nov 2020, 08:23

                  Bump... any idea how to do it with qt widget not native os one?

                  M Offline
                  M Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on 12 Nov 2020, 08:33 last edited by
                  #8

                  @Dariusz
                  Hi sorry. It sailed away.
                  We can always get hold of the live widget via findChildren
                  and try to set its property to editable. however, it might not work
                  as you expect as nothing will expect "edit" signals to come from it so not sure it will respond to you pasting stuff there but its worth a shot :)

                  B 1 Reply Last reply 12 Nov 2020, 09:12
                  0
                  • M mrjj
                    12 Nov 2020, 08:33

                    @Dariusz
                    Hi sorry. It sailed away.
                    We can always get hold of the live widget via findChildren
                    and try to set its property to editable. however, it might not work
                    as you expect as nothing will expect "edit" signals to come from it so not sure it will respond to you pasting stuff there but its worth a shot :)

                    B Offline
                    B Offline
                    Bonnie
                    wrote on 12 Nov 2020, 09:12 last edited by Bonnie 11 Dec 2020, 09:19
                    #9

                    @mrjj
                    I can confirm that it doesn't work. Just tried that. :)
                    But we can also handle the signals since we are already cheating.

                    QComboBox *combo = saveWidget->findChild<QComboBox*>("lookInCombo", Qt::FindDirectChildrenOnly);
                    combo->setEditable(true);
                    QLineEdit *edit = combo->lineEdit();
                    connect(edit, &QLineEdit::returnPressed, saveWidget, [=](){
                        QString newPath = edit->text(); //TODO: verify the text is a valid path or not
                        saveWidget->setDirectory(newPath);
                    });
                    
                    M 1 Reply Last reply 12 Nov 2020, 10:26
                    1
                    • B Bonnie
                      12 Nov 2020, 09:12

                      @mrjj
                      I can confirm that it doesn't work. Just tried that. :)
                      But we can also handle the signals since we are already cheating.

                      QComboBox *combo = saveWidget->findChild<QComboBox*>("lookInCombo", Qt::FindDirectChildrenOnly);
                      combo->setEditable(true);
                      QLineEdit *edit = combo->lineEdit();
                      connect(edit, &QLineEdit::returnPressed, saveWidget, [=](){
                          QString newPath = edit->text(); //TODO: verify the text is a valid path or not
                          saveWidget->setDirectory(newPath);
                      });
                      
                      M Offline
                      M Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on 12 Nov 2020, 10:26 last edited by
                      #10

                      @Bonnie
                      Hi
                      Super with the testing. :)

                      So with the usual disclaimer of breaking later on
                      as code is relying on internal details, its
                      can actually work ok. \o/

                      How did you find its name ?
                      dumpObjectTree()?

                      B 1 Reply Last reply 12 Nov 2020, 12:49
                      0
                      • M mrjj
                        12 Nov 2020, 10:26

                        @Bonnie
                        Hi
                        Super with the testing. :)

                        So with the usual disclaimer of breaking later on
                        as code is relying on internal details, its
                        can actually work ok. \o/

                        How did you find its name ?
                        dumpObjectTree()?

                        B Offline
                        B Offline
                        Bonnie
                        wrote on 12 Nov 2020, 12:49 last edited by
                        #11

                        @mrjj
                        I read it from the qt source code.
                        I always do that when I want to cheat by using findChild / findChildren, to make sure I can find the right object.

                        1 Reply Last reply
                        1

                        6/11

                        9 Nov 2020, 21:18

                        • Login

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