VolumeRendering

Qt Main Window

QPainter Example | | Qt Framework

Usually we start as a special widget as the root of the widget hierarchy, the main window, that is QMainWindow:

class MyQMainWindow: public QMainWindow
{
   Q_OBJECT; // Qt Metacall object for signal/slot connections

public:

   //! default ctor
   MyQMainWindow(QWidget *parent = 0)
   : QMainWindow(parent)
   {
      setWindowTitle("MyQMainWindow");

      QAction *quitAction = new QAction(tr("Q&uit"), this);
      connect(quitAction, SIGNAL(triggered()), this, SLOT(close()));

      QMenu *fileMenu_ = menuBar()->addMenu(tr("&File"));
      fileMenu_->addAction(quitAction);

      setCentralWidget(new PainterWidget());
   }

   //! dtor
   ~MyQMainWindow()
   {}

protected:

   void keyPressEvent(QKeyEvent *event)
   {
      if (event->key() == Qt::Key_Q)
         emit close();

      QMainWindow::keyPressEvent(event);
   }

};


QPainter Example | | Qt Framework

Options: