예제 #1
0
void BracketedSentenceWidget::updateText()
{
  alpinocorpus::CorpusInfo corpusInfo =
    alpinocorpus::predefinedCorpusOrFallback(d_corpusReader->type());

    if (!d_entry.isEmpty() && d_corpusReader)
    {
        std::vector<alpinocorpus::LexItem> items = d_corpusReader->sentence(
            d_entry.toUtf8().constData(), d_query.toUtf8().constData(),
            corpusInfo.tokenAttribute(), MISSING_ATTRIBUTE, corpusInfo);

        clear();

        // Reset colors.
        setTextColor(Qt::black);
        setTextBackgroundColor(Qt::white);

        bool adoptSpace = false;
        size_t prevDepth = 0;
        for (std::vector<alpinocorpus::LexItem>::const_iterator iter = items.begin();
            iter != items.end(); ++iter)
        {
            size_t depth = iter->matches.size();

            if (depth != prevDepth) {
                if (depth == 0)
                {
                    setTextColor(Qt::black);
                    setTextBackgroundColor(Qt::white);
                }
                else
                {
                    setTextColor(Qt::white);
                    d_highlightColor.setAlpha(std::min(85 + 42 * depth,
                        static_cast<size_t>(255)));
                    setTextBackgroundColor(d_highlightColor);
                }

                prevDepth = depth;
            }

            if (adoptSpace) {
                insertPlainText(" ");
                adoptSpace = false;
            }

            insertPlainText(QString::fromUtf8(iter->word.c_str()));

            std::vector<alpinocorpus::LexItem>::const_iterator next = iter + 1;
            if (next != items.end()) {
                if (next->matches.size() < depth)
                    adoptSpace = true;
                else
                    insertPlainText(" ");
            }
        }
    }
}
void CMyTextBrowser::PrintRXFrame(QString str, QColor color)
{
    /*!
    * \brief  功能概述 打印接收报文
    * \param  参数描述 str打印的信息,color字颜色
    * \return 返回值描述 无
    * \author zzy
    * \date   2015/1/16
    */
    str.toUpper();///小写转大写
//    nClearCounter++;
//    if(nClearCounter > 512)
//    {
//        nClearCounter = 0;
//        clear();
//    }
    ////////保存报文////////
//    if(m_bSaveMsgFlag) SaveMsg(str,1);
    QString strDateTime = QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss.zzz");
    QString strForWord = "接收 <---: ";
    strForWord += str;
    if(getPauseFlag()) return;

     if(m_bTextColor)
     {
         setTextBackgroundColor(color);
         setTextColor(QColor(125,125,125));
         append(strDateTime);
         setTextColor(QColor(255,0,0));
         append(strForWord);
     }
     else
     {
         setTextBackgroundColor(QColor(255,255,255));
         setTextColor(QColor(125,125,125));
         append(strDateTime);
         setTextColor(color);
         append(strForWord);
     }
     if (m_bSaveFrame)
     {
         emit SignalSaveFrame(strDateTime+" "+strForWord);
     }

}
예제 #3
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);

   

}
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 );
}
예제 #5
0
// ---------------------------------------------------------------------------
// Name:        afPropertiesView::afPropertiesView
// Description: Constructor.
// Arguments:   parent - My parent window.
// Author:      Yaki Tebeka
// Date:        1/11/2003
// ---------------------------------------------------------------------------
afPropertiesView::afPropertiesView(afProgressBarWrapper* pProgressBar, QWidget* pParent)
    : acQHTMLWindow(pParent), afBaseView(pProgressBar), m_pCurrentURLHandler(nullptr)
{
    // Set the background color:
    setTextBackgroundColor(AF_HTML_BG_COLOR);

    // Set an empty HTML string:
    setText(acGTStringToQString(afHTMLContent::emptyHTML()));

    // Set my initial message:
    gtString htmlPropertiesString;
    buildProjectNotLoadedMessage(htmlPropertiesString);
    setText(acGTStringToQString(htmlPropertiesString));
}
void CMyTextBrowser::PrintOutPutInfo(QString str, QColor color)
{
    /*!
    * \brief  功能概述 打印自定义颜色的信息
    * \param  参数描述 str打印的信息,color字颜色
    * \return 返回值描述 无
    * \author zzy
    * \date   2015/1/16
    */
    str.toUpper();/// @note 小写转大写
    QString strDateTime = QDateTime::currentDateTime().toString("yyyy/MM/dd hh:mm:ss.zzz");
    if(getPauseFlag())/// @note 如果是暂定,则不刷文字及报文
       return;

    if(m_bTextColor)
    {
        setTextBackgroundColor(color);
        setTextColor(QColor(125,125,125));
        append(strDateTime);
//        setTextBackgroundColor(color);
        setTextColor(QColor(255,0,0));
        append(str);
    }
    else
    {
        setTextBackgroundColor(QColor(255,255,255));
        setTextColor(QColor(125,125,125));
        append(strDateTime);
        setTextColor(color);
        append(str);
    }
    if (m_bSaveFrame)
    {
        emit SignalSaveFrame(strDateTime+" "+str);
    }
}
void CMyTextBrowser::printDebugInfo(QString str)
{
    /*!
    * \brief  功能概述 打印Debug信息
    * \param  参数描述
    * \return 返回值描述
    * \author zzy
    * \date   2015/1/16
    */
    str.toUpper();/// @note 小写转大写
    if(getPauseFlag())/// @note 如果是暂定,则不刷文字及报文
        return;

    setTextBackgroundColor(QColor(255,255,255));/// @note 调试信息一律为红色
    setTextColor(QColor(255,0,0));
    append(str);
}
예제 #8
0
void Cursor::setTextBackgroundColorIndex(ColorPalette::Color color)
{
    qCDebug(lcCursor) << color;
    setTextBackgroundColor(colorPalette()->color(color).rgb());
}
예제 #9
0
void BtStyle::setCurrentStyle(int style) {
    if (style == BtStyle::darkTheme) {

        currentStyle = style;

        BtModuleTextModel::setLinkColor(QColor(0,191,255));
        BtModuleTextModel::setHighlightColor(QColor(255,255,0));
        BtModuleTextModel::setJesusWordsColor(QColor(255,0,0));

        setTextColor(QColor(255,255,255));
        setLinkColor(QColor(0,0,80));
        setTextBackgroundColor(QColor(0,0,0));
        setTextBackgroundHighlightColor(QColor(184,135,11));

        setButtonColor(QColor(0,0,0));
        setButtonBackground(QColor(35,35,100));
        setButtonTextColor(QColor(255,210,0));
        setButtonHighlightedText(QColor(255,255,0));
        setButtonBorder(QColor(110,110,110));
        setButtonRadius(3);
        setButtonGradient0(QColor(125,125,125));
        setButtonGradient1(QColor(60,60,60));
        setButtonGradient2(QColor(50,50,50));
        setButtonGradient3(QColor(20,20,20));

        setWindowTab(QColor(100,100,100));
        setWindowTabSelected(QColor(218,165,3));
        setWindowTabText(QColor(255,255,255));
        setWindowTabTextSelected(QColor(0,0,0));

        setMenu(QColor(255,255,255));
        setMenuBorder(QColor(60,60,60));
        setMenuText(QColor(0,0,0));
        setMenuHeight(34);

        setToolbarColor(QColor(0,0,0));
        setToolbarTextColor(QColor(218,165,3));
        setToolbarButtonText(QColor(255,255,255));
        setToolbarTextPointSize(10);
    }
    else if (style == BtStyle::lightBlueTheme) {

        currentStyle = style;

        BtModuleTextModel::setLinkColor(QColor(0,0,255));
        BtModuleTextModel::setHighlightColor(QColor(0,0,255));
        BtModuleTextModel::setJesusWordsColor(QColor(255,0,0));

        setTextColor(QColor(0,0,0));
        setLinkColor(QColor(0,0,220));
        setTextBackgroundColor(QColor(255,255,255));
        setTextBackgroundHighlightColor(QColor(255,240,170));

        setButtonColor(QColor(0,0,0));
        setButtonBackground(QColor(190,220,255));
        setButtonTextColor(QColor(0,0,0));
        setButtonHighlightedText(QColor(0,0,255));
        setButtonBorder(QColor(80,80,0));
        setButtonRadius(3);
        setButtonGradient0(QColor(180,180,255));
        setButtonGradient1(QColor(255,255,255));
        setButtonGradient2(QColor(255,255,255));
        setButtonGradient3(QColor(180,180,255));

        setWindowTab(QColor(245,245,245));
        setWindowTabSelected(QColor(65,105,225));
        setWindowTabText(QColor(100,100,100));
        setWindowTabTextSelected(QColor(255,255,255));

        setMenu(QColor(255,255,255));
        setMenuBorder(QColor(220,220,220));
        setMenuText(QColor(0,0,0));
        setMenuHeight(40);

        setToolbarColor(QColor(190,220,255));
        setToolbarTextColor(QColor(0,0,0));
        setToolbarButtonText(QColor(0,0,0));
        setToolbarTextPointSize(10);
    }
    else if (style == BtStyle::crimsonTheme) {

        currentStyle = style;

        BtModuleTextModel::setLinkColor(QColor(0,0,255));
        BtModuleTextModel::setHighlightColor(QColor(0,0,255));
        BtModuleTextModel::setJesusWordsColor(QColor(170,0,0));

        setTextColor(QColor(0,0,0));
        setLinkColor(QColor(0,0,220));
        setTextBackgroundColor(QColor(255,255,255));
        setTextBackgroundHighlightColor(QColor(255,240,170));

        setButtonColor(QColor(0,0,0));
        setButtonBackground(QColor(190,220,255));
        setButtonTextColor(QColor(0,0,0));
        setButtonHighlightedText(QColor(0,0,255));
        setButtonBorder(QColor(80,80,0));
        setButtonRadius(3);
        setButtonGradient0(QColor(180,180,255));
        setButtonGradient1(QColor(255,255,255));
        setButtonGradient2(QColor(255,255,255));
        setButtonGradient3(QColor(180,180,255));

        setWindowTab(QColor(245,245,245));
        setWindowTabSelected(QColor(218,165,3));
        setWindowTabText(QColor(100,100,100));
        setWindowTabTextSelected(QColor(0,0,0));

        setMenu(QColor(255,255,255));
        setMenuBorder(QColor(220,220,220));
        setMenuText(QColor(0,0,0));
        setMenuHeight(40);

        setToolbarColor(QColor(99,0,0));
        setToolbarTextColor(QColor(255,255,255));
        setToolbarButtonText(QColor(0,0,0));
        setToolbarTextPointSize(10);
    }
}