This week I started to create my first Qt application. One of the first problems I came across was that once I had created a class that inherited QWidget for it’s display I wanted to place it into a KMainWindow display that I had already created earlier. My QWidget class was called ProgrammeViewer. To insert this class into my KMainWindow I used the code:
Code:
QWidget * programmeViwer = new ProgrammeViewer(); |
This created a new QWidget object called programmeViewer using the ProgrammeViewer class. It’s very simple but took me a while to figure out as I was first trying to create the QWidget object using the QWidget class and then attempting to link the object to the ProgrammeViewer class afterwards.