• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeplasma-addons API Reference
  • KDE Home
  • Contact Us
 

liblancelot

  • sources
  • kde-4.12
  • kdeplasma-addons
  • libs
  • lancelot
  • widgets
BasicWidget.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2007, 2008, 2009, 2010 Ivan Cukic <ivan.cukic(at)kde.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser/Library General Public License version 2,
6  * or (at your option) any later version, as published by the Free
7  * Software Foundation
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser/Library General Public License for more details
13  *
14  * You should have received a copy of the GNU Lesser/Library General Public
15  * License along with this program; if not, write to the
16  * Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef LANCELOT_BASIC_WIDGET_H
21 #define LANCELOT_BASIC_WIDGET_H
22 
23 #include <QtGui/QGraphicsScene>
24 #include <QtGui/QIcon>
25 
26 #include <Plasma/Svg>
27 
28 #include <lancelot/lancelot.h>
29 #include <lancelot/lancelot_export.h>
30 #include <lancelot/widgets/Widget.h>
31 
32 namespace Lancelot
33 {
34 
44 class LANCELOT_EXPORT BasicWidget: public Lancelot::Widget {
45  Q_OBJECT
46 
47  Q_PROPERTY ( QIcon icon READ icon WRITE setIcon )
48  Q_PROPERTY ( QSize iconSize READ iconSize WRITE setIconSize )
49  Q_PROPERTY ( QString title READ title WRITE setTitle ) L_EXTRA ( i18n )
50  Q_PROPERTY ( QString description READ description WRITE setDescription ) L_EXTRA ( i18n )
51  Q_PROPERTY ( Qt::Orientation innerOrientation READ innerOrientation WRITE setInnerOrientation )
52 
53  // @puck L_WIDGET
54  // @puck L_INCLUDE(lancelot/widgets/TabBar.h QIcon QSize QString)
55 
56 public:
61  BasicWidget(QGraphicsItem * parent = 0);
62 
69  explicit BasicWidget(QString title, QString description = QString(),
70  QGraphicsItem * parent = 0);
71 
79  explicit BasicWidget(QIcon icon, QString title = QString(),
80  QString description = QString(), QGraphicsItem * parent = 0);
81 
89  explicit BasicWidget(const Plasma::Svg & icon, QString title = QString(),
90  QString description = QString(), QGraphicsItem * parent = 0);
91 
95  virtual ~BasicWidget();
96 
100  QIcon icon() const;
101 
106  void setIcon(QIcon icon);
107 
111  Plasma::Svg & iconInSvg() const;
112 
117  void setIconInSvg(const Plasma::Svg & svg);
118 
122  QSize iconSize() const;
123 
128  void setIconSize(QSize size);
129 
133  Qt::Orientation innerOrientation() const;
134 
139  void setInnerOrientation(Qt::Orientation orientation);
140 
144  Qt::Alignment alignment() const;
145 
150  void setAlignment(Qt::Alignment alignment);
151 
155  QString title() const;
156 
161  void setTitle(const QString & title);
162 
166  QString description() const;
167 
172  void setDescription(const QString & description);
173 
177  virtual void setShortcutKey(const QString & key);
178 
179 protected:
184  void paintForeground(QPainter * painter);
185 
190  void drawText(QPainter * painter, const QRectF & rectangle, int flags,
191  const QString & text, bool shortcutEnabled);
192 
193  L_Override void paint(QPainter * painter,
194  const QStyleOptionGraphicsItem * option, QWidget * widget = 0);
195  L_Override QSizeF sizeHint(Qt::SizeHint which,
196  const QSizeF & constraint = QSizeF()) const;
197 
198 private:
199  class Private;
200  Private * const d;
201 };
202 
203 } // namespace Lancelot
204 
205 #endif /* LANCELOT_BASIC_WIDGET_H */
206 
Lancelot::BasicWidget
Provides a common appearance with an icon, title and a description.
Definition: BasicWidget.h:44
L_Override
#define L_Override
Definition: lancelot_export.h:41
lancelot_export.h
Lancelot::Widget
Base class for Widgets that want to use Lancelot framework.
Definition: Widget.h:37
LANCELOT_EXPORT
#define LANCELOT_EXPORT
Definition: lancelot_export.h:32
L_EXTRA
#define L_EXTRA(A)
Definition: lancelot_export.h:47
Widget.h
lancelot.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Mon Oct 13 2014 22:55:07 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

liblancelot

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

kdeplasma-addons API Reference

Skip menu "kdeplasma-addons API Reference"
  •     GroupingDesktop
  •   liblancelot

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