Change font sizes for a QFileDialog



  • I am currently opening a QFileDialog using the following static function.

    QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
            "",
            "",
            0,
            QFileDialog::DontUseNativeDialog);
    

    Is there a way to increase the font size within the dialog that this function call opens?

    I have tried to set the stylesheet using the following statement to no effect:

     this->setStyleSheet("QTreeView {font: 16pt \"Arial\";}");


  • I just tried this in an empty project and the stylesheet statement worked for me to increase the text size. Did you put the call to set the stylesheet before the filedialog call? I also used a larger font just to be sure it was working:

    this->setStyleSheet("QTreeView {font: 26pt \"Arial\";}");
    QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"),
            "",
            "",
            0,
            QFileDialog::DontUseNativeDialog);


  • Thanks dcape, I did set the call to setStyleSheet before the fileDialog call as in your example, but not seeing any results. I'm running this on Ubuntu and also tried it on a debian system running LXDE for the window manager.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.