Skip to main content
Visitor II
June 30, 2020
Question

Different font size between Ubuntu PC and STM32MP157C-DK2

  • June 30, 2020
  • 1 reply
  • 952 views

I made a simple widget example with label but the font size in STM32MP157C-DK2 is biggest than Ubuntu PC. How can I fix this?

Thank you for any help.

    This topic has been closed for replies.

    1 reply

    CDias.1Author
    Visitor II
    July 5, 2020

    I found one way to fix it but I don't know if is the best.

    Does anyone knows how to config the pixel size on Qt?

    Thank you for any help!

    Follow the solution I used:

    #define ADJUST_PIXEL_SIZE_FOR_STM32MP1 1.4
     
    MainWindow::MainWindow(QWidget *parent)
     : QMainWindow(parent)
     , ui(new Ui::MainWindow)
    {
     ui->setupUi(this);
     
     QFont font;
     
     font = ui->label->font();
     font.setPixelSize(font.pointSize() * ADJUST_PIXEL_SIZE_FOR_STM32MP1);
     ui->label->setFont(font);
     
     font = ui->label_2->font();
     font.setPixelSize(font.pointSize() * ADJUST_PIXEL_SIZE_FOR_STM32MP1);
     ui->label_2->setFont(font);
     
     font = ui->pushButton->font();
     font.setPixelSize(font.pointSize() * ADJUST_PIXEL_SIZE_FOR_STM32MP1);
     ui->pushButton->setFont(font);
    }

    0693W000001sAV1QAM.jpg0693W000001sAUwQAM.png