Changeset 561 for trunk/src/svg/qsvgnode.cpp
- Timestamp:
- Feb 11, 2010, 11:19:06 PM (15 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to (toggle deleted branches)
/branches/vendor/nokia/qt/4.6.1 merged eligible /branches/vendor/nokia/qt/current merged eligible /branches/vendor/trolltech/qt/current 3-149
-
Property svn:mergeinfo
set to (toggle deleted branches)
-
trunk/src/svg/qsvgnode.cpp
r2 r561 2 2 ** 3 3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 4 ** Contact: Qt Software Information (qt-info@nokia.com) 4 ** All rights reserved. 5 ** Contact: Nokia Corporation (qt-info@nokia.com) 5 6 ** 6 7 ** This file is part of the QtSvg module of the Qt Toolkit. … … 21 22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 22 23 ** 23 ** In addition, as a special exception, Nokia gives you certain 24 ** additional rights. These rights are described in the Nokia Qt LGPL 25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this 26 ** package. 24 ** In addition, as a special exception, Nokia gives you certain additional 25 ** rights. These rights are described in the Nokia Qt LGPL Exception 26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 27 27 ** 28 28 ** GNU General Public License Usage … … 34 34 ** met: http://www.gnu.org/copyleft/gpl.html. 35 35 ** 36 ** If you are unsure which license is appropriate for your use, please37 ** contact the sales department at qt-sales@nokia.com.36 ** If you have questions regarding the use of this file, please contact 37 ** Nokia at qt-info@nokia.com. 38 38 ** $QT_END_LICENSE$ 39 39 ** … … 61 61 } 62 62 63 void QSvgNode::appendStyleProperty(QSvgStyleProperty *prop, const QString &id, 64 bool justLink) 63 void QSvgNode::appendStyleProperty(QSvgStyleProperty *prop, const QString &id) 65 64 { 66 65 //qDebug()<<"appending "<<prop->type()<< " ("<< id <<") "<<"to "<<this<<this->type(); 67 if (!justLink) { 68 switch (prop->type()) { 69 case QSvgStyleProperty::QUALITY: 70 m_style.quality = static_cast<QSvgQualityStyle*>(prop); 71 break; 72 case QSvgStyleProperty::FILL: 73 m_style.fill = static_cast<QSvgFillStyle*>(prop); 74 break; 75 case QSvgStyleProperty::VIEWPORT_FILL: 76 m_style.viewportFill = static_cast<QSvgViewportFillStyle*>(prop); 77 break; 78 case QSvgStyleProperty::FONT: 79 m_style.font = static_cast<QSvgFontStyle*>(prop); 80 break; 81 case QSvgStyleProperty::STROKE: 82 m_style.stroke = static_cast<QSvgStrokeStyle*>(prop); 83 break; 84 case QSvgStyleProperty::SOLID_COLOR: 85 m_style.solidColor = static_cast<QSvgSolidColorStyle*>(prop); 86 break; 87 case QSvgStyleProperty::GRADIENT: 88 m_style.gradient = static_cast<QSvgGradientStyle*>(prop); 89 break; 90 case QSvgStyleProperty::TRANSFORM: 91 m_style.transform = static_cast<QSvgTransformStyle*>(prop); 92 break; 93 case QSvgStyleProperty::ANIMATE_COLOR: 94 m_style.animateColor = static_cast<QSvgAnimateColor*>(prop); 95 break; 96 case QSvgStyleProperty::ANIMATE_TRANSFORM: 97 m_style.animateTransforms.append( 98 static_cast<QSvgAnimateTransform*>(prop)); 99 break; 100 case QSvgStyleProperty::OPACITY: 101 m_style.opacity = static_cast<QSvgOpacityStyle*>(prop); 102 break; 103 case QSvgStyleProperty::COMP_OP: 104 m_style.compop = static_cast<QSvgCompOpStyle*>(prop); 105 break; 106 default: 107 qDebug("QSvgNode: Trying to append unknown property!"); 108 break; 109 } 110 } 111 if (!id.isEmpty()) { 112 m_styles.insert(id, prop); 66 QSvgTinyDocument *doc; 67 switch (prop->type()) { 68 case QSvgStyleProperty::QUALITY: 69 m_style.quality = static_cast<QSvgQualityStyle*>(prop); 70 break; 71 case QSvgStyleProperty::FILL: 72 m_style.fill = static_cast<QSvgFillStyle*>(prop); 73 break; 74 case QSvgStyleProperty::VIEWPORT_FILL: 75 m_style.viewportFill = static_cast<QSvgViewportFillStyle*>(prop); 76 break; 77 case QSvgStyleProperty::FONT: 78 m_style.font = static_cast<QSvgFontStyle*>(prop); 79 break; 80 case QSvgStyleProperty::STROKE: 81 m_style.stroke = static_cast<QSvgStrokeStyle*>(prop); 82 break; 83 case QSvgStyleProperty::SOLID_COLOR: 84 m_style.solidColor = static_cast<QSvgSolidColorStyle*>(prop); 85 doc = document(); 86 if (doc && !id.isEmpty()) 87 doc->addNamedStyle(id, m_style.solidColor); 88 break; 89 case QSvgStyleProperty::GRADIENT: 90 m_style.gradient = static_cast<QSvgGradientStyle*>(prop); 91 doc = document(); 92 if (doc && !id.isEmpty()) 93 doc->addNamedStyle(id, m_style.gradient); 94 break; 95 case QSvgStyleProperty::TRANSFORM: 96 m_style.transform = static_cast<QSvgTransformStyle*>(prop); 97 break; 98 case QSvgStyleProperty::ANIMATE_COLOR: 99 m_style.animateColor = static_cast<QSvgAnimateColor*>(prop); 100 break; 101 case QSvgStyleProperty::ANIMATE_TRANSFORM: 102 m_style.animateTransforms.append( 103 static_cast<QSvgAnimateTransform*>(prop)); 104 break; 105 case QSvgStyleProperty::OPACITY: 106 m_style.opacity = static_cast<QSvgOpacityStyle*>(prop); 107 break; 108 case QSvgStyleProperty::COMP_OP: 109 m_style.compop = static_cast<QSvgCompOpStyle*>(prop); 110 break; 111 default: 112 qDebug("QSvgNode: Trying to append unknown property!"); 113 break; 113 114 } 114 115 } … … 186 187 } 187 188 188 QSvg StyleProperty * QSvgNode::styleProperty(const QString &id) const189 QSvgFillStyleProperty * QSvgNode::styleProperty(const QString &id) const 189 190 { 190 191 QString rid = id; 191 192 if (rid.startsWith(QLatin1Char('#'))) 192 193 rid.remove(0, 1); 193 const QSvgNode *node = this; 194 while (node) { 195 QSvgStyleProperty *style = node->m_styles[rid]; 196 if (style) 197 return style; 198 node = node->parent(); 199 } 200 201 return 0; 194 QSvgTinyDocument *doc = document(); 195 return doc ? doc->namedStyle(rid) : 0; 202 196 } 203 197 … … 321 315 QSvgStrokeStyle *stroke = static_cast<QSvgStrokeStyle*>( 322 316 styleProperty(QSvgStyleProperty::STROKE)); 323 if (!stroke || stroke->qpen().style() == Qt::NoPen)317 if (!stroke) 324 318 return 0; 325 return stroke->qpen().widthF(); 319 if (stroke->stroke().brush().style() == Qt::NoBrush) 320 return 0; 321 return stroke->width(); 326 322 } 327 323
Note:
See TracChangeset
for help on using the changeset viewer.