Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Font Size Problem

Font Size Problem

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 1.3k 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.
  • Z Offline
    Z Offline
    ZekDe
    wrote on last edited by
    #1

    Hi friends,
    I'm running my codes and first groupBox's font size equals label above ,you will understand what I mean .These are my codes. groupBox_1 giving my intention result but groupBox giving labelBluetoothAdress fontsize.I cannot solve it.

    /// \brief labelTitle
    //
    mfont.setPointSize(round(10*ui->labelTitle->geometry().height()/gbox));
    ui->labelTitle->setFont(mfont);
    ui->labelTitle->setStyleSheet(QStringLiteral("color: #0095d6"));
    ui->labelTitle->setAlignment(Qt::AlignHCenter);

                /// \brief labelBluetoothAdress
                ///
                mfont.setPointSize(round(10*ui->labelBluetoothAdress->geometry().height()/10));
                ui->labelBluetoothAdress->setFont(mfont);
                ui->labelBluetoothAdress->setAlignment(Qt::AlignHCenter);
                /*********///6 adet Group Box nesnelerini uygun şekilde yerleştirmek için başlık ve bluetooth adresinin yazılacağı nesnelerin yükseklikleri dahil edilmiyor.
                //int hh = round(h - 1.6*(ui->labelTitle->geometry().height() + ui->labelBluetoothAdress->geometry().height()));
                /*********/
                //////////Tüm groupBox Ayarları////////////
                ///
                /// \brief groupBox
                ///
                QRect gb;
    
                gb = ui->groupBox->geometry();
                mfont.setPointSize(round(gb.height()/gbox));
                mfont.setBold(false);
                ui->groupBox->setFont(mfont);
    
                mfont.setPointSize(round(ui->customPlot->geometry().height()/cPlot));
                mfont.setBold(false);
                ui->customPlot->xAxis->setTickLabelFont(mfont);
                ui->customPlot->yAxis->setTickLabelFont(mfont);
    
                mfont.setPointSize(round(ui->labelDisplay->geometry().height())/cnst);
                mfont.setBold(true);
                ui->labelDisplay->setFont(mfont);
                ui->labelDisplay->setAlignment(Qt::AlignRight);
    
                mfont.setPointSize(round(ui->labelUnity->geometry().height()/cnst));
                mfont.setBold(true);
                ui->labelUnity->setFont(mfont);
                ui->labelUnity->setAlignment(Qt::AlignLeft);
    
    
                /// \brief groupBox_1
                ///
                gb = ui->groupBox_1->geometry();
    
                mfont.setPointSize(round(gb.height()/gbox));
                mfont.setBold(false);
                ui->groupBox_1->setFont(mfont);
    
                mfont.setPointSize(round(ui->customPlot_1->geometry().height()/cPlot));
                mfont.setBold(false);
                ui->customPlot_1->xAxis->setTickLabelFont(mfont);
                ui->customPlot_1->yAxis->setTickLabelFont(mfont);
    
                mfont.setPointSize(round(ui->labelDisplay_2->geometry().height())/cnst);
                mfont.setBold(true);
                ui->labelDisplay_2->setFont(mfont);
                ui->labelDisplay_2->setAlignment(Qt::AlignRight);
    
                mfont.setPointSize(round(ui->labelUnity_2->geometry().height()/cnst));
                mfont.setBold(true);
                ui->labelUnity_2->setFont(mfont);
                ui->labelUnity_2->setAlignment(Qt::AlignLeft);
    
    jsulmJ 1 Reply Last reply
    0
    • Z ZekDe

      Hi friends,
      I'm running my codes and first groupBox's font size equals label above ,you will understand what I mean .These are my codes. groupBox_1 giving my intention result but groupBox giving labelBluetoothAdress fontsize.I cannot solve it.

      /// \brief labelTitle
      //
      mfont.setPointSize(round(10*ui->labelTitle->geometry().height()/gbox));
      ui->labelTitle->setFont(mfont);
      ui->labelTitle->setStyleSheet(QStringLiteral("color: #0095d6"));
      ui->labelTitle->setAlignment(Qt::AlignHCenter);

                  /// \brief labelBluetoothAdress
                  ///
                  mfont.setPointSize(round(10*ui->labelBluetoothAdress->geometry().height()/10));
                  ui->labelBluetoothAdress->setFont(mfont);
                  ui->labelBluetoothAdress->setAlignment(Qt::AlignHCenter);
                  /*********///6 adet Group Box nesnelerini uygun şekilde yerleştirmek için başlık ve bluetooth adresinin yazılacağı nesnelerin yükseklikleri dahil edilmiyor.
                  //int hh = round(h - 1.6*(ui->labelTitle->geometry().height() + ui->labelBluetoothAdress->geometry().height()));
                  /*********/
                  //////////Tüm groupBox Ayarları////////////
                  ///
                  /// \brief groupBox
                  ///
                  QRect gb;
      
                  gb = ui->groupBox->geometry();
                  mfont.setPointSize(round(gb.height()/gbox));
                  mfont.setBold(false);
                  ui->groupBox->setFont(mfont);
      
                  mfont.setPointSize(round(ui->customPlot->geometry().height()/cPlot));
                  mfont.setBold(false);
                  ui->customPlot->xAxis->setTickLabelFont(mfont);
                  ui->customPlot->yAxis->setTickLabelFont(mfont);
      
                  mfont.setPointSize(round(ui->labelDisplay->geometry().height())/cnst);
                  mfont.setBold(true);
                  ui->labelDisplay->setFont(mfont);
                  ui->labelDisplay->setAlignment(Qt::AlignRight);
      
                  mfont.setPointSize(round(ui->labelUnity->geometry().height()/cnst));
                  mfont.setBold(true);
                  ui->labelUnity->setFont(mfont);
                  ui->labelUnity->setAlignment(Qt::AlignLeft);
      
      
                  /// \brief groupBox_1
                  ///
                  gb = ui->groupBox_1->geometry();
      
                  mfont.setPointSize(round(gb.height()/gbox));
                  mfont.setBold(false);
                  ui->groupBox_1->setFont(mfont);
      
                  mfont.setPointSize(round(ui->customPlot_1->geometry().height()/cPlot));
                  mfont.setBold(false);
                  ui->customPlot_1->xAxis->setTickLabelFont(mfont);
                  ui->customPlot_1->yAxis->setTickLabelFont(mfont);
      
                  mfont.setPointSize(round(ui->labelDisplay_2->geometry().height())/cnst);
                  mfont.setBold(true);
                  ui->labelDisplay_2->setFont(mfont);
                  ui->labelDisplay_2->setAlignment(Qt::AlignRight);
      
                  mfont.setPointSize(round(ui->labelUnity_2->geometry().height()/cnst));
                  mfont.setBold(true);
                  ui->labelUnity_2->setFont(mfont);
                  ui->labelUnity_2->setAlignment(Qt::AlignLeft);
      
      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @ZekDe said in Font Size Problem:

      mfont.setPointSize(round(10*ui->labelBluetoothAdress->geometry().height()/10));

      You multiply by 10 and then devide by 10 - what's the point?

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

      1 Reply Last reply
      1
      • Z Offline
        Z Offline
        ZekDe
        wrote on last edited by
        #3

        I got this problem,I am getting 'size < 0' this is why I think program assign default value maybe previous value .

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

          Hi,

          In addition to the point made by @jsulm, when are you calling that code ? If it's in the constructor then you are using invalid values. No geometry is known at construction time, it's only when a widget is shown that its geometry becomes real.

          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
          1

          • Login

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