このページでは

Layouting::Layout Class

class Layouting::Layout

レイアウトビルダークラスの基底クラス。詳細...

Header: #include <Layout>
Inherits: Layouting::Object
Inherited By:

Layouting::Column, Layouting::Flow, Layouting::Form, Layouting::Grid, and Layouting::Row

パブリック関数

void addItem(Layouting::Layout::I item)
void addItems(std::initializer_list<Layouting::Layout::I> items)
void addRow(std::initializer_list<Layouting::Layout::I> items)
void align(Qt::Alignment alignment)
void attachTo(QWidget *widget)
QWidget *emerge() const
void flush()
void setNoMargins()
void setNormalMargins()
void span(int cols, int rows)

詳細な説明

QLayout を継承したオブジェクトをラップします。インスタンスは一時的なものです。構築、設定を行い、attachTo() またはemerge() を呼び出してください。囲んでいる関数の外でインスタンスを保持しないでください。

サブクラスは、addItem()、addItems()、およびaddRow() を通じて項目を蓄積し、これらはビルダーが最終化される際に基盤となるQLayout にフラッシュされます。行やスパンをサポートするレイアウト(Form、Grid)の場合、項目はステージングされ、flush() によってレイアウトにコミットされます。

Layouting::Widget 、Layouting::Column 、Layouting::Row 、Layouting::Form 、およびLayouting::Gridも参照してください 。

メンバ関数のドキュメント

void Layout::addItem(Layouting::Layout::I item)

レイアウト項目「item 」をサブ項目として追加します。

void Layout::addItems(std::initializer_list<Layouting::Layout::I> items)

レイアウト項目「items 」をサブ項目として追加します。

void Layout::addRow(std::initializer_list<Layouting::Layout::I> items)

items を含む新しい行を開始します。この行は、addItem() またはaddItems() を使用して、他の項目を追加することでさらに拡張することができます。

addItem() およびaddItems()も参照してください 。

void Layout::align(Qt::Alignment alignment)

このレイアウトに最後に追加された項目の配置を「alignment 」に設定します。Grid レイアウトおよび Form レイアウトでのみ有効です。

void Layout::attachTo(QWidget *widget)

構築されたレイアウトを、指定されたQWidget widget に紐付けます。

この操作は、LayoutBuilderインスタンスごとに1回のみ実行可能です。

QWidget *Layout::emerge() const

レイアウトを確定し、新しいQWidget でラップして返します。

これは、明示的な外側のWidgetビルダーを指定せずに、レイアウトをウィジェットとして(例えばQScrollArea やQStackedWidget の内部に)埋め込む必要がある場合に便利です。呼び出し元は、返されたウィジェットの所有権を取得します。

Layout::attachTo()も参照してください 。

void Layout::flush()

蓄積されたすべての保留中の項目を、基盤となるQLayout にコミットします。

Gridレイアウトの場合、flush()が呼び出されるたびに次の行に進みます。Formレイアウトの場合、flush()が呼び出されるたびに、ラベルとフィールドからなる1行(または1つの全幅行)が追加されます。boxおよびflowレイアウトの場合、アイテムは直接追加されるため、flush()は何も行いません。

flush() は、初期化リストを受け取るコンストラクタの終了時に自動的に呼び出されるほか、attachTo() およびemerge() によっても呼び出されます。addItem() やaddRow() を使用してレイアウトを段階的に構築する場合にのみ、手動で呼び出してください。

Layout::attachTo() およびLayout::emerge()も参照してください 。

void Layout::setNoMargins()

4つのコンテンツマージンすべてを0に設定します。

Layout::setNormalMargins() およびLayouting::noMarginも参照してください 。

void Layout::setNormalMargins()

4つのコンテンツマージンすべてを9ピクセルに設定します。

Layout::setNoMargins() およびLayouting::normalMarginも参照してください 。

void Layout::span(int cols, int rows)

このレイアウトに最後に追加された項目の列スパンをcols に、行スパンをrows に設定します。グリッドレイアウトでのみ有効です。

Layouting::Span およびLayouting::SpanAllも参照してください 。

Copyright © The Qt Company Ltd. and other contributors. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.