Esempio n. 1
0
WSpinBox::WSpinBox(WContainerWidget *parent)
  : WAbstractSpinBox(parent),
    value_(-1),
    min_(0),
    max_(99),
    step_(1)
{ 
  setValidator(createValidator());
  setValue(0);
}
Esempio n. 2
0
WDoubleSpinBox::WDoubleSpinBox(WContainerWidget *parent)
  : WAbstractSpinBox(parent),
    value_(-1),
    min_(0.0),
    max_(99.99),
    step_(1.0),
    precision_(2)
{ 
  setValidator(createValidator());
  setValue(0.0);
}
Esempio n. 3
0
void XmlParserTest::initTestCase()
{
	try
	{
		// Create a validator
		validator = createValidator(QStringLiteral(":/courses/course.xsd"));
	}
	catch (Exception& e)
	{
		QFAIL(qUtf8Printable(e.message()));
	}
}
Esempio n. 4
0
WSpinBox::WSpinBox(WContainerWidget *parent)
    : WAbstractSpinBox(parent),
      value_(-1),
      min_(0),
      max_(99),
      step_(1),
      wrapAroundEnabled_(false),
      valueChanged_(this)
{
    setValidator(createValidator());
    setValue(0);
}
Esempio n. 5
0
void WAbstractSpinBox::updateDom(DomElement& element, bool all)
{
  if (all || changed_) {
    if (!all) {
      if (!nativeControl())
	doJavaScript("jQuery.data(" + jsRef() + ", 'obj')"
		     ".update(" + jsMinMaxStep() + ","
		     + boost::lexical_cast<std::string>(decimals()) + ");");
      else
	setValidator(createValidator());
    }
  }

  changed_ = false;

  WLineEdit::updateDom(element, all);

  if (all && nativeControl())
    element.setAttribute("type", "number");
}
Esempio n. 6
0
void WAbstractSpinBox::updateDom(DomElement& element, bool all)
{
  if (all || changed_) {
    if (!all) {
      if (!nativeControl())
	doJavaScript("jQuery.data(" + jsRef() + ", 'obj')"
		     ".configure("
		     + std::to_string(decimals()) + ","
		     + prefix().jsStringLiteral() + ","
		     + suffix().jsStringLiteral() + ","
		     + jsMinMaxStep() + ");");
      else
	setValidator(std::shared_ptr<WValidator>(createValidator().release()));
    }
  }

  changed_ = false;

  WLineEdit::updateDom(element, all);

  if (all && nativeControl())
    element.setAttribute("type", "number");
}
Esempio n. 7
0
void WAbstractSpinBox::setup(bool useNative)
{
  if (useNative) {
    setValidator(createValidator());
  } else {
    defineJavaScript();

    addStyleClass("Wt-spinbox");

#ifdef WT_CNOR
    EventSignalBase& b = mouseMoved();
    EventSignalBase& c = keyWentDown();
#endif

    connectJavaScript(mouseMoved(), "mouseMove");
    connectJavaScript(mouseWentUp(), "mouseUp");
    connectJavaScript(mouseWentDown(), "mouseDown");
    connectJavaScript(mouseWentOut(), "mouseOut");
    connectJavaScript(keyWentDown(), "keyDown");
    connectJavaScript(keyWentUp(), "keyUp");

    setValidator(new SpinBoxValidator(this));
  }
}
Esempio n. 8
0
void XmlParserTest::invalidSchemaFile()
{
	QVERIFY_EXCEPTION_THROWN(createValidator(QStringLiteral(":/testing/courses/testcourse.xml")), XmlException);
}
Esempio n. 9
0
void XmlParserTest::invalidSchemaFilePath()
{
	QVERIFY_EXCEPTION_THROWN(createValidator(QStringLiteral(":/testing/courses/FOOBAR.xsd")), FileException);
}
void IndirectSpectrumSelectionView::setMaskBinsRegex(const std::string &regex) {
  m_selector->leMaskBins->setValidator(
      createValidator(QString::fromStdString(regex)));
}