[solved] How can I click on a cell, in a QTextTable and trigger a signal?



  • I have a calendar almost the same as the calendar example. I wish to click on one of the cells that represent a day and have an signal fire and trigger a slot on my mainwindow. I have the slot all set up but I can't find which object and signal to connect when a cell is clicked in the table.

    The Tables are in a TextBrowser

    In my code all it needs to do is set a field to the date of the cell clicked. I have this code written as well.

    For a visual aid, the arrow in the pic below points to a cell that I need a signal for when clicked.

    !http://imageshack.us/a/img51/1559/whatsignal.png!





  • Hi,
    Can't you get a event? In that event check for a click event, then get the currentIndex and your done. Did do this in a QTableView/Model context, but can't imagine that this class doesn't do the same. There are also mouseOver events in case you need some extra information on a cell. Hope this helps just a bit, but again, never used the QTextTable before.
    Greetz



  • Its very easy if its a [[doc:QTableWidget]]

    And a workaround for this issue could be like, catching the cursorchanged signal, and look for the position of the cursor to make sure, that it is in the table.



  • [quote author="Rahul Das" date="1348734306"]Its very easy if its a [[doc:QTableWidget]]

    And a workaround for this issue could be like, catching the cursorchanged signal, and look for the position of the cursor to make sure, that it is in the table.[/quote]

    Being new is hard :( I didn't know that the textbrowser way of doing it didn't have click events so I had to rewrite my application using QTableWidget. It was a good learning experience though.

    Thread solved.



  • Usually we don't use the documents so interactive as any ui widget right ? Its simply because, when we take a print out of the document, interaction is almost useless! I mean, there is no ui interactions on a paper!

    Still we can make it interactive by customizing our own way.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.