PDA

View Full Version : QTableWidget signal cellActivated?



abrou
11th February 2008, 22:36
Hello, I am using qt 4.3.3 with two QTableWidgets. When one cell is selected in a table, I want a corresponding cell to be selected in another table. I have implemented this, but I am not sure which signal to use. I had been using cellClicked, which worked fine, but since I am not clicking both cells (one on each table) with the mouse, how can I get the other one to emit a signal?

If that isn't clear, the basic question is: how do I get a signal to be emitted when using it is mearly "highlighted"? (I don't know if highlighted is the right term). would I use cellActivated? I can't figure out what this signal is supposed to be. It seems to connect properly, but nothing happens.

Thanks again for people's advice!

jpn
12th February 2008, 08:46
When one cell is selected in a table, I want a corresponding cell to be selected in another table.
Do they have same data? In that case I'd suggest using model based approach and a shared QItemSelectionModel. Just like the Chart example (http://doc.trolltech.com/latest/itemviews-chart.html) does, see MainWindow::setupViews().

abrou
14th February 2008, 21:12
They might have the same data, but it isn't guaranteed. Each table has a list populated from a different .xml file, and clicking a row in the table will bring up information read from the corresponding .xml file (the info isn't stored, it is opened each time the user wants to look at another command). It will also bring up information from the corresponding command in the other QTableWidget.

I think there is another way to do it, but it isn't as nice as just having a signal produced which the highlighted cell is changed.

Thanks for your suggestion though!