void MainWindow::textSize(const QString &p)
{
    QTextCharFormat fmt;
    fmt.setFontPointSize(p.toFloat());
    activeEditor()->setFocus();
    mergeFormatOnWordOrSelection(fmt);
}
void DocumentHandler::setBold(bool arg)
{
    QTextCharFormat fmt;
    fmt.setFontWeight(arg ? QFont::Bold : QFont::Normal);
    mergeFormatOnWordOrSelection(fmt);
    emit boldChanged();
}
void DocumentHandler::setUnderline(bool arg)
{
    QTextCharFormat fmt;
    fmt.setFontUnderline(arg);
    mergeFormatOnWordOrSelection(fmt);
    emit underlineChanged();
}
void MainWindow::textFamily(const QString &f)
{
    QTextCharFormat fmt;
    fmt.setFontFamily(f);
    activeEditor()->setFocus();
    mergeFormatOnWordOrSelection(fmt);
}
void DocumentHandler::setItalic(bool arg)
{
    QTextCharFormat fmt;
    fmt.setFontItalic(arg);
    mergeFormatOnWordOrSelection(fmt);
    emit italicChanged();
}
Exemple #6
0
void TextRoom::textSizeDown()
{
	textSize = textEdit->currentFont().pointSize();
	textSize--;
	QTextCharFormat fmt;
	fmt.setFontPointSize(textSize);
	mergeFormatOnWordOrSelection(fmt);
}
void XYZTextEditor::textSize(const QString &p) {
    qreal pointSize = p.toFloat();
    if (p.toFloat() > 0) {
        QTextCharFormat fmt;
        fmt.setFontPointSize(pointSize);
        mergeFormatOnWordOrSelection(fmt);
    }
}
Exemple #8
0
/**
 * Standardizes a selected text
 */
void MainWindow::on_actionNormal_triggered()
{
    QTextCharFormat fmt;
    fmt.setFontWeight(QFont::Normal);
    fmt.setFontItalic(false);
    fmt.setFontUnderline(false);
    mergeFormatOnWordOrSelection(fmt);
}
Exemple #9
0
void TextEdit::textColor(const QColor& col)
{
    if (!col.isValid())
        return;
    QTextCharFormat fmt;
    fmt.setForeground(col);
    mergeFormatOnWordOrSelection(fmt);
    colorChanged(col);
}
void XYZTextEditor::textColor() {
    QColor color;
    QColorDialog *dlg = new QColorDialog(this);
    if (dlg->exec() == QDialog::Accepted) {
        color = dlg->selectedColor();
    } else return;
    QTextCharFormat fmt;
    fmt.setForeground( QBrush( color ) );
    mergeFormatOnWordOrSelection(fmt);
}
void DocumentHandler::setFontFamily(const QString &arg)
{
    QTextCursor cursor = textCursor();
    if (cursor.isNull())
        return;
    QTextCharFormat format;
    format.setFontFamily(arg);
    mergeFormatOnWordOrSelection(format);
    emit fontFamilyChanged();
}
void TextEdit::textSize(const QString &p)
{
  qreal pointSize = p.toFloat();
  if (p.toFloat() > 0) {
    cout<<"textedit.textsize:"<<p;
    QTextCharFormat fmt;
    fmt.setFontPointSize(pointSize);
    mergeFormatOnWordOrSelection(fmt);
  }
}
void DocumentHandler::setFontSize(int arg)
{
    QTextCursor cursor = textCursor();
    if (cursor.isNull())
        return;
    QTextCharFormat format;
    format.setFontPointSize(arg);
    mergeFormatOnWordOrSelection(format);
    emit fontSizeChanged();
}
Exemple #14
0
void MailEditorMainWindow::onTextSizeChanged(const QString &p)
  {
  qreal pointSize = p.toFloat();
  if(p.toFloat() > 0)
    {
    QTextCharFormat fmt;
    fmt.setFontPointSize(pointSize);
    mergeFormatOnWordOrSelection(fmt);
    }
  }
Exemple #15
0
void TextEdit::textColor()
{
    QColor col = QColorDialog::getColor(textEdit->textColor(), this);
    if (!col.isValid())
        return;
    QTextCharFormat fmt;
    fmt.setForeground(col);
    mergeFormatOnWordOrSelection(fmt);
    colorChanged(col);
}
void DocumentHandler::setTextColor(const QColor &c)
{
    QTextCursor cursor = textCursor();
    if (cursor.isNull())
        return;
    QTextCharFormat format;
    format.setForeground(QBrush(c));
    mergeFormatOnWordOrSelection(format);
    emit textColorChanged();
}
Exemple #17
0
void MainWindow::on_actionChangeFontColor_triggered()
{
    QTextEdit *pEdit = textEditor.editor;
    QColor col = QColorDialog::getColor(pEdit->textColor(), this);
    if (!col.isValid())
        return;
    QTextCharFormat fmt;
    fmt.setForeground(col);
    mergeFormatOnWordOrSelection(fmt);
    colorChanged(col);
}
Exemple #18
0
void MailEditorMainWindow::onTextColorTriggerred()
  {
  QColor col = QColorDialog::getColor(ui->messageEdit->textColor(), this);
  
  if(col.isValid() == false)
    return;
  QTextCharFormat fmt;
  fmt.setForeground(col);
  mergeFormatOnWordOrSelection(fmt);
  colorChanged(col);
  }
