Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos protegidos
Referencia de la Clase QSizeGrip

The QSizeGrip class provides a corner-grip for resizing a top-level window. Más...

#include <qsizegrip.h>

Diagrama de herencias de QSizeGrip
QWidget QWidget QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject QPaintDevice QObject

Lista de todos los miembros.

Métodos públicos

 QSizeGrip (QWidget *parent, const char *name=0)
 ~QSizeGrip ()
QSize sizeHint () const
 QSizeGrip (QWidget *parent, const char *name=0)
 ~QSizeGrip ()
QSize sizeHint () const

Métodos protegidos

void paintEvent (QPaintEvent *)
void mousePressEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
bool eventFilter (QObject *, QEvent *)
void paintEvent (QPaintEvent *)
void mousePressEvent (QMouseEvent *)
void mouseMoveEvent (QMouseEvent *)
bool eventFilter (QObject *, QEvent *)

Descripción detallada

The QSizeGrip class provides a corner-grip for resizing a top-level window.

This widget works like the standard Windows resize handle. In the X11 version this resize handle generally works differently from the one provided by the system; we hope to reduce this difference in the future.

Put this widget anywhere in a widget tree and the user can use it to resize the top-level window. Generally, this should be in the lower right-hand corner. Note that QStatusBar already uses this widget, so if you have a status bar (e.g. you are using QMainWindow), then you don't need to use this widget explicitly.

qsizegrip-m.png
qsizegrip-w.png
Ver también:
QStatusBar

Documentación del constructor y destructor

QSizeGrip::QSizeGrip ( QWidget parent,
const char *  name = 0 
)

Constructs a resize corner called name, as a child widget of parent.

QSizeGrip::~QSizeGrip ( )

Destroys the size grip.

QSizeGrip::QSizeGrip ( QWidget parent,
const char *  name = 0 
)
QSizeGrip::~QSizeGrip ( )

Documentación de las funciones miembro

bool QSizeGrip::eventFilter ( QObject o,
QEvent e 
) [protected, virtual]

Reimplementado de QObject.

bool QSizeGrip::eventFilter ( QObject ,
QEvent  
) [protected, virtual]

Filters events if this object has been installed as an event filter for the watched object.

In your reimplementation of this function, if you want to filter the event e, out, i.e. stop it being handled further, return TRUE; otherwise return FALSE.

Example:

    class MyMainWindow : public QMainWindow
    {
    public:
        MyMainWindow( QWidget *parent = 0, const char *name = 0 );

    protected:
        bool eventFilter( QObject *obj, QEvent *ev );

    private:
        QTextEdit *textEdit;
    };

    MyMainWindow::MyMainWindow( QWidget *parent, const char *name )
        : QMainWindow( parent, name )
    {
        textEdit = new QTextEdit( this );
        setCentralWidget( textEdit );
        textEdit->installEventFilter( this );
    }

    bool MyMainWindow::eventFilter( QObject *obj, QEvent *ev )
    {
        if ( obj == textEdit ) {
            if ( e->type() == QEvent::KeyPress ) {
                QKeyEvent *k = (QKeyEvent*)ev;
                qDebug( "Ate key press %d", k->key() );
                return TRUE;
            } else {
                return FALSE;
            }
        } else {
            // pass the event on to the parent class
            return QMainWindow::eventFilter( obj, ev );
        }
    }

Notice in the example above that unhandled events are passed to the base class's eventFilter() function, since the base class might have reimplemented eventFilter() for its own internal purposes.

Atención:
If you delete the receiver object in this function, be sure to return TRUE. Otherwise, Qt will forward the event to the deleted object and the program might crash.
Ver también:
installEventFilter()

Reimplementado de QObject.

void QSizeGrip::mouseMoveEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse move events for the widget.

If mouse tracking is switched off, mouse move events only occur if a mouse button is pressed while the mouse is being moved. If mouse tracking is switched on, mouse move events occur even if no mouse button is pressed.

QMouseEvent::pos() reports the position of the mouse cursor, relative to this widget. For press and release events, the position is usually the same as the position of the last mouse move event, but it might be different if the user's hand shakes. This is a feature of the underlying window system, not Qt.

Ver también:
setMouseTracking(), mousePressEvent(), mouseReleaseEvent(), mouseDoubleClickEvent(), event(), QMouseEvent

Reimplementado de QWidget.

void QSizeGrip::mouseMoveEvent ( QMouseEvent e) [protected, virtual]

Resizes the top-level widget containing this widget. The event is in e.

Reimplementado de QWidget.

void QSizeGrip::mousePressEvent ( QMouseEvent e) [protected, virtual]

Primes the resize operation. The event is in e.

Reimplementado de QWidget.

void QSizeGrip::mousePressEvent ( QMouseEvent e) [protected, virtual]

This event handler, for event e, can be reimplemented in a subclass to receive mouse press events for the widget.

If you create new widgets in the mousePressEvent() the mouseReleaseEvent() may not end up where you expect, depending on the underlying window system (or X11 window manager), the widgets' location and maybe more.

The default implementation implements the closing of popup widgets when you click outside the window. For other widget types it does nothing.

Ver también:
mouseReleaseEvent(), mouseDoubleClickEvent(), mouseMoveEvent(), event(), QMouseEvent

Reimplementado de QWidget.

void QSizeGrip::paintEvent ( QPaintEvent ) [protected, virtual]

This event handler can be reimplemented in a subclass to receive paint events.

A paint event is a request to repaint all or part of the widget. It can happen as a result of repaint() or update(), or because the widget was obscured and has now been uncovered, or for many other reasons.

Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QCanvas do this, for example.

Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::unite()). repaint() does not permit this optimization, so we suggest using update() when possible.

When the paint event occurs, the update region has normally been erased, so that you're painting on the widget's background. There are a couple of exceptions and QPaintEvent::erased() tells you whether the widget has been erased or not.

The background can be set using setBackgroundMode(), setPaletteBackgroundColor() or setBackgroundPixmap(). The documentation for setBackgroundMode() elaborates on the background; we recommend reading it.

Ver también:
event(), repaint(), update(), QPainter, QPixmap, QPaintEvent

Reimplementado de QWidget.

void QSizeGrip::paintEvent ( QPaintEvent e) [protected, virtual]

Paints the resize grip. Resize grips are usually rendered as small diagonal textured lines in the lower-right corner. The event is in e.

Reimplementado de QWidget.

QSize QSizeGrip::sizeHint ( ) const [virtual]

Returns the size grip's size hint; this is a small size.

Reimplementado de QWidget.

QSize QSizeGrip::sizeHint ( ) const [virtual]

Reimplementado de QWidget.


La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'