cImageButton::cImageButton(int x, int y, unsigned short up, unsigned short down) {
	x_ = x;
	y_ = y;
	mouseOver_ = false;
	mouseHolding_ = false;
	spaceHolding_ = false;
	canHaveFocus_ = true; // Buttons can have the input focus
	pressRepeatRate_ = 0; // There is no press repeat rate by default (normal push buttons)
	ignoreDoubleClicks_ = true;

	width_ = 0;
	height_ = 0;

	gumps[BS_UNPRESSED] = Gumpart->readTexture(up);
	gumps[BS_HOVER] = 0;
	gumps[BS_PRESSED] = Gumpart->readTexture(down);
	
	if (gumps[BS_UNPRESSED]) {
		width_ = gumps[BS_UNPRESSED]->realWidth();
		height_ = gumps[BS_UNPRESSED]->realHeight();
	}

	pressRepeatTimer = new QTimer(this); // Should be auto freed
	pressRepeatTimer->setSingleShot(true);
	connect(pressRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatPress())); // Connect the timer to the press repeat slot
}
示例#2
0
void ArrowDiscWidget::startPressRepeat()
{
    repeatPress();

    if ( m_arrowPressed != Qt::NoArrow ) {
        m_repeatPressTimer.start( 100 );
    }
}
示例#3
0
ArrowDiscWidget::ArrowDiscWidget( QWidget *parent ) :
    QWidget( parent ),
    m_arrowPressed( Qt::NoArrow ),
    m_repetitions( 0 ),
    m_marbleWidget( 0 ),
    m_imagePath( "marble/navigation/navigational_arrows" )
{
    setMouseTracking( true );

    m_initialPressTimer.setSingleShot( true );
    connect( &m_initialPressTimer, SIGNAL(timeout()), SLOT(startPressRepeat()) );
    connect( &m_repeatPressTimer, SIGNAL(timeout()), SLOT(repeatPress()) );
}
cImageButton::cImageButton() {
	mouseOver_ = false;
	mouseHolding_ = false;
	spaceHolding_ = false;
	canHaveFocus_ = true; // Buttons can have the input focus
	pressRepeatRate_ = 0; // There is no press repeat rate by default (normal push buttons)
	ignoreDoubleClicks_ = true;

	width_ = 0;
	height_ = 0;

	gumps[BS_UNPRESSED] = 0;
	gumps[BS_HOVER] = 0;
	gumps[BS_PRESSED] = 0;
	
	pressRepeatTimer = new QTimer(this); // Should be auto freed
	connect(pressRepeatTimer, SIGNAL(timeout()), this, SLOT(repeatPress())); // Connect the timer to the press repeat slot
}