Time for action – creating an item for drawing outlined text

The goal of the current exercise is to be able to make the following QML code work:

import QtQuick 2.3
import OutlineTextItem 1.0

Rectangle {
  width: 800; height: 400
  OutlineTextItem {
    anchors.centerIn: parent
    text: "This is outlined text"
    fontFamily: "Arial"
    fontPixelSize: 64
    color: "#33ff0000"
    antialiasing: true
    border {
      color: "blue"
      width: 2
      style: Qt.DotLine
    }
  }
}

And produce the following result:

Time for action – creating an item for drawing outlined text

Start with an empty Qt project with the core, gui, and quick modules activated. Create a new class and call it OutlineTextItemBorder. Delete the implementation file as we are going to put all ...

Get Game Programming Using Qt now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.