May 14, 2011

bright day bright day
Lab Rat
21 posts

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?

5 replies

May 16, 2011

bright day bright day
Lab Rat
21 posts

?

May 16, 2011

Andre Andre
Area 51 Engineer
6031 posts

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

 Signature 

Looking for Qt developers to join our team @ i-Optics: https://qt-project.org/forums/viewthread/25393/

May 16, 2011

rajeevpodar rajeevpodar
Lab Rat
2 posts

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

May 16, 2011

bright day bright day
Lab Rat
21 posts

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?

May 16, 2011

leon.anavi leon.anavi
Mad Scientist
1046 posts

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,
Leon

 Signature 

http://anavi.org/

 
  ‹‹ Target multiples MacOS X version with one computer      display 3D image file ››

You must log in to post a reply. Not a member yet? Register here!