Qt Jambi Home

com.trolltech.qt.gui
Class QFrame

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by com.trolltech.qt.gui.QFrame
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface
Direct Known Subclasses:
QAbstractScrollArea, QLabel, QLCDNumber, QSplitter, QStackedWidget, QToolBox

public class QFrame
extends QWidget

The QFrame class is the base class of widgets that can have a frame.

QMenu uses this to "raise" the menu above the surrounding screen. QProgressBar has a "sunken" look. QLabel has a flat look. The frames of widgets like these can be changed.

    QLabel label(...);
    label.setFrameStyle(QFrame::Panel | QFrame::Raised);
    label.setLineWidth(2);

    QProgressBar pbar(...);
    label.setFrameStyle(QFrame::NoFrame);

The QFrame class can also be used directly for creating simple placeholder frames without any contents.

The frame style is specified by a frame shape and a shadow style that is used to visually separate the frame from surrounding widgets. These properties can be set together using the setFrameStyle function and read with frameStyle.

The frame shapes are NoFrame, Box, Panel, StyledPanel, HLine and VLine; the shadow styles are Plain, Raised and Sunken.

A frame widget has three attributes that describe the thickness of the border: lineWidth, midLineWidth, and frameWidth.

The margin between the frame and the contents of the frame can be customized with the QWidget::setContentsMargins() function.

This table shows some of the combinations of styles and line widths:

Table of frame styles


Nested Class Summary
static class QFrame.Shadow
          This enum type defines the types of shadow that are used to give a 3D effect to frames.
static class QFrame.Shape
          This enum type defines the shapes of frame available.
static class QFrame.StyleMask
          This enum defines two constants that can be used to extract the two components of frameStyle:
ConstantValueDescription Shadow_Mask240The Shadow part of frameStyle Shape_Mask15The Shape part of frameStyle Normally, you don't need to use these, since frameShadow and frameShape already extract the Shadow and the Shape parts of frameStyle.
 
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.AbstractSignal, 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
QFrame()
          Equivalent to QFrame(0, 0).
QFrame(QWidget parent)
          Equivalent to QFrame(parent, 0).
QFrame(QWidget parent, Qt.WindowFlags f)
          Constructs a frame widget with frame style NoFrame and a 1-pixel frame width.
 
Method Summary
protected  void changeEvent(QEvent arg__1)
          This function is reimplemented for internal reasons.
protected  void drawFrame(QPainter arg__1)
          
 boolean event(QEvent e)
          This function is reimplemented for internal reasons.
 QRect frameRect()
          Returns the frame's rectangle.
 QFrame.Shadow frameShadow()
          Returns the frame shadow value from the frame style.
 QFrame.Shape frameShape()
          Returns the frame shape value from the frame style.
 int frameStyle()
          Returns the frame style.
 int frameWidth()
          Returns the width of the frame that is drawn..
static QFrame fromNativePointer(QNativePointer nativePointer)
          This function returns the QFrame instance pointed to by nativePointer
 int lineWidth()
          Returns the line width.
 int midLineWidth()
          Returns the width of the mid-line.
protected  void paintEvent(QPaintEvent arg__1)
          This function is reimplemented for internal reasons.
 void setFrameRect(QRect arg__1)
          Sets the frame's rectangle to arg__1.
 void setFrameShadow(QFrame.Shadow arg__1)
          Sets the frame shadow value from the frame style to arg__1.
 void setFrameShape(QFrame.Shape arg__1)
          Sets the frame shape value from the frame style to arg__1.
 void setFrameStyle(int arg__1)
          Sets the frame style to arg__1.
 void setLineWidth(int arg__1)
          Sets the line width to arg__1.
 void setMidLineWidth(int arg__1)
          Sets the width of the mid-line to arg__1.
 QSize sizeHint()
          This function is reimplemented for internal reasons.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintEngine, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, 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

QFrame

public QFrame(QWidget parent)

Equivalent to QFrame(parent, 0).


QFrame

public QFrame()

Equivalent to QFrame(0, 0).


QFrame

public QFrame(QWidget parent,
              Qt.WindowFlags f)

Constructs a frame widget with frame style NoFrame and a 1-pixel frame width.

The parent and f arguments are passed to the QWidget constructor.

Method Detail

drawFrame

protected final void drawFrame(QPainter arg__1)


frameRect

public final QRect frameRect()

Returns the frame's rectangle.

