示例#1
0
void TextContent::slotShakeLess()
{
    if (m_shakeRadius > 0) {
        m_shakeRadius--;
        updateTextConstraints();
    }
}
示例#2
0
void TextBoxContent::contentsResized()
{
 	DEBUG_TSTART();
 	updateTextConstraints();
 	update();
 	//qDebug() << "TextBoxContent::contentsResized(): \t \t Elapsed:"<<(((double)total.elapsed())/1000.0)<<" sec";
}
示例#3
0
void TextBoxContent::resizeContents(const QRect & rect, bool keepRatio)
{
	DEBUG_TSTART();
	updateTextConstraints(rect.width());
	AbstractContent::resizeContents(rect,keepRatio);
	update();
	//qDebug() << "TextBoxContent::resizeContents(): \t \t Elapsed:"<<(((double)total.elapsed())/1000.0)<<" sec";
}
示例#4
0
void TextBoxContent::setHtml(const QString & htmlCode)
{
        DEBUG_TSTART();
	
	//qDebug()<<modelItem()->itemName()<<"TextBoxContent::setHtml(): htmlCode:"<<htmlCode;
	m_text->setHtml(htmlCode);
	m_shadowText->setHtml(htmlCode);
	
	updateTextConstraints();
	syncToModelItem(0);

	// Apply outline pen to the html
	QTextCursor cursor(m_text);
	cursor.select(QTextCursor::Document);

	QTextCharFormat format;

	QPen p(Qt::NoPen);
	if(modelItem() && modelItem()->outlineEnabled())
	{
		p = modelItem()->outlinePen();
		p.setJoinStyle(Qt::MiterJoin);
	}

	format.setTextOutline(p);
	format.setForeground(modelItem() && modelItem()->fillType() == AbstractVisualItem::Solid ? modelItem()->fillBrush() : Qt::NoBrush);

	
	cursor.mergeCharFormat(format);
	
	#if QT46_SHADOW_ENAB == 0
	// Setup the shadow text formatting if enabled
	if(modelItem() && modelItem()->shadowEnabled())
	{
		if(qFuzzyIsNull(modelItem()->shadowBlurRadius()))
		{
			QTextCursor cursor(m_shadowText);
			cursor.select(QTextCursor::Document);
	
			QTextCharFormat format;
			format.setTextOutline(Qt::NoPen);
			format.setForeground(modelItem() ? modelItem()->shadowBrush() : Qt::black);
	
			cursor.mergeCharFormat(format);
		}
	}
	#endif
	
	// Cache gets dirty in syncfrommodelitem conditionally based on model revision
	//dirtyCache();

	update();
	
	//qDebug() << "TextBoxContent::setHtml(): \t \t Elapsed:"<<(((double)total.elapsed())/1000.0)<<" sec";
}
示例#5
0
void TextContent::setShapePath(const QPainterPath & path)
{
    if (path == m_shapePath)
        return;

    // invalidate rectangles
    m_textRect = QRect();
    m_shapeRect = QRect();

    // set new path
    m_shapePath = path;

    // regenerate text layouting
    updateTextConstraints();
}
示例#6
0
void TextContent::setHtml(const QString & htmlCode)
{
    m_text->setHtml(htmlCode);
    updateTextConstraints();
}
示例#7
0
void TextContent::slotShakeMore()
{
    m_shakeRadius++;
    updateTextConstraints();
}