void SyntaxHighlighter::TextFormat::loadFromJson(const QJsonObject& o) {
		namespace Highlight = JEnt::Highlight;
		// Italicフラグ: デフォルト値=false
		auto itr = o.find(Highlight::italic);
		bool b = false;
		if(itr != o.end())
			b = itr.value().toBool(false);
		setFontItalic(b);
		// Boldフラグ: デフォルト値=QFont::Normal
		int w = QFont::Normal;
		itr = o.find(Highlight::bold);
		if(itr != o.end())
			w = itr.value().toBool(false) ? QFont::Bold : QFont::Normal;
		setFontWeight(w);
		// Underlineフラグ: デフォルト値=false
		b = false;
		itr = o.find(Highlight::underline);
		if(itr != o.end())
			b = itr.value().toBool(false);
		setFontUnderline(b);
		// Color RGB: デフォルト値=(128,128,128)
		QColor col(128,128,128);
		itr = o.find(Highlight::color);
		if(itr != o.end()) {
			QJsonArray ar = itr.value().toArray();
			if(ar.size() == 3)
				col.setRgb(ar[0].toInt(), ar[1].toInt(), ar[2].toInt());
		}
		setForeground(col);
	}
/*!
 * Set the format properties from the given \a font.
 */
void Format::setFont(const QFont &font)
{
    setFontName(font.family());
    setFontSize(font.pointSize());
    setFontBold(font.bold());
    setFontItalic(font.italic());
    setFontUnderline(font.underline() ? FontUnderlineSingle : FontUnderlineNone);
    setFontStrikeOut(font.strikeOut());
}
Exemple #3
0
//-------------------------------------------------------
void CLinkLabel::init(HINSTANCE hInst, HWND hOwner, HWND hWnd, const TCHAR *link)
{
	CSmLabel::init(hInst, hOwner, hWnd);
	setCursor(m_shLinkCursor);
	setHyperLink(link);
	setTextColor(RGB(0, 0, 255));
	setFontUnderline();
	//setFontBold();
	reconstructFont();
}
void
SimpleRichTextEdit::toggleFontUnderline()
{
	setFontUnderline(!fontUnderline());
}
void CHTMLWriteDisplay::toggleUnderline(bool) 
{
	setFontUnderline( m_actions.underline->isChecked() );
}