void Screenshot::createButtonsLayout() { #ifdef Q_WS_QWS QMenu *contextMenu = QSoftMenuBar::menuFor(this); contextMenu->addAction( tr("New"), this, SLOT( newScreenshot())); contextMenu->addAction( tr("Save"), this, SLOT( saveScreenshot())); contextMenu->addAction( tr("Quit"), this, SLOT( close())); #else newScreenshotButton = createButton(tr("New Screenshot"), this, SLOT(newScreenshot())); saveScreenshotButton = createButton(tr("Save Screenshot"), this, SLOT(saveScreenshot())); quitScreenshotButton = createButton(tr("Quit"), this, SLOT(close())); buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(); buttonsLayout->addWidget(newScreenshotButton); buttonsLayout->addWidget(saveScreenshotButton); buttonsLayout->addWidget(quitScreenshotButton); #endif }
//! [8] void Screenshot::createButtonsLayout() { newScreenshotButton = createButton(tr("New Screenshot"), this, SLOT(newScreenshot())); saveScreenshotButton = createButton(tr("Save Screenshot"), this, SLOT(saveScreenshot())); quitScreenshotButton = createButton(tr("Quit"), this, SLOT(close())); buttonsLayout = new QHBoxLayout; buttonsLayout->addStretch(); buttonsLayout->addWidget(newScreenshotButton); buttonsLayout->addWidget(saveScreenshotButton); buttonsLayout->addWidget(quitScreenshotButton); }