Different font size between Ubuntu PC and STM32MP157C-DK2
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-06-30 4:36 PM
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.
Labels:
- Labels:
-
STM32MP15 Lines
This discussion is locked. Please start a new topic to ask your question.
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
2020-07-05 1:05 PM
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);
}
