Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-13011

QFontMetrics on S60 emulator does not return correct values for underlinePos() and lineWidth()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P1: Critical P1: Critical
    • 4.7.1
    • 4.6.3, 4.7.0
    • GUI: Font handling
    • None
    • Symbian Wk28 (Qt 4.7.0 libraries)

      Hi,

      The following code snippet is run in the QWidget's paintEvent() method in Symbian_Wk28 (Qt 4.7.0) baseline:

      void width_prb::paintEvent ( QPaintEvent * event )
      {
          QPainter painter(this);
          painter.setPen(Qt::blue);
          QFont f("Arial", 40);
          QFontMetrics fm = QFontMetrics(f);
          int pos1 = fm.underlinePos();
          int posWidth1 = fm.lineWidth();
       
          f.setPointSize(100);
          fm = QFontMetrics(f);
          int pos2 = fm.underlinePos();
          int posWidth2 = fm.lineWidth();
       
          f.setPointSize(200);
          fm = QFontMetrics(f);
          int pos3 = fm.underlinePos();
          int posWidth3 = fm.lineWidth();
          
          
          qDebug() << "Position1" << pos1;
          qDebug() << "Position2" << pos2;
          qDebug() << "Position3" << pos3;
          
          qDebug() << "Position1 Width" << posWidth1;
          qDebug() << "Position2 Width" << posWidth2;
          qDebug() << "Position3 Width" << posWidth3;
        
          return;
      }
      

      I get the following two different outputs in QT Windows and s60 emulator :
      The result in QT windows is :

      Position1 2
      Position2 4
      Position3 7
      Position1 Width 4
      Position2 Width 10
      Position3 Width 20

      The results in s60 emulator is:

      Position1 1
      Position2 1
      Position3 1
      Position1 Width 1
      Position2 Width 1
      Position3 Width 1

      The emulator always returns '1' for underlinePos and lineWidth, regardless of the point size of the QFont being used.

      It will be helpful if you can provide a fix for this issue.

      Thanks and Regards,
      Paramita Biswas.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            portale Alessandro Portale
            parbiswa Paramita Biswas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes