void createUi(PlotViewInterpolation* plot_view) {
    _b1_rbtn = new QRadioButton("no boundary", plot_view);
    _b2_rbtn = new QRadioButton("c1 boundary", plot_view);
    _b3_rbtn = new QRadioButton("c2 boundary", plot_view);
    _b1_rbtn->setDown(true);

    _lbl_weight = new QLabel("lambda", plot_view);
    _lbl_weight->setAlignment(Qt::AlignRight);
    _lbl_weight->adjustSize();

    _sld_precision = new QSlider(Qt::Horizontal, plot_view);
    _sld_precision->setMinimum(1);
    _sld_precision->setMaximum(1000);
    _sld_precision->setTickInterval(1);
    _sld_precision->setValue(20);
    _sld_precision->adjustSize();

    _sld_alpha = new QSlider(Qt::Horizontal, plot_view);
    _sld_alpha->setMinimum(1);
    _sld_alpha->setMaximum(1000);
    _sld_alpha->setTickInterval(1);
    _sld_alpha->setValue(50);
    _sld_alpha->adjustSize();

    _lbl_knot = new QLabel("initial knots", plot_view);
    _lbl_knot->setAlignment(Qt::AlignRight);
    _lbl_knot->adjustSize();

    _lbl_level = new QLabel("level", plot_view);
    _lbl_level->setAlignment(Qt::AlignRight);
    _lbl_knot->adjustSize();

    _sld_level = new QSlider(Qt::Horizontal, plot_view);
    _sld_level->setMinimum(1);
    _sld_level->setMaximum(10);
    _sld_level->setTickInterval(1);
    _sld_level->setValue(1);
    _sld_level->adjustSize();

    QSignalMapper* signal_map = new QSignalMapper(plot_view);
    signal_map->setMapping(_b1_rbtn, 0);  // no boundary
    signal_map->setMapping(_b2_rbtn, 1);  // c1 boundary
    signal_map->setMapping(_b3_rbtn, 2);  // c2 boundary

    QObject::connect(_b1_rbtn, SIGNAL(clicked()), signal_map, SLOT(map()));
    QObject::connect(_b2_rbtn, SIGNAL(clicked()), signal_map, SLOT(map()));
    QObject::connect(_b3_rbtn, SIGNAL(clicked()), signal_map, SLOT(map()));
    QObject::connect(signal_map, SIGNAL(mapped(int)), plot_view,
                     SLOT(setBoundary(int)));
    QObject::connect(_sld_precision, &QSlider::valueChanged, plot_view,
                     &PlotViewInterpolation::changePrecision);
    QObject::connect(_sld_alpha, &QSlider::valueChanged, plot_view,
                     &PlotViewInterpolation::changeAlpha);
    QObject::connect(_sld_level, &QSlider::valueChanged, plot_view,
                     &PlotViewInterpolation::changeLevel);
  }
