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. How to fix height and width of filedailog in qml.
Forum Update on Monday, May 27th 2025

How to fix height and width of filedailog in qml.

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 211 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.
  • S Offline
    S Offline
    salma banu
    wrote on 15 May 2024, 10:18 last edited by
    #1

    I am not able to set the height and width for the file dialog. Is there any way to set an overlay for the background of the file dialog?
    please find the attachment .!SampleScreen.png

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SuhasKrishanamurthy
      wrote on 19 Mar 2025, 06:58 last edited by
      #2

      In Qt, QFileDialog is a native dialog by default on most platforms, meaning it uses the platform's file dialog and not Qt's own QFileDialog widget. Because of this, setting width, height, or applying a background overlay is often not possible when the native dialog is used.
      However, you have two options to customize its size and background:
      1: Use Non-Native QFileDialog
      2: Custom Overlay Outside QFileDialog

      J 1 Reply Last reply 19 Mar 2025, 08:36
      0
      • S SuhasKrishanamurthy
        19 Mar 2025, 06:58

        In Qt, QFileDialog is a native dialog by default on most platforms, meaning it uses the platform's file dialog and not Qt's own QFileDialog widget. Because of this, setting width, height, or applying a background overlay is often not possible when the native dialog is used.
        However, you have two options to customize its size and background:
        1: Use Non-Native QFileDialog
        2: Custom Overlay Outside QFileDialog

        J Online
        J Online
        JonB
        wrote on 19 Mar 2025, 08:36 last edited by
        #3

        @SuhasKrishanamurthy
        The OP is posting in a QML forum and asking about QML's FileDialog. Your response is about Qt widget's QFileDialog, having features like ability to select to use non-native vs native dialog. Does this even apply to QML's FileDialog? I don't use QML, but maybe not. OP's screenshot looks to me like native file dialog under Ubuntu/GNOME, but not sure.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SuhasKrishanamurthy
          wrote on 19 Mar 2025, 08:55 last edited by
          #4

          You're right — my earlier response was focused on QFileDialog from Qt Widgets, but the OP is indeed asking about QML's FileDialog.
          If the OP needs full control over the size or wants to add a background overlay, the alternative would be to create a custom file browser UI in QML using FolderListModel, ListView, and other controls instead of relying on FileDialog.

          Thanks again for pointing this out!

          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