Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to change thickness of letters?

How to change thickness of letters?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 259 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    qwe3
    wrote on last edited by
    #1

    Hi,

    I would like to have a filled letters and I have it:

    someText.png

    But I would like to change thickness ( black border ). I don't want use setStyleSheet ( maybe it is impossible ). How can I change that?

        QPainter painter(this);
        QPainterPath painterPath;
        painter.setRenderHint(QPainter::Antialiasing);
    
        painterPath.addText(100,600,font(),"some text");
    
        painter.fillPath(painterPath, Qt::red);
        painter.drawPath(painterPath);
    

    I tried with

    QFont f = font();
    f.setWeight(50);
    

    But with no good result.

    VRoninV 1 Reply Last reply
    0
    • Q qwe3

      Hi,

      I would like to have a filled letters and I have it:

      someText.png

      But I would like to change thickness ( black border ). I don't want use setStyleSheet ( maybe it is impossible ). How can I change that?

          QPainter painter(this);
          QPainterPath painterPath;
          painter.setRenderHint(QPainter::Antialiasing);
      
          painterPath.addText(100,600,font(),"some text");
      
          painter.fillPath(painterPath, Qt::red);
          painter.drawPath(painterPath);
      

      I tried with

      QFont f = font();
      f.setWeight(50);
      

      But with no good result.

      VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      @qwe3 said in How to change thickness of letters?:

      But I would like to change thickness ( black border )

      https://doc.qt.io/qt-5/qpainter.html#setPen

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved