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

kalarm/lib

  • sources
  • kde-4.14
  • kdepim
  • kalarm
  • lib
spinbox2_p.h
Go to the documentation of this file.
1 /*
2  * spinbox2_p.h - private classes for SpinBox2
3  * Program: kalarm
4  * Copyright © 2005,2006,2008 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef SPINBOX2_P_H
22 #define SPINBOX2_P_H
23 
24 #include "spinbox.h"
25 
26 #include <QGraphicsView>
27 
28 class QMouseEvent;
29 class QPaintEvent;
30 
31 
32 /*=============================================================================
33 = Class ExtraSpinBox
34 * Extra pair of spin buttons for SpinBox2.
35 * The widget is actually a whole spin box, but only the buttons are displayed.
36 =============================================================================*/
37 
38 class ExtraSpinBox : public SpinBox
39 {
40  Q_OBJECT
41  public:
42  explicit ExtraSpinBox(QWidget* parent)
43  : SpinBox(parent), mInhibitPaintSignal(0) { }
44  ExtraSpinBox(int minValue, int maxValue, QWidget* parent)
45  : SpinBox(minValue, maxValue, parent), mInhibitPaintSignal(0) { }
46  void inhibitPaintSignal(int i) { mInhibitPaintSignal = i; }
47 
48  signals:
49  void painted();
50 
51  protected:
52  virtual void paintEvent(QPaintEvent*);
53 
54  private:
55  int mInhibitPaintSignal;
56 };
57 
58 
59 /*=============================================================================
60 = Class SpinMirror
61 * Displays the left-to-right mirror image of a pair of spin buttons, for use
62 * as the extra spin buttons in a SpinBox2. All mouse clicks are passed on to
63 * the real extra pair of spin buttons for processing.
64 * Mirroring in this way allows styles with rounded corners to display correctly.
65 =============================================================================*/
66 
67 class SpinMirror : public QGraphicsView
68 {
69  Q_OBJECT
70  public:
71  explicit SpinMirror(ExtraSpinBox*, SpinBox*, QWidget* parent = 0);
72  void setReadOnly(bool ro) { mReadOnly = ro; }
73  bool isReadOnly() const { return mReadOnly; }
74  void setButtons();
75  void setFrame();
76  void setButtonPos(const QPoint&);
77 
78  protected:
79  virtual bool event(QEvent*);
80  virtual void resizeEvent(QResizeEvent*);
81  virtual void styleChange(QStyle&);
82  virtual void mousePressEvent(QMouseEvent* e) { mouseEvent(e); }
83  virtual void mouseReleaseEvent(QMouseEvent* e) { mouseEvent(e); }
84  virtual void mouseMoveEvent(QMouseEvent* e) { mouseEvent(e); }
85  virtual void mouseDoubleClickEvent(QMouseEvent* e) { mouseEvent(e); }
86  virtual void wheelEvent(QWheelEvent*);
87 
88  private:
89  void mouseEvent(QMouseEvent*);
90  void setMirroredState(bool clear = false);
91  QPoint spinboxPoint(const QPoint&) const;
92 
93  ExtraSpinBox* mSpinbox; // spinbox whose spin buttons are being mirrored
94  SpinBox* mMainSpinbox;
95  QGraphicsPixmapItem* mButtons; // image of spin butttons
96  bool mReadOnly; // value cannot be changed
97  bool mMirrored; // mirror left-to-right
98 };
99 
100 #endif // SPINBOX2_P_H
101 
102 // vim: et sw=4:
SpinMirror::setButtons
void setButtons()
Definition: spinbox2.cpp:612
SpinMirror::setReadOnly
void setReadOnly(bool ro)
Definition: spinbox2_p.h:72
ExtraSpinBox::ExtraSpinBox
ExtraSpinBox(int minValue, int maxValue, QWidget *parent)
Definition: spinbox2_p.h:44
QEvent
QResizeEvent
QWidget
ExtraSpinBox::paintEvent
virtual void paintEvent(QPaintEvent *)
Definition: spinbox2.cpp:518
SpinMirror
Definition: spinbox2_p.h:67
ExtraSpinBox::inhibitPaintSignal
void inhibitPaintSignal(int i)
Definition: spinbox2_p.h:46
SpinMirror::setFrame
void setFrame()
Definition: spinbox2.cpp:561
QSpinBox::minValue
int minValue() const
SpinMirror::mouseMoveEvent
virtual void mouseMoveEvent(QMouseEvent *e)
Definition: spinbox2_p.h:84
QWheelEvent
QGraphicsPixmapItem
QPoint
QMouseEvent
SpinMirror::event
virtual bool event(QEvent *)
Definition: spinbox2.cpp:711
SpinMirror::styleChange
virtual void styleChange(QStyle &)
Definition: spinbox2.cpp:654
ExtraSpinBox::painted
void painted()
QStyle
ExtraSpinBox::ExtraSpinBox
ExtraSpinBox(QWidget *parent)
Definition: spinbox2_p.h:42
SpinMirror::wheelEvent
virtual void wheelEvent(QWheelEvent *)
Definition: spinbox2.cpp:681
SpinMirror::isReadOnly
bool isReadOnly() const
Definition: spinbox2_p.h:73
SpinMirror::setButtonPos
void setButtonPos(const QPoint &)
Definition: spinbox2.cpp:632
SpinBox
Spin box with accelerated shift key stepping and read-only option.
Definition: spinbox.h:44
QSpinBox::maxValue
int maxValue() const
QPaintEvent
SpinMirror::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QMouseEvent *e)
Definition: spinbox2_p.h:85
SpinMirror::mousePressEvent
virtual void mousePressEvent(QMouseEvent *e)
Definition: spinbox2_p.h:82
SpinMirror::SpinMirror
SpinMirror(ExtraSpinBox *, SpinBox *, QWidget *parent=0)
Definition: spinbox2.cpp:532
QObject::parent
QObject * parent() const
ExtraSpinBox
Definition: spinbox2_p.h:38
spinbox.h
QGraphicsView
SpinMirror::resizeEvent
virtual void resizeEvent(QResizeEvent *)
Definition: spinbox2.cpp:647
SpinMirror::mouseReleaseEvent
virtual void mouseReleaseEvent(QMouseEvent *e)
Definition: spinbox2_p.h:83
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:35:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm/lib

Skip menu "kalarm/lib"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer
  • pimprint

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