|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QSizeGrip
public class QSizeGrip
The QSizeGrip class provides a resize handle for resizing top-level windows.
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 if the X11 window manager does not support necessary modern post-ICCCM specifications.
Put this widget anywhere in a widget tree and the user can use it to resize the top-level window or any widget with the Qt::SubWindow flag set. 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.
On some platforms the size grip automatically hides itself when the window is shown full screen or maximised.
![]() | A size grip widget at the bottom-right corner of a main window, shown in the Plastique widget style. |
The QSizeGrip class inherits QWidget and reimplements the mousePressEvent() and mouseMoveEvent() functions to feature the resize functionality, and the paintEvent() function to render the size grip widget.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget |
---|
QWidget.RenderFlag, QWidget.RenderFlags |
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter |
---|
QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I> |
Field Summary |
---|
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
Constructor Summary | |
---|---|
QSizeGrip(QWidget parent)
Constructs a resize corner as a child widget of the given parent. |
Method Summary | |
---|---|
boolean |
event(QEvent arg__1)
This is the main event handler; it handles event arg__1. |
boolean |
eventFilter(QObject arg__1,
QEvent arg__2)
Filters events if this object has been installed as an event filter for the arg__1 object. |
static QSizeGrip |
fromNativePointer(QNativePointer nativePointer)
This function returns the QSizeGrip instance pointed to by nativePointer |
protected void |
hideEvent(QHideEvent hideEvent)
This event handler can be reimplemented in a subclass to receive widget hide events. |
protected void |
mouseMoveEvent(QMouseEvent arg__1)
Resizes the top-level widget containing this widget. |
protected void |
mousePressEvent(QMouseEvent arg__1)
Receives the mouse press events for the widget, and primes the resize operation. |
protected void |
mouseReleaseEvent(QMouseEvent mouseEvent)
This event handler, for event arg__1, can be reimplemented in a subclass to receive mouse release events for the widget. |
protected void |
moveEvent(QMoveEvent moveEvent)
This event handler can be reimplemented in a subclass to receive widget move events which are passed in the arg__1 parameter. |
protected void |
paintEvent(QPaintEvent arg__1)
Paints the resize grip. |
void |
setVisible(boolean arg__1)
Sets whether the widget is visible to visible. |
protected void |
showEvent(QShowEvent showEvent)
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the arg__1 parameter. |
QSize |
sizeHint()
Returns the recommended size for the widget. |
Methods inherited from class com.trolltech.qt.core.QObject |
---|
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent |
Methods inherited from class com.trolltech.qt.QtJambiObject |
---|
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr |
Methods inherited from class com.trolltech.qt.QSignalEmitter |
---|
disconnect, disconnect, signalSender |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.trolltech.qt.QtJambiInterface |
---|
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership |
Constructor Detail |
---|
public QSizeGrip(QWidget parent)
Constructs a resize corner as a child widget of the given parent.
Method Detail |
---|
public boolean event(QEvent arg__1)
This is the main event handler; it handles event arg__1. You can reimplement this function in a subclass, but we recommend using one of the specialized event handlers instead.
Key press and release events are treated differently from other events. event checks for Tab and Shift+Tab and tries to move the focus appropriately. If there is no widget to move the focus to (or the key press is not Tab or Shift+Tab), event calls keyPressEvent.
Mouse and tablet event handling is also slightly special: only when the widget is enabled, event will call the specialized handlers such as mousePressEvent; otherwise it will discard the event.
This function returns true if the event was recognized, otherwise it returns false. If the recognized event was accepted (see QEvent::accepted), any further processing such as event propagation to the parent widget stops.
event
in class QWidget
public boolean eventFilter(QObject arg__1, QEvent arg__2)
Filters events if this object has been installed as an event filter for the arg__1 object.
In your reimplementation of this function, if you want to filter the arg__2 out, i.e. stop it being handled further, return true; otherwise return false.
Example:
class MainWindow : public QMainWindow
{
public:
MainWindow();
protected:
bool eventFilter(QObject *obj, QEvent *ev);
private:
QTextEdit *textEdit;
};
MainWindow::MainWindow()
{
textEdit = new QTextEdit;
setCentralWidget(textEdit);
textEdit->installEventFilter(this);
}
bool MainWindow::eventFilter(QObject *obj, QEvent *event)
{
if (obj == textEdit) {
if (event->type() == QEvent::KeyPress) {
QKeyEvent *keyEvent = static_cast<QKeyEvent*>(event);
qDebug() << "Ate key press" << keyEvent->key();
return true;
} else {
return false;
}
} else {
// pass the event on to the parent class
return QMainWindow::eventFilter(obj, event);
}
}
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.
Warning: 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.
eventFilter
in class QObject
protected void hideEvent(QHideEvent hideEvent)
This event handler can be reimplemented in a subclass to receive widget hide events. The event is passed in the arg__1 parameter.
Hide events are sent to widgets immediately after they have been hidden.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible.
hideEvent
in class QWidget
visible
,
event,
QHideEventprotected void mouseMoveEvent(QMouseEvent arg__1)
Resizes the top-level widget containing this widget. The mouse move event is passed in the arg__1 parameter.
mouseMoveEvent
in class QWidget
Example
protected void mousePressEvent(QMouseEvent arg__1)
Receives the mouse press events for the widget, and primes the resize operation. The mouse press event is passed in the arg__1 parameter.
mousePressEvent
in class QWidget
Example
protected void mouseReleaseEvent(QMouseEvent mouseEvent)
This event handler, for event arg__1, can be reimplemented in a subclass to receive mouse release events for the widget.
mouseReleaseEvent
in class QWidget
Example
protected void moveEvent(QMoveEvent moveEvent)
This event handler can be reimplemented in a subclass to receive widget move events which are passed in the arg__1 parameter. When the widget receives this event, it is already at the new position.
The old position is accessible through QMoveEvent::oldPos().
moveEvent
in class QWidget
protected void paintEvent(QPaintEvent arg__1)
Paints the resize grip.
Resize grips are usually rendered as small diagonal textured lines in the lower-right corner. The paint event is passed in the arg__1 parameter.
paintEvent
in class QWidget
public void setVisible(boolean arg__1)
Sets whether the widget is visible to visible.
Calling setVisible(true) or show sets the widget to visible status if all its parent widgets up to the window are visible. If an ancestor is not visible, the widget won't become visible until all its ancestors are shown. If its size or position has changed, Qt guarantees that a widget gets move and resize events just before it is shown. If the widget has not been resized yet, Qt will adjust the widget's size to a useful default using adjustSize.
Calling setVisible(false) or hide hides a widget explicitly. An explicitly hidden widget will never become visible, even if all its ancestors become visible, unless you show it.
A widget receives show and hide events when its visibility status changes. Between a hide and a show event, there is no need to waste CPU cycles preparing or displaying information to the user. A video application, for example, might simply stop generating new frames.
A widget that happens to be obscured by other windows on the screen is considered to be visible. The same applies to iconified windows and windows that exist on another virtual desktop (on platforms that support this concept). A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again.
You almost never have to reimplement the setVisible function. If you need to change some settings before a widget is shown, use showEvent instead. If you need to do some delayed initialization use the Polish event delivered to the event function.
setVisible
in class QWidget
protected void showEvent(QShowEvent showEvent)
This event handler can be reimplemented in a subclass to receive widget show events which are passed in the arg__1 parameter.
Non-spontaneous show events are sent to widgets immediately before they are shown. The spontaneous show events of windows are delivered afterwards.
Note: A widget receives spontaneous show and hide events when its mapping status is changed by the window system, e.g. a spontaneous hide event when the user minimizes the window, and a spontaneous show event when the window is restored again. After receiving a spontaneous hide event, a widget is still considered visible in the sense of isVisible.
showEvent
in class QWidget
visible
,
event,
QShowEventpublic QSize sizeHint()
Returns the recommended size for the widget.
If the value of this property is an invalid size, no size is recommended.
The default implementation of sizeHint returns an invalid size if there is no layout for this widget, and returns the layout's preferred size otherwise.
sizeHint
in class QWidget
public static QSizeGrip fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |