たとえば、フォームに 20 個のウィジェットがあります。画面の解像度に基づいてサイズを変更する必要があるため、ここに私の方法があります
newHeight=(desktopHeight * ui->widget1->height())/768;
newWidth=(desktopWidth * ui->widget1->width())/1024;
newY=(desktopHeight * ui->widget1->y())/768;
newX=(desktopWidth * ui->widget1->x())/1024;
ui->widget1->setGeometry(newX,
newY,
newWidth,
newHeight);
newFontSize=(desktopHeight * ui->widget1->font().pointSize())/768;
ui->widget1->setFont(QFont ("Ubuntu",newFontSize, QFont::Bold));
残りの 19 個のウィジェットについても、この方法を繰り返します。すべてのウィジェットを取得して do while ステートメントを作成し、ウィジェットがパラメーターである関数を作成する方法はありますか?