Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. [SOLVED] How to let <input type="file"/> remember the last selected directory with Qt webkit?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to let <input type="file"/> remember the last selected directory with Qt webkit?

Scheduled Pinned Locked Moved Qt WebKit
7 Posts 2 Posters 3.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.
  • L Offline
    L Offline
    ldlchina
    wrote on last edited by
    #1

    Create an app consuming Qt webkit, create a html file including <input type="file"/>, run the app browse this html file, select a file by <input type="file"/> element, close the app, restart the app, the directory last selected is not remembered.

    But in chrome, the last selected directory can be remembered.
    How to let <input type="file"/> remember the last selected directory with Qt webkit?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      ldlchina
      wrote on last edited by
      #2

      In chrome, the directory info is stored in "C:\Users[your account]\AppData\Local\Google\Chrome\User Data\Default\preferences"-> "selectfile"->"last_directory".

      can Qt webkit support like this?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AcerExtensa
        wrote on last edited by
        #3

        Yes, but you need to implement it yourself, exactly like chrome developers have done it too... chrome is not webkit, chrome is based on webkit engine, exactly like QtWebKit is based on WebKit and QtWebKit is not WebKit itself!

        God is Real unless explicitly declared as Integer.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          ldlchina
          wrote on last edited by
          #4

          Thanks, Need I to implement it in webkit or Qtwebkit? Does Chrome make some changes in its webkit, right?

          [quote author="AcerExtensa" date="1373385102"]Yes, but you need to implement it yourself, exactly like chrome developers have done it too... chrome is not webkit, chrome is based on webkit engine, exactly like QtWebKit is based on WebKit and QtWebKit is not WebKit itself![/quote]

          1 Reply Last reply
          0
          • A Offline
            A Offline
            AcerExtensa
            wrote on last edited by
            #5

            On Qt side there is virtual functions in QWebPage class to be reimplemented for this purpose... You need to subclass QWebPage and reimplement "virtual QString chooseFile ( QWebFrame * parentFrame, const QString & suggestedFile )":http://qt-project.org/doc/qt-4.8/qwebpage.html#chooseFile for single file, or "virtual bool extension ( Extension extension, const ExtensionOption * option = 0, ExtensionReturn * output = 0 )":http://qt-project.org/doc/qt-4.8/qwebpage.html#extension with "QWebPage::ChooseMultipleFilesExtension ":http://qt-project.org/doc/qt-4.8/qwebpage.html#Extension-enum extension for multiple file upload. For multiple file upload you also need to reimplement "virtual bool supportsExtension ( Extension extension ) const":http://qt-project.org/doc/qt-4.8/qwebpage.html#supportsExtension and return true for supported extensions. There is also signals to handle downloads of files, take a look at "QWebPage Class Reference":http://qt-project.org/doc/qt-4.8/qwebpage.html

            God is Real unless explicitly declared as Integer.

            1 Reply Last reply
            0
            • L Offline
              L Offline
              ldlchina
              wrote on last edited by
              #6

              That's it. Thanks.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                AcerExtensa
                wrote on last edited by
                #7

                Please add "[SOLVED]" prefix to the topic subject. Thanks!

                God is Real unless explicitly declared as Integer.

                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