Пример #2
0
EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString &current,
                                      QWidget *parent ) :
  KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok,
               parent )
{
  QFrame *topFrame = plainPage();
  QBoxLayout *topLayout = new QVBoxLayout( topFrame );

  mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"),
                                   topFrame );
  mButtonGroup->setRadioButtonExclusive( true );
  topLayout->addWidget( mButtonGroup );

  QStringList::ConstIterator it;
  for( it = emails.begin(); it != emails.end(); ++it ) {
    QRadioButton *button = new QRadioButton( *it, mButtonGroup );
    if ( (*it) == current ) {
      button->setDown( true );
    }
  }
}
Пример #3
0
MainWindow::MainWindow( QWidget *_parent ): QMainWindow(_parent)
{
	this->resize(QSize(1024,800));
	m_kinect=QKinect::instance();
	QToolBar *toolbar = new QToolBar(this);
	toolbar->setObjectName("KinectToolbar");
	QLabel *label= new QLabel(toolbar);
	label->setText("angle");
	toolbar->addWidget(label);
	QDoubleSpinBox *angle = new QDoubleSpinBox(this);
	angle->setMaximum(30.0);
	angle->setMinimum(-30.0);
	angle->setSingleStep(1.0);
	QObject::connect(angle,SIGNAL(valueChanged(double)),m_kinect,SLOT(setAngle(double)));

	toolbar->addWidget(angle);
	QPushButton *reset = new QPushButton("reset");
	QObject::connect(reset,SIGNAL(clicked()),m_kinect,SLOT(resetAngle()));

	toolbar->addWidget(reset);
	QLabel *label2= new QLabel(toolbar);
	label2->setText("Camera Mode");
	toolbar->addWidget(label2);
	QComboBox *videoMode= new QComboBox(toolbar);

	videoMode->addItem("RGB");
	videoMode->addItem("Bayer");
	videoMode->addItem("IR 8");
	videoMode->addItem("IR 10");
	videoMode->addItem("IR 10 P");
	videoMode->addItem("YUV_RGB");
	videoMode->addItem("YUV_RAW");
	QObject::connect(videoMode,SIGNAL(currentIndexChanged(int)),m_kinect,SLOT(setVideoMode(int)));

	toolbar->addWidget(videoMode);

	QRadioButton *off = new QRadioButton("LED off",toolbar);
	off->setDown(true);
	QObject::connect(off,SIGNAL(clicked()),m_kinect,SLOT(setLedOff()));
	toolbar->addWidget(off);
	QRadioButton *red = new QRadioButton("LED red",toolbar);
	QObject::connect(red,SIGNAL(clicked()),m_kinect,SLOT(setRedLed()));

	toolbar->addWidget(red);
	QRadioButton *green = new QRadioButton("LED green",toolbar);
	QObject::connect(green,SIGNAL(clicked()),m_kinect,SLOT(setGreenLed()));

	toolbar->addWidget(green);
	QRadioButton *yellow = new QRadioButton("LED yellow",toolbar);
	QObject::connect(yellow,SIGNAL(clicked()),m_kinect,SLOT(setYellowLed()));

	toolbar->addWidget(yellow);

  QRadioButton *redF = new QRadioButton("flash red ",toolbar);
  QObject::connect(redF,SIGNAL(clicked()),m_kinect,SLOT(setRedLedFlash()));

	toolbar->addWidget(redF);
	QRadioButton *greenF = new QRadioButton("flash green",toolbar);

	QObject::connect(greenF,SIGNAL(clicked()),m_kinect,SLOT(setGreenLedFlash()));
	toolbar->addWidget(greenF);
	QRadioButton *yellowF = new QRadioButton("flash yellow",toolbar);
	QObject::connect(yellowF,SIGNAL(clicked()),m_kinect,SLOT(setYellowLedFlash()));

	toolbar->addWidget(yellowF);

	this->addToolBar(toolbar);

	m_mdiArea = new QMdiArea;
	m_mdiArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	m_mdiArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
	setCentralWidget(m_mdiArea);
	this->setWindowTitle(QString("Kinect Demo"));

	QGLFormat format;
	format.setVersion(4,1);
	format.setProfile( QGLFormat::CoreProfile);
	format.setSwapInterval(1);


	QMdiSubWindow *subWindow1 = new QMdiSubWindow;
	VideoWindow *rgb = new VideoWindow(VideoWindow::RGB);
	QWidget *container = QWidget::createWindowContainer(rgb);
	subWindow1->setWidget(container);
	subWindow1->setAttribute(Qt::WA_DeleteOnClose);
	subWindow1->setWindowTitle("RGB Output");
	subWindow1->resize(500,350);
	m_mdiArea->addSubWindow(subWindow1);
	VideoWindow *depth = new VideoWindow(VideoWindow::DEPTH);
	container = QWidget::createWindowContainer(depth);
	QMdiSubWindow *subWindow2 = new QMdiSubWindow;
	subWindow2->setWidget(container);
	subWindow2->setAttribute(Qt::WA_DeleteOnClose);
	subWindow2->setWindowTitle("Depth Output");
	subWindow2->resize(500,350);
	m_mdiArea->addSubWindow(subWindow2);


	PointCloud *cloud = new PointCloud();
	container = QWidget::createWindowContainer(cloud);
	QMdiSubWindow *subWindow3 = new QMdiSubWindow;
	subWindow3->setWidget(container);
	subWindow3->setAttribute(Qt::WA_DeleteOnClose);
	subWindow3->setWindowTitle("PointCloud");
	subWindow3->resize(500,350);
	m_mdiArea->addSubWindow(subWindow3);

	this->setWindowTitle(QString("kinect demo"));


}