-1

For some reason, my QTableView seems to never emit a single signal. At first I tried connecting to any slot programmatically, but then I realized even through the Signal/Slot Editor from the GUI I could not make something happen, no matter which signal or slot I chose.

One detail that I noticed after a lot of research was that the Qt Documentation specifies that "The signal is only emitted when the index is valid.", so I understand this may be a problem with my models.

However, I still have no idea what might be the issue, or how I can fix it. Displaying the cells work perfectly fine on all models I have, but none of them seem to provide the correct signaling behavior, so I can't really detect the problematic code to post it.

It might be relevant to note, I tried disabling editing, and I'm testing this on Mac OS X Lion 10.7.5.

I appreciate any help. This is my first question here, although I've long benefited from those asked by others. So, yes, I've thoroughly searched for solutions.

asm
  • 11
  • 3
  • 1
    Please paste a self-contained code. Refer to sscce.org for details. – László Papp Jan 03 '14 at 23:46
  • Ok, now I'm baffled. I tried creating a bare bones example and, sure enough, it worked, so now I'm sure the issue is not in the .ui file. However, when I tried simplifying the original model code, I found out that somehow there was _no change at all_ in the compiled program. I mean, I changed `return usernames.size();` to `return 1;` in the rowCount() implementation, and the data() method to `return QVariant("TEST");` and the exact same data that used to be displayed was still displayed. And when I removed that implementation altogether, the project still compiled and executed just fine. WTH! – asm Jan 04 '14 at 17:49

1 Answers1

1

Okay, I finally figured it out. After I realized Qt Creator was never updating the executable, no matter which code I changed, it was simply a matter of manually cleaning the build directory. Using the GUI options to do so (either rebuild or clean+build) hadn't had any effect. I guess it's because I had renamed the project, but didn't update the build directory or something. I had changed (improved) so much code since then that I would never have guessed there was an issue as everything was working fine, until I decided to add some more functionality.

As I had expected, this is kind of underwhelming for my first published issue, but I don't think it deserves negative points. The reason I didn't post some self-contained code is because I had no idea which code was causing the issue; I suppose I was just expecting someone with more experience to point me in the right direction. In the end, it wasn't even an issue with my code, it was with Qt Creator, so I really couldn't have been clearer.

I'll keep this as it might be useful for other people, so tl;dr Qt Creator was silently failing to recompile the code, and the solution was to manually remove the old binaries.

asm
  • 11
  • 3