Ejemplo n.º 1
0
void EqonomizeValueEdit::focusInEvent(QFocusEvent *e) {
	if(e->reason() == Qt::TabFocusReason || e->reason() == Qt::BacktabFocusReason) {
		QDoubleSpinBox::focusInEvent(e);
		selectNumber();
	} else {
		QDoubleSpinBox::focusInEvent(e);
	}
	
}
Ejemplo n.º 2
0
bool EqonomizeValueEdit::eventFilter(QObject *, QEvent *e) {
	if(e->type() == QMouseEvent::MouseButtonDblClick) {
		QLineEdit *w = findChild<QLineEdit*>();
		QString text = w->text();
		int pos = w->cursorPosition();
		if(pos >= text.length()) pos = text.length() - 1;
		if(!text[pos].isNumber() && !text[pos].isSpace() && !text[pos].isPunct()) return false;
		selectNumber();
		return true;
	}
	return false;
}
Ejemplo n.º 3
0
int main(void){
	// 顯示陣列
	int bingoTable[SIZE][SIZE] = {0};
	int playerTable[SIZE][SIZE] = {0};
	int *tmpRand;
	int score = 0;
	int guessTime = 0;
	tmpRand = createRandNum();
	setValueInTable(tmpRand, bingoTable);
	
	// 以下為 while or do while
	while(score < 3){
		printf("|隱藏的賓果盤|\n");
		displayTable(bingoTable);
		printf("|玩家戳號盤|\n");
		displayTable(playerTable);
		printf("Score:%d\n", score);
		int number;
		printf("Plz input a number:");
		scanf(" %d", &number);
		selectNumber(bingoTable, playerTable, number);
		guessTime++;
		score = score
			+	checkRow(playerTable)
			+	checkColumn(playerTable)
			+	checkCross(playerTable);
		system("CLS");
	}
	printf("|隱藏的賓果盤|\n");
	displayTable(bingoTable);
	printf("|玩家戳號盤|\n");
	displayTable(playerTable);
	printf("恭喜結束遊戲\n");
	printf("Score:%d\n", score);
	printf("猜測次數:%2d\n", guessTime);
	system("pause");
	return 0;
}
Ejemplo n.º 4
0
  void SetTimeMenu::configureTime() {
    Serial.println(F("Entering configureTime()..."));
    nextMode();
    tmElements_t tm;
#if TEENSYDUINO
    breakTime(now(), tm);
#else
    if (!RTC.read(tm)) {
      app->debug(0, "Can't ¨read current time", true);
      delay(3000);
      return;
    }
#endif
    switch (app->mode) {
      case SetTime::Hour:
        blinkColor(ColorNames::red);
        app->debug(0, "====== Setup =======", true);
        instructions();
        what = (char *) "Hours";
        h = tm.Hour;
        if (h == 0) {
          h = 24;
        }
        selectNumber(&h, 1, 24);
        if (app->mode == SetTime::Default) break;
        /* no break */

      case SetTime::Minute:
        blinkColor(ColorNames::yellow);
        what = (char *) "Minutes";
        m = tm.Minute;
        selectNumber(&m, 0, 59);
        if (app->mode == SetTime::Default) break;
        /* no break */

      case SetTime::Save:
        blinkColor(ColorNames::red);
        if (h == 24) {
          h = 0;
        }
        tm.Hour = h;
        tm.Minute = m;
        tm.Second = 0;
        sprintf(buffer, "New Time: %2d:%02d", h, m);
        Serial.print("Setting Time to: ");
        Serial.println(buffer);
  #if DEBUG
        app->debug(0, "Saving New Time...", true);
        app->debug(1, buffer, false);
        app->debug(3, "Success! :)", false);
  #endif
        app->helper.setTimeTo(tm, 0);
        nextMode();
        /* no break */

      case SetTime::Last:
        app->mode = SetTime::Default;
        /* no break */
      case SetTime::Default:
        return;
    };
  }