コード例 #1
0
void BtQmlScrollView::initScrollBar() {
    m_scrollBar->setRange(-100,100);
    m_scrollBar->setValue(0);
    BT_CONNECT(m_scrollBar, SIGNAL(sliderMoved(int)), this, SLOT(slotSliderMoved(int)));
    BT_CONNECT(m_scrollBar, SIGNAL(sliderPressed()), this, SLOT(slotSliderPressed()));
    BT_CONNECT(m_scrollBar, SIGNAL(sliderReleased()), this, SLOT(slotSliderReleased()));
}
コード例 #2
0
ファイル: vcslider.cpp プロジェクト: speakman/qlc
void VCSlider::init()
{
	setCaption("");

	/* Main VBox */
	m_vbox = new QVBoxLayout(this);
	m_vbox->setMargin(10);
	m_vbox->setSpacing(10);
	
	/* Top label */
	m_topLabel = new QLabel(this);
	m_vbox->addWidget(m_topLabel);
	m_topLabel->setAlignment(AlignCenter);

	/* Slider & its HBox */
	m_hbox = new QHBoxLayout(m_vbox);
	m_hbox->insertSpacing(-1, 10);

	m_slider = new QSlider(this);
	m_hbox->addWidget(m_slider);
	m_slider->setRange(KDefaultBusLowLimit * KFrequency, 
			   KDefaultBusHighLimit * KFrequency);
	m_slider->setPageStep(1);
	connect(m_slider, SIGNAL(sliderPressed()),
		this, SLOT(slotSliderPressed()));
	connect(m_slider, SIGNAL(valueChanged(int)),
		this, SLOT(slotSliderValueChanged(int)));
	connect(m_slider, SIGNAL(sliderReleased()),
		this, SLOT(slotSliderReleased()));
	
	m_hbox->insertSpacing(-1, 10);

	/* Tap button */
	m_tapButton = new QPushButton(this);
	m_vbox->addWidget(m_tapButton);
	connect(m_tapButton, SIGNAL(clicked()),
		this, SLOT(slotTapButtonClicked()));
	m_time = new QTime();

	/* Bottom label */
	m_bottomLabel = new QLabel(this);
	m_vbox->addWidget(m_bottomLabel);
	m_bottomLabel->setAlignment(AlignCenter);
	m_bottomLabel->hide();

	resize(QPoint(60, 220));

	/* Initialize to bus mode by default */
	setBus(KBusIDDefaultFade);
	setSliderMode(Bus);
	setSliderValue(0);
	slotSliderValueChanged(0);

	/* Update the slider according to current mode */
	slotModeChanged(_app->mode());
}
コード例 #3
0
KScienceSetup::KScienceSetup(  QWidget *parent, const char *name )
	: KDialogBase( parent, name, true, i18n( "Setup Science Screen Saver" ),
	  Ok|Cancel|Help, Ok, true ), saver( 0 )
{
	readSettings();
	initModeInfo();

	QWidget *main = makeMainWidget();

	QHBoxLayout *lt  = new QHBoxLayout( main, 0, spacingHint());
	QVBoxLayout *ltm = new QVBoxLayout;
	lt->addLayout( ltm );
	QVBoxLayout *ltc = new QVBoxLayout;
	lt->addLayout( ltc );

	// mode
	QLabel *label = new QLabel( i18n("Mode:"), main );
	ltm->addWidget( label );

	QListBox *c = new QListBox( main );
	for(int i = 0; i<MAX_MODES; i++)
		c->insertItem( modeInfo[i].name );
	c->setCurrentItem( mode );
	c->setFixedHeight( 5 * c->fontMetrics().height() );
	connect( c, SIGNAL( highlighted( int ) ), SLOT( slotMode( int ) ) );
	ltm->addWidget( c );

	// inverse
	QCheckBox *cbox = checkInverse = new QCheckBox( i18n("Inverse"), main );
	cbox->setEnabled( modeInfo[mode].inverseEnable );
	cbox->setChecked( inverse[mode] );
	connect( cbox, SIGNAL( clicked() ), SLOT( slotInverse() ) );
	ltm->addWidget( cbox );

	// gravity
	cbox = checkGravity = new QCheckBox( i18n("Gravity"), main );
	cbox->setChecked( gravity[mode] );
	connect( cbox, SIGNAL( clicked() ), SLOT( slotGravity() ) );
	ltm->addWidget( cbox );

	// hide background
	cbox = checkHideBG = new QCheckBox( i18n("Hide background"), main );
	cbox->setChecked( hideBG[mode] );
	connect( cbox, SIGNAL( clicked() ), SLOT( slotHideBG() ) );
	ltm->addWidget( cbox );
	ltm->addStretch();

	// size
	label = new QLabel( i18n("Size:"), main );
	ltc->addWidget( label );

	slideSize = new QSlider(9, 50, 5, size[mode], QSlider::Horizontal,
                                main );
	slideSize->setMinimumSize( 90, 20 );
    slideSize->setTickmarks(QSlider::Below);
    slideSize->setTickInterval(5);
	connect( slideSize, SIGNAL( sliderMoved( int ) ),
		SLOT( slotSize( int ) ) );
	connect( slideSize, SIGNAL( sliderPressed() ),
		SLOT( slotSliderPressed() ) );
	connect( slideSize, SIGNAL( sliderReleased() ),
		SLOT( slotSliderReleased() ) );

	ltc->addWidget( slideSize );

	// intensity
	label = new QLabel( i18n("Intensity:"), main );
	ltc->addWidget( label );

	slideIntensity = new QSlider(0, 10, 1, intensity[mode],
                                     QSlider::Horizontal, main );
	slideIntensity->setMinimumSize( 90, 20 );
    slideIntensity->setTickmarks(QSlider::Below);
    slideIntensity->setTickInterval(1);
	connect( slideIntensity, SIGNAL( sliderMoved( int ) ),
		SLOT( slotIntensity( int )) );
	connect( slideIntensity, SIGNAL( sliderPressed() ),
		SLOT( slotSliderPressed() ) );
	connect( slideIntensity, SIGNAL( sliderReleased() ),
		SLOT( slotSliderReleased() ) );
	ltc->addWidget( slideIntensity );

	// speed
	label = new QLabel( i18n("Speed:"), main );
	ltc->addWidget( label );

	slideSpeed = new QSlider(0, SCI_MAX_SPEED, 10, speed[mode],
                             QSlider::Horizontal, main );
	slideSpeed->setMinimumSize( 90, 20 );
    slideSpeed->setTickmarks(QSlider::Below);
    slideSpeed->setTickInterval(10);
	connect( slideSpeed, SIGNAL( sliderMoved( int ) ),
		SLOT( slotSpeed( int ) ) );
	ltc->addWidget( slideSpeed );

	// motion
	label = new QLabel( i18n("Motion:"), main );
	ltc->addWidget( label );

	QHBoxLayout *ltcm = new QHBoxLayout;
	ltc->addLayout( ltcm );

	slideMoveX = new QSlider(0, SCI_MAX_MOVE, 5, moveX[mode],
                                 QSlider::Horizontal, main );
	slideMoveX->setMinimumSize( 40, 20 );
    slideMoveX->setTickmarks(QSlider::Below);
    slideMoveX->setTickInterval(5);
	connect( slideMoveX, SIGNAL( sliderMoved( int ) ),
		SLOT( slotMoveX( int ) ) );
	ltcm->addWidget( slideMoveX );

	slideMoveY = new QSlider(0, SCI_MAX_MOVE, 5, moveY[mode],
                                QSlider::Horizontal, main );
	slideMoveY->setMinimumSize( 40, 20 );
    slideMoveY->setTickmarks(QSlider::Below);
    slideMoveY->setTickInterval(5);
	connect( slideMoveY, SIGNAL( sliderMoved( int ) ),
		SLOT( slotMoveY( int ) ) );
	ltcm->addWidget( slideMoveY );

	ltc->addStretch();

	// preview
	preview = new KPreviewWidget( main );
	preview->setFixedSize( 220, 170 );
	QPixmap p( locate("data", "kscreensaver/pics/kscience.png") );
	if( p.isNull() )
		preview->setBackgroundColor( black );
	else
		preview->setBackgroundPixmap( p );
	preview->show();	// otherwise saver does not get correct size
	lt->addWidget( preview );

	// let the preview window display before creating the saver
	kapp->processEvents();

	saver = new KScienceSaver( preview->winId(), true, !p.isNull() );
	preview->notifySaver( saver );
}