• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • graphicsview
FrameGraphicsItem_p.h
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Bastian Holst <bastianholst@gmx.de>
9 //
10 
11 #ifndef MARBLE_FRAMEGRAPHICSITEMPRIVATE_H
12 #define MARBLE_FRAMEGRAPHICSITEMPRIVATE_H
13 
14 // Marble
15 #include "FrameGraphicsItem.h"
16 
17 // Qt
18 #include<QDebug>
19 #include<QBrush>
20 #include<QPixmapCache>
21 
22 namespace Marble
23 {
24 
25 class FrameGraphicsItemPrivate
26 {
27  public:
28  explicit FrameGraphicsItemPrivate( FrameGraphicsItem *parent )
29  : m_frame( FrameGraphicsItem::NoFrame ),
30  m_contentSize( 0.0, 0.0 ),
31  m_margin( 0.0 ),
32  m_marginTop( 0.0 ),
33  m_marginBottom( 0.0 ),
34  m_marginLeft( 0.0 ),
35  m_marginRight( 0.0 ),
36  m_padding( 0.0 ),
37  m_borderWidth( 1.0 ),
38  m_borderBrush( QBrush( Qt::black ) ),
39  m_borderStyle( Qt::SolidLine ),
40  m_backgroundBrush( QBrush( QColor( 192, 192, 192, 192 ) ) ),
41  m_parent( parent )
42  {
43  updateSize();
44  }
45 
46  void updateSize()
47  {
48  qreal const border2 = 0.5 * m_borderWidth;
49  qreal marginTop = qMax( border2, ( m_marginTop == 0.0 ) ? m_margin : m_marginTop );
50  qreal marginBottom = qMax( border2, ( m_marginBottom == 0.0 ) ? m_margin : m_marginBottom );
51  qreal marginLeft = qMax( border2, ( m_marginLeft == 0.0 ) ? m_margin : m_marginLeft );
52  qreal marginRight = qMax( border2, ( m_marginRight == 0.0 ) ? m_margin : m_marginRight );
53 
54  QSizeF totalSize = m_contentSize;
55  totalSize += QSizeF( marginLeft + marginRight, marginTop + marginBottom );
56  totalSize += QSizeF( m_padding * 2, m_padding * 2 );
57 
58  m_parent->setSize( totalSize );
59  }
60 
61  FrameGraphicsItem::FrameType m_frame;
62  QSizeF m_contentSize;
63 
64  // Margin
65  qreal m_margin;
66  qreal m_marginTop;
67  qreal m_marginBottom;
68  qreal m_marginLeft;
69  qreal m_marginRight;
70  // Padding
71  qreal m_padding;
72 
73  // Background/Border painting
74  qreal m_borderWidth;
75  QBrush m_borderBrush;
76  Qt::PenStyle m_borderStyle;
77  QBrush m_backgroundBrush;
78 
79  FrameGraphicsItem * const m_parent;
80 };
81 
82 } // namespace Marble
83 
84 #endif
Marble::FrameGraphicsItem
Definition: FrameGraphicsItem.h:25
Marble::FrameGraphicsItemPrivate::m_parent
FrameGraphicsItem *const m_parent
Definition: FrameGraphicsItem_p.h:79
Marble::FrameGraphicsItemPrivate
Definition: FrameGraphicsItem_p.h:25
Marble::MarbleGraphicsItem::setSize
void setSize(const QSizeF &size)
Set the size of the item.
Definition: MarbleGraphicsItem.cpp:197
Marble::FrameGraphicsItemPrivate::m_marginTop
qreal m_marginTop
Definition: FrameGraphicsItem_p.h:66
Marble::FrameGraphicsItemPrivate::m_marginBottom
qreal m_marginBottom
Definition: FrameGraphicsItem_p.h:67
Marble::FrameGraphicsItemPrivate::m_marginLeft
qreal m_marginLeft
Definition: FrameGraphicsItem_p.h:68
Marble::FrameGraphicsItemPrivate::m_borderBrush
QBrush m_borderBrush
Definition: FrameGraphicsItem_p.h:75
FrameGraphicsItem.h
Marble::FrameGraphicsItemPrivate::m_marginRight
qreal m_marginRight
Definition: FrameGraphicsItem_p.h:69
Marble::FrameGraphicsItemPrivate::m_contentSize
QSizeF m_contentSize
Definition: FrameGraphicsItem_p.h:62
Marble::FrameGraphicsItemPrivate::FrameGraphicsItemPrivate
FrameGraphicsItemPrivate(FrameGraphicsItem *parent)
Definition: FrameGraphicsItem_p.h:28
Marble::FrameGraphicsItem::FrameType
FrameType
Definition: FrameGraphicsItem.h:28
Marble::FrameGraphicsItemPrivate::m_margin
qreal m_margin
Definition: FrameGraphicsItem_p.h:65
Marble::FrameGraphicsItemPrivate::m_backgroundBrush
QBrush m_backgroundBrush
Definition: FrameGraphicsItem_p.h:77
Marble::FrameGraphicsItemPrivate::m_borderWidth
qreal m_borderWidth
Definition: FrameGraphicsItem_p.h:74
Marble::FrameGraphicsItemPrivate::m_borderStyle
Qt::PenStyle m_borderStyle
Definition: FrameGraphicsItem_p.h:76
Marble::FrameGraphicsItemPrivate::updateSize
void updateSize()
Definition: FrameGraphicsItem_p.h:46
Marble::FrameGraphicsItemPrivate::m_padding
qreal m_padding
Definition: FrameGraphicsItem_p.h:71
Marble::FrameGraphicsItemPrivate::m_frame
FrameGraphicsItem::FrameType m_frame
Definition: FrameGraphicsItem_p.h:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:49 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal