Important: Please read the Qt Code of Conduct -

QFileDialog sidebar on target device not visible

  • Hi, I have problems with a Qt Widget Application.
    There is a difference in how the QFileDialog is displayed on my host computer and on my target device. On the taget device the sidebar with some urls isn’t visible. I’ve found out that there is a problem with the indexes of the Widgets in the QFileDialog. When I add a QButton to a specific place in QFileDialog then the position (0,0 --> see below) of the button on my Host Computer is as expected.
    On target the position is different.
    I guess there is a problem with the indexes. This would also explain the missing sidebar. Then if the position of the button on the target is (0,0) then the position of the sidebar would be negative. Does anyone had this problem before?

    Additional information:

    • The Class CFileDialog inherits QFileDialog.
    • I don’t use the native file dialog I use one from Qt.
    • I hide some ToolButtons because I don’t need them, but there is no difference in behaviour when these lines are commented out.
      CFileDialog* fileDialog = new CFileDialog(nullptr, caption, usbDir, "*.*");
      // enlarge buttons and list items
        "QPushButton{min-height: 40px; min-width: 200px;}"
        "QListView{font-size: 18px;}"
        "QListView::item{height: 50px;}"
        "QTreeView{font-size: 14px;}"
        "QTreeView::item{height: 50px;}"
      // use Qt design of dialog, and not the design from OS
      fileDialog->setOption(QFileDialog::DontUseNativeDialog, true);
      // make system read only
      fileDialog->setOption(QFileDialog::ReadOnly, true);
      // set the view (List or Detail)
      // hide unnecessary tool buttons
      QToolButton* forwardButton = fileDialog->findChild<QToolButton *>("forwardButton");
      if (forwardButton != nullptr){
      QToolButton* backButton = fileDialog->findChild<QToolButton *>("backButton");
      if (backButton != nullptr){
      QToolButton* newFolderButton = fileDialog->findChild<QToolButton *>("newFolderButton");
      if (newFolderButton != nullptr){
      QToolButton* listModeButton = fileDialog->findChild<QToolButton *>("listModeButton");
      if (listModeButton != nullptr){
      QToolButton* detailModeButton = fileDialog->findChild<QToolButton *>("detailModeButton");
      if (detailModeButton != nullptr){
      // add example button
      QGridLayout* gridLayout = fileDialog->findChild<QGridLayout *>("gridLayout");
      gridLayout->addWidget(new QPushButton("USB"), 0,0);
      // remove file type selection box and add label
      QComboBox* fileTypeCombo = fileDialog->findChild<QComboBox *>("fileTypeCombo");
      // add short cuts for USB and NANDFlash
      QList<QUrl> urls;
      urls << QUrl::fromLocalFile("/USB_Disk") << QUrl::fromLocalFile("/NANDFlash");
      // execute file dialog and get fileName
      QString filePath = QString();
      if (fileDialog->exec())
        QStringList filePathList = fileDialog->selectedFiles();
        if (!filePathList.empty()){
          filePath =;
      // check for present file name
      if (!filePath.isNull())
        qDebug() << "FileDialog: selected file path: " << filePath.toUtf8();
      delete fileDialog;
      return filePath;

    Target Device
    Platform: WinCE 7
    Qt Version: 5.6.3 Commercial

    Host Computer
    Platform: Win 10
    Qt Version: 5.6.3 Commercial

Log in to reply