「QBoxLayout」の編集履歴(バックアップ)一覧はこちら
「QBoxLayout」(2014/09/09 (火) 23:57:35) の最新版変更点
追加された行は緑色になります。
削除された行は赤色になります。
**見出し
#contents()
**QBoxLayout クラス
ウィジェットを水平方向または垂直方向に並べて配置します。
[[公式リファレンス>http://qt-project.org/doc/qt-5/qboxlayout.html]]
**継承関係
[[QLayoutItem]]
┣[[QLayout]]
┃┣[[QBoxLayout]] … このクラス
┃┃┣[[QHBoxLayout]] … 水平方向のレイアウト
┃┃┗[[QVBoxLayout]] … 垂直方向のレイアウト
┃┣[[QFormLayout]]
┃┣[[QGridLayout]]
┃┗[[QStackedLayout.]]
┣[[QSpacerItem]]
┗[[QWidgetItem]]
**列挙型
enum QBoxLayout::Direction
|キー|値|説明|
|QBoxLayout::LeftToRight|0|水平方向 左から右へ|
|QBoxLayout::RightToLeft|1|水平方向 右から左へ|
|QBoxLayout::TopToBottom|2|垂直方向 下から上へ|
|QBoxLayout::BottomToTop|3|垂直方向 上から下へ|
#ref(QBoxLayout_01.png)
**補足
***レイアウトに追加できるもの
-ウィジェットを追加できます。
void QBoxLayout::addWidget(QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0)
-他のレイアウトを追加して入れ子にすることもできます。
void QBoxLayout::addItem(QLayoutItem * item) [virtual]
void QBoxLayout::addLayout(QLayout * layout, int stretch = 0)
#ref(QBoxLayout_04.png)
-余白を追加できます。余白は伸縮したり、長さを固定したりできます。
void QBoxLayout::addSpacerItem(QSpacerItem * spacerItem)
void QBoxLayout::addSpacing(int size)
void QBoxLayout::addStretch(int stretch = 0)
#ref(QBoxLayout_05.png)
-突っ張りを追加できます。
void QBoxLayout::addStrut(int size)
#ref(QBoxLayout_03.png)
***伸縮要素
一方テキストエディタなどの一部のウィジェットや余白は引き伸ばしすことができます。
引き伸ばすことができるアイテムが複数ある場合は、伸縮要素で設定した比にしたがって空間が分けられます。
#ref(QBoxLayout_06.png)
**メンバ関数
***コンストラクタ
QBoxLayout::QBoxLayout(Direction dir, QWidget * parent = 0)
-説明
--指定した方向及び親ウィジェットを持つボックスレイアウトを生成します。
--
-パラメータ
--dir … レイアウトの方向
--parent … 親のウィジェット
***デストラクタ
QBoxLayout::~QBoxLayout()
-説明
--このボックスレイアウトを破棄します。
--レイアウトにあるウィジェットは破棄されません。
***レイアウトに要素を追加する
void QBoxLayout::addItem(QLayoutItem * item) [virtual]
-説明
--QLayout::addItem() の再実装です。
-パラメータ
--item … アイテム
void QBoxLayout::addLayout(QLayout * layout, int stretch = 0)
-説明
--このボックスレイアウトの最後に指定したレイアウトを追加します。
-パラメータ
--layout … レイアウト
--stretch … 伸縮要素
void QBoxLayout::addWidget(QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0)
-説明
--このボックスレイアウトの最後に指定したウィジェットを追加します。
-パラメータ
--widget … ウィジェット
--stretch … 伸縮要素
--alignment … 左寄せ/中央寄せ/右寄せ
---0の場合は、ウィジェットを引き伸ばしてレイアウトを埋める
#ref(QBoxLayout_07.png)
void QBoxLayout::addSpacerItem(QSpacerItem * spacerItem)
-説明
--このボックスレイアウトの最後に指定した余白を追加します。
-パラメータ
--spacerItem … 余白
void QBoxLayout::addSpacing(int size)
-説明
--このボックスレイアウトの最後に指定サイズの伸縮しない余白を追加します。
-パラメータ
--size … 余白のサイズ
void QBoxLayout::addStretch(int stretch = 0)
-説明
--このボックスレイアウトの最後に伸縮する余白を追加します。
--追加される spacerItem オブジェクトはデフォルト状態です。
-パラメータ
--stretch … 伸縮要素
void QBoxLayout::addStrut(int size)
-説明
--このボックスレイアウトの垂直方向の最小の長さを設定します。
--レイアウトに配置されているウィジェットが指定した長さでは収まらない場合は無視されます。
-パラメータ
--size … 余白のサイズ
***レイアウトに要素を挿入する
レイアウトの要素のインデックスは追加順に0、1、2、…となります。
#ref(QBoxLayout_02.png)
----
void QBoxLayout::insertItem(int index, QLayoutItem * item)
-説明
--このボックスレイアウトの指定インデックスの前に指定したアイテムを挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--item … レイアウト
void QBoxLayout::insertLayout(int index, QLayout * layout, int stretch = 0)
-説明
--このボックスレイアウトの指定インデックスの前に指定したレイアウトを挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--layout … レイアウト
--stretch … 伸縮要素
void QBoxLayout::insertWidget(int index, QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0)
-説明
--このボックスレイアウトの指定インデックスの前にウィジェットを挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--widget … ウィジェット
--stretch … 伸縮要素
--alignment … 左寄せ/中央寄せ/右寄せ
---0の場合は、ウィジェットを引き伸ばしてレイアウトを埋める
void QBoxLayout::insertSpacerItem(int index, QSpacerItem * spacerItem)
-説明
--このボックスレイアウトの指定インデックスの前に指定した余白を挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--spacerItem … 余白
void QBoxLayout::insertSpacing(int index, int size)
-説明
--このボックスレイアウトの指定インデックスの前に指定サイズの伸縮しない余白を追加します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--size … 余白のサイズ
void QBoxLayout::insertStretch(int index, int stretch = 0)
-説明
--このボックスレイアウトの指定インデックスの前に伸縮する余白を挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--stretch … 伸縮要素
***レイアウトの方向を取得または設定します。
Direction QBoxLayout::direction() const
-説明
--このボックスレイアウトの方向を返します。
void QBoxLayout::setDirection(Direction direction)
-説明
--このボックスレイアウトの方向を設定します。
-パラメータ
--direction … 方向
***伸縮要素を取得または設定します。
bool QBoxLayout::setStretchFactor(QWidget * widget, int stretch)
-説明
--このレイアウトに存在する指定したウィジェットに伸縮要素を設定します。
--指定したウィジェットがこのレイアウトに存在する場合はtrue、そうでない場合はfalseを返します。
-パラメータ
--widget … ウィジェット
--stretch … 伸縮要素
bool QBoxLayout::setStretchFactor(QLayout * layout, int stretch)
-説明
--このレイアウトに存在する指定したウィジェットに伸縮要素を設定します。
--指定したウィジェットがこのレイアウトに存在する(入れ子になったレイアウトではなく直接の子として)場合はtrue、そうでない場合はfalseを返します。
-パラメータ
--layout … レイアウト
--stretch … 伸縮要素
int QBoxLayout::stretch(int index) const
-説明
--指定インデックスの伸縮要素を返します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
void QBoxLayout::setStretch(int index, int stretch)
-説明
--指定インデックスの伸縮要素を設定します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
--stretch … 伸縮要素
----
以下再実装
int QBoxLayout::count() const [virtual]
-説明
--QLayout::count() の再実装です。
Qt::Orientations QBoxLayout::expandingDirections() const [virtual]
-説明
--QLayoutItem::expandingDirections() の再実装です。
bool QBoxLayout::hasHeightForWidth() const [virtual]
-説明
--QLayoutItem::hasHeightForWidth() の再実装です。
int QBoxLayout::heightForWidth(int w) const [virtual]
-説明
--QLayoutItem::heightForWidth() の再実装です。
void QBoxLayout::invalidate() [virtual]
-説明
--QLayoutItem::invalidate() の再実装です。
QLayoutItem * QBoxLayout::itemAt(int index) const [virtual]
-説明
--QLayout::itemAt() の再実装です。
QSize QBoxLayout::maximumSize() const [virtual]
-説明
--QLayoutItem::maximumSize() の再実装です。
int QBoxLayout::minimumHeightForWidth(int w) const [virtual]
-説明
--QLayoutItem::minimumHeightForWidth() の再実装です。
QSize QBoxLayout::minimumSize() const [virtual]
-説明
--QLayoutItem::minimumSize() の再実装です。
void QBoxLayout::setGeometry(const QRect & r) [virtual]
-説明
--QLayoutItem::setGeometry() の再実装です。
QSize QBoxLayout::sizeHint() const [virtual]
-説明
--QLayoutItem::sizeHint() の再実装です。
QLayoutItem * QBoxLayout::takeAt(int index) [virtual]
-説明
--QLayout::takeAt() の再実装です。
int QBoxLayout::spacing() const
-説明
QLayout::spacing() の再実装です。
--余白プロパティが有効の場合は、その値を返します。
--無効な場合は、余白プロパティの値は計算して返します。
--ウィジェットのレイアウトの余白はスタイルに依存するため、親がウィジェットの場合は、Otherwise, the parent is a layout, and it queries the parent layout for the spacing().
void QBoxLayout::setSpacing(int spacing)
-説明
--QLayout::setSpacing() の再実装です。
--余白プロパティに指定した値を設定します。
**見出し
#contents()
**QBoxLayout クラス
ウィジェットを水平方向または垂直方向に並べて配置します。
[[公式リファレンス>http://qt-project.org/doc/qt-5/qboxlayout.html]]
**継承関係
[[QLayoutItem]]
┣[[QLayout]]
┃┣[[QBoxLayout]] … このクラス
┃┃┣[[QHBoxLayout]] … 水平方向のレイアウト
┃┃┗[[QVBoxLayout]] … 垂直方向のレイアウト
┃┣[[QFormLayout]]
┃┣[[QGridLayout]]
┃┗[[QStackedLayout.]]
┣[[QSpacerItem]]
┗[[QWidgetItem]]
**列挙型
enum QBoxLayout::Direction
|キー|値|説明|
|QBoxLayout::LeftToRight|0|水平方向 左から右へ|
|QBoxLayout::RightToLeft|1|水平方向 右から左へ|
|QBoxLayout::TopToBottom|2|垂直方向 下から上へ|
|QBoxLayout::BottomToTop|3|垂直方向 上から下へ|
#ref(QBoxLayout_01.png)
**補足
***レイアウトに追加できるもの
-ウィジェットを追加できます。
void QBoxLayout::addWidget(QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0)
-他のレイアウトを追加して入れ子にすることもできます。
void QBoxLayout::addItem(QLayoutItem * item) [virtual]
void QBoxLayout::addLayout(QLayout * layout, int stretch = 0)
#ref(QBoxLayout_04.png)
-余白を追加できます。余白は伸縮したり、長さを固定したりできます。
void QBoxLayout::addSpacerItem(QSpacerItem * spacerItem)
void QBoxLayout::addSpacing(int size)
void QBoxLayout::addStretch(int stretch = 0)
#ref(QBoxLayout_05.png)
-突っ張りを追加できます。
void QBoxLayout::addStrut(int size)
#ref(QBoxLayout_03.png)
***伸縮要素
一方テキストエディタなどの一部のウィジェットや余白は引き伸ばしすことができます。
引き伸ばすことができるアイテムが複数ある場合は、伸縮要素で設定した比にしたがって空間が分けられます。
#ref(QBoxLayout_06.png)
**メンバ関数
***コンストラクタ
QBoxLayout::QBoxLayout(Direction dir, QWidget * parent = 0)
-説明
--指定した方向及び親ウィジェットを持つボックスレイアウトを生成します。
-パラメータ
--dir … レイアウトの方向
--parent … 親のウィジェット
***デストラクタ
QBoxLayout::~QBoxLayout()
-説明
--このボックスレイアウトを破棄します。
--レイアウトにあるウィジェットは破棄されません。
***レイアウトに要素を追加する
void QBoxLayout::addItem(QLayoutItem * item) [virtual]
-説明
--QLayout::addItem() の再実装です。
-パラメータ
--item … アイテム
void QBoxLayout::addLayout(QLayout * layout, int stretch = 0)
-説明
--このボックスレイアウトの最後に指定したレイアウトを追加します。
-パラメータ
--layout … レイアウト
--stretch … 伸縮要素
void QBoxLayout::addWidget(QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0)
-説明
--このボックスレイアウトの最後に指定したウィジェットを追加します。
-パラメータ
--widget … ウィジェット
--stretch … 伸縮要素
--alignment … 左寄せ/中央寄せ/右寄せ
---0の場合は、ウィジェットを引き伸ばしてレイアウトを埋める
#ref(QBoxLayout_07.png)
void QBoxLayout::addSpacerItem(QSpacerItem * spacerItem)
-説明
--このボックスレイアウトの最後に指定した余白を追加します。
-パラメータ
--spacerItem … 余白
void QBoxLayout::addSpacing(int size)
-説明
--このボックスレイアウトの最後に指定サイズの伸縮しない余白を追加します。
-パラメータ
--size … 余白のサイズ
void QBoxLayout::addStretch(int stretch = 0)
-説明
--このボックスレイアウトの最後に伸縮する余白を追加します。
--追加される spacerItem オブジェクトはデフォルト状態です。
-パラメータ
--stretch … 伸縮要素
void QBoxLayout::addStrut(int size)
-説明
--このボックスレイアウトの垂直方向の最小の長さを設定します。
--レイアウトに配置されているウィジェットが指定した長さでは収まらない場合は無視されます。
-パラメータ
--size … 余白のサイズ
***レイアウトに要素を挿入する
レイアウトの要素のインデックスは追加順に0、1、2、…となります。
#ref(QBoxLayout_02.png)
----
void QBoxLayout::insertItem(int index, QLayoutItem * item)
-説明
--このボックスレイアウトの指定インデックスの前に指定したアイテムを挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--item … レイアウト
void QBoxLayout::insertLayout(int index, QLayout * layout, int stretch = 0)
-説明
--このボックスレイアウトの指定インデックスの前に指定したレイアウトを挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--layout … レイアウト
--stretch … 伸縮要素
void QBoxLayout::insertWidget(int index, QWidget * widget, int stretch = 0, Qt::Alignment alignment = 0)
-説明
--このボックスレイアウトの指定インデックスの前にウィジェットを挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--widget … ウィジェット
--stretch … 伸縮要素
--alignment … 左寄せ/中央寄せ/右寄せ
---0の場合は、ウィジェットを引き伸ばしてレイアウトを埋める
void QBoxLayout::insertSpacerItem(int index, QSpacerItem * spacerItem)
-説明
--このボックスレイアウトの指定インデックスの前に指定した余白を挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--spacerItem … 余白
void QBoxLayout::insertSpacing(int index, int size)
-説明
--このボックスレイアウトの指定インデックスの前に指定サイズの伸縮しない余白を追加します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--size … 余白のサイズ
void QBoxLayout::insertStretch(int index, int stretch = 0)
-説明
--このボックスレイアウトの指定インデックスの前に伸縮する余白を挿入します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
---指定位置が負の値の場合は、最後に追加します。
--stretch … 伸縮要素
***レイアウトの方向を取得または設定します。
Direction QBoxLayout::direction() const
-説明
--このボックスレイアウトの方向を返します。
void QBoxLayout::setDirection(Direction direction)
-説明
--このボックスレイアウトの方向を設定します。
-パラメータ
--direction … 方向
***伸縮要素を取得または設定します。
bool QBoxLayout::setStretchFactor(QWidget * widget, int stretch)
-説明
--このレイアウトに存在する指定したウィジェットに伸縮要素を設定します。
--指定したウィジェットがこのレイアウトに存在する場合はtrue、そうでない場合はfalseを返します。
-パラメータ
--widget … ウィジェット
--stretch … 伸縮要素
bool QBoxLayout::setStretchFactor(QLayout * layout, int stretch)
-説明
--このレイアウトに存在する指定したウィジェットに伸縮要素を設定します。
--指定したウィジェットがこのレイアウトに存在する(入れ子になったレイアウトではなく直接の子として)場合はtrue、そうでない場合はfalseを返します。
-パラメータ
--layout … レイアウト
--stretch … 伸縮要素
int QBoxLayout::stretch(int index) const
-説明
--指定インデックスの伸縮要素を返します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
void QBoxLayout::setStretch(int index, int stretch)
-説明
--指定インデックスの伸縮要素を設定します。
-パラメータ
--index … レイアウトに配置されている要素のインデックス
--stretch … 伸縮要素
----
以下再実装
int QBoxLayout::count() const [virtual]
-説明
--QLayout::count() の再実装です。
Qt::Orientations QBoxLayout::expandingDirections() const [virtual]
-説明
--QLayoutItem::expandingDirections() の再実装です。
bool QBoxLayout::hasHeightForWidth() const [virtual]
-説明
--QLayoutItem::hasHeightForWidth() の再実装です。
int QBoxLayout::heightForWidth(int w) const [virtual]
-説明
--QLayoutItem::heightForWidth() の再実装です。
void QBoxLayout::invalidate() [virtual]
-説明
--QLayoutItem::invalidate() の再実装です。
QLayoutItem * QBoxLayout::itemAt(int index) const [virtual]
-説明
--QLayout::itemAt() の再実装です。
QSize QBoxLayout::maximumSize() const [virtual]
-説明
--QLayoutItem::maximumSize() の再実装です。
int QBoxLayout::minimumHeightForWidth(int w) const [virtual]
-説明
--QLayoutItem::minimumHeightForWidth() の再実装です。
QSize QBoxLayout::minimumSize() const [virtual]
-説明
--QLayoutItem::minimumSize() の再実装です。
void QBoxLayout::setGeometry(const QRect & r) [virtual]
-説明
--QLayoutItem::setGeometry() の再実装です。
QSize QBoxLayout::sizeHint() const [virtual]
-説明
--QLayoutItem::sizeHint() の再実装です。
QLayoutItem * QBoxLayout::takeAt(int index) [virtual]
-説明
--QLayout::takeAt() の再実装です。
int QBoxLayout::spacing() const
-説明
QLayout::spacing() の再実装です。
--余白プロパティが有効の場合は、その値を返します。
--無効な場合は、余白プロパティの値は計算して返します。
--ウィジェットのレイアウトの余白はスタイルに依存するため、親がウィジェットの場合は、Otherwise, the parent is a layout, and it queries the parent layout for the spacing().
void QBoxLayout::setSpacing(int spacing)
-説明
--QLayout::setSpacing() の再実装です。
--余白プロパティに指定した値を設定します。