The frame's rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Setting the rectangle does does not cause a widget update. The frame rectangle is automatically adjusted when the widget changes size.

If you set the rectangle to a null rectangle (for example, QRect(0, 0, 0, 0)), then the resulting frame rectangle is equivalent to the widget rectangle.

See Also:
setFrameRect

frameShadow

public final QFrame.Shadow frameShadow()

Returns the frame shadow value from the frame style.

See Also:
setFrameShadow, frameStyle, frameShape

frameShape

public final QFrame.Shape frameShape()

Returns the frame shape value from the frame style.

See Also:
setFrameShape, frameStyle, frameShadow

frameStyle

public final int frameStyle()

Returns the frame style.

The default value is QFrame::NoFrame.

See Also:
setFrameStyle, frameShape, frameShadow

frameWidth

public final int frameWidth()

Returns the width of the frame that is drawn..

Note that the frame width depends on the frame style, not only the line width and the mid-line width. For example, the style specified by NoFrame always has a frame width of 0, whereas the style Panel has a frame width equivalent to the line width.

See Also:
lineWidth, midLineWidth, frameStyle

lineWidth

public final int lineWidth()

Returns the line width.

Note that the total line width for frames used as separators (HLine and VLine) is specified by frameWidth.

The default value is 1.

See Also:
setLineWidth, midLineWidth, frameWidth

midLineWidth

public final int midLineWidth()

Returns the width of the mid-line.

The default value is 0.

See Also:
setMidLineWidth, lineWidth, frameWidth

setFrameRect

public final void setFrameRect(QRect arg__1)

Sets the frame's rectangle to arg__1.

The frame's rectangle is the rectangle the frame is drawn in. By default, this is the entire widget. Setting the rectangle does does not cause a widget update. The frame rectangle is automatically adjusted when the widget changes size.

If you set the rectangle to a null rectangle (for example, QRect(0, 0, 0, 0)), then the resulting frame rectangle is equivalent to the widget rectangle.

See Also:
frameRect

setFrameShadow

public final void setFrameShadow(QFrame.Shadow arg__1)

Sets the frame shadow value from the frame style to arg__1.

See Also:
frameShadow, frameStyle, frameShape

setFrameShape

public final void setFrameShape(QFrame.Shape arg__1)

Sets the frame shape value from the frame style to arg__1.

See Also:
frameShape, frameStyle, frameShadow

setFrameStyle

public final void setFrameStyle(int arg__1)

Sets the frame style to arg__1.

The arg__1 is the bitwise OR between a frame shape and a frame shadow style. See the picture of the frames in the main class documentation.

The frame shapes are given in QFrame::Shape and the shadow styles in QFrame::Shadow.

If a mid-line width greater than 0 is specified, an additional line is drawn for Raised or Sunken Box, HLine, and VLine frames. The mid-color of the current color group is used for drawing middle lines.

See Also:
frameStyle

setLineWidth

public final void setLineWidth(int arg__1)

Sets the line width to arg__1.

Note that the total line width for frames used as separators (HLine and VLine) is specified by frameWidth.

The default value is 1.

See Also:
lineWidth, midLineWidth, frameWidth

setMidLineWidth

public final void setMidLineWidth(int arg__1)

Sets the width of the mid-line to arg__1.

The default value is 0.

See Also:
midLineWidth, lineWidth, frameWidth

changeEvent

protected void changeEvent(QEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
changeEvent in class QWidget

event

public boolean event(QEvent e)

This function is reimplemented for internal reasons.

Overrides:
event in class QWidget
See Also:
closeEvent, focusInEvent, focusOutEvent, enterEvent, keyPressEvent, keyReleaseEvent, leaveEvent, mouseDoubleClickEvent, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, moveEvent, paintEvent, resizeEvent, QObject::event, QObject::timerEvent

paintEvent

protected void paintEvent(QPaintEvent arg__1)

This function is reimplemented for internal reasons.

Overrides:
paintEvent in class QWidget
See Also:
event, repaint, update, QPainter, QPixmap, QPaintEvent, Analog Clock Example

sizeHint

public QSize sizeHint()

This function is reimplemented for internal reasons.

Overrides:
sizeHint in class QWidget
See Also:
QSize::isValid, minimumSizeHint, sizePolicy, setMinimumSize, updateGeometry

fromNativePointer

public static QFrame fromNativePointer(QNativePointer nativePointer)
This function returns the QFrame instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

Qt Jambi Home