QVBoxLayout Class
QVBoxLayout クラスは、ウィジェットを縦に並べます。詳細...
ヘッダー | #include <QVBoxLayout> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Widgets) target_link_libraries(mytarget PRIVATE Qt6::Widgets) |
qmake: | QT += widgets |
継承: | QBoxLayout |
パブリック関数
QVBoxLayout() | |
QVBoxLayout(QWidget *parent) | |
virtual | ~QVBoxLayout() |
詳細説明
このクラスは、垂直ボックスレイアウトオブジェクトを構築するために使用されます。詳細はQBoxLayout を参照。
このクラスの最も単純な使い方は次のようなものです:
QWidget *window = new QWidget; QPushButton *button1 = new QPushButton("One"); QPushButton *button2 = new QPushButton("Two"); QPushButton *button3 = new QPushButton("Three"); QPushButton *button4 = new QPushButton("Four"); QPushButton *button5 = new QPushButton("Five"); QVBoxLayout *layout = new QVBoxLayout(window); layout->addWidget(button1); layout->addWidget(button2); layout->addWidget(button3); layout->addWidget(button4); layout->addWidget(button5); window->show();
まず、レイアウトに追加したいウィジェットを作成します。まず、レイアウトに追加したいウィジェットを作成します。次に、QVBoxLayout オブジェクトを作成し、window
をコンストラクタで渡して親に設定します。次に、ウィジェットをレイアウトに追加します。window
が、レイアウトに追加されるウィジェットの親になります。
コンストラクタに親window
を渡さない場合は、後でQWidget::setLayout() を使用して QVBoxLayout オブジェクトをwindow
にインストールできます。この時点で、レイアウト内のウィジェットは、window
を親として持つように再ペアレントされます。
QHBoxLayout,QGridLayout,QStackedLayout,レイアウト管理,基本レイアウト例も参照してください 。
メンバ関数ドキュメント
QVBoxLayout::QVBoxLayout()
新しい垂直ボックスを作成します。別のレイアウトに追加する必要があります。
[explicit]
QVBoxLayout::QVBoxLayout(QWidget *parent)
親を持つ新しいトップレベル縦ボックスを構築するparent 。
レイアウトは、parent のトップレベルレイアウトとして直接設定されます。ウィジェットのトップレベルレイアウトは1つだけです。これはQWidget::layout() によって返されます。
QWidget::setLayout()も参照してください 。
[virtual noexcept]
QVBoxLayout::~QVBoxLayout()
このボックス・レイアウトを破壊します。
レイアウトのウィジェットは破壊されません。
© 2025 The Qt Company Ltd. 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.