Placholders has ? around name

Not set placeholders have their value replaced with empty string


git-svn-id: https://svn.code.sf.net/p/qlscribe/svn/trunk@121 cac9541e-1b8d-4bfa-827e-589bba606050
This commit is contained in:
ruglory
2009-03-10 03:42:49 +00:00
parent ac027069c0
commit c101314bec
3 changed files with 24 additions and 2 deletions
+5
View File
@@ -60,6 +60,11 @@ void QCDScene::replace( const QString2String &strings )
f->second->replace( item, st.key(), st.value() );
}
}
foreach(QGraphicsItem *item, list ) {
QShapeFactory::iterator f = sfactory.find( item->type() );
if( f != sfactory.end() )
f->second->replace( item, "", "" ); // to clean placeholders
}
}
bool QCDScene::load( const QString &fileName, QString *errMessage )
+9 -1
View File
@@ -264,7 +264,15 @@ QItemDialog *QShapeControllerRoundText::createDialog( QWidget *parent ) const
void QShapeControllerRoundText::replace( QGraphicsItem *item, const QString &from, const QString &to ) const
{
QLightRoundTextItem *textItem = static_cast< QLightRoundTextItem * >( item );
if( textItem->text() == from )
bool placeHolder = textItem->text().left( 1 ) == "?" && textItem->text().right( 1 ) == "?";
bool replace = false;
if( from.isEmpty() )
replace = placeHolder;
else
replace = textItem->text() == ( placeHolder ? QString( "?%1?" ).arg( from ) : from );
if( replace )
textItem->setText( to );
}
+10 -1
View File
@@ -81,7 +81,16 @@ void QShapeControllerText::writeData( QXmlStreamWriter &writer, const QGraphicsI
void QShapeControllerText::replace( QGraphicsItem *item, const QString &from, const QString &to ) const
{
QGraphicsSimpleTextItem *textItem = static_cast< QGraphicsSimpleTextItem * >( item );
if( textItem->text() == from )
bool placeHolder = textItem->text().left( 1 ) == "?" && textItem->text().right( 1 ) == "?";
bool replace = false;
if( from.isEmpty() )
replace = placeHolder;
else
replace = textItem->text() == ( placeHolder ? QString( "?%1?" ).arg( from ) : from );
if( replace )
textItem->setText( to );
}