May 2019
Intermediate to advanced
542 pages
13h 37m
English
Now, let's add some basic content to our logo_frame with the following command:
cursor.setPosition(logo_frame.firstPosition())
Just like we called the root frame's lastPosition method to get the position at its end, we can call the logo frame's firstPosition() method to get the position at the beginning of the frame. Once there, we can insert content, such as a logo image, as follows:
cursor.insertImage('nc_logo.png')
Images can be inserted just like this—by passing a path to the image as a string. However, this method offers little in the way of configuration, so let's try a slightly more involved approach:
logo_image_fmt = qtg.QTextImageFormat() logo_image_fmt.setName('nc_logo.png') logo_image_fmt.setHeight(48)Read now
Unlock full access