|
1Qter豆
本帖最后由 w1518893 于 2013-10-9 14:46 编辑
#include <QtGui/QApplication>
#include "mainwindow.h"
#include <QtGui/QWidget>
#include <QtGui/QSpinBox>
#include <QtGui/QSlider>
#include <QtGui/QHBoxLayout>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *window = new QWidget;
window->setWindowTitle("Enter your age");
QSpinBox *spinBOX = new QSpinBox;
QSlider *slider = new QSlider(Qt::Horizontal);
spinBOX->setRange(0,130);
slider->setRange(0,130);
QObject::connect(slider, SIGNAL(valueChanged(int)), spinBox, SLOT(setValue(int)));
QObject::connect(spinBox, SIGNAL(valueChanged(int)), slider, SLOT(setValue(int)));
spinBOX->setValue(35);
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinBox);
layout->addWidget(slider);
window->setLayout(layout);
window->show();
return a.exec();
}
F:\qt\buju\main.cpp:16: 错误:'spinBox' was not declared in this scope
前面不是声明了吗。为什么还是报错?求各位好心人帮忙看一下 |
最佳答案
查看完整内容
QSpinBox *spinBOX = new QSpinBox; *pinBOX 大写的
|