Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QFontDialog: How to set it size?

QFontDialog: How to set it size?

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 549 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mireiner
    wrote on last edited by mireiner
    #1

    Hi there,

    I like to increase the size of a QFontDialog but my code doesn't work:

    #include <QApplication>
    #include <QFileDialog>
    
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        a.setAttribute(Qt::AA_EnableHighDpiScaling);
        a.setDesktopSettingsAware(true);
    
        QFileDialog FileDialog(nullptr);
        FileDialog.resize(1600,800);
    //    FileDialog.setGeometry(100, 100, 1600, 900); -> not working also
    
        QString filePath = QString("/home");
        QString fileFilter = QString("Textfile (*.txt)");
        QString selectedFilter;
        QString fullPath = FileDialog.getOpenFileName(nullptr, "File Save As", filePath, fileFilter, &selectedFilter);
    
        return a.exec();
    }
    

    My system:
    Arch Linux
    KDE Plasma 5.20.2 desktop
    Qt 5.15.1

    How to increase the size of QFontDialog?

    B 1 Reply Last reply
    0
    • M mireiner

      Hi there,

      I like to increase the size of a QFontDialog but my code doesn't work:

      #include <QApplication>
      #include <QFileDialog>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          a.setAttribute(Qt::AA_EnableHighDpiScaling);
          a.setDesktopSettingsAware(true);
      
          QFileDialog FileDialog(nullptr);
          FileDialog.resize(1600,800);
      //    FileDialog.setGeometry(100, 100, 1600, 900); -> not working also
      
          QString filePath = QString("/home");
          QString fileFilter = QString("Textfile (*.txt)");
          QString selectedFilter;
          QString fullPath = FileDialog.getOpenFileName(nullptr, "File Save As", filePath, fileFilter, &selectedFilter);
      
          return a.exec();
      }
      

      My system:
      Arch Linux
      KDE Plasma 5.20.2 desktop
      Qt 5.15.1

      How to increase the size of QFontDialog?

      B Offline
      B Offline
      Bonnie
      wrote on last edited by
      #2

      @mireiner said in QFontDialog: How to set it size?:

      FileDialog.getOpenFileName(nullptr, "File Save As", filePath, fileFilter, &selectedFilter)

      That's a static methd, calling that equals calling QFileDialog::getOpenFileName(...).
      So your setting on FileDialog will not have any effect on it.
      Just use non-static methods.

      1 Reply Last reply
      1
      • M Offline
        M Offline
        mireiner
        wrote on last edited by mireiner
        #3

        @Bonnie
        Sorry, I'm a beginner. I already thought that I used the non static method because I didn't use QFileDialog::getOpenFileName(..) in my code.

        Can you please provide a short code snippet for the non static method?

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Bonnie
          wrote on last edited by
          #4

          Somehow you asked about QFontDialog, but you are using QFileDialog in the code...
          For QFileDialog, https://doc.qt.io/qt-5/qfiledialog.html#details, start reading from "You can create your own QFileDialog without using the static functions."
          For QFontDialog, the doc doesn't write that in detail, but it is just similar to QFileDialog.

          M 1 Reply Last reply
          2
          • B Bonnie

            Somehow you asked about QFontDialog, but you are using QFileDialog in the code...
            For QFileDialog, https://doc.qt.io/qt-5/qfiledialog.html#details, start reading from "You can create your own QFileDialog without using the static functions."
            For QFontDialog, the doc doesn't write that in detail, but it is just similar to QFileDialog.

            M Offline
            M Offline
            mireiner
            wrote on last edited by
            #5

            @Bonnie said in QFontDialog: How to set it size?:

            Somehow you asked about QFontDialog, but you are using QFileDialog in the code...

            Oh, sorry that was a typo.

            Thank you for the link to the documentation, I will read this part carefully.

            M 1 Reply Last reply
            0
            • M mireiner

              @Bonnie said in QFontDialog: How to set it size?:

              Somehow you asked about QFontDialog, but you are using QFileDialog in the code...

              Oh, sorry that was a typo.

              Thank you for the link to the documentation, I will read this part carefully.

              M Offline
              M Offline
              mireiner
              wrote on last edited by mireiner
              #6
              This post is deleted!
              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved