コード例 #1
0
void KNoteEdit::slotTextBackgroundColor()
{
  if ( m_note )
      m_note->blockEmitDataChanged( true );
  QColor c = textBackgroundColor();
  int ret = KColorDialog::getColor( c, this );

  if ( ret == QDialog::Accepted ) {
    setTextBackgroundColor( c );
  }
  if ( m_note )
      m_note->blockEmitDataChanged( false );
}
コード例 #2
0
ファイル: typing.cpp プロジェクト: EMacks/HCI
void Typing::keyPressEvent(QKeyEvent * event) {
   key.push_back(event->key());
   press.push_back(time->elapsed());
   release.resize(press.size());
   if(key[key.size()-1] == Qt::Key_Backspace && atChar > 0
      && textBackgroundColor() != Qt::red) {
      atChar--;
   } else if(check.contains(key[key.size()-1])
	     && check[key[key.size()-1]] != toMatch[atChar]) {
      setTextBackgroundColor(Qt::red);
   } else if(check.contains(key[key.size()-1])){
      setTextBackgroundColor(Qt::transparent);
      atChar++;
   } else {
      setTextBackgroundColor(Qt::red);
   }
   QTextEdit::keyPressEvent(event);

   

}