Exemplo n.º 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
		}
	}
Exemplo n.º 2
0
	void CodeSpinBox::contextMenuEvent(QContextMenuEvent *event)
	{
		QMenu *menu = codeLineEdit()->createStandardContextMenu();

		menu->addSeparator();

		const uint se = stepEnabled();

		QAction *up = menu->addAction(tr("&Step up"));
		up->setShortcut(QKeySequence(Qt::Key_Up));
		up->setEnabled(se & StepUpEnabled);

		QAction *down = menu->addAction(tr("Step &down"));
		down->setShortcut(QKeySequence(Qt::Key_Down));
		down->setEnabled(se & StepDownEnabled);

		menu->addSeparator();

		codeLineEdit()->addShortcuts(menu);

		const QAction *action = menu->exec(event->globalPos());

		if(action == up)
			stepBy(1);
		else if(action == down)
			stepBy(-1);

		delete menu;

		event->accept();
	}
Exemplo n.º 3
0
	QString CodeSpinBox::textFromValue(int value) const
	{
		if(isCode())
			return codeLineEdit()->text();

		return QSpinBox::textFromValue(value);
	}
Exemplo n.º 4
0
	QString CodeDateTimeEdit::textFromDateTime(const QDateTime &dateTime) const
	{
		if(isCode())
			return codeLineEdit()->text();

		return QDateTimeEdit::textFromDateTime(dateTime);
	}
Exemplo n.º 5
0
	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);
		}
	}
Exemplo n.º 6
0
	QString CodeSpinBox::text()
	{
		QString currentPrefix = prefix();
		QString currentSuffix = suffix();

		setPrefix(QString());
		setSuffix(QString());

		QString value = codeLineEdit()->text();

		setPrefix(currentPrefix);
		setSuffix(currentSuffix);

		return value;
	}
Exemplo n.º 7
0
	bool KeyEdit::eventFilter(QObject *object, QEvent *event)
	{
		if(isCode())
			return QObject::eventFilter(object, event);

		if(event->type() == QEvent::KeyPress)
		{
			QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);

			if(!mKeyInput.fromEvent(keyEvent))
				return true;

			codeLineEdit()->setText(mKeyInput.toTranslatedText());

			return true;
		}

		return QObject::eventFilter(object, event);
	}
Exemplo n.º 8
0
 void CodeSpinBox::setParameterContainer(const ParameterContainer *parameterContainer)
 {
     codeLineEdit()->setParameterContainer(parameterContainer);
 }
Exemplo n.º 9
0
	void CodeSpinBox::setCompletionModel(QAbstractItemModel *completionModel)
	{
        codeLineEdit()->setCompletionModel(completionModel);
    }
Exemplo n.º 10
0
	void CodeSpinBox::openEditor(int line, int column)
	{
		codeLineEdit()->openEditor(line, column);
	}
Exemplo n.º 11
0
	void CodeSpinBox::setFromSubParameter(const SubParameter &subParameter)
	{
		setCode(subParameter.isCode());
		codeLineEdit()->setText(subParameter.value().toString());
	}
Exemplo n.º 12
0
	void CodeSpinBox::setCode(bool code)
	{
		codeLineEdit()->setCode(code);
	}
Exemplo n.º 13
0
	bool CodeSpinBox::isCode() const
	{
		return codeLineEdit()->isCode();
	}
Exemplo n.º 14
0
 void FileEdit::setParameterContainer(const ParameterContainer *parameterContainer)
 {
     codeLineEdit()->setParameterContainer(parameterContainer);
 }
Exemplo n.º 15
0
	void KeyEdit::setKeyInput(const KeyInput &keyInput)
	{
		mKeyInput = keyInput;

		codeLineEdit()->setText(mKeyInput.toTranslatedText());
	}
Exemplo n.º 16
0
	bool CodeComboBox::isCode() const
	{
		return codeLineEdit()->isCode();
	}
Exemplo n.º 17
0
 void CodeDateTimeEdit::setParameterContainer(const ParameterContainer *parameterContainer)
 {
     codeLineEdit()->setParameterContainer(parameterContainer);
 }
Exemplo n.º 18
0
	void CodeDateTimeEdit::openEditor(int line, int column)
	{
		codeLineEdit()->openEditor(line, column);
	}
Exemplo n.º 19
0
	void CodeDateTimeEdit::setCode(bool code)
	{
		codeLineEdit()->setCode(code);
	}
Exemplo n.º 20
0
	bool CodeDateTimeEdit::isCode() const
	{
		return codeLineEdit()->isCode();
	}
Exemplo n.º 21
0
 QSet<QString> CodeSpinBox::findVariables() const
 {
     return codeLineEdit()->findVariables();
 }
Exemplo n.º 22
0
	void CodeComboBox::setCode(bool code)
	{
		codeLineEdit()->setCode(code);
	}
Exemplo n.º 23
0
 QSet<QString> CodeDateTimeEdit::findVariables() const
 {
     return codeLineEdit()->findVariables();
 }
Exemplo n.º 24
0
 QSet<QString> FileEdit::findVariables() const
 {
     return codeLineEdit()->findVariables();
 }
Exemplo n.º 25
0
	void ColorEdit::setCompletionModel(QAbstractItemModel *completionModel)
	{
		codeLineEdit()->setCompletionModel(completionModel);
	}
Exemplo n.º 26
0
 void PositionEdit::setParameterContainer(const ParameterContainer *parameterContainer)
 {
     codeLineEdit()->setParameterContainer(parameterContainer);
 }