Results 1 to 5 of 5

Thread: Font Pixel Size issue

  1. #1
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Font Pixel Size issue

    Hi
    In the image attached i have two texts in rows. Here i need to place the first row of the text at 45 pixels from top.But it is placing at 54 pixels from top.Font size is 28 px.Where am i doing wrong with this? Please suggest ur answers.


    Regards
    Bala B
    Attached Images Attached Images
    • File Type: png 1.png (11.8 KB, 2 views)

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Font Pixel Size issue

    You forgot to post the QML code for this item.

    Cheers,
    _

  3. #3
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Font Pixel Size issue

    Hi,
    Here it is.
    Qt Code:
    1. Text {
    2. id: _unitName
    3. anchors {
    4. left:parent.left;leftMargin: 30;top: parent.top;topMargin: _screenName.text===""? 45 : 24
    5. }
    6. font.pixelSize: 28
    7. font.family: appStyle.font.familyRegular
    8. }
    9.  
    10. Text {
    11. id: _unitTime
    12. anchors{ left:parent.left;leftMargin: 30; top: _unitName.bottom }
    13. text: time+"<font color=\"#4F555A\"> | </font>" +date
    14. font.pixelSize: 26
    15. font.family: appStyle.font.familyRegular
    16. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by anda_skoa; 6th April 2016 at 19:49. Reason: missing [code] tags

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Font Pixel Size issue

    Hmm, that looks all ok.

    Have you tried if a Rectangle gets positioned correctly if you anchor it that way?

    Cheers,
    _

  5. #5
    Join Date
    Jul 2013
    Posts
    33
    Qt products
    Qt3
    Platforms
    Unix/X11

    Default Re: Font Pixel Size issue

    Hi,
    Rectangle is positioned correctly.I am fine with those. I have problem only with fonts here.Let me brief my understanding here.The text element we took was assigned 28 px as font size.Here we have positioned text element 45px from the top.And now when i measure the font in Photoshop , font occupies only 19 px and remaining space is left on top of the font.it looked like font baseline is aligned to bottom.Something lineheight comes in to the picture i guess. Not sure how these fonts are positioned and aligned.

    Regards
    Bala B

Similar Threads

  1. Replies: 1
    Last Post: 30th March 2012, 16:46
  2. Font size issue on Mac OS X
    By hitmaneidos in forum Qt Programming
    Replies: 2
    Last Post: 13th March 2012, 00:01
  3. QTransform Pixel Issue
    By meazza in forum Newbie
    Replies: 2
    Last Post: 21st June 2011, 10:09
  4. Font Height and width based on font size
    By Ghufran in forum Qt Programming
    Replies: 1
    Last Post: 31st July 2010, 08:02
  5. Replies: 1
    Last Post: 24th October 2006, 16:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.