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. QTextDocument: overlay multiple items on the same cursor position
Forum Updated to NodeBB v4.3 + New Features

QTextDocument: overlay multiple items on the same cursor position

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 153 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    Mark81
    wrote on last edited by
    #1

    I'm trying to print the "usual" form for date and signature, something like this:

    Signature            Date
    ______________       _______________
    

    but on the signature's line I want to print a QImage (the signature).
    I tried the following:

    QTextCharFormat charFormat;
    charFormat.setFontPointSize(200);
    
    QTextTableFormat tableFormat;
    tableFormat.setHeaderRowCount(0);
    tableFormat.setWidth(QTextLength(QTextLength::PercentageLength, 100));
    tableFormat.setBorder(0);
    tableFormat.setCellSpacing(200);
    
    textTable = cursor.insertTable(2, 2, tableFormat);
    textTable->cellAt(0, 0).firstCursorPosition().insertText(tr("Signature"), charFormat);
    textTable->cellAt(0, 1).firstCursorPosition().insertText(tr("Date"), charFormat);
    textTable->cellAt(1, 0).firstCursorPosition().insertText("_________________________", charFormat);
    textTable->cellAt(1, 0).firstCursorPosition().insertImage(myQImage);
    textTable->cellAt(1, 1).firstCursorPosition().insertText("_________________________", charFormat);
    

    but calling the firstCursorPosition() twice it just makes room for the image:

    Signature            Date
    image goes here      _______________
    ______________
    

    Instead I want the image is printed over the line. Because it's a png I also expect the alpha channel is honored and I can see the line behind.

    How to achieve this?

    1 Reply Last reply
    0

    • Login

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