Example #1
0
	void CodeSpinBox::codeChanged(bool code)
	{
		if(!code)
		{
			if(mPrefix.isEmpty())
				mPrefix = prefix();
			if(mSuffix.isEmpty())
				mSuffix = suffix();

			setPrefix(mPrefix);
			setSuffix(mSuffix);
			
			setButtonSymbols(QAbstractSpinBox::UpDownArrows);
			setValue(text().toInt());
			codeLineEdit()->textChanged(codeLineEdit()->text());
		}
		else
		{
			setButtonSymbols(QAbstractSpinBox::NoButtons);
			
			mPrefix = prefix();
			mSuffix = suffix();
			
			int previousWidth = width();

			setPrefix(QString());
			setSuffix(QString());
			
			setMinimumWidth(previousWidth);//This is a hack to fix widget size under KDE, but a better fix has to be found
		}
	}
Example #2
0
TimeSpinBox::TimeSpinBox( QWidget *parent, bool _daysonly )
        : KIntSpinBox ( parent )
{
    setDaysOnly( _daysonly );

    setMinimum( -41 );
    setMaximum( 41 );
    setSingleStep( 1 );

    setButtonSymbols( QSpinBox::PlusMinus );
    lineEdit()->setReadOnly( true );
    setValue( 4 ); //1 second (real time)

    //Set width:
    QFontMetrics fm( font() );
    int extra = width() - lineEdit()->width();
    uint wmax = 0;
    for ( int i=0; i < maximum(); ++i ) {
        uint w = fm.width( '-' + TimeString[i] );
        if (  w > wmax ) wmax = w;
    }
    setFixedWidth( wmax + extra );

    connect( this, SIGNAL( valueChanged( int ) ), this, SLOT( reportChange() ) );
    //	updateDisplay();
}
	void CodeDateTimeEdit::codeChanged(bool code)
	{
		if(!code)
		{
			setCalendarPopup(true);
			setButtonSymbols(QAbstractSpinBox::UpDownArrows);
			setDateTime(QDateTime::currentDateTime());
			setDisplayFormat("dd/MM/yyyy hh:mm:ss");
			codeLineEdit()->textChanged(codeLineEdit()->text());
		}
		else
		{
			setDisplayFormat(QString());
			setCalendarPopup(false);
			setButtonSymbols(QAbstractSpinBox::NoButtons);
		}
	}
Example #4
0
/**
\param parent
**/
BlDoubleSpinBox::BlDoubleSpinBox ( QWidget *parent ) : QDoubleSpinBox ( parent )
{
    BL_FUNC_DEBUG
    installEventFilter ( this );
    setAlignment ( Qt::AlignRight );
    setButtonSymbols ( QAbstractSpinBox::PlusMinus );
    
}
Example #5
0
        void Dial::editorSetup() {
            auto _editor = this->editorAs<editor_type>();

            connect(_editor, SIGNAL(valueChanged(double)), this,
                    SLOT(setValue(double)));
            _editor->setFrame(false);
            _editor->setAlignment(Qt::AlignRight);
            _editor->setButtonSymbols(QAbstractSpinBox::PlusMinus);
            mixin_range_type::apply(_editor);
            valueChangedEvent();
        }
Example #6
0
/// <summary>
/// Constructor that passes parent to the base and sets up height and step.
/// Specific focus policy is used to allow the user to hover over the control
/// and change its value using the mouse wheel without explicitly having to click
/// inside of it.
/// </summary>
/// <param name="p">The parent widget. Default: nullptr.</param>
/// <param name="h">The height of the spin box. Default: 16.</param>
/// <param name="step">The step used to increment/decrement the spin box when using the mouse wheel. Default: 1.</param>
SpinBox::SpinBox(QWidget* p, int h, int step)
	: QSpinBox(p)
{
	m_Select = false;
	m_DoubleClick = false;
	m_DoubleClickNonZero = 0;
	m_DoubleClickZero = 1;
	m_Step = step;
	m_SmallStep = 1;
	setSingleStep(step);
	setFrame(false);
	setButtonSymbols(QAbstractSpinBox::NoButtons);
	setFocusPolicy(Qt::StrongFocus);
	setMinimumHeight(h);//setGeometry() has no effect, so set both of these instead.
	setMaximumHeight(h);
	lineEdit()->installEventFilter(this);
	lineEdit()->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
	connect(this, SIGNAL(valueChanged(int)), this, SLOT(onSpinBoxValueChanged(int)), Qt::QueuedConnection);
}
Example #7
0
KMinuteSpinBox::KMinuteSpinBox(int _step, QWidget *_parent, const char *_name)
	: QSpinBox(0, 59, _step, _parent, _name)
{
	setButtonSymbols(PlusMinus);
	setWrapping(true);
}