Ejemplo n.º 1
0
Nentry::Nentry(QWidget* parent, const QString& txt,
		int _lPos, bool dark) : QFrame(parent)
{
	focusW = 0;
	lPos = _lPos;
	edit = new QLineEdit(this);
	timer = new QTimer(this);
	filter = new NentryFilter(this);
	drawFrame = false;
	edit->installEventFilter(filter);
	edit->setFrame(drawFrame);

	connect(timer, SIGNAL(timeout()), SLOT(repeat()));
	connect(edit, SIGNAL(returnPressed()), SLOT(endEdit()));
	edit->setCursor(QCursor(Qt::ArrowCursor));
	//      edit->setFont(font3);
	val = 0;
	layout = new QHBoxLayout(this);
	if (txt == "")
	{
		layout->addWidget(edit, 1, Qt::AlignHCenter);
	}
	else
	{
		label = new QLabel(txt, this);
		if (lPos == 0)
		{
			layout->addStretch(5);
			layout->addSpacing(5);
			layout->addWidget(label);
			layout->addSpacing(5);
			layout->addWidget(edit);
			layout->addSpacing(5);
			layout->addStretch(5);
		}
		else
		{
			label->setAlignment(Qt::AlignLeft);
			layout->addWidget(edit, 0, Qt::AlignRight);
			layout->addSpacing(5);
			layout->addWidget(label, 100, Qt::AlignRight | Qt::AlignVCenter);
		}
	}
	if (dark)
	{
		setDark();
	}
	edit->setFocusPolicy(Qt::NoFocus);
}
Ejemplo n.º 2
0
void hilightFlicker(LedGroup* group) {
    for(int i=0; i<group->selectionLen; i++) {

    switch(group->pixelState[i]) {
      case 0:
        setDark(group, i);
        group->pixelState[i]++;
        break;
        
      case 2:
        selectVisibleLed(group, i);
        break;
        
      case 3:
        setProportionalTargetColor(group, i, 400);
        group->pixelState[i]++;
        break;

      case 5:
        flickerSelectColor(group, i, 2, 3);
            
        group->increment[i][0] = 5;
        group->increment[i][1] = 5;
        group->increment[i][2] = 5;
        
        group->pixelState[i]++;
        break;

      case 7:
        selectHiddenLed(group, i);
        
        //selectFlickerLeds(group, i);
        //group->pixelState[i] = 3;
        break;
      
      default:
        updateState(group, i, i);
    }
  }
}