KWidgetLister Class Reference
Widget that manages a list of other widgets (incl. 'more', 'fewer' and 'clear' buttons). More...
#include <kwidgetlister.h>
Inherits QWidget.
Inherited by ActionEditWidget, and ConditionEditWidget.
Signals
- void widgetAdded ()
- void widgetAdded (QWidget *)
- void widgetRemoved ()
- void clearWidgets ()
Public Member Functions
Protected Slots
Protected Member Functions
- virtual void addWidgetAtEnd (QWidget *w=0)
- virtual void removeLastWidget ()
- virtual void clearWidget (QWidget *)
- virtual QWidget * createWidget (QWidget *parent)
- virtual void setNumberOfShownWidgetsTo (int aNum)
Protected Attributes
- QPtrList< QWidget > mWidgetList
- int mMinWidgets
- int mMaxWidgets
Detailed Description
Widget that manages a list of other widgets (incl. 'more', 'fewer' and 'clear' buttons).Simple widget that nonetheless does a lot of the dirty work for the filter edit widgets (KMSearchPatternEdit and KMFilterActionEdit). It provides a growable and shrinkable area where widget may be displayed in rows. Widgets can be added by hitting the provided 'More' button, removed by the 'Fewer' button and cleared (e.g. reset, if an derived class implements that and removed for all but mMinWidgets).
To use this widget, derive from it with the template changed to the type of widgets this class should list. Then reimplement addWidgetAtEnd, removeLastWidget, calling the original implementation as necessary. Instantiate an object of the class and put it in your dialog.
- Author:
- Marc Mutz <Marc@Mutz.com>
- See also:
- KMSearchPatternEdit::WidgetLister KMFilterActionEdit::WidgetLister
Member Function Documentation
|
Called whenever the user clicks on the 'more' button. Reimplementations should call this method, because this implementation does all the dirty work with adding the widgets to the layout (through addWidgetAtEnd) and enabling/disabling the control buttons. |
|
Called whenever the user clicks on the 'fewer' button. Reimplementations should call this method, because this implementation does all the dirty work with removing the widgets from the layout (through removeLastWidget) and enabling/disabling the control buttons. |
|
Called whenever the user clicks on the 'clear' button. Reimplementations should call this method, because this implementation does all the dirty work with removing all but mMinWidgets widgets from the layout and enabling/disabling the control buttons. |
|
Adds a single widget.
Doesn't care if there are already mMaxWidgets on screen and whether it should enable/disable any controls. It simply does what it is asked to do. You want to reimplement this method if you want to initialize the the widget when showing it on screen. Make sure you call this implementaion, though, since you cannot put the widget on screen from derived classes ( |
|
Removes a single (always the last) widget. Doesn't care if there are still only mMinWidgets left on screen and whether it should enable/disable any controls. It simply does what it is asked to do. You want to reimplement this method if you want to save the the widget's state before removing it from screen. Make sure you call this implementaion, though, since you should not remove the widget from screen from derived classes. |
|
Called to clear a given widget. The default implementation does nothing. Reimplemented in ConditionEditWidget, and ActionEditWidget. |
|
Because QT 2.x does not support signals/slots in template classes, we are forced to emulate this by forcing the implementers of subclasses of KWidgetLister to reimplement this function which replaces the "@p new @p T" call.
Reimplemented in ConditionEditWidget, and ActionEditWidget. |
|
Sets the number of widgets on scrren to exactly
Doesn't check if |
|
This signal is emitted whenever a widget was added.
|
|
This signal is emitted whenever a widget was added.
|
|
This signal is emitted whenever a widget was removed.
|
|
This signal is emitted whenever the clear button is clicked.
|
Member Data Documentation
|
The list of widgets. Note that this list is set to auto-delete, meaning that widgets that are removed from the screen by either slotFewer or slotClear will be destroyed! |
|
The minimum number of widgets that are to stay on screen.
|
|
The maximum number of widgets that are to be shown on screen.
|
The documentation for this class was generated from the following files:
- kwidgetlister.h
- kwidgetlister.cpp