|
|
@ -39,9 +39,9 @@ Variant * DrawPart::createProperty( const TQString & id, Variant::Type::Value ty
|
|
|
|
if ( type == Variant::Type::PenStyle )
|
|
|
|
if ( type == Variant::Type::PenStyle )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList penStyles;
|
|
|
|
TQStringList penStyles;
|
|
|
|
penStyles << DrawPart::penStyleToName(Qt::SolidLine) << DrawPart::penStyleToName(Qt::DashLine)
|
|
|
|
penStyles << DrawPart::penStyleToName(TQt::SolidLine) << DrawPart::penStyleToName(TQt::DashLine)
|
|
|
|
<< DrawPart::penStyleToName(Qt::DotLine) << DrawPart::penStyleToName(Qt::DashDotLine)
|
|
|
|
<< DrawPart::penStyleToName(TQt::DotLine) << DrawPart::penStyleToName(TQt::DashDotLine)
|
|
|
|
<< DrawPart::penStyleToName(Qt::DashDotDotLine);
|
|
|
|
<< DrawPart::penStyleToName(TQt::DashDotDotLine);
|
|
|
|
|
|
|
|
|
|
|
|
Variant * v = createProperty( id, Variant::Type::String );
|
|
|
|
Variant * v = createProperty( id, Variant::Type::String );
|
|
|
|
v->setType( Variant::Type::PenStyle );
|
|
|
|
v->setType( Variant::Type::PenStyle );
|
|
|
@ -52,8 +52,8 @@ Variant * DrawPart::createProperty( const TQString & id, Variant::Type::Value ty
|
|
|
|
if ( type == Variant::Type::PenCapStyle )
|
|
|
|
if ( type == Variant::Type::PenCapStyle )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
TQStringList penCapStyles;
|
|
|
|
TQStringList penCapStyles;
|
|
|
|
penCapStyles << DrawPart::penCapStyleToName(Qt::FlatCap) << DrawPart::penCapStyleToName(Qt::SquareCap)
|
|
|
|
penCapStyles << DrawPart::penCapStyleToName(TQt::FlatCap) << DrawPart::penCapStyleToName(TQt::SquareCap)
|
|
|
|
<< DrawPart::penCapStyleToName(Qt::RoundCap);
|
|
|
|
<< DrawPart::penCapStyleToName(TQt::RoundCap);
|
|
|
|
|
|
|
|
|
|
|
|
Variant * v = createProperty( id, Variant::Type::String );
|
|
|
|
Variant * v = createProperty( id, Variant::Type::String );
|
|
|
|
v->setType( Variant::Type::PenCapStyle );
|
|
|
|
v->setType( Variant::Type::PenCapStyle );
|
|
|
@ -65,19 +65,19 @@ Variant * DrawPart::createProperty( const TQString & id, Variant::Type::Value ty
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Qt::PenStyle DrawPart::getDataPenStyle( const TQString & id )
|
|
|
|
TQt::PenStyle DrawPart::getDataPenStyle( const TQString & id )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return nameToPenStyle( dataString(id) );
|
|
|
|
return nameToPenStyle( dataString(id) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Qt::PenCapStyle DrawPart::getDataPenCapStyle( const TQString & id )
|
|
|
|
TQt::PenCapStyle DrawPart::getDataPenCapStyle( const TQString & id )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return nameToPenCapStyle( dataString(id) );
|
|
|
|
return nameToPenCapStyle( dataString(id) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void DrawPart::setDataPenStyle( const TQString & id, Qt::PenStyle value )
|
|
|
|
void DrawPart::setDataPenStyle( const TQString & id, TQt::PenStyle value )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
property(id)->setValue( penStyleToName(value) );
|
|
|
|
property(id)->setValue( penStyleToName(value) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void DrawPart::setDataPenCapStyle( const TQString & id, Qt::PenCapStyle value )
|
|
|
|
void DrawPart::setDataPenCapStyle( const TQString & id, TQt::PenCapStyle value )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
property(id)->setValue( penCapStyleToName(value) );
|
|
|
|
property(id)->setValue( penCapStyleToName(value) );
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -144,121 +144,121 @@ void DrawPart::restoreFromItemData( const ItemData &itemData )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TQString DrawPart::penStyleToID( Qt::PenStyle style )
|
|
|
|
TQString DrawPart::penStyleToID( TQt::PenStyle style )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (style)
|
|
|
|
switch (style)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case Qt::SolidLine:
|
|
|
|
case TQt::SolidLine:
|
|
|
|
return "SolidLine";
|
|
|
|
return "SolidLine";
|
|
|
|
case Qt::NoPen:
|
|
|
|
case TQt::NoPen:
|
|
|
|
return "NoPen";
|
|
|
|
return "NoPen";
|
|
|
|
case Qt::DashLine:
|
|
|
|
case TQt::DashLine:
|
|
|
|
return "DashLine";
|
|
|
|
return "DashLine";
|
|
|
|
case Qt::DotLine:
|
|
|
|
case TQt::DotLine:
|
|
|
|
return "DotLine";
|
|
|
|
return "DotLine";
|
|
|
|
case Qt::DashDotLine:
|
|
|
|
case TQt::DashDotLine:
|
|
|
|
return "DashDotLine";
|
|
|
|
return "DashDotLine";
|
|
|
|
case Qt::DashDotDotLine:
|
|
|
|
case TQt::DashDotDotLine:
|
|
|
|
return "DashDotDotLine";
|
|
|
|
return "DashDotDotLine";
|
|
|
|
case Qt::MPenStyle:
|
|
|
|
case TQt::MPenStyle:
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return ""; // ?!
|
|
|
|
return ""; // ?!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Qt::PenStyle DrawPart::idToPenStyle( const TQString & id )
|
|
|
|
TQt::PenStyle DrawPart::idToPenStyle( const TQString & id )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( id == "NoPen" )
|
|
|
|
if ( id == "NoPen" )
|
|
|
|
return Qt::NoPen;
|
|
|
|
return TQt::NoPen;
|
|
|
|
if ( id == "DashLine" )
|
|
|
|
if ( id == "DashLine" )
|
|
|
|
return Qt::DashLine;
|
|
|
|
return TQt::DashLine;
|
|
|
|
if ( id == "DotLine" )
|
|
|
|
if ( id == "DotLine" )
|
|
|
|
return Qt::DotLine;
|
|
|
|
return TQt::DotLine;
|
|
|
|
if ( id == "DashDotLine" )
|
|
|
|
if ( id == "DashDotLine" )
|
|
|
|
return Qt::DashDotLine;
|
|
|
|
return TQt::DashDotLine;
|
|
|
|
if ( id == "DashDotDotLine" )
|
|
|
|
if ( id == "DashDotDotLine" )
|
|
|
|
return Qt::DashDotDotLine;
|
|
|
|
return TQt::DashDotDotLine;
|
|
|
|
return Qt::SolidLine;
|
|
|
|
return TQt::SolidLine;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TQString DrawPart::penCapStyleToID( Qt::PenCapStyle style )
|
|
|
|
TQString DrawPart::penCapStyleToID( TQt::PenCapStyle style )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (style)
|
|
|
|
switch (style)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case Qt::FlatCap:
|
|
|
|
case TQt::FlatCap:
|
|
|
|
return "FlatCap";
|
|
|
|
return "FlatCap";
|
|
|
|
case Qt::SquareCap:
|
|
|
|
case TQt::SquareCap:
|
|
|
|
return "SquareCap";
|
|
|
|
return "SquareCap";
|
|
|
|
case Qt::RoundCap:
|
|
|
|
case TQt::RoundCap:
|
|
|
|
return "RoundCap";
|
|
|
|
return "RoundCap";
|
|
|
|
case Qt::MPenCapStyle:
|
|
|
|
case TQt::MPenCapStyle:
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return ""; // ?!
|
|
|
|
return ""; // ?!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Qt::PenCapStyle DrawPart::idToPenCapStyle( const TQString & id )
|
|
|
|
TQt::PenCapStyle DrawPart::idToPenCapStyle( const TQString & id )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( id == "SquareCap" )
|
|
|
|
if ( id == "SquareCap" )
|
|
|
|
return Qt::SquareCap;
|
|
|
|
return TQt::SquareCap;
|
|
|
|
if ( id == "RoundCap" )
|
|
|
|
if ( id == "RoundCap" )
|
|
|
|
return Qt::RoundCap;
|
|
|
|
return TQt::RoundCap;
|
|
|
|
return Qt::FlatCap;
|
|
|
|
return TQt::FlatCap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
TQString DrawPart::penStyleToName( Qt::PenStyle style )
|
|
|
|
TQString DrawPart::penStyleToName( TQt::PenStyle style )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (style)
|
|
|
|
switch (style)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case Qt::SolidLine:
|
|
|
|
case TQt::SolidLine:
|
|
|
|
return i18n("Solid");
|
|
|
|
return i18n("Solid");
|
|
|
|
case Qt::NoPen:
|
|
|
|
case TQt::NoPen:
|
|
|
|
return i18n("None");
|
|
|
|
return i18n("None");
|
|
|
|
case Qt::DashLine:
|
|
|
|
case TQt::DashLine:
|
|
|
|
return i18n("Dash");
|
|
|
|
return i18n("Dash");
|
|
|
|
case Qt::DotLine:
|
|
|
|
case TQt::DotLine:
|
|
|
|
return i18n("Dot");
|
|
|
|
return i18n("Dot");
|
|
|
|
case Qt::DashDotLine:
|
|
|
|
case TQt::DashDotLine:
|
|
|
|
return i18n("Dash Dot");
|
|
|
|
return i18n("Dash Dot");
|
|
|
|
case Qt::DashDotDotLine:
|
|
|
|
case TQt::DashDotDotLine:
|
|
|
|
return i18n("Dash Dot Dot");
|
|
|
|
return i18n("Dash Dot Dot");
|
|
|
|
case Qt::MPenStyle:
|
|
|
|
case TQt::MPenStyle:
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return ""; // ?!
|
|
|
|
return ""; // ?!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Qt::PenStyle DrawPart::nameToPenStyle( const TQString & name )
|
|
|
|
TQt::PenStyle DrawPart::nameToPenStyle( const TQString & name )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( name == i18n("None") )
|
|
|
|
if ( name == i18n("None") )
|
|
|
|
return Qt::NoPen;
|
|
|
|
return TQt::NoPen;
|
|
|
|
if ( name == i18n("Dash") )
|
|
|
|
if ( name == i18n("Dash") )
|
|
|
|
return Qt::DashLine;
|
|
|
|
return TQt::DashLine;
|
|
|
|
if ( name == i18n("Dot") )
|
|
|
|
if ( name == i18n("Dot") )
|
|
|
|
return Qt::DotLine;
|
|
|
|
return TQt::DotLine;
|
|
|
|
if ( name == i18n("Dash Dot") )
|
|
|
|
if ( name == i18n("Dash Dot") )
|
|
|
|
return Qt::DashDotLine;
|
|
|
|
return TQt::DashDotLine;
|
|
|
|
if ( name == i18n("Dash Dot Dot") )
|
|
|
|
if ( name == i18n("Dash Dot Dot") )
|
|
|
|
return Qt::DashDotDotLine;
|
|
|
|
return TQt::DashDotDotLine;
|
|
|
|
return Qt::SolidLine;
|
|
|
|
return TQt::SolidLine;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
TQString DrawPart::penCapStyleToName( Qt::PenCapStyle style )
|
|
|
|
TQString DrawPart::penCapStyleToName( TQt::PenCapStyle style )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
switch (style)
|
|
|
|
switch (style)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
case Qt::FlatCap:
|
|
|
|
case TQt::FlatCap:
|
|
|
|
return i18n("Flat");
|
|
|
|
return i18n("Flat");
|
|
|
|
case Qt::SquareCap:
|
|
|
|
case TQt::SquareCap:
|
|
|
|
return i18n("Square");
|
|
|
|
return i18n("Square");
|
|
|
|
case Qt::RoundCap:
|
|
|
|
case TQt::RoundCap:
|
|
|
|
return i18n("Round");
|
|
|
|
return i18n("Round");
|
|
|
|
case Qt::MPenCapStyle:
|
|
|
|
case TQt::MPenCapStyle:
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
return ""; // ?!
|
|
|
|
return ""; // ?!
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Qt::PenCapStyle DrawPart::nameToPenCapStyle( const TQString & name )
|
|
|
|
TQt::PenCapStyle DrawPart::nameToPenCapStyle( const TQString & name )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if ( name == i18n("Square") )
|
|
|
|
if ( name == i18n("Square") )
|
|
|
|
return Qt::SquareCap;
|
|
|
|
return TQt::SquareCap;
|
|
|
|
if ( name == i18n("Round") )
|
|
|
|
if ( name == i18n("Round") )
|
|
|
|
return Qt::RoundCap;
|
|
|
|
return TQt::RoundCap;
|
|
|
|
return Qt::FlatCap;
|
|
|
|
return TQt::FlatCap;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|