How to fix height and width of filedailog in qml.
-
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 .! -
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 -
@SuhasKrishanamurthy
The OP is posting in a QML forum and asking about QML'sFileDialog
. Your response is about Qt widget'sQFileDialog
, having features like ability to select to use non-native vs native dialog. Does this even apply to QML'sFileDialog
? I don't use QML, but maybe not. OP's screenshot looks to me like native file dialog under Ubuntu/GNOME, but not sure. -
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!