I have one abstract class, TableWidget, which inherits from QWidget. It implements paintEvent.
class TableWidget : public QWidget
{
    Q_OBJECT
private:
    int width;
    int height;
public:
    explicit TableWidget(QWidget *parent = 0);
    virtual int getWidthInCells() = 0;
    virtual int getHeightInCells() = 0;
    virtual QString getCellText(byte x, byte y) = 0;
    virtual QString getColumnLabel(byte a) = 0;
    virtual QString getRowLabel(byte a) = 0;
    byte getCellHighlight(byte x, byte y);
    void setCellHighlight(byte x, byte y, bool highlighted);
    void setHeight(int h);
    void setWidth(int w);
protected:
    void paintEvent(QPaintEvent *e);
signals:
public slots:
};
I tried testing TableWidget out with a dummy class with next to no functionality.
class DummyTable : public TableWidget {
public:
    explicit DummyTable(QWidget *parent = 0) {}
    int getWidthInCells() {return 2;}
    int getHeightInCells() {return 2;}
    QString getCellText(byte x, byte y) {return "0";}
    QString getColumnLabel(byte a) {return QString(a);}
    QString getRowLabel(byte a) {return QString(a);}
};
The problem is that paintEvent (implemented in TableWidget.cpp), is never called. The first mistake I noticed was the absence of the Q_OBJECT macro in DummyTable. I added it in and tested it, but this resulted in a failure to terminate correctly. I had to completely exit out of QT to kill the process. I looked into QPushButton and it seemed to do things the same as me, except for the inclusion of Q_OBJECT.
So, how can I get paintEvent to be called properly?