Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. FileDialog rendering broken on Android?
Forum Updated to NodeBB v4.3 + New Features

FileDialog rendering broken on Android?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
6 Posts 2 Posters 3.9k Views 2 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.
  • V Offline
    V Offline
    Violet Giraffe
    wrote on 5 Aug 2016, 09:28 last edited by
    #1

    Here's what I'm trying to do:

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    import QtQuick.Dialogs 1.2
    import QtQuick.Controls.Material 2.0
    
    ApplicationWindow {
    	Material.theme: Material.Dark
    	property bool toolBarsVisible: true
    	id: window
    	visible: true
    	header: toolBarsVisible ? toolBarLoader : null
    
    	Loader {
    		id: toolBarLoader
    		sourceComponent: toolbarComponent
    	}
    
    	Component {
    		id: toolbarComponent
    
    		ToolBar {
    
    			RowLayout {
    				anchors.fill: parent
    
    				Slider {
    					Layout.fillWidth: true
    				}
    
    				ToolButton {
    					id: mainMenuButton
    					anchors.leftMargin: 10
    					font.pointSize: 26
    					text: "≡"
    
    					onClicked: mainMenu.open()
    				}
    
    				Menu {
    						id: mainMenu
    						y: mainMenuButton.height
    						x: mainMenuButton.x
    
    						MenuItem {
    							FileDialog {
    								id: openFileDIalog
    								title: "Pick a text file"
    								folder: shortcuts.home
    								onAccepted: {
    									Qt.quit()
    								}
    								onRejected: {
    									Qt.quit()
    								}
    							}
    
    							text: "Open..."
    							onClicked: openFileDIalog.open()
    						}
    
    						MenuItem {
    							text: "Settings..."
    						}
    					}
    			}
    		}
    	}
    }
    

    And here's what I get when I invoke the menu and press "Open".
    That doesn't look right. What's the problem and how can I fix it?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jpnurmi
      wrote on 5 Aug 2016, 10:56 last edited by
      #2

      I'd recommend building your own simple mobile-oriented file picker using ListView and FolderListModel. With Qt Quick Controls 2.0, you can use a Popup like the Gallery Example does.

      In the near future, Qt Quick Controls 2.1 (Qt 5.8) is going to introduce Dialog and DialogButtonBox controls. Even though there will be also experimental native FileDialog and FolderDialog types, these are targeting the traditional desktop platforms. On mobile, you are better off with ListView and FolderListModel.

      V 1 Reply Last reply 5 Aug 2016, 16:12
      0
      • J jpnurmi
        5 Aug 2016, 10:56

        I'd recommend building your own simple mobile-oriented file picker using ListView and FolderListModel. With Qt Quick Controls 2.0, you can use a Popup like the Gallery Example does.

        In the near future, Qt Quick Controls 2.1 (Qt 5.8) is going to introduce Dialog and DialogButtonBox controls. Even though there will be also experimental native FileDialog and FolderDialog types, these are targeting the traditional desktop platforms. On mobile, you are better off with ListView and FolderListModel.

        V Offline
        V Offline
        Violet Giraffe
        wrote on 5 Aug 2016, 16:12 last edited by Violet Giraffe 8 May 2016, 16:12
        #3

        @jpnurmi
        Thank you. That's certainly more work than it should be. But either way, I now recall running the QML "Dialogs" example on this very Nexus 7 without any issues! Surely it shouldn't look like this. Could it become broken because of the Material style?

        J 1 Reply Last reply 5 Aug 2016, 19:43
        0
        • V Violet Giraffe
          5 Aug 2016, 16:12

          @jpnurmi
          Thank you. That's certainly more work than it should be. But either way, I now recall running the QML "Dialogs" example on this very Nexus 7 without any issues! Surely it shouldn't look like this. Could it become broken because of the Material style?

          J Offline
          J Offline
          jpnurmi
          wrote on 5 Aug 2016, 19:43 last edited by
          #4

          @Violet-Giraffe said:

          That's certainly more work than it should be.

          It might be much less of work than one would expect. Mobile file pickers are typically simple lists, after all. Qt Quick Controls 2 provide built-in delegate types, so building a Material style file picker should not be much more than putting a ListView, ItemDelegate, and FolderListModel together. Even though we do have vague plans providing later some pickers (date, time, file...) later, we still have some basic controls to do before we get to implement such higher level controls.

          But either way, I now recall running the QML "Dialogs" example on this very Nexus 7 without any issues! Surely it shouldn't look like this. Could it become broken because of the Material style?

          If you mean the Qt Quick Controls 2.x Material style, no, not really, it has nothing to do with the QML FileDialog from Qt Quick Dialogs 1.x. The QML FileDialog is just too desktop centric. One can see it doesn't scale too well on a smaller screens - it's cluttered with too much... stuff. What might be the culprit though is that Qt Quick Controls 1.x and Qt Quick Dialogs 2.x don't play well with Qt::AA_EnableHighDpiScaling (some things may get double scaled).

          V 1 Reply Last reply 6 Aug 2016, 04:17
          1
          • J jpnurmi
            5 Aug 2016, 19:43

            @Violet-Giraffe said:

            That's certainly more work than it should be.

            It might be much less of work than one would expect. Mobile file pickers are typically simple lists, after all. Qt Quick Controls 2 provide built-in delegate types, so building a Material style file picker should not be much more than putting a ListView, ItemDelegate, and FolderListModel together. Even though we do have vague plans providing later some pickers (date, time, file...) later, we still have some basic controls to do before we get to implement such higher level controls.

            But either way, I now recall running the QML "Dialogs" example on this very Nexus 7 without any issues! Surely it shouldn't look like this. Could it become broken because of the Material style?

            If you mean the Qt Quick Controls 2.x Material style, no, not really, it has nothing to do with the QML FileDialog from Qt Quick Dialogs 1.x. The QML FileDialog is just too desktop centric. One can see it doesn't scale too well on a smaller screens - it's cluttered with too much... stuff. What might be the culprit though is that Qt Quick Controls 1.x and Qt Quick Dialogs 2.x don't play well with Qt::AA_EnableHighDpiScaling (some things may get double scaled).

            V Offline
            V Offline
            Violet Giraffe
            wrote on 6 Aug 2016, 04:17 last edited by
            #5

            @jpnurmi
            I do indeed have Qt::AA_EnableHighDpiScaling set. Will check if that's the culprit.
            Isn't this a Qt bug?..

            J 1 Reply Last reply 6 Aug 2016, 07:55
            0
            • V Violet Giraffe
              6 Aug 2016, 04:17

              @jpnurmi
              I do indeed have Qt::AA_EnableHighDpiScaling set. Will check if that's the culprit.
              Isn't this a Qt bug?..

              J Offline
              J Offline
              jpnurmi
              wrote on 6 Aug 2016, 07:55 last edited by
              #6

              @Violet-Giraffe said:

              I do indeed have Qt::AA_EnableHighDpiScaling set. Will check if that's the culprit.
              Isn't this a Qt bug?..

              QTBUG-51999

              1 Reply Last reply
              1

              1/6

              5 Aug 2016, 09:28

              • Login

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