Qt-2-Varsta-Age-Tutorial: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
(Add "cleanup" tag)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
<code>#include &quot;varsta.h&amp;quot;<br />#include &lt;QApplication&amp;gt;<br />#include &lt;QSpinBox&amp;gt;<br />#include &lt;QSlider&amp;gt;<br />#include &lt;QHBoxLayout&amp;gt;
{{Cleanup | reason=Auto-imported from ExpressionEngine.}}


int main(int argc, char *argv[])<br />{<br /> QApplication a(argc, argv);<br /> QWidget *w = new QWidget;<br /> w-&gt;setWindowTitle(&quot;Introduceti varsta dvs.&quot;);
@#include "varsta.h"
#include <QApplication>
#include <QSpinBox>
#include <QSlider>
#include <QHBoxLayout>


QSpinBox *spinBox = new QSpinBox;<br /> QSlider *slider = new QSlider(Qt::Horizontal);<br /> spinBox-&gt;setRange(0,130);<br /> slider-&gt;setRange(0,130);
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *w = new QWidget;
w->setWindowTitle("Introduceti varsta dvs.");


QObject::connect(spinBox, SIGNAL (valueChanged(int)), slider, SLOT (setValue(int)));<br /> QObject::connect(slider, SIGNAL (valueChanged(int)), spinBox, SLOT (setValue(int)));<br /> spinBox-&gt;setValue(35);
QSpinBox *spinBox = new QSpinBox;
QSlider *slider = new QSlider(Qt::Horizontal);
spinBox->setRange(0,130);
slider->setRange(0,130);


QHBoxLayout *layout = new QHBoxLayout;<br /> layout-&gt;addWidget(spinBox);<br /> layout-&gt;addWidget(slider);<br /> w-&gt;setLayout(layout);
QObject::connect(spinBox, SIGNAL (valueChanged(int)), slider, SLOT (setValue(int)));
QObject::connect(slider, SIGNAL (valueChanged(int)), spinBox, SLOT (setValue(int)));
spinBox->setValue(35);


w-&gt;show();
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(spinBox);
layout->addWidget(slider);
w->setLayout(layout);


return a.exec&amp;amp;#40;&amp;#41;;<br />}<br /></code>
w->show();
 
return a.exec();
}
<code>

Latest revision as of 16:25, 3 March 2015

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(); }