File indexing completed on 2024-05-12 04:35:05
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2013-2018 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZ_STYLE_H 0021 #define TIKZ_STYLE_H 0022 0023 #include "tikz.h" 0024 #include "Entity.h" 0025 #include "Value.h" 0026 0027 #include <QColor> 0028 0029 namespace tikz { 0030 namespace core { 0031 0032 class Document; 0033 class StylePrivate; 0034 class Visitor; 0035 0036 class TIKZKITCORE_EXPORT Style : public Entity 0037 { 0038 Q_OBJECT 0039 Q_PROPERTY(Uid parentStyle READ parentStyle WRITE setParentStyle) 0040 0041 // 0042 // properties shared between Nodes and Paths 0043 // 0044 Q_PROPERTY(QColor penColor READ penColor WRITE setPenColor RESET unsetPenColor) 0045 Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor RESET unsetFillColor) 0046 Q_PROPERTY(qreal penOpacity READ penOpacity WRITE setPenOpacity RESET unsetPenOpacity) 0047 Q_PROPERTY(qreal fillOpacity READ fillOpacity WRITE setFillOpacity RESET unsetFillOpacity) 0048 0049 Q_PROPERTY(tikz::PenStyle penStyle READ penStyle WRITE setPenStyle RESET unsetPenStyle) 0050 0051 Q_PROPERTY(tikz::Value lineWidth READ lineWidth WRITE setLineWidth RESET unsetLineWidth) 0052 0053 Q_PROPERTY(bool doubleLine READ doubleLine WRITE setDoubleLine RESET unsetDoubleLine) 0054 Q_PROPERTY(tikz::Value innerLineWidth READ innerLineWidth WRITE setInnerLineWidth RESET unsetInnerLineWidth) 0055 Q_PROPERTY(QColor innerLineColor READ innerLineColor WRITE setInnerLineColor RESET unsetInnerLineColor) 0056 0057 Q_PROPERTY(qreal rotation READ rotation WRITE setRotation RESET unsetRotation) 0058 0059 public: 0060 /** 0061 * Default constructor. 0062 */ 0063 Style(); 0064 0065 /** 0066 * Virtual destructor. 0067 */ 0068 virtual ~Style(); 0069 0070 /** 0071 * Returns EntityType::Style. 0072 */ 0073 tikz::EntityType entityType() const override; 0074 0075 /** 0076 * Set the properties of this style to all properties of @p other. 0077 */ 0078 virtual void setStyle(const Style * other); 0079 0080 /** 0081 * Load the style to a JSON object. 0082 */ 0083 void loadData(const QJsonObject & json) override; 0084 0085 /** 0086 * Save the style to the json object. 0087 */ 0088 QJsonObject saveData() const override; 0089 0090 // 0091 // visitor pattern 0092 // 0093 public: 0094 /** 0095 * Visitor pattern. 0096 * Visits all elements of the document. 0097 */ 0098 bool accept(Visitor & visitor); 0099 0100 // 0101 // parent / child hierarchy 0102 // 0103 public: 0104 /** 0105 * Get the parent style this style inherits from. 0106 */ 0107 Uid parentStyle() const; 0108 0109 /** 0110 * Set @p parentUid as new parent to inherit attributes from. 0111 */ 0112 void setParentStyle(const Uid & parentUid); 0113 0114 /** 0115 * Returns true, if this style has child styles inheriting from 0116 * this style. 0117 */ 0118 bool hasChildStyles() const; 0119 0120 // 0121 // properties 0122 // 0123 public Q_SLOTS: 0124 /** 0125 * Add @p property to the list of set properties. 0126 */ 0127 void addProperty(const QString & property); 0128 0129 /** 0130 * Remove @p property from the list of set properties. 0131 */ 0132 void removeProperty(const QString & property); 0133 0134 public: 0135 /** 0136 * Check whether @p property is set. 0137 */ 0138 bool propertySet(const QString & property) const; 0139 0140 // 0141 // pen style 0142 // 0143 public: 0144 /** 0145 * Get the PenStyle of this style. 0146 * @see PenStyle 0147 */ 0148 Q_INVOKABLE PenStyle penStyle() const; 0149 0150 /** 0151 * Check whether the pen style is set. 0152 * @return true, if this style has an own pen style 0153 */ 0154 Q_INVOKABLE bool penStyleSet() const; 0155 0156 public Q_SLOTS: 0157 /** 0158 * Set the PenStyle of this style to @p style. 0159 * @see PenStyle 0160 */ 0161 Q_INVOKABLE void setPenStyle(tikz::PenStyle style); 0162 0163 /** 0164 * Unset the pen style. 0165 * After this, calling penStyle() returns the parent()->penStyle() 0166 * if a parent() style exists, otherwise penStyle() returns the 0167 * default pen style @e tikz::PenStyle::SolidLine. 0168 * @see PenStyle, penStyle() 0169 */ 0170 Q_INVOKABLE void unsetPenStyle(); 0171 0172 // 0173 // pen style / line width 0174 // 0175 public: 0176 /** 0177 * Check whether the line width is set. 0178 * @return true, if this style has an own line width 0179 */ 0180 Q_INVOKABLE bool lineWidthSet() const; 0181 0182 /** 0183 * Get the lineWidth() in cm. 0184 */ 0185 Q_INVOKABLE tikz::Value lineWidth() const; 0186 0187 /** 0188 * Get the pen width for drawing in cm. 0189 * The pen with equals lineWidth(), if double lines are disabled. 0190 * If double lines are enabled, the pen width is set to 0191 * 2 * lineWidth() + innerLineWidth(). 0192 */ 0193 Q_INVOKABLE tikz::Value penWidth() const; 0194 0195 public Q_SLOTS: 0196 /** 0197 * Set the line width to @p width cm. 0198 * Calling this function automatically sets the lineWidth() 0199 * to LineWidth::CustomLineWidth. 0200 * @p width the line width [cm] 0201 * @see Linewidth 0202 */ 0203 Q_INVOKABLE void setLineWidth(const tikz::Value & width); 0204 0205 /** 0206 * Unset the line width. 0207 * After this, calling lineWidth() returns the respective value 0208 * of the parent() style, if the parent() style exists, 0209 * otherwise the returned line width is @e Value::semiThick(). 0210 * @see LineWidth, lineWidth() 0211 */ 0212 Q_INVOKABLE void unsetLineWidth(); 0213 0214 // 0215 // double lines 0216 // 0217 public: 0218 /** 0219 * Get whether this line is a double line. 0220 * By default, returns @e false. 0221 */ 0222 Q_INVOKABLE bool doubleLine() const; 0223 0224 /** 0225 * Check whether the double line property is set. 0226 * @return true, if this style has an own double line property 0227 */ 0228 Q_INVOKABLE bool doubleLineSet() const; 0229 0230 public Q_SLOTS: 0231 /** 0232 * Draw double lines if @p enabled is @e true. 0233 */ 0234 Q_INVOKABLE void setDoubleLine(bool enabled); 0235 0236 /** 0237 * Unset the double line property. 0238 * After this, calling isDoubleLine() returns values of the parent() 0239 * style, if applicable; otherwise the returned line width is @e false. 0240 */ 0241 Q_INVOKABLE void unsetDoubleLine(); 0242 0243 public: 0244 /** 0245 * Get the inner line width in cm. 0246 * The inner line width is used for double lines in paths and shapes. 0247 */ 0248 Q_INVOKABLE tikz::Value innerLineWidth() const; 0249 0250 /** 0251 * Check whether the inner line width property is set. 0252 * @return true, if this style has an own inner line width property 0253 */ 0254 Q_INVOKABLE bool innerLineWidthSet() const; 0255 0256 public Q_SLOTS: 0257 /** 0258 * Set the inner line width to @p width cm. 0259 * Calling this function automatically sets the innerLineWidth() 0260 * to LineWidth::CustomLineWidth. 0261 * @p width the line width [cm] 0262 * @see LineWidth 0263 */ 0264 Q_INVOKABLE void setInnerLineWidth(const tikz::Value & width); 0265 0266 /** 0267 * Unset the inner line width property. 0268 * After this, calling innerLineWidth() returns parent()->innerLineWidth(), 0269 * or the default inner line width, if parent() is null. 0270 */ 0271 Q_INVOKABLE void unsetInnerLineWidth(); 0272 0273 // 0274 // draw & fill opacity 0275 // 0276 public: 0277 /** 0278 * Get the opacity for drawing primitives in the interval [0.0; 1.0]. 0279 */ 0280 Q_INVOKABLE qreal penOpacity() const; 0281 0282 /** 0283 * Check whether the pen opacity property is set. 0284 * @return true, if this style has an own pen opacity property 0285 */ 0286 Q_INVOKABLE bool penOpacitySet() const; 0287 0288 /** 0289 * Get the opacity for filling operations in the interval [0.0; 1.0]. 0290 */ 0291 Q_INVOKABLE qreal fillOpacity() const; 0292 0293 /** 0294 * Check whether the fill opacity property is set. 0295 * @return true, if this style has an own fill opacity property 0296 */ 0297 Q_INVOKABLE bool fillOpacitySet() const; 0298 0299 public Q_SLOTS: 0300 /** 0301 * Set the opacity for drawing primitives to @p opacity. 0302 * @param opacity the opacity in the interval [0.0; 1.0] 0303 */ 0304 Q_INVOKABLE void setPenOpacity(qreal opacity); 0305 0306 /** 0307 * Unsets the draw opacity of the pen. 0308 * Afterwards, penOpacity() returns either the opacity of the parent() 0309 * style, or the default value @e 1.0. 0310 */ 0311 Q_INVOKABLE void unsetPenOpacity(); 0312 0313 /** 0314 * Set the opacity for filling primitives to @p opacity. 0315 * @param opacity the opacity in the interval [0.0; 1.0] 0316 */ 0317 Q_INVOKABLE void setFillOpacity(qreal opacity); 0318 0319 /** 0320 * Unsets the fill opacity of fill operations. 0321 * Afterwards, fillOpacity() returns either the opacity of the parent() 0322 * style, or the default value @e 1.0. 0323 */ 0324 Q_INVOKABLE void unsetFillOpacity(); 0325 0326 // 0327 // pen color and fill color/brush 0328 // 0329 public: 0330 /** 0331 * Gets the pen color for drawing paths. 0332 * If the color is not explicitly set, the returned color is Qt::black. 0333 */ 0334 Q_INVOKABLE QColor penColor() const; 0335 0336 /** 0337 * Check whether the pen color property is set. 0338 * @return true, if this style has an own pen color property 0339 */ 0340 Q_INVOKABLE bool penColorSet() const; 0341 0342 /** 0343 * Gets the inner line pen color for drawing double line paths. 0344 * If the color is not explicitly set, the returned color is Qt::white. 0345 */ 0346 Q_INVOKABLE QColor innerLineColor() const; 0347 0348 /** 0349 * Check whether the inner line color property is set. 0350 * @return true, if this style has an own inner line color property 0351 */ 0352 Q_INVOKABLE bool innerLineColorSet() const; 0353 0354 /** 0355 * Gets the fill color for filling paths. 0356 * If the color is not explicitly set, the returned color is Qt::transparent. 0357 */ 0358 Q_INVOKABLE QColor fillColor() const; 0359 0360 /** 0361 * Check whether the fill color property is set. 0362 * @return true, if this style has an own fill color property 0363 */ 0364 Q_INVOKABLE bool fillColorSet() const; 0365 0366 public Q_SLOTS: 0367 /** 0368 * Sets the pen color used for drawing paths to @p color. 0369 * @param color draw color 0370 */ 0371 Q_INVOKABLE void setPenColor(const QColor & color); 0372 0373 /** 0374 * Unsets the pen color used for drawing paths. 0375 * Afterwards, penColor() returns either the color of the parent() 0376 * style, or the default color Qt::black. 0377 */ 0378 Q_INVOKABLE void unsetPenColor(); 0379 0380 /** 0381 * Sets the inner line color used for drawing double paths to @p color. 0382 * @param color draw color 0383 */ 0384 Q_INVOKABLE void setInnerLineColor(const QColor & color); 0385 0386 /** 0387 * Unsets the inner line color used for drawing double line paths. 0388 * Afterwards, innerLineColor() returns either the color of the parent() 0389 * style, or the default color Qt::white. 0390 */ 0391 Q_INVOKABLE void unsetInnerLineColor(); 0392 0393 /** 0394 * Sets the fill color used for filling paths to @p color. 0395 * @param color draw color 0396 */ 0397 Q_INVOKABLE void setFillColor(const QColor & color); 0398 0399 /** 0400 * Unsets the fill color used for filling paths. 0401 * Afterwards, fillColor() returns either the color of the parent() 0402 * style, or the default Qt::transparent. 0403 */ 0404 Q_INVOKABLE void unsetFillColor(); 0405 0406 // 0407 // rotation 0408 // 0409 public: 0410 /** 0411 * Get the rotation in degrees. 0412 */ 0413 Q_INVOKABLE qreal rotation() const; 0414 0415 /** 0416 * Check whether the rotation is set. 0417 */ 0418 Q_INVOKABLE bool rotationSet() const; 0419 0420 public Q_SLOTS: 0421 /** 0422 * Set the rotation to @p angle degrees. 0423 */ 0424 Q_INVOKABLE void setRotation(qreal angle); 0425 0426 /** 0427 * Unset the rotation attribute. 0428 * Afterwards, the rotation falls back to the value of parent()->rotation(). 0429 */ 0430 Q_INVOKABLE void unsetRotation(); 0431 0432 private: 0433 // 0434 // properties specific to Paths 0435 // 0436 Q_PROPERTY(tikz::Value radiusX READ radiusX WRITE setRadiusX RESET unsetRadiusX) 0437 Q_PROPERTY(tikz::Value radiusY READ radiusY WRITE setRadiusY RESET unsetRadiusY) 0438 Q_PROPERTY(qreal bendAngle READ bendAngle WRITE setBendAngle RESET unsetBendAngle) 0439 Q_PROPERTY(qreal looseness READ looseness WRITE setLooseness RESET unsetLooseness) 0440 Q_PROPERTY(qreal outAngle READ outAngle WRITE setOutAngle RESET unsetOutAngle) 0441 Q_PROPERTY(qreal inAngle READ inAngle WRITE setInAngle RESET unsetInAngle) 0442 Q_PROPERTY(tikz::Arrow arrowTail READ arrowTail WRITE setArrowTail RESET unsetArrowTail) 0443 Q_PROPERTY(tikz::Arrow arrowHead READ arrowHead WRITE setArrowHead RESET unsetArrowHead) 0444 Q_PROPERTY(tikz::Value shortenStart READ shortenStart WRITE setShortenStart RESET unsetShortenStart) 0445 Q_PROPERTY(tikz::Value shortenEnd READ shortenEnd WRITE setShortenEnd RESET unsetShortenEnd) 0446 0447 // 0448 // Ellipse properties 0449 // 0450 public: 0451 /** 0452 * Get the "x radius" of an ellipse path. The default value is 0.0. 0453 * @note This value has an effect only if the path is of type Path::Ellipse. 0454 */ 0455 Q_INVOKABLE tikz::Value radiusX() const; 0456 0457 /** 0458 * Get the "y radius" of an ellipse path. The default value is 0.0. 0459 * @note This value has an effect only if the path is of type Path::Ellipse. 0460 */ 0461 Q_INVOKABLE tikz::Value radiusY() const; 0462 0463 /** 0464 * Check whether the "x radius" property is set. 0465 */ 0466 Q_INVOKABLE bool radiusXSet() const; 0467 0468 /** 0469 * Check whether the "y radius" property is set. 0470 */ 0471 Q_INVOKABLE bool radiusYSet() const; 0472 0473 public Q_SLOTS: 0474 /** 0475 * Set the "x radius" of the ellipse to @p xradius. 0476 * This value is used by tikz::EllipsePath. 0477 */ 0478 Q_INVOKABLE void setRadiusX(const tikz::Value & xradius); 0479 0480 /** 0481 * Set the "y radius" of the ellipse to @p yradius. 0482 * This value is used by tikz::EllipsePath. 0483 */ 0484 Q_INVOKABLE void setRadiusY(const tikz::Value & yradius); 0485 0486 /** 0487 * Unset the "x radius" property. 0488 */ 0489 Q_INVOKABLE void unsetRadiusX(); 0490 0491 /** 0492 * Unset the "y radius" property. 0493 */ 0494 Q_INVOKABLE void unsetRadiusY(); 0495 0496 public: 0497 /** 0498 * Get the bending angle in degrees. 0499 * @note The return value is only of meaning if the edge type is BendCurve. 0500 * @return The bending angle is always expressed as 'bend left'. 0501 * Therefore, negative values can be interpreted as positive with 'bend right'. 0502 */ 0503 Q_INVOKABLE qreal bendAngle() const; 0504 0505 /** 0506 * Check whether the bend angle is set. 0507 */ 0508 Q_INVOKABLE bool bendAngleSet() const; 0509 0510 public Q_SLOTS: 0511 /** 0512 * Set the bending angle to @p angle. 0513 * @note This value has an effect only if the edge type is BendCurve. 0514 */ 0515 Q_INVOKABLE void setBendAngle(qreal angle); 0516 0517 /** 0518 * Unset the bend angle property. 0519 */ 0520 Q_INVOKABLE void unsetBendAngle(); 0521 0522 public: 0523 /** 0524 * Get the looseness of the edge. The default value is 1.0. 0525 * @note This value has an effect only if the edge type is set to 0526 * CurveMode::BendCurve or CurveMode::InOutCurve. 0527 */ 0528 Q_INVOKABLE qreal looseness() const; 0529 0530 /** 0531 * Check whether the looseness is set. 0532 */ 0533 Q_INVOKABLE bool loosenessSet() const; 0534 0535 public Q_SLOTS: 0536 /** 0537 * Set the looseness for bending the edge to @p looseness. 0538 * @note This value has an effect only if the edge type is set to 0539 * CurveMode::BendCurve or CurveMode::InOutCurve. 0540 */ 0541 Q_INVOKABLE void setLooseness(qreal looseness); 0542 0543 /** 0544 * Unset the looseness for bending the edge. 0545 */ 0546 Q_INVOKABLE void unsetLooseness(); 0547 0548 public: 0549 /** 0550 * Get the first/start control point. 0551 * @note This returned point is only of meaning if the edge type is set 0552 * to CurveMode::BezierCurve. 0553 */ 0554 QPointF startControlPoint() const; 0555 0556 /** 0557 * Get the second/end control point. 0558 * @note This returned point is only of meaning if the edge type is set 0559 * to CurveMode::BezierCurve. 0560 */ 0561 QPointF endControlPoint() const; 0562 0563 public Q_SLOTS: 0564 /** 0565 * Set the first/start control point to @p cp1. 0566 * @note This value has an effect only if the edge type is set to 0567 * CurveMode::BezierCurve. 0568 */ 0569 void setStartControlPoint(const QPointF & cp1); 0570 0571 /** 0572 * Set the second/end control point to @p cp2. 0573 * @note This value has an effect only if the edge type is set to 0574 * CurveMode::BezierCurve. 0575 */ 0576 void setEndControlPoint(const QPointF & cp2); 0577 0578 public: 0579 /** 0580 * Get the out angle for the start node. 0581 * @note This value is only of meaning if the edge type is set to 0582 * CurveMode::InOutCurve. 0583 */ 0584 Q_INVOKABLE qreal outAngle() const; 0585 0586 /** 0587 * Check whether the out angle is set. 0588 */ 0589 Q_INVOKABLE bool outAngleSet() const; 0590 0591 /** 0592 * Get the in angle for the end node. 0593 * @note This value is only of meaning if the edge type is set to 0594 * CurveMode::InOutCurve. 0595 */ 0596 Q_INVOKABLE qreal inAngle() const; 0597 0598 /** 0599 * Check whether the in angle is set. 0600 */ 0601 Q_INVOKABLE bool inAngleSet() const; 0602 0603 public Q_SLOTS: 0604 /** 0605 * Set the out angle for the start node to @p angle. 0606 * @note This value has an effect only if the edge type is set to 0607 * CurveMode::InOutCurve. 0608 */ 0609 Q_INVOKABLE void setOutAngle(qreal angle); 0610 0611 /** 0612 * Unset the out angle property. 0613 */ 0614 Q_INVOKABLE void unsetOutAngle(); 0615 0616 /** 0617 * Set the in angle for the end node to @p angle. 0618 * @note This value has an effect only if the edge type is set to 0619 * CurveMode::InOutCurve. 0620 */ 0621 Q_INVOKABLE void setInAngle(qreal angle); 0622 0623 /** 0624 * Unset the in angle property. 0625 */ 0626 Q_INVOKABLE void unsetInAngle(); 0627 0628 // 0629 // Arrow attributes 0630 // 0631 public: 0632 /** 0633 * Get the arrow tail style. 0634 */ 0635 Q_INVOKABLE Arrow arrowTail() const; 0636 0637 /** 0638 * Check whether the arrow tail is set. 0639 */ 0640 Q_INVOKABLE bool arrowTailSet() const; 0641 0642 /** 0643 * Get the arrow head style. 0644 */ 0645 Q_INVOKABLE Arrow arrowHead() const; 0646 0647 /** 0648 * Check whether the arrow head is set. 0649 */ 0650 Q_INVOKABLE bool arrowHeadSet() const; 0651 0652 public Q_SLOTS: 0653 /** 0654 * Set the arrow tail style to @p tail. 0655 */ 0656 Q_INVOKABLE void setArrowTail(tikz::Arrow tail); 0657 0658 /** 0659 * Set the arrow head style to @p head. 0660 */ 0661 Q_INVOKABLE void setArrowHead(tikz::Arrow head); 0662 0663 /** 0664 * Unset the arrow tail style. 0665 */ 0666 Q_INVOKABLE void unsetArrowTail(); 0667 0668 /** 0669 * Unset the arrow head style. 0670 */ 0671 Q_INVOKABLE void unsetArrowHead(); 0672 0673 // 0674 // shorten >, shorten < of edges 0675 // 0676 public: 0677 /** 0678 * Shorten amount for the start of the edge in cm. 0679 * Default: 0.0cm 0680 */ 0681 Q_INVOKABLE tikz::Value shortenStart() const; 0682 0683 /** 0684 * Check whether shorten start is set. 0685 */ 0686 Q_INVOKABLE bool shortenStartSet() const; 0687 0688 /** 0689 * Shorten amount for the end of the edge in cm. 0690 * Default: 0.0cm 0691 */ 0692 Q_INVOKABLE tikz::Value shortenEnd() const; 0693 0694 /** 0695 * Check whether shorten end is set. 0696 */ 0697 Q_INVOKABLE bool shortenEndSet() const; 0698 0699 public Q_SLOTS: 0700 /** 0701 * Set the start shorten amount to @p shorten cm. 0702 */ 0703 Q_INVOKABLE void setShortenStart(const tikz::Value & shorten); 0704 0705 /** 0706 * Set the end shorten amount to @p shorten cm. 0707 */ 0708 Q_INVOKABLE void setShortenEnd(const tikz::Value & shorten); 0709 0710 /** 0711 * Unset the start shorten amount. 0712 */ 0713 Q_INVOKABLE void unsetShortenStart(); 0714 0715 /** 0716 * Unset the end shorten amount. 0717 */ 0718 Q_INVOKABLE void unsetShortenEnd(); 0719 0720 0721 private: 0722 // 0723 // properties specific to Node 0724 // 0725 Q_PROPERTY(tikz::TextAlignment textAlign READ textAlign WRITE setTextAlign RESET unsetTextAlign) 0726 Q_PROPERTY(tikz::Shape shape READ shape WRITE setShape RESET unsetShape) 0727 Q_PROPERTY(tikz::Value innerSep READ innerSep WRITE setInnerSep RESET unsetInnerSep) 0728 Q_PROPERTY(tikz::Value outerSep READ outerSep WRITE setOuterSep RESET unsetOuterSep) 0729 Q_PROPERTY(tikz::Value minimumHeight READ minimumHeight WRITE setMinimumHeight RESET unsetMinimumHeight) 0730 Q_PROPERTY(tikz::Value minimumWidth READ minimumWidth WRITE setMinimumWidth RESET unsetMinimumWidth) 0731 0732 // 0733 // text alignment 0734 // 0735 public: 0736 /** 0737 * Get the text alignment. 0738 */ 0739 Q_INVOKABLE TextAlignment textAlign() const; 0740 0741 /** 0742 * Check whether the alignment is set. 0743 */ 0744 Q_INVOKABLE bool textAlignSet() const; 0745 0746 public Q_SLOTS: 0747 /** 0748 * Set the text alignment to @p align. 0749 */ 0750 Q_INVOKABLE void setTextAlign(tikz::TextAlignment align); 0751 0752 /** 0753 * Unset the alignment attribute. 0754 * The default value is tikz::NoAlign. 0755 */ 0756 Q_INVOKABLE void unsetTextAlign(); 0757 0758 // 0759 // Node specific attributes 0760 // 0761 public: 0762 /** 0763 * Get the Shape of this style. 0764 * @see Shape 0765 */ 0766 Q_INVOKABLE Shape shape() const; 0767 0768 /** 0769 * Check whether the shape is set. 0770 */ 0771 Q_INVOKABLE bool shapeSet() const; 0772 0773 public Q_SLOTS: 0774 /** 0775 * Set the Shape of this style. 0776 * @see Shape 0777 */ 0778 Q_INVOKABLE void setShape(tikz::Shape shape); 0779 0780 /** 0781 * Unset the shape attribute. 0782 * Afterwards, the shape falls back to the value of parent()->shape(). 0783 */ 0784 Q_INVOKABLE void unsetShape(); 0785 0786 // 0787 // size methods 0788 // 0789 public: 0790 /** 0791 * Get the 'inner sep'. 0792 * Default: 0.3333ex 0793 */ 0794 Q_INVOKABLE tikz::Value innerSep() const; 0795 0796 /** 0797 * Check whether the inner sep is set. 0798 */ 0799 Q_INVOKABLE bool innerSepSet() const; 0800 0801 /** 0802 * Get the 'outer sep'. 0803 * Default: 0.5 lineWidth() 0804 */ 0805 Q_INVOKABLE tikz::Value outerSep() const; 0806 0807 /** 0808 * Check whether the inner sep is set. 0809 */ 0810 Q_INVOKABLE bool outerSepSet() const; 0811 0812 public Q_SLOTS: 0813 /** 0814 * Set the 'inner sep' to @p sep. 0815 */ 0816 Q_INVOKABLE void setInnerSep(const tikz::Value & sep); 0817 0818 /** 0819 * Set the 'outer sep' to @p sep. 0820 */ 0821 Q_INVOKABLE void setOuterSep(const tikz::Value & sep); 0822 0823 /** 0824 * Unset the 'inner sep'. 0825 * Afterwards, the style falls back to the value of parent()->innerSep(). 0826 */ 0827 Q_INVOKABLE void unsetInnerSep(); 0828 0829 /** 0830 * Unset the 'outer sep'. 0831 * Afterwards, the style falls back to the value of parent()->outerSep(). 0832 */ 0833 Q_INVOKABLE void unsetOuterSep(); 0834 0835 // 0836 // minimum width & height 0837 // 0838 public: 0839 /** 0840 * Get the minimum height. 0841 * Initially unset, and the default value is 0 mm. 0842 */ 0843 Q_INVOKABLE tikz::Value minimumHeight() const; 0844 0845 /** 0846 * Check whether the minimum height is set. 0847 */ 0848 Q_INVOKABLE bool minimumHeightSet() const; 0849 0850 /** 0851 * Get the minimum width. 0852 * Initially unset, and the default value is 0 mm. 0853 */ 0854 Q_INVOKABLE tikz::Value minimumWidth() const; 0855 0856 /** 0857 * Check whether the minimum width is set. 0858 */ 0859 Q_INVOKABLE bool minimumWidthSet() const; 0860 0861 public Q_SLOTS: 0862 /** 0863 * Get the minimum height. 0864 * Initially unset, and the default value is 0 mm. 0865 */ 0866 Q_INVOKABLE void setMinimumHeight(const tikz::Value & height); 0867 0868 /** 0869 * Get the minimum width. 0870 * Initially unset, and the default value is 0 mm. 0871 */ 0872 Q_INVOKABLE void setMinimumWidth(const tikz::Value & width); 0873 0874 /** 0875 * Unset the minimum height. 0876 * Afterwards, the style falls back to the value of parent()->minimumHeight(). 0877 */ 0878 Q_INVOKABLE void unsetMinimumHeight(); 0879 0880 /** 0881 * Unset the minimum width. 0882 * Afterwards, the style falls back to the value of parent()->minimumWidth(). 0883 */ 0884 Q_INVOKABLE void unsetMinimumWidth(); 0885 0886 0887 // 0888 // internal to tikz::Document 0889 // 0890 protected: 0891 friend class Document; 0892 0893 /** 0894 * Associate this style with @p uid. 0895 */ 0896 Style(const Uid & uid); 0897 0898 private: 0899 std::unique_ptr<StylePrivate> const d; 0900 }; 0901 0902 } 0903 } 0904 0905 Q_DECLARE_METATYPE(tikz::core::Style*) 0906 0907 #endif // TIKZ_STYLE_H 0908 0909 // kate: indent-width 4; replace-tabs on;