ControlWidget::ControlWidget(QWidget *parent) : QWidget(parent) { hLayout = new QHBoxLayout; next = new QPushButton("weiter"); previous = new QPushButton("zurück"); skip = new QPushButton("überspringen"); hLayout->addWidget(previous); previous->setEnabled(false); hLayout->addWidget(skip); skip->setEnabled(false); hLayout->addWidget(next); QObject::connect(previous, SIGNAL(clicked()), this, SLOT(previousButtonClicked())); QObject::connect(skip, SIGNAL(clicked()), this, SLOT(skipButtonClicked())); QObject::connect(next, SIGNAL(clicked()), this, SLOT(nextButtonClicked())); }
ScratchTool::ScratchTool() : QMainWindow(), central(new MainWidget(this)) { this->setWindowTitle(tr("LocTool")); this->setCentralWidget(central); //Create the toolbar toolbar = new QToolBar(); previousButton = new QPushButton("previous", this); nextButton = new QPushButton("next", this); toolbar->addWidget(previousButton); toolbar->addWidget(nextButton); this->addToolBar(toolbar); //Connect the buttons with appropriate slots connect(previousButton, SIGNAL(released()), central, SLOT(previousButtonClicked())); connect(nextButton, SIGNAL(released()), central, SLOT(nextButtonClicked())); }