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. Alignment of image and text in QTextTable
Forum Updated to NodeBB v4.3 + New Features

Alignment of image and text in QTextTable

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtexttablealignmentqtextcursor
2 Posts 2 Posters 472 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.
  • V Offline
    V Offline
    voltron
    wrote on last edited by
    #1

    I create a simple two column table programmatically using QTextTable class. In the cells of the first row I need to put an image plus short text and center them vertically. Unfortunately I can't find a way to do it.

    I have tried to apply a vertical alignment to cells using following code

    format = table->cellAt(0, 1).format();
    format.setVerticalAlignment(QTextCharFormat::AlignMiddle);
    table->cellAt(0, 1).setFormat(format);
    

    But it seems not working. In the resulting table images and text are not centered vertically, instead image seems to be aligned to the cell top while text aligned to the cell bottom.

    Also tried with applying QTextBlockFormat with vertical alignment to cells with the same result.

    Am I miss something or doing it incorrectly? Maybe another approach should be used to achieve desired result?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Please provide a minimal compilable example to reproduce your issue.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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