Qt-2-Varsta-Age-Tutorial

From Qt Wiki
Jump to navigation Jump to search
This article may require cleanup to meet the Qt Wiki's quality standards. Reason: Auto-imported from ExpressionEngine.
Please improve this article if you can. Remove the {{cleanup}} tag and add this page to Updated pages list after it's clean.

@#include "varsta.h"

  1. include <QApplication>
  2. include <QSpinBox>
  3. include <QSlider>
  4. include <QHBoxLayout>

int main(int argc, char *argv[]) {

QApplication a(argc, argv);
QWidget *w = new QWidget;
w->setWindowTitle("Introduceti varsta dvs.");

QSpinBox *spinBox = new QSpinBox;

QSlider *slider = new QSlider(Qt::Horizontal);
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->addWidget(spinBox);
layout->addWidget(slider);
w->setLayout(layout);

w->show();

return a.exec(); }