kchart
KDFrame Class Reference#include <KDFrame.h>
List of all members.
Detailed Description
The main class of KDFrame.
KDFrame is made for highly configurable rectangular frame drawing.
A frame may consist of an (optional) border and/or an (optional) background. v200 This class is work in progress, at present only single line frame borders and (scaled/streched) background pictures are available. See KDChartParams::setSimpleFrame() to learn how to use them.
The border may consist of up to four edges and/or up to four border corners.
- Note:
- Each of the edges and each of the corners may use their own user-definable profile.
The frame corners ( see types defined in CornerStyle ) are set up via setCorner()
Some commonly used frame profiles (e.g. raised box, sunken panel) are predefined in SimpleFrame, see setSimpleFrame(). To learn how to specify your frame profiles have a look at example code given with setProfile()
Definition at line 87 of file KDFrame.h.
|
Public Types |
enum | BackPixmapMode { PixCentered,
PixScaled,
PixStretched
} |
enum | SimpleFrame {
FrameFlat,
FrameElegance,
FrameBoxRaized,
FrameBoxSunken,
FramePanelRaized,
FramePanelSunken,
FrameSemicircular
} |
enum | ProfileName { ProfileTop,
ProfileRight,
ProfileBottom,
ProfileLeft
} |
enum | CornerName {
CornerTopLeft,
CornerTopRight,
CornerBottomLeft,
CornerBottomRight,
CornerUNKNOWN
} |
enum | CornerStyle { CornerNormal,
CornerRound,
CornerOblique
} |
enum | KDFramePaintSteps {
PaintBackground,
PaintEdges,
PaintCorners,
PaintBorder,
PaintAll
} |
Public Slots |
static QString | backPixmapModeToString (BackPixmapMode type) |
static BackPixmapMode | stringToBackPixmapMode (const QString &string) |
void | setSimpleFrame (SimpleFrame frame, int lineWidth, int midLineWidth, QPen pen, QBrush background=QBrush(), const QPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched) |
void | clearProfile (ProfileName name) |
void | addProfileSection (ProfileName name, int wid, QPen pen, KDFrameProfileSection::Direction dir=KDFrameProfileSection::DirPlain, KDFrameProfileSection::Curvature curv=KDFrameProfileSection::CvtPlain) |
void | setProfile (ProfileName name, const KDFrameProfile &profile) |
const KDFrameProfile & | profile (ProfileName name) const |
static QString | cornerNameToString (CornerName type) |
static CornerName | stringToCornerName (const QString &string) |
static QString | cornerStyleToString (CornerStyle type) |
static CornerStyle | stringToCornerStyle (const QString &string) |
void | setCorner (CornerName name, CornerStyle style, int width, KDFrameProfile *const profile=0) |
void | setCorners (CornerStyle style, int width, KDFrameProfile *const profile=0) |
CornerStyle | cornerStyle (CornerName name) const |
int | cornerWidth (CornerName name) const |
const KDFrameProfile & | cornerProfile (CornerName name) const |
void | setSunPos (CornerName sunPos) |
CornerName | sunPos () const |
void | setBackground (QBrush background=QBrush(Qt::NoBrush)) |
void | setBackPixmap (const QPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched) |
const QBrush & | background (const QPixmap *&backPixmap, BackPixmapMode &backPixmapMode) const |
void | setInnerRect (QRect innerRect) |
QRect | innerRect () const |
virtual void | paintBackground (QPainter &painter, const QRect &innerRect) const |
virtual void | paintEdges (QPainter &painter, const QRect &innerRect) const |
virtual void | paintCorners (QPainter &painter, const QRect &innerRect) const |
virtual void | paint (QPainter *painter, KDFramePaintSteps steps=PaintAll, QRect innerRect=QRect(0, 0, 0, 0)) const |
void | clearAll () |
Signals |
void | changed () |
Public Member Functions |
| KDFrame (QRect innerRect=QRect(0, 0, 0, 0), SimpleFrame frame=FrameFlat, int lineWidth=1, int midLineWidth=0, QPen pen=QPen(), QBrush background=QBrush(), const QPixmap *backPixmap=0, BackPixmapMode backPixmapMode=PixStretched, int shadowWidth=0, CornerName sunPos=CornerTopLeft) |
virtual | ~KDFrame () |
Static Public Member Functions |
static void | deepCopy (KDFrame &D, const KDFrame &R) |
static void | createFrameNode (QDomDocument &document, QDomNode &parent, const QString &elementName, const KDFrame &frame) |
static void | createFrameProfileNode (QDomDocument &document, QDomNode &parent, const QString &elementName, KDFrameProfile profile) |
static bool | readFrameNode (const QDomElement &element, KDFrame &frame) |
static bool | readFrameProfileNode (const QDomElement &element, KDFrameProfile &profile) |
Friends |
QTextStream & | operator<< (QTextStream &s, const KDFrame &p) |
QTextStream & | operator>> (QTextStream &s, KDFrame &p) |
Classes |
class | KDFrameCorner |
Member Enumeration Documentation
|
These are ways how to display a pixmap that might be painted into the inner area.
- Note:
- To have a 'tiled' background image do not use a background pixmap but use a background brush holding this pixmap.
Definition at line 108 of file KDFrame.h. |
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 348 of file KDFrame.h. |
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 424 of file KDFrame.h. |
|
The different steps taken to paint the frame: first paint the background then the edges then the corners.
By choosing PaintAll all the parts of the frame will be drawn.
PaintBackground -- first paints the brush, then paints the pixmap if any
PaintEdges
PaintCorners
PaintBorder -- paint the edges and the corners but not the background
PaintAll
- See also:
- paint
Definition at line 842 of file KDFrame.h. |
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 240 of file KDFrame.h. |
|
These simple frames are pre-defined for your convenience.
FrameFlat a flat rectangular frame
FrameElegance a flat frame consisting of three lines
FrameBoxRaized a raised box
FrameBoxSunken a sunken box
FramePanelRaized a raised panel
FramePanelSunken a sunken panel
FrameSemicircular a raised box with round edges
All pre-defined frames have normal corners.
Definition at line 176 of file KDFrame.h. |
Constructor & Destructor Documentation
KDFrame::KDFrame |
( |
QRect |
innerRect = QRect(0,0,0,0) , |
|
|
SimpleFrame |
frame = FrameFlat , |
|
|
int |
lineWidth = 1 , |
|
|
int |
midLineWidth = 0 , |
|
|
QPen |
pen = QPen() , |
|
|
QBrush |
background = QBrush() , |
|
|
const QPixmap * |
backPixmap = 0 , |
|
|
BackPixmapMode |
backPixmapMode = PixStretched , |
|
|
int |
shadowWidth = 0 , |
|
|
CornerName |
sunPos = CornerTopLeft |
|
) |
[inline] |
|
|
Default Constructor.
Defines default values.
The constructor does *not* have a parent parameter since drawing of the frame is not done transparently but by (one or more) explicit calls of the frames paint() methode. See explanation given there to learn about the why and how of this...
- Note:
- The rectangle applies to the inner area of the frame. The Frame is drawn around this area: touching it but not covering it. The outer size of the frame and the position of its outer left corner depends from the frame profile width.
To have a 'tiled' background image do not specify a backPixmap but use a background brush holding this pixmap.
- See also:
- rect, setInnerRect, setProfile
Definition at line 916 of file KDFrame.h. |
KDFrame::~KDFrame |
( |
|
) |
[virtual] |
|
|
Destructor.
Only defined to have it virtual.
Definition at line 47 of file KDFrame.cpp. |
Member Function Documentation
const QBrush& KDFrame::background |
( |
const QPixmap *& |
backPixmap, |
|
|
BackPixmapMode & |
backPixmapMode |
|
) |
const [inline, slot] |
|
|
Returns the brush that is used to fill the inner area of this frame, or a QBrush( ) if no background is to be drawn.
- Parameters:
-
| backPixmap | receives the pixmap used for drawing the background or a null pixmap, test this by calling backPixmap.isNull() |
- Note:
- If a 'tiled' background image is shown the respective pixmap may be found by calling the brush's pixmap() function.
- See also:
- setBackground, setBackPixmap
Definition at line 762 of file KDFrame.h. |
static QString KDFrame::backPixmapModeToString |
( |
BackPixmapMode |
type |
) |
[inline, static, slot] |
|
|
Converts the specified background pixmap mode enum to a string representation.
- Parameters:
-
| type | the background pixmap mode to convert |
- Returns:
- the string representation of the background pixmap mode enum
Definition at line 119 of file KDFrame.h. |
void KDFrame::changed |
( |
|
) |
[signal] |
|
|
This signal is emitted when any of the frame parameters has changed.
|
void KDFrame::clearAll |
( |
|
) |
[inline, slot] |
|
|
Remove all settings and specify no border, no edges, no background.
Definition at line 878 of file KDFrame.h. |
static QString KDFrame::cornerNameToString |
( |
CornerName |
type |
) |
[inline, static, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 365 of file KDFrame.h. |
const KDFrameProfile& KDFrame::cornerProfile |
( |
CornerName |
name |
) |
const [inline, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 676 of file KDFrame.h. |
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 634 of file KDFrame.h. |
static QString KDFrame::cornerStyleToString |
( |
CornerStyle |
type |
) |
[inline, static, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 439 of file KDFrame.h. |
int KDFrame::cornerWidth |
( |
CornerName |
name |
) |
const [inline, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 655 of file KDFrame.h. |
void KDFrame::createFrameNode |
( |
QDomDocument & |
document, |
|
|
QDomNode & |
parent, |
|
|
const QString & |
elementName, |
|
|
const KDFrame & |
frame |
|
) |
[static] |
|
|
Creates a DOM element node that represents a frame for use in a DOM document.
- Parameters:
-
| document | the DOM document to which the node will belong |
| parent | the parent node to which the new node will be appended |
| elementName | the name of the new node |
| frame | the frame to be represented |
Definition at line 407 of file KDFrame.cpp. |
void KDFrame::createFrameProfileNode |
( |
QDomDocument & |
document, |
|
|
QDomNode & |
parent, |
|
|
const QString & |
elementName, |
|
|
KDFrameProfile |
profile |
|
) |
[static] |
|
|
Creates a DOM element node that represents a frame profile for use in a DOM document.
- Parameters:
-
| document | the DOM document to which the node will belong |
| parent | the parent node to which the new node will be appended |
| elementName | the name of the new node |
| profile | the profile to be represented |
Definition at line 445 of file KDFrame.cpp. |
QRect KDFrame::innerRect |
( |
|
) |
const [inline, slot] |
|
|
Returns the position and the size of the frame.
- Note:
- The rectangle returns to the inner area of the frame. The Frame is drawn around this area: touching it but not covering it. The outer size of the frame and the position of its outer left corner depends from the frame profile width.
- See also:
- setInnerRect, setProfile
Definition at line 796 of file KDFrame.h. |
void KDFrame::paint |
( |
QPainter * |
painter, |
|
|
KDFramePaintSteps |
steps = PaintAll , |
|
|
QRect |
innerRect = QRect(0, 0, 0, 0) |
|
) |
const [virtual, slot] |
|
|
Paint methode actually drawing the frame.
This method must be called from inside the paint() methode of your widget.
In order not to override the inner contents of the frame you normally would first call paint( painter, PaintBackground ); then do all the inside drawing and finally call paint( painter, PaintBorder );. In case the inner contents are allowed to (partially) override the frame border you could do the following: First call paint( painter, PaintBackground ); immediately followed by paint( painter, PaintEdges ); then do all your inside work and finally draw paint( painter, PaintCorners );.
- Parameters:
-
| painter | The QPainter to be used for drawing. |
| steps | The part of the frame to be drawn, use KDFrame::PaintAll to draw the entire frame and the background, use KDFrame::PaintBackground to draw only the background, use KDFrame::PaintEdges to draw just the edges, use KDFrame::PaintCorners to draw only the corners. |
| innerRect | The area inside the frame. Use this parameter to temporarily override the innerRect set by the constructor of KDFrame or by setInnerRect(). This approach can be usefull if you want to draw several frames that differ only regarding to their position and size but share the same edges/corners/background settings. In this case you could decide to instantiate only one KDFrame set up the desired settings and just call its paint() methode several time - giving it the appropriate innerRect for each frame. This would result in less memory usage since you could use that single KDFrame object as kind of a shared ressource. |
Definition at line 156 of file KDFrame.cpp. |
void KDFrame::paintBackground |
( |
QPainter & |
painter, |
|
|
const QRect & |
innerRect |
|
) |
const [virtual, slot] |
|
|
Paint methode drawing the background (if any) of the frame.
- Note:
- Under normal circumstances you will never have to call this methode since it is called internally by paint() if you start it with
PaintBackground (or with PaintAll , resp.) for the steps parameter.
Definition at line 61 of file KDFrame.cpp. |
void KDFrame::paintCorners |
( |
QPainter & |
painter, |
|
|
const QRect & |
innerRect |
|
) |
const [virtual, slot] |
|
|
Paint methode drawing the corners (if any) of the frame.
- Note:
- Under normal circumstances you will never have to call this methode since it is called internally by paint() if you start it with
PaintCorners (or with PaintAll , PaintBorder , resp.) for the steps parameter.
Definition at line 147 of file KDFrame.cpp. |
void KDFrame::paintEdges |
( |
QPainter & |
painter, |
|
|
const QRect & |
innerRect |
|
) |
const [virtual, slot] |
|
|
Paint methode drawing the edges (if any) of the frame.
- Note:
- Under normal circumstances you will never have to call this methode since it is called internally by paint() if you start it with
PaintEdges (or with PaintAll , PaintBorder , resp.) for the steps parameter.
Definition at line 112 of file KDFrame.cpp. |
const KDFrameProfile & KDFrame::profile |
( |
ProfileName |
name |
) |
const [slot] |
|
bool KDFrame::readFrameNode |
( |
const QDomElement & |
element, |
|
|
KDFrame & |
frame |
|
) |
[static] |
|
|
Reads data from a DOM element node that represents a frame object and fills a KDFrame object with the data.
- Parameters:
-
| element | the DOM element to read from |
| frame | the frame object to read the data into |
Definition at line 475 of file KDFrame.cpp. |
bool KDFrame::readFrameProfileNode |
( |
const QDomElement & |
element, |
|
|
KDFrameProfile & |
profile |
|
) |
[static] |
|
|
Reads data from a DOM element node that represents a frame profile and fills a KDFrameProfile object with the data.
- Parameters:
-
| element | the DOM element to read from |
| profile | the frame profile object to read the data into |
Definition at line 556 of file KDFrame.cpp. |
void KDFrame::setBackground |
( |
QBrush |
background = QBrush( Qt::NoBrush ) |
) |
[inline, slot] |
|
|
Specifies the brush to be used to fill the inner area of this frame, calling this methode without passing in a parameter re-sets the background brush to QBrush ( NoBrush ).
- Note:
- To have a 'tiled' background image just use a brush holding this pixmap - for other ways to show background images please use setBackPixmap.
- See also:
- setBackPixmap, background
Definition at line 729 of file KDFrame.h. |
void KDFrame::setBackPixmap |
( |
const QPixmap * |
backPixmap = 0 , |
|
|
BackPixmapMode |
backPixmapMode = PixStretched |
|
) |
[inline, slot] |
|
|
Specifies a pixmap to be used to fill the inner area of this frame, calling this methode without passing in a parameter removes the background pixmap.
- Note:
- To have a 'tiled' background image do not use setBackPixmap but use setBackground specifying a brush holding the pixmap.
- See also:
- setBackground, background
Definition at line 743 of file KDFrame.h. |
void KDFrame::setCorner |
( |
CornerName |
name, |
|
|
CornerStyle |
style, |
|
|
int |
width, |
|
|
KDFrameProfile *const |
profile = 0 |
|
) |
[inline, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 585 of file KDFrame.h. |
void KDFrame::setCorners |
( |
CornerStyle |
style, |
|
|
int |
width, |
|
|
KDFrameProfile *const |
profile = 0 |
|
) |
[inline, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 614 of file KDFrame.h. |
void KDFrame::setInnerRect |
( |
QRect |
innerRect |
) |
[inline, slot] |
|
|
Specifies the position and the size of area that is surrounded by the frame.
- Note:
- The rectangle applies to the inner area of the frame. The Frame is drawn around this area: touching it but not covering it. The outer size of the frame and the position of its outer left corner depends from the frame profile width(s).
- See also:
- innerRect, setCorners, setSimpleFrame, setProfile
Definition at line 781 of file KDFrame.h. |
void KDFrame::setProfile |
( |
ProfileName |
name, |
|
|
const KDFrameProfile & |
profile |
|
) |
[slot] |
|
void KDFrame::setSimpleFrame |
( |
SimpleFrame |
frame, |
|
|
int |
lineWidth, |
|
|
int |
midLineWidth, |
|
|
QPen |
pen, |
|
|
QBrush |
background = QBrush() , |
|
|
const QPixmap * |
backPixmap = 0 , |
|
|
BackPixmapMode |
backPixmapMode = PixStretched |
|
) |
[slot] |
|
void KDFrame::setSunPos |
( |
CornerName |
sunPos |
) |
[inline, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 698 of file KDFrame.h. |
static BackPixmapMode KDFrame::stringToBackPixmapMode |
( |
const QString & |
string |
) |
[inline, static, slot] |
|
|
Converts the specified string to a background pixmap mode enum value.
- Parameters:
-
| string | the string to convert |
- Returns:
- the background pixmap mode enum value
Definition at line 139 of file KDFrame.h. |
static CornerName KDFrame::stringToCornerName |
( |
const QString & |
string |
) |
[inline, static, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 393 of file KDFrame.h. |
static CornerStyle KDFrame::stringToCornerStyle |
( |
const QString & |
string |
) |
[inline, static, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 463 of file KDFrame.h. |
CornerName KDFrame::sunPos |
( |
|
) |
const [inline, slot] |
|
|
- Deprecated:
- Feature scheduled for future release, at present not implemented.
Definition at line 712 of file KDFrame.h. |
Friends And Related Function Documentation
QTextStream& operator<< |
( |
QTextStream & |
s, |
|
|
const KDFrame & |
p |
|
) |
[friend] |
|
|
Writes the KDFrame object p as an XML document to the text stream s.
- Parameters:
-
| s | the text stream to write to |
| p | the KDFrame object to write |
- Returns:
- the text stream after the write operation
|
QTextStream& operator>> |
( |
QTextStream & |
s, |
|
|
KDFrame & |
p |
|
) |
[friend] |
|
|
Reads the an XML document from the text stream s into the KDFrame object p.
- Parameters:
-
| s | the text stream to read from |
| p | the KDFrame object to read into |
- Returns:
- the text stream after the read operation
|
The documentation for this class was generated from the following files:
|