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. Shapes of control are shrinked on 4k displays d
Forum Updated to NodeBB v4.3 + New Features

Shapes of control are shrinked on 4k displays d

Scheduled Pinned Locked Moved Solved General and Desktop
dpi awareness
13 Posts 3 Posters 1.8k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome to devnet,

    Your explication is not exactly clear. Can you post screen shots that shows the difference ?

    By the way:

    • What Qt version are you using ?
    • What OS are you running ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • Pavel_47P Offline
      Pavel_47P Offline
      Pavel_47
      wrote on last edited by
      #3

      Thanks.
      Here it is:
      0_1557090064040_16d7a0e5-db85-4180-9bc3-b597f3cc3079-image.png
      QtCreator: 4.9.0
      OS: Windows 10

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        Did you already check the HighDPI chapter in Qt's documentation ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • Pavel_47P Offline
          Pavel_47P Offline
          Pavel_47
          wrote on last edited by
          #5

          Well, there is attrbute Qt::AA_EnableHighDpiScaling, that apparently resolves the problem.
          How (or where) can I set it ?
          Thanks.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            If you follow the link to the attribute documentation, you can find QCoreApplication::setAttribute.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            2
            • Pavel_47P Offline
              Pavel_47P Offline
              Pavel_47
              wrote on last edited by
              #7

              Setting the Qt::AA_EnableHighDpiScaling attribute to true in the MainWindow constructor
              didn't help: the button shape remains shrinked.

              jsulmJ 1 Reply Last reply
              0
              • Pavel_47P Pavel_47

                Setting the Qt::AA_EnableHighDpiScaling attribute to true in the MainWindow constructor
                didn't help: the button shape remains shrinked.

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #8

                @Pavel_47 Try to set the attribute before creating the MainWindow instance.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                1
                • Pavel_47P Offline
                  Pavel_47P Offline
                  Pavel_47
                  wrote on last edited by
                  #9

                  Tried. The same (i.e. button shrinked).
                  int main(int argc, char *argv[])

                  {
                      QApplication a(argc, argv);
                      QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
                      MainWindow w;
                      w.show();
                  
                      return a.exec();
                  }
                  
                  jsulmJ 1 Reply Last reply
                  0
                  • Pavel_47P Pavel_47

                    Tried. The same (i.e. button shrinked).
                    int main(int argc, char *argv[])

                    {
                        QApplication a(argc, argv);
                        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
                        MainWindow w;
                        w.show();
                    
                        return a.exec();
                    }
                    
                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    @Pavel_47 Is the button in a layout? How did you set it up?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • Pavel_47P Offline
                      Pavel_47P Offline
                      Pavel_47
                      wrote on last edited by
                      #11

                      Should be like this:
                      0_1557121275842_2509ce2b-ee14-481e-9cb4-28ea616f36a5-image.png

                      1 Reply Last reply
                      0
                      • SGaistS Offline
                        SGaistS Offline
                        SGaist
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        @Pavel_47 said in Shapes of control are shrinked on 4k displays d:

                        AA_EnableHighDpiScaling

                        As explained in the documentation of this enum, it must be set before creating a QGuiApplication instance (which is also valid for QApplication since it's based on QGuiApplication).

                        Interested in AI ? www.idiap.ch
                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                        1 Reply Last reply
                        2
                        • Pavel_47P Offline
                          Pavel_47P Offline
                          Pavel_47
                          wrote on last edited by
                          #13

                          Yes ! Works. Thanks

                          int main(int argc, char *argv[])
                          {
                              QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
                              QApplication a(argc, argv);
                              MainWindow w;
                              w.show();
                              return a.exec();
                          }
                          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