QT小滑块

主代码:

QWidget *window=new QWidget();
	window->setWindowTitle("hello");
	QSpinBox *spinBox=new QSpinBox();
	QSlider *slider=new QSlider(Qt::Horizontal);
	spinBox->setRange(100,1000);
	slider->setRange(100,1000);
	spinBox->setValue(100);

	QObject::connect(slider,SIGNAL(valueChanged(int)),spinBox,SLOT(setValue(int)));
	QObject::connect(spinBox,SIGNAL(valueChanged(int)),slider,SLOT(setValue(int)));

	QHBoxLayout *layout=new QHBoxLayout();
	layout->addWidget(spinBox);
	layout->addWidget(slider);
	window->setLayout(layout);
	window->show();
	return a.exec();

 

相关文章:

  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2022-02-07
  • 2022-02-23
  • 2021-11-23
  • 2021-04-29
  • 2021-12-05
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-14
  • 2021-11-22
  • 2022-12-23
  • 2022-01-18
相关资源
相似解决方案