CustomTextEdit::CustomTextEdit(const QString &text, QGraphicsItem *parent)
    : MTextEdit(MTextEditModel::MultiLine, text, parent)
{
    QObject::connect(this, SIGNAL(textChanged()), this, SLOT(changeLabel()));
    QObject::connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(changeButton()));
    QObject::connect(this, SIGNAL(gainedFocus(Qt::FocusReason)), this, SLOT(changeLabel()));
    QObject::connect(this, SIGNAL(gainedFocus(Qt::FocusReason)), this, SLOT(changeButton()));
    setInputMethodCorrectionEnabled(false);
}
Example #2
0
/*
 *Makes specified move in a recursive way
 */
BoardNode makeMove(BoardNode newBoard, int moveRow, int moveCol, int currRow, int currCol, moveStage currStep) {
    if(currStep == DONE)    { return newBoard; }
    switch(currStep)    {

    case DELETE:
                changeButton(newBoard,currRow,currCol,DEAD); //!removing current button
                currStep = JUMP;
                changeButton(newBoard,currRow+moveRow,currCol+moveCol,DEAD); //!deleting button to be jumped
                break;
    case JUMP:
                changeButton(newBoard,currRow+moveRow,currCol+moveCol,ALIVE); //! placing button in new spot
                currStep = DONE;
                break;
    default:
                fprintf(stderr,"Unrecognised step\n");
                break;
    }

    return(makeMove(newBoard,moveRow,moveCol,currRow+moveRow,currCol+moveCol,currStep));
}
void StartMenu::update()
{
	if(HowToPlay == false)
	{
		updateCurrentButton();
		changeButton();
	}

	if(LevelManager::getInstance()->getCurrentLevel() > 0)
	{
		Resumedraw = false;	
	}
	else
	{
		Resumedraw = true;
	}

	updateButtons();
	buttonActivate();
}
void CtrlCheckbox::onVarBoolUpdate( VarBool &rVariable )
{
    (void)rVariable;
    changeButton();
}
Example #5
0
void KJumpingCube::initKAction() {
  QAction * action;

  QSignalMapper * gameMapper = new QSignalMapper (this);
  connect (gameMapper, SIGNAL (mapped(int)), m_game, SLOT (gameActions(int)));

  action = KStandardGameAction::gameNew (gameMapper, SLOT (map()), this);
  actionCollection()->addAction (action->objectName(), action);
  gameMapper->setMapping (action, NEW);

  action = KStandardGameAction::load    (gameMapper, SLOT (map()), this);
  actionCollection()->addAction (action->objectName(), action);
  gameMapper->setMapping (action, LOAD);

  action = KStandardGameAction::save    (gameMapper, SLOT (map()), this);
  actionCollection()->addAction (action->objectName(), action);
  gameMapper->setMapping (action, SAVE);

  action = KStandardGameAction::saveAs  (gameMapper, SLOT (map()), this);
  actionCollection()->addAction (action->objectName(), action);
  gameMapper->setMapping (action, SAVE_AS);

  action = KStandardGameAction::hint    (gameMapper, SLOT(map()), this);
  actionCollection()->addAction (action->objectName(), action);
  gameMapper->setMapping (action, HINT);

  action = KStandardGameAction::undo    (gameMapper, SLOT (map()), this);
  actionCollection()->addAction (action->objectName(), action);
  gameMapper->setMapping (action, UNDO);
  action->setEnabled (false);

  action = KStandardGameAction::redo    (gameMapper, SLOT (map()), this);
  actionCollection()->addAction (action->objectName(), action);
  gameMapper->setMapping (action, REDO);
  action->setEnabled (false);

  actionButton = new QPushButton (this);
  actionButton->setObjectName ("ActionButton");
  // Action button's style sheet: parameters for red, green and clicked colors.
  buttonLook =
       "QPushButton#ActionButton { color: white; background-color: %1; "
           "border-style: outset; border-width: 2px; border-radius: 10px; "
           "border-color: beige; font: bold 14px; min-width: 10em; "
           "padding: 6px; margin: 5px; margin-left: 10px; } "
       "QPushButton#ActionButton:pressed { background-color: %2; "
           "border-style: inset; } "
       "QPushButton#ActionButton:disabled { color: white;"
            "border-color: beige; background-color: steelblue; }";
  gameMapper->setMapping (actionButton, BUTTON);
  connect (actionButton, SIGNAL(clicked()), gameMapper, SLOT(map()));

  QWidgetAction *widgetAction = new QWidgetAction(this);
  widgetAction->setDefaultWidget(actionButton);
  actionCollection()->addAction (QLatin1String ("action_button"), widgetAction);

  changeButton (true, true);		// Load the button's style sheet.
  changeButton (false);			// Set the button to be inactive.

  action = KStandardAction::preferences (m_game, SLOT(showSettingsDialog()),
                                         actionCollection());
  qDebug() << "PREFERENCES ACTION is" << action->objectName();
  action->setIconText (i18n("Settings"));

  action = KStandardGameAction::quit (this, SLOT (close()), this);
  actionCollection()->addAction (action->objectName(), action);

  setupGUI();
}