0

I am trying to add a widget in a QFileDialog( File Open Dialog ). Basically I want to display a message just above the Ok and Cancel button of the QFileDialog.I did some research and one way to achieve this was to get the layout of the QFileDialog and add a Qlabel to it.Here is the code :

QFileDialog box;
QGridLayout *layout = (QGridLayout*)box.layout();
QLabel *openLabel = new QLabel( "Please choose the folder" );
layout->addWidget(openLabel, 0, 0);
box.show();

The Problem here is the openLabel comes over the already present items in the QFileDialog. How do i make the label come just above the Ok and cancel buttons ?and make sure it does not override any other widget ?

Sadaab
  • 83
  • 1
  • 1
  • 7
  • 1
    Can you upload snapshot of App, so we can understand problem better ? – Kunal Mar 27 '15 at 09:31
  • have a look at `QFileDialog::setLabelText(DialogLabel label, const QString & text)` and/or `QWidget::setWindowTitle(const QString& text)` – Zaiborg Mar 27 '15 at 09:38
  • Are you sure, that file dialog has grid layout? Did you set `DontUseNativeDialog` option? – Dmitry Sazonov Mar 27 '15 at 09:51
  • I suggest you take a look at qfiledialog.cpp and qfiledoalog.ui in the source code of the Qt libraries you are using, I believe you will find them very useful – Marco Mar 27 '15 at 13:43

0 Answers0