以前在学JAVA。现在来学一下C++这东东。感觉QT和JAVA很相似。自己想当然的写了这个程序,编能过就是不能运行。希望高手来帮忙改下。不胜感激!!
#include <QtGui/QApplication>
#include <QHBoxLayout>
#include <qslider.h>
#include <qspinbox.h>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QHBoxLayout *layout=new QHBoxLayout();
layout->setMargin(6);
QSpinBox *spinBox=new QSpinBox((QWidget*)layout);
QSlider *slider=new QSlider(Qt::Horizontal,(QWidget*)layout);
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);
layout->addWidget(spinBox);
layout->addWidget(slider);
app.setMainWidget((QWidget*)layout);
//qt_2 w;
//w.show();
return app.exec();
}