Hello. I recently started to work with Qt and Qwt. I can't find my mistake by myself. Please help me. There is the code:
I know that my mistakes in somewhere here:
.h file
...
class MainWindow : public
{
Q_OBJECT
public:
...
...
class MainWindow : public
QMainWindow
{
Q_OBJECT
QWidget *centralWidget;
public:
MainWindow(QWidget *parent = 0);
...
To copy to clipboard, switch view to plain text mode
.cpp
MainWindow
::MainWindow(QWidget *parent
):...
...
void MainWindow::setPlotButton() {
button->setCheckable(true);
connect(button, SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
plotsLayout->setSpacing(10);
plotsLayout->addWidget(funPlot);
buttonsLayout->addWidget(button);
widgetLayout->addLayout(plotsLayout);
widgetLayout->addLayout(buttonsLayout);
setLayout(widgetLayout);
...
}
MainWindow::MainWindow(QWidget *parent):
QMainWindow(parent) {
...
...
void MainWindow::setPlotButton() {
button = new QPushButton("push"),
button->setCheckable(true);
connect(button, SIGNAL(toggled(bool)), this, SLOT(toggled(bool)));
QHBoxLayout *plotsLayout = new QHBoxLayout;
plotsLayout->setSpacing(10);
plotsLayout->addWidget(funPlot);
QHBoxLayout *buttonsLayout = new QHBoxLayout ;
buttonsLayout->addWidget(button);
QVBoxLayout *widgetLayout = new QVBoxLayout;
widgetLayout->addLayout(plotsLayout);
widgetLayout->addLayout(buttonsLayout);
setLayout(widgetLayout);
...
}
To copy to clipboard, switch view to plain text mode
I recieve a message "QWidget::setLayout: Attempting to set QLayout "" on MainWindow "", which already has a layout". What I should change?
Bookmarks