Icon app progress
Posted by mholmes on 21 Dec 2009 in Activity log
Moved a lot further forward towards a normal working application today. These are some of the things I learned:
- Although my data is in a QAbstractTableModel descendant, and my first instinct was to give that class a
modified
property to track whether the data was dirty or not, it turns out that for an SDI app like this one, you might as well store that info in thewindowModified
property of theQMainWindow
. This makes things simpler. - When the model's data is changed, it emits a dataChanged() signal, which I was trying for a while to hook up to a custom slot in my MainWindow. I couldn't figure out why this wasn't working. It turned out that:
- the signal and slot must have exactly the same parameter types;
- when you declare, you use variable names, but when you connect the signal and slot, you must leave out the variable names, and only include the ampersand;
- omitting the const keyword will cause the connection to fail.
- QDebug is really neat and easy to use. Just include
<QDebug>
in the header, and callqDebug()<<"My message"
to write it out to the Application Output console,