Answer the question
In order to leave comments, you need to log in
'class GHBoxLayout' has no membered named 'addWidget'?
In Summerfield's book, I took an example and inserted it into Qt, but an error pops up.
#include "widget.h"
#include <QApplication>
#include <QPushButton>
#include <QSlider>
#include <QSpinBox>
#include <QHBoxLayout>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *window = new QWidget;
window->setWindowTitle("Введите имя: ");
QSpinBox *spinBox = new QSpinBox;
QSlider *slider = new QSlider(Qt::Vertical);
spinBox->setRange(0,130);
slider->setRange(0, 130);
QObject::connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
QObject::connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
spinBox->setValue(35);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWiget(spinBox);
layout->addWiget(slider);
window->setLayout(layout);
window->show();
return a.exec();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question