Exemple #19
0
void PQTextEditor::slotChangeColor()
{
     QColor col = QColorDialog::getColor(mEditor->textColor(), this);
     if (!col.isValid()) {
         return;
     }

     QTextCharFormat format;
     format.setForeground(col);
     mergeFormatOnWordOrSelection(format);
}
Exemple #20
0
void ChatWindow::setColor()
{
    QColor col = QColorDialog::getColor(Qt::green, this);
    if (col.isValid()) {

        ui.colorButton->setPalette(QPalette(col));
        QTextCharFormat fmt;
        fmt.setForeground(col);
        mergeFormatOnWordOrSelection(fmt);
        colorChanged(col);
    }
}
Exemple #21
0
void EditorWidget::on_edit_bold()
{
	if (m_initialPag == PlainTextIndex) {
		const QString str_select = editor_plain_text->textCursor().selectedText();
		if (!str_select.isEmpty())
			editor_plain_text->textCursor().insertText("<strong>"+ str_select +"</strong>");
	} else {
		QTextCharFormat fmt;
		fmt.setFontWeight(m_bold_action->isChecked() ? QFont::Bold : QFont::Normal);
		mergeFormatOnWordOrSelection(fmt);
	}
}
Exemple #22
0
void EditorWidget::on_edit_underline()
{
	if (m_initialPag == PlainTextIndex) {
		const QString str_select = editor_plain_text->textCursor().selectedText();
		if (!str_select.isEmpty())
			editor_plain_text->textCursor().insertText("<u>"+ str_select +"</u>");
	} else {
		QTextCharFormat fmt;
		fmt.setFontUnderline(m_underline_action->isChecked());
		mergeFormatOnWordOrSelection(fmt);
	}
}
Exemple #23
0
void EditorWidget::on_edit_font(const QString &font)
{
	if (m_initialPag == PlainTextIndex) {
		const QString str_select = editor_plain_text->textCursor().selectedText();
		if (!str_select.isEmpty())
			editor_plain_text->textCursor().insertText("<span style=\"font-family:'"+ font +"';\">"+ str_select +"</span>");
	} else {
		QTextCharFormat fmt;
		fmt.setFontFamily(font);
		mergeFormatOnWordOrSelection(fmt);
	}
}
Exemple #24
0
void TextRoom::textItalic()
{
	QTextCharFormat fmt;
	QTextCursor cursor = textEdit->textCursor();
	if (cursor.charFormat().fontItalic())
	{
		fmt.setFontItalic(false);
	}
	else
	{
		fmt.setFontItalic(true);
	}
	mergeFormatOnWordOrSelection(fmt);
}
void GraphicTextDialog::textAlignSubSuperScript(QAction *a)
{
    QTextCharFormat fmt;
    if(a == actionAlignSubscript) {
        fmt.setVerticalAlignment(QTextCharFormat::AlignSubScript);
    }
    else if(a == actionAlignSupersript) {
        fmt.setVerticalAlignment(QTextCharFormat::AlignSuperScript);
    }
    else {
        fmt.setVerticalAlignment(QTextCharFormat::AlignNormal);
    }
    mergeFormatOnWordOrSelection(fmt);
}
void MainWindow::setFont()
{
    bool ok;
    QFont font = QFontDialog::getFont(&ok, QFont("Courier", 9), this);
    if (!ok){
       return;
    }//if
    else{
       QTextCharFormat fmt;
       fmt.setFont(font);
       mergeFormatOnWordOrSelection(fmt);
       currentCharFormatChanged(fmt);
    }//else
}
Exemple #27
0
void TextRoom::textBold()
{
	QTextCharFormat fmt;
	QTextCursor cursor = textEdit->textCursor();
	if (cursor.charFormat().fontWeight() == 75)
	{
		fmt.setFontWeight(50);
	}
	else
	{
		fmt.setFontWeight(75);
	}
	mergeFormatOnWordOrSelection(fmt);
}
Exemple #28
0
void EditorWidget::on_edit_valign_sub()
{
	if (m_initialPag == PlainTextIndex) {
		const QString str_select = editor_plain_text->textCursor().selectedText();
		if (!str_select.isEmpty())
			editor_plain_text->textCursor().insertText("<span style=\"vertical-align:sub;\">"+ str_select +"</span>");
	} else {
		const QTextCharFormat::VerticalAlignment align = m_valign_sub_action->isChecked() ?
				QTextCharFormat::AlignSubScript : QTextCharFormat::AlignNormal;
		QTextCharFormat fmt;
		fmt.setVerticalAlignment(align);
		mergeFormatOnWordOrSelection(fmt);
		m_valign_sup_action->setChecked(false);
	}
}
Exemple #29
0
void EditorWidget::on_edit_font_size(const QString &size)
{
	qreal pointSize = size.toFloat();
	if (size.toFloat() > 0) {
		if (m_initialPag == PlainTextIndex) {
			const QString str_select = editor_plain_text->textCursor().selectedText();
			if (!str_select.isEmpty())
				editor_plain_text->textCursor().insertText("<span style=\"font-size:"+ size +"pt;\">"+ str_select +"</span>");
		} else {
				QTextCharFormat fmt;
				fmt.setFontPointSize(pointSize);
				mergeFormatOnWordOrSelection(fmt);
		}
	}
}
void TextZone::setTextFont(QFont font)
{
    //    QString currentFormat = settings->value("Settings/Text/textFontFamily", textCursor().charFormat().fontFamily() ).toString();
    QTextCharFormat fmt;
    fmt.setFontFamily(font.family());
    //    QString fontcolor = settings->value("Settings/Text/FontColor", "000000").toString();
    //    QColor color;
    //    color.setNamedColor(fontcolor);
    //    QBrush brush(color, Qt::SolidPattern);
    //    QFont font;
    //    font.fromString(currentFormat);
    //    fmt.setForeground(brush);

    mergeFormatOnWordOrSelection(fmt);

}