コード例 #1
0
void QWeekDisplaytextDlg::setTextColor(const QColor & mColor)       //文本色
{
    QString nColor = pwnd->ColorTOString(mColor);
    TextProperty[nCurrentIndex].sColor = pwnd->ColorTOString(mColor);
    ui->Text_Color->setStyleSheet(QString("background:%1").arg(mColor.name()));
    emit SetTextProperty();
}
コード例 #2
0
void QWeekDisplaytextDlg::on_m_fontcmb_currentIndexChanged(QString sFont)
{
    if(!InitFlag)
        return;
    int nLanguageIndex = ui->m_languagecmb->currentIndex();            //获得多语言下标
    TextProperty[nCurrentIndex].sFont[nLanguageIndex] = sFont;
    emit SetTextProperty();
}
コード例 #3
0
nsresult
nsStyleUpdatingCommand::ToggleState(nsIEditor *aEditor)
{
  nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
  NS_ENSURE_TRUE(htmlEditor, NS_ERROR_NO_INTERFACE);

  //create some params now...
  nsresult rv;
  nsCOMPtr<nsICommandParams> params =
      do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
  if (NS_FAILED(rv) || !params)
    return rv;

  // tags "href" and "name" are special cases in the core editor
  // they are used to remove named anchor/link and shouldn't be used for insertion
  bool doTagRemoval;
  if (mTagName == nsGkAtoms::href || mTagName == nsGkAtoms::name) {
    doTagRemoval = true;
  } else {
    // check current selection; set doTagRemoval if formatting should be removed
    rv = GetCurrentState(aEditor, params);
    NS_ENSURE_SUCCESS(rv, rv);
    rv = params->GetBooleanValue(STATE_ALL, &doTagRemoval);
    NS_ENSURE_SUCCESS(rv, rv);
  }

  if (doTagRemoval) {
    // Also remove equivalent properties (bug 317093)
    if (mTagName == nsGkAtoms::b) {
      rv = RemoveTextProperty(htmlEditor, NS_LITERAL_STRING("strong"));
      NS_ENSURE_SUCCESS(rv, rv);
    } else if (mTagName == nsGkAtoms::i) {
      rv = RemoveTextProperty(htmlEditor, NS_LITERAL_STRING("em"));
      NS_ENSURE_SUCCESS(rv, rv);
    } else if (mTagName == nsGkAtoms::strike) {
      rv = RemoveTextProperty(htmlEditor, NS_LITERAL_STRING("s"));
      NS_ENSURE_SUCCESS(rv, rv);
    }

    rv = RemoveTextProperty(htmlEditor, nsDependentAtomString(mTagName));
  } else {
    // Superscript and Subscript styles are mutually exclusive
    aEditor->BeginTransaction();

    nsDependentAtomString tagName(mTagName);
    if (mTagName == nsGkAtoms::sub || mTagName == nsGkAtoms::sup) {
      rv = RemoveTextProperty(htmlEditor, tagName);
    }
    if (NS_SUCCEEDED(rv))
      rv = SetTextProperty(htmlEditor, tagName);

    aEditor->EndTransaction();
  }

  return rv;
}
コード例 #4
0
void QWeekDisplaytextDlg::on_m_textedit_textChanged() //文本输入
{
    if(!InitFlag)
        return;
    int nLanguageIndex = ui->m_languagecmb->currentIndex();            //获得多语言下标
    QString sText = ui->m_textedit->toPlainText();                     //获得文本
    TextProperty[nCurrentIndex].sText[nLanguageIndex] = sText;         //存储文本
    ui->m_table->setItem(nCurrentIndex,1,new QTableWidgetItem(sText)); //在列表框中设置文本
    emit SetTextProperty();
}
コード例 #5
0
nsresult
nsStyleUpdatingCommand::ToggleState(nsIEditor *aEditor, const char* aTagName)
{
  nsCOMPtr<nsIHTMLEditor> htmlEditor = do_QueryInterface(aEditor);
  NS_ENSURE_TRUE(htmlEditor, NS_ERROR_NO_INTERFACE);

  //create some params now...
  nsresult rv;
  nsCOMPtr<nsICommandParams> params =
      do_CreateInstance(NS_COMMAND_PARAMS_CONTRACTID,&rv);
  if (NS_FAILED(rv) || !params)
    return rv;

  // tags "href" and "name" are special cases in the core editor 
  // they are used to remove named anchor/link and shouldn't be used for insertion
  nsAutoString tagName; tagName.AssignWithConversion(aTagName);
  bool doTagRemoval;
  if (tagName.EqualsLiteral("href") ||
      tagName.EqualsLiteral("name"))
    doTagRemoval = true;
  else
  {
    // check current selection; set doTagRemoval if formatting should be removed
    rv = GetCurrentState(aEditor, aTagName, params);
    NS_ENSURE_SUCCESS(rv, rv);
    rv = params->GetBooleanValue(STATE_ALL, &doTagRemoval);
    NS_ENSURE_SUCCESS(rv, rv);
  }

  if (doTagRemoval)
    rv = RemoveTextProperty(aEditor, tagName.get(), nsnull);
  else
  {
    // Superscript and Subscript styles are mutually exclusive
    nsAutoString removeName; 
    aEditor->BeginTransaction();

    if (tagName.EqualsLiteral("sub"))
    {
      removeName.AssignLiteral("sup");
      rv = RemoveTextProperty(aEditor,tagName.get(), nsnull);
    } 
    else if (tagName.EqualsLiteral("sup"))
    {
      removeName.AssignLiteral("sub");
      rv = RemoveTextProperty(aEditor, tagName.get(), nsnull);
    }
    if (NS_SUCCEEDED(rv))
      rv = SetTextProperty(aEditor,tagName.get(), nsnull, nsnull);

    aEditor->EndTransaction();
  }

  return rv;
}
コード例 #6
0
void QWeekDisplaytextDlg::OnClickCell()
{
    QString str = "";
    int nLanguageIndex = ui->m_languagecmb->currentIndex();            //获得多语言下标
    int nIndex = 0;
    QColor nColor;

    str = QString("%1").arg(TextProperty[nCurrentIndex].nFontSize[nLanguageIndex]);
    nIndex = ui->m_fontsizecmb->findText(str);
    if(nIndex != -1)
        ui->m_fontsizecmb->setCurrentIndex(nIndex);                  //设置字体大小

    str = TextProperty[nCurrentIndex].sFont[nLanguageIndex]; //设置字体
    nIndex = ui->m_fontcmb->findText(str);
    if(nIndex != -1)
        ui->m_fontcmb->setCurrentIndex(nIndex);

    nColor = pwnd->StringTOColor(TextProperty[nCurrentIndex].sColor);//设置字体颜色
 //   pTextColor->setCurrentColor(nColor);
    ui->Text_Color->setStyleSheet( QString("background:%1").arg(nColor.name()));

    ui->m_wordintervalspin->setValue(TextProperty[nCurrentIndex].nWordInterval);//设置字距
    ui->m_flickcheck->setCurrentIndex(TextProperty[nCurrentIndex].bIfFlick);
    ui->m_radio1->setChecked(false);
    ui->m_radio2->setChecked(false);
    ui->m_radio3->setChecked(false);
    ui->m_radio4->setChecked(false);
    ui->m_radio5->setChecked(false);
    ui->m_radio6->setChecked(false);
    ui->m_radio7->setChecked(false);
    ui->m_radio8->setChecked(false);
    ui->m_radio9->setChecked(false);

    switch(TextProperty[nCurrentIndex].nPosition)                    //文本位置
    {
        case 1:ui->m_radio1->setChecked(true);break;
        case 2:ui->m_radio2->setChecked(true);break;
        case 3:ui->m_radio3->setChecked(true);break;
        case 4:ui->m_radio4->setChecked(true);break;
        case 5:ui->m_radio5->setChecked(true);break;
        case 6:ui->m_radio6->setChecked(true);break;
        case 7:ui->m_radio7->setChecked(true);break;
        case 8:ui->m_radio8->setChecked(true);break;
        case 9:ui->m_radio9->setChecked(true);break;
        default:ui->m_radio5->setChecked(true);break;
    }

    ui->m_textedit->setPlainText(TextProperty[nCurrentIndex].sText[nLanguageIndex]);
    ui->m_textedit->setFocus();
    ui->m_textedit->selectAll();

    emit SetTextProperty();
    emit ClickCell();
}
コード例 #7
0
void QWeekDisplaytextDlg::on_m_fontsizecmb_currentIndexChanged(int index) //字体大小
{
    if(!InitFlag)
        return;

    QString sFontSize;
    int nLanguageIndex = ui->m_languagecmb->currentIndex();            //获得多语言下标
    sFontSize = ui->m_fontsizecmb->currentText();
    TextProperty[nCurrentIndex].nFontSize[nLanguageIndex] = sFontSize.toInt();
    emit SetTextProperty();
}
コード例 #8
0
void QWeekDisplaytextDlg::on_m_languagecmb_currentIndexChanged(int index)//语言
{
    if(index == 0)
    {
        ui->label_19->setEnabled(true);
        ui->Text_Color->setEnabled(true);
        ui->label_2->setEnabled(true);
        ui->m_flickcheck->setEnabled(true);
        ui->label_3->setEnabled(true);
        ui->m_wordintervalspin->setEnabled(true);
        ui->groupBox_6->setEnabled(true);
    }
    else
    {
        ui->label_19->setEnabled(false);
        ui->Text_Color->setEnabled(false);
        ui->label_2->setEnabled(false);
        ui->m_flickcheck->setEnabled(false);
        ui->label_3->setEnabled(false);
        ui->m_wordintervalspin->setEnabled(false);
        ui->groupBox_6->setEnabled(false);
    }

    if(!InitFlag)
        return;
    int nLanguageIndex = ui->m_languagecmb->currentIndex();
    int i = 0;
    int nIndex = 0;
    QString str = "";

    for(i = 0; i < 7; i++)
    {
        ui->m_table->setItem(i,1,new QTableWidgetItem(TextProperty[i].sText[nLanguageIndex]));
    }
    ui->m_textedit->setPlainText(TextProperty[nCurrentIndex].sText[nLanguageIndex]);
    ui->m_textedit->setFocus();

    str = QString("%1").arg(TextProperty[nCurrentIndex].nFontSize[nLanguageIndex]);
    nIndex = ui->m_fontsizecmb->findText(str);
    if(nIndex != -1)
        ui->m_fontsizecmb->setCurrentIndex(nIndex);                  //设置字体大小

    str = TextProperty[nCurrentIndex].sFont[nLanguageIndex]; //设置字体
    nIndex = ui->m_fontcmb->findText(str);
    if(nIndex != -1)
        ui->m_fontcmb->setCurrentIndex(nIndex);

    emit SetTextProperty();
}
コード例 #9
0
ファイル: qweekdisplaydlg.cpp プロジェクト: mildrock/pc_code
QWeekDisplayDlg::QWeekDisplayDlg(QGraphicsItem *pItem,QWidget *parent) :
    QDialog(parent)
{
    tabWidget = new QTabWidget();

    pGeneralDlg = new QWeekDisplayGenDlg;
    pTextDlg = new QWeekDisplaytextDlg;

    tabWidget->addTab(pGeneralDlg, tr("一般"));
    tabWidget->addTab(pTextDlg, tr("文字"));

    buttonBox = new QDialogButtonBox();
    buttonBox->addButton(tr("确定"),QDialogButtonBox::AcceptRole);
    buttonBox->addButton(tr("取消"),QDialogButtonBox::RejectRole);
    buttonBox->addButton(tr("帮助"),QDialogButtonBox::HelpRole);

    connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
    connect(buttonBox, SIGNAL(helpRequested ()), this, SLOT(loadHelp()));

    connect(pGeneralDlg, SIGNAL(GeneralStateChange()), this, SLOT(OnGeneralStateChange()));
    connect(pGeneralDlg, SIGNAL(txtChange()),this, SLOT(OnSetTextProperty()));

    connect(pTextDlg, SIGNAL(SetTextProperty()), this, SLOT(OnSetTextProperty()));
    connect(pTextDlg, SIGNAL(ClickCell()), this, SLOT(OnClickTextCell()));

    datalist = new QStringList();
    int i = 0;
    for (i = 0; i <= 250; i++)
    {
        datalist->append("");
    }
    InitAllProperty(pItem);
    mainLayout = new QVBoxLayout;
    mainLayout->addWidget(tabWidget);
    mainLayout->addWidget(buttonBox);
    setLayout(mainLayout);
    this->setWindowTitle(tr("星期显示"));

    this->resize(450,520);
}
コード例 #10
0
void QWeekDisplaytextDlg::on_m_radio9_clicked()
{
    TextProperty[nCurrentIndex].nPosition = 9;
    emit SetTextProperty();
}
コード例 #11
0
void QWeekDisplaytextDlg::on_m_wordintervalspin_valueChanged(int )//字距
{
    //判断输入是否正确
    TextProperty[nCurrentIndex].nWordInterval = ui->m_wordintervalspin->value();
    emit SetTextProperty();
}