|
|
KNewPanner is a simple widget for managing two children which are seperated by a draggable divider. The user can resize both children by moving the bar. You can also label the two children and the labels will be adjusted as the divider is moved.
This widget is considerably easier to use than the old one, simply set the minimum and maximum sizes of the two children then call activate(). Note that the widgets to be panned should be children of the panner widget.
This widget fixes a number of design problems in the original KPanner class which show up particularly if you try to use it under a layout manager (such as QBoxLayout).
PLEASE NOTE: This panner is NOT source or binary compatable with the old one.
enum Orientation {Vertical, Horizontal } |
Constants used to specify the orientation.
enum Units {Percent, Absolute } |
Constants used to choose between absolute (pixel) sizes and percentages.
KNewPanner (QWidget *parent= 0, const char *name= 0, Orientation orient= Vertical, Units units= Percent, int pos= 50) |
Construct a KNewPanner widget.
Parameters:
parent | The parent widget |
name | The name of the panner widget. |
orient | The orientation of the panner, one of the constants Vertical or Horizontal. |
units | The units in which you want to specify the seperator position. This must be one of the constants Percent or Absolute. |
pos | The initial seperator position in the selected units. |
~KNewPanner () |
Clean up
void activate (QWidget *c0, QWidget *c1) |
Begin managing these two widgets. If you want to set the minimum or maximum sizes of the children then you should do it before calling this method.
void deactivate () |
Call this method to restore the panner to it's initial state. This allows you to call activate() a second time with different children.
void setLabels (const char *text0, const char *text1) |
Set the label texts for the two windows, note that they are only shown if you have called showLabels(true).
void showLabels (bool) |
Call this to show or hide the labels. Note that labels are only supported when the panner is oriented vertically. If it is not then calling this method has no effect.
int seperatorPos () |
void setSeperatorPos (int pos) |
int absSeperatorPos () |
void setAbsSeperatorPos (int pos, bool do_resize = true) |
int separatorPos () |
This gets the current position of the separator in the current units.
void setSeparatorPos (int pos) |
This sets the position of the seperator to the specified position. The position is specified in the currently selected units.
int absSeparatorPos () |
This gets the current position of the separator in absolute (pixel) units.
void setAbsSeparatorPos (int pos, bool do_resize = true) |
This sets the position of the seperator to the specified position. The position is specified in absolute units (pixels) irrespective of the the currently selected units.
Units units () |
Get the current units.
void setUnits (Units) |
Set the current units.
int checkValue (int) |
This returns the closest valid absolute seperator position to the position specified in the parameter.
void resizeEvent (QResizeEvent *) |
This method handles changes in the panner size, it will automatically resize the child widgets as appropriate.
Reimplemented from QWidget
bool eventFilter (QObject *, QEvent *) |
Filter the events from the divider
Reimplemented from QObject