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

KDEUI

  • sources
  • kde-4.14
  • kdelibs
  • kdeui
  • widgets
kselector.h
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 1997 Martin Jones (mjones@kde.org)
3 
4  This library is free software; you can redistribute it and/or
5  modify it under the terms of the GNU Library General Public
6  License as published by the Free Software Foundation; either
7  version 2 of the License, or (at your option) any later version.
8 
9  This library 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 GNU
12  Library General Public License for more details.
13 
14  You should have received a copy of the GNU Library General Public License
15  along with this library; see the file COPYING.LIB. If not, write to
16  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  Boston, MA 02110-1301, USA.
18 */
19 //-----------------------------------------------------------------------------
20 // Selector widgets for KDE Color Selector, but probably useful for other
21 // stuff also.
22 
23 #ifndef KSELECTOR_H
24 #define KSELECTOR_H
25 
26 #include <kdeui_export.h>
27 
28 #include <QtGui/QAbstractSlider>
29 #include <QtGui/QGradient>
30 #include <QtGui/QWidget>
31 
41 class KDEUI_EXPORT KSelector : public QAbstractSlider
42 {
43  Q_OBJECT
44  Q_PROPERTY( int value READ value WRITE setValue )
45  Q_PROPERTY( int minValue READ minimum WRITE setMinimum )
46  Q_PROPERTY( int maxValue READ maximum WRITE setMaximum )
47  Q_PROPERTY( bool indent READ indent WRITE setIndent )
48  Q_PROPERTY( Qt::ArrowType arrowDirection READ arrowDirection WRITE setArrowDirection )
49 public:
50 
54  explicit KSelector( QWidget *parent=0 );
59  explicit KSelector( Qt::Orientation o, QWidget *parent = 0 );
60  /*
61  * Destructs the widget.
62  */
63  ~KSelector();
64 
68  QRect contentsRect() const;
69 
74  void setIndent( bool i );
75 
79  bool indent() const;
80 
84  void setArrowDirection( Qt::ArrowType direction );
85 
89  Qt::ArrowType arrowDirection() const;
90 
91 protected:
98  virtual void drawContents( QPainter * );
103  virtual void drawArrow( QPainter *painter, const QPoint &pos );
104 
105  virtual void paintEvent( QPaintEvent * );
106  virtual void mousePressEvent( QMouseEvent *e );
107  virtual void mouseMoveEvent( QMouseEvent *e );
108  virtual void mouseReleaseEvent( QMouseEvent *e );
109  virtual void wheelEvent( QWheelEvent * );
110 
111 private:
112  QPoint calcArrowPos( int val );
113  void moveArrow( const QPoint &pos );
114 
115 private:
116  class Private;
117  friend class Private;
118  Private * const d;
119 
120  Q_DISABLE_COPY(KSelector)
121 };
122 
123 
132 class KDEUI_EXPORT KGradientSelector : public KSelector
133 {
134  Q_OBJECT
135 
136  Q_PROPERTY( QColor firstColor READ firstColor WRITE setFirstColor )
137  Q_PROPERTY( QColor secondColor READ secondColor WRITE setSecondColor )
138  Q_PROPERTY( QString firstText READ firstText WRITE setFirstText )
139  Q_PROPERTY( QString secondText READ secondText WRITE setSecondText )
140 
141 public:
146  explicit KGradientSelector( QWidget *parent=0 );
151  explicit KGradientSelector( Qt::Orientation o, QWidget *parent=0 );
155  ~KGradientSelector();
156 
162  void setStops(const QGradientStops &stops);
163 
168  QGradientStops stops() const;
169 
173  void setColors( const QColor &col1, const QColor &col2 );
174  void setText( const QString &t1, const QString &t2 );
175 
179  void setFirstColor( const QColor &col );
180  void setSecondColor( const QColor &col );
181 
185  void setFirstText( const QString &t );
186  void setSecondText( const QString &t );
187 
188  QColor firstColor() const;
189  QColor secondColor() const;
190 
191  QString firstText() const;
192  QString secondText() const;
193 
194 protected:
195 
196  virtual void drawContents( QPainter * );
197  virtual QSize minimumSize() const;
198 
199 private:
200  class KGradientSelectorPrivate;
201  friend class KGradientSelectorPrivate;
202  KGradientSelectorPrivate * const d;
203 
204  Q_DISABLE_COPY(KGradientSelector)
205 };
206 
207 #endif // KSELECTOR_H
QWidget
QWheelEvent
QPoint
QMouseEvent
QRect
QPainter
QString
QColor
QAbstractSlider
KGradientSelector
The KGradientSelector widget allows the user to choose from a one-dimensional range of colors which i...
Definition: kselector.h:132
QSize
kdeui_export.h
QPaintEvent
KSelector
KSelector is the base class for other widgets which provides the ability to choose from a one-dimensi...
Definition: kselector.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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