Results 1 to 6 of 6

Thread: Font

  1. #1
    Join Date
    Feb 2008
    Posts
    47
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Font

    hi,
    I have a exe in which there is a button.If i click on that button then stylesheet should be applied to the same exe.
    Everything is working fine.But the exe's font size alone changes .I want the font size whatever i have assigned for that module(exe) to be constant.How to do that?
    Thanx

  2. #2
    Join Date
    Feb 2008
    Posts
    47
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: Font

    After i applied stylesheet the font size changed.In the trolltect doc --They have given like this
    Warning: If the value of the Qt property changes after the style sheet has been set, it might be necessary to force a style sheet recomputation. One way to achieve this is to unset the style sheet and set it again.

    but how to unset the stylesheet and set it?
    Plz help.

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    258
    Thanks
    22
    Thanked 19 Times in 16 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Font

    I guess something like
    Qt Code:
    1. qApp->setStyleSheet(QString());
    2. qApp->setStyleSheet(myStyleSheet); // myStyleSheet stands for your custom stylesheet string
    To copy to clipboard, switch view to plain text mode 
    would do it. I assume Qt will compare the passed string to it's current stylesheet string and drop out of the function if they are identical in order to avoid unneccesary stylesheet recalculations, so passing any string that is different from your current style would do it. Yet I think, this is not what you are looking for.What the qt documentation refers to is changing properties that influence the style after the stylesheet has already been applied. This means, Qt respects certain properties when it "calculates the look" whenever you call setStyleSheet. If you change the properties later Qt will not automatically recalculate those. I don't think that is the case for you.
    Last edited by momesana; 23rd April 2008 at 15:48.

  4. #4
    Join Date
    Feb 2008
    Posts
    47
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: Font

    My problem is "Even after applying stylesheet whatever font i have set for the application shouldnt change."

  5. #5
    Join Date
    Sep 2007
    Location
    Szczecin, Poland
    Posts
    153
    Thanks
    7
    Thanked 11 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Font

    hi, maybe you simply shouldn't have font entries in your styleSheet?
    See GrEEn (Graphics Effects Environment)
    http://sourceforge.net/project/platf...roup_id=232746
    a qt-based plugins oriented MDI image processing application(contains also qt plugins like styles & imageformats).

  6. #6
    Join Date
    Feb 2008
    Posts
    47
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Post Re: Font

    i dont have any such entry.But still the font size is changing.
    Plz help.

Similar Threads

  1. Font size calculation when painting in a QImage
    By Ishark in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 22:22
  2. Automatic font selection
    By NTwoO in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 27th April 2007, 12:40
  3. Font not Antialiasing
    By ChasW in forum Qt Programming
    Replies: 6
    Last Post: 21st January 2007, 18:12
  4. Qt renders wrong font
    By durbrak in forum Qt Programming
    Replies: 8
    Last Post: 2nd November 2006, 14:36
  5. Determine system font
    By niala in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2006, 22:45

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.