Results 1 to 4 of 4

Thread: QWidget refuses to accept it's own font, insists on inheriting

  1. #1
    Join Date
    Jun 2006
    Posts
    43
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QWidget refuses to accept it's own font, insists on inheriting

    I have a QWidget that initially had no parent (i.e. top level window). It defined it's own pallete and fonts.

    I decided that I wanted to take advantage of the parent/child cleanup if the main application was destroyed. So I gave this window a parent in it's initializer list and add the following to the constructor.

    Qt Code:
    1. setWindowFlags(windowFlags() | Qt::Window); // top-level window
    To copy to clipboard, switch view to plain text mode 
    I can set a pallete but this window it refusing to accept a new font. If I again remove the parenting then it takes the font.

    Ideas?

    I initially thought that maybe my style sheets or my custom style were interfering, but I disabled both and the problem persists.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWidget refuses to accept it's own font, insists on inheriting

    Can you prepare a minimal compilable example reproducing the problem?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2006
    Posts
    43
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget refuses to accept it's own font, insists on inheriting

    I had already tried, but my stripped down version behaved correctly.

    I eventually found out that it was, indeed, a style sheets issue after all. I had a style sheet defined at a much higher level that was clobbering the look. My new best-coding practice is to use setStyleSheet() judiciously and only when the desired effect cannot be easily achieved through palettes.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,363
    Thanks
    3
    Thanked 5,012 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWidget refuses to accept it's own font, insists on inheriting

    Quote Originally Posted by Mookie View Post
    My new best-coding practice is to use setStyleSheet() judiciously and only when the desired effect cannot be easily achieved through palettes.
    That's a very good approach.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Phonon refuses to open AAC files on Windows 7 (Qt 4.7)
    By bitsflew in forum Qt Programming
    Replies: 3
    Last Post: 7th February 2012, 05:44
  2. Replies: 1
    Last Post: 4th August 2010, 19:50
  3. Replies: 1
    Last Post: 23rd February 2010, 15:57
  4. Inheriting from QwtPlotCurve problems
    By dbrmik in forum Qwt
    Replies: 5
    Last Post: 1st April 2009, 14:02
  5. Inheriting QListViewItem
    By ct in forum Newbie
    Replies: 1
    Last Post: 17th March 2006, 05:52

Tags for this Thread

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.