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