Plasma
spinbox.h
Go to the documentation of this file.
00001 /* 00002 * Copyright 2008 Aaron Seigo <aseigo@kde.org> 00003 * Copyright 2009 Davide Bettio <davide.bettio@kdemail.net> 00004 * 00005 * This program is free software; you can redistribute it and/or modify 00006 * it under the terms of the GNU Library General Public License as 00007 * published by the Free Software Foundation; either version 2, or 00008 * (at your option) any later version. 00009 * 00010 * This program is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 * GNU General Public License for more details 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this program; if not, write to the 00017 * Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 00019 */ 00020 00021 #ifndef PLASMA_SPINBOX_H 00022 #define PLASMA_SPINBOX_H 00023 00024 #include <QtGui/QGraphicsProxyWidget> 00025 00026 #include <plasma/plasma_export.h> 00027 00028 class KIntSpinBox; 00029 00030 namespace Plasma 00031 { 00032 00033 class SpinBoxPrivate; 00034 00040 class PLASMA_EXPORT SpinBox : public QGraphicsProxyWidget 00041 { 00042 Q_OBJECT 00043 00044 Q_PROPERTY(QGraphicsWidget *parentWidget READ parentWidget) 00045 Q_PROPERTY(int maximum READ maximum WRITE setMinimum) 00046 Q_PROPERTY(int minimum READ minimum WRITE setMinimum) 00047 Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) 00048 Q_PROPERTY(QString styleSheet READ styleSheet WRITE setStyleSheet) 00049 Q_PROPERTY(KIntSpinBox *nativeWidget READ nativeWidget) 00050 00051 public: 00052 explicit SpinBox(QGraphicsWidget *parent = 0); 00053 ~SpinBox(); 00054 00058 int maximum() const; 00059 00063 int minimum() const; 00064 00068 int value() const; 00069 00075 void setStyleSheet(const QString &stylesheet); 00076 00080 QString styleSheet(); 00081 00085 KIntSpinBox *nativeWidget() const; 00086 00087 protected: 00088 void changeEvent(QEvent *event); 00089 void hoverEnterEvent(QGraphicsSceneHoverEvent *event); 00090 void hoverLeaveEvent(QGraphicsSceneHoverEvent *event); 00091 void resizeEvent(QGraphicsSceneResizeEvent *event); 00092 void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget); 00093 void mousePressEvent(QGraphicsSceneMouseEvent *event); 00094 void focusOutEvent(QFocusEvent *event); 00095 00096 public Q_SLOTS: 00100 void setMaximum(int maximum); 00101 00105 void setMinimum(int minimum); 00106 00110 void setRange(int minimum, int maximum); 00111 00118 void setValue(int value); 00119 00120 Q_SIGNALS: 00128 void sliderMoved(int value); 00129 00134 void valueChanged(int value); 00135 00140 void editingFinished(); 00141 00142 private: 00143 Q_PRIVATE_SLOT(d, void setPalette()) 00144 00145 SpinBoxPrivate * const d; 00146 }; 00147 00148 } // namespace Plasma 00149 00150 #endif // multiple inclusion guard
KDE 4.6 API Reference