From 460c52653ab0dcca6f19a4f492ed2c5e4e963ab0 Mon Sep 17 00:00:00 2001 From: toma Date: Wed, 25 Nov 2009 17:56:58 +0000 Subject: Copy the KDE 3.5 branch to branches/trinity for new KDE 3.5 features. BUG:215923 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdepim@1054174 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- kalarm/lib/buttongroup.h | 90 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 kalarm/lib/buttongroup.h (limited to 'kalarm/lib/buttongroup.h') diff --git a/kalarm/lib/buttongroup.h b/kalarm/lib/buttongroup.h new file mode 100644 index 000000000..1d647b420 --- /dev/null +++ b/kalarm/lib/buttongroup.h @@ -0,0 +1,90 @@ +/* + * buttongroup.h - QButtonGroup with an extra signal and Qt 2 compatibility + * Program: kalarm + * Copyright © 2002,2004,2006 by David Jarvie + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +#ifndef BUTTONGROUP_H +#define BUTTONGROUP_H + +#include + + +/** + * @short A QButtonGroup with signal on new selection, plus Qt 2 compatibility. + * + * The ButtonGroup class provides an enhanced version of the QButtonGroup class. + * + * It emits an additional signal, buttonSet(int), whenever any of its buttons + * changes state, for whatever reason, including programmatic control. (The + * QButtonGroup class only emits signals when buttons are clicked on by the user.) + * The class also provides Qt 2 compatibility. + * + * @author David Jarvie + */ +class ButtonGroup : public QButtonGroup +{ + Q_OBJECT + public: + /** Constructor. + * @param parent The parent object of this widget. + * @param name The name of this widget. + */ + explicit ButtonGroup(QWidget* parent, const char* name = 0); + /** Constructor. + * @param title The title displayed for this button group. + * @param parent The parent object of this widget. + * @param name The name of this widget. + */ + ButtonGroup(const QString& title, QWidget* parent, const char* name = 0); + /** Constructor. + * @param strips The number of rows or columns of buttons. + * @param orient The orientation (Qt::Horizontal or Qt::Vertical) of the button group. + * @param parent The parent object of this widget. + * @param name The name of this widget. + */ + ButtonGroup(int strips, Qt::Orientation orient, QWidget* parent, const char* name = 0); + /** Constructor. + * @param strips The number of rows or columns of buttons. + * @param orient The orientation (Qt::Horizontal or Qt::Vertical) of the button group. + * @param title The title displayed for this button group. + * @param parent The parent object of this widget. + * @param name The name of this widget. + */ + ButtonGroup(int strips, Qt::Orientation orient, const QString& title, QWidget* parent, const char* name = 0); + /** Inserts a button in the group. + * This overrides the insert() method of QButtonGroup, which should really be a virtual method... + * @param button The button to insert. + * @param id The identifier for the button. + * @return The identifier of the inserted button. + */ + int insert(QButton* button, int id = -1); + /** Sets the button with the specified identifier to be on. If this is an exclusive group, + * all other buttons in the group will be set off. The buttonSet() signal is emitted. + * @param id The identifier of the button to set on. + */ + virtual void setButton(int id) { QButtonGroup::setButton(id); emit buttonSet(id); } + private slots: + void slotButtonToggled(bool); + signals: + /** Signal emitted whenever whenever any button in the group changes state, + * for whatever reason. + * @param id The identifier of the button which is now selected. + */ + void buttonSet(int id); +}; + +#endif // BUTTONGROUP_H -- cgit v1.2.1