Important: Please read the Qt Code of Conduct -

Buttons in QTextTable

  • Hi, I'm Qt newbie.
    Is there any way to insert buttons(or, maybe, hyperlinks, that can call functions) directly into QTextTable object?

  • ?

  • Perhaps you should explain a bit more what you want to achieve. Are you sure you want a QTextTable?

  • Try to use QTableWidget and then you can add any widget to the table by using:
    setCellWidget ( int, int, QWidget * )

  • I tried ) And soon came to conclusion, that it's not good idea in my project.
    I need rich text formatting (in particular bold, italic, underlined text, also merging and splitiing table cells) in a table (that's why i chose QTextTable).
    the table has to be completed with data from the database. When the table is completed (with required formatting), the user must be able to add new entries to the table (and the database), and that would be great to have buttons or hyperlinks in the table cells, which will open new window to add the entry.
    Sure, I can place the button beyond the QTextTable object, but

    1. I want the "add entry" window open with different properties, according to cell, where the button located.
    2. Button beyond the table is less handy than one (or hyperlink) inside the table.

    Hope it's more clear know ) What would you advise?

  • Hi,

    In my opinion QGridLayout might suit better for your needs. You can insert QPushButton and QLabel as well as other widget inside the grid layout.

    Best regards,

Log in to reply