Compatibility Members for QSplitter

以下成员源于类 QSplitter are part of the Qt compatibility layer. We advise against using them in new code.

公共类型

enum ResizeMode { Auto, Stretch, KeepSize, FollowSizeHint }

公共函数

QSplitter (QWidget * parent , const char * name )
QSplitter (Qt::Orientation orientation , QWidget * parent , const char * name )
int margin () const
void moveToFirst (QWidget * widget )
void moveToLast (QWidget * widget )
void setCollapsible (QWidget * widget , bool collapsible )
void setMargin (int margin )
void setResizeMode (QWidget * widget , ResizeMode mode )

成员类型文档编制

enum QSplitter:: ResizeMode

This enum describes the different resizing behaviors child widgets can have:

常量 描述
QSplitter::Auto 3 The widget will be resized according to the stretch factors set in its sizePolicy ().
QSplitter::Stretch 0 The widget will be resized when the splitter itself is resized.
QSplitter::KeepSize 1 QSplitter will try to keep the widget's size unchanged.
QSplitter::FollowSizeHint 2 QSplitter will resize the widget when the widget's size hint changes.

使用 setStretchFactor () 代替。

成员函数文档编制

QSplitter:: QSplitter ( QWidget * parent , const char * name )

Use one of the constructors that doesn't take the name argument and then use setObjectName () 代替。

QSplitter:: QSplitter ( Qt::Orientation orientation , QWidget * parent , const char * name )

Use one of the constructors that don't take the name argument and then use setObjectName () 代替。

int QSplitter:: margin () const

Returns the width of the margin around the contents of the widget.

使用 QWidget::getContentsMargins () 代替。

另请参阅 setMargin () 和 QWidget::getContentsMargins ().

void QSplitter:: moveToFirst ( QWidget * widget )

使用 insertWidget (0, widget ) 代替。

void QSplitter:: moveToLast ( QWidget * widget )

使用 addWidget ( widget ) 代替。

void QSplitter:: setCollapsible ( QWidget * widget , bool collapsible )

使用 setCollapsible ( indexOf ( widget , collapsible )) instead.

void QSplitter:: setMargin ( int margin )

Sets the width of the margin around the contents of the widget to margin .

使用 QWidget::setContentsMargins () 代替。

另请参阅 margin () 和 QWidget::setContentsMargins ().

void QSplitter:: setResizeMode ( QWidget * widget , ResizeMode mode )

使用 setStretchFactor () 代替。

例如,若有代码像

splitter->setResizeMode(firstChild, QSplitter::KeepSize);
splitter->setResizeMode(secondChild, QSplitter::Stretch);
					

可以把它重写成

splitter->setStretchFactor(splitter->indexOf(firstChild), 0);
splitter->setStretchFactor(splitter->indexOf(secondChild), 1);