Results 1 to 4 of 4

Thread: QText, how to only change font family?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Apr 2019
    Posts
    8
    Thanks
    5
    Qt products
    Qt5
    Platforms
    Windows

    Default QText, how to only change font family?

    Hello. Sorry for the stupid question, but I've written up some code that I expected to only change font family, but it also changes the font size.

    Qt Code:
    1. int id = QFontDatabase::addApplicationFont(font_path);
    2. if(id != -1)
    3. {
    4. QStringList family = QFontDatabase::applicationFontFamilies(id);
    5. ui_vp_message->setFont(family.at(0));
    6. }
    To copy to clipboard, switch view to plain text mode 

    I have tried specifically using setFontFamily, but for some reason this does not change the font at all.
    Am I approaching this the wrong way? Is there some other way I could change the font family?
    Last edited by UriTK; 9th April 2019 at 10:43. Reason: QText fits better than QFont in this context.

Similar Threads

  1. Replies: 3
    Last Post: 11th October 2011, 17:58
  2. Requested font family failed
    By wirasto in forum Qt Programming
    Replies: 0
    Last Post: 20th November 2010, 04:30
  3. Font family for non-latin text.
    By chandan in forum Newbie
    Replies: 0
    Last Post: 25th May 2010, 13:01
  4. QTextEdit and font family
    By giusepped in forum Qt Programming
    Replies: 6
    Last Post: 4th June 2008, 10:17
  5. Replies: 1
    Last Post: 25th December 2007, 10:35

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.