QHBoxLayout Class
QHBoxLayout 클래스는 위젯을 가로로 정렬합니다. 더 보기...
Header: | #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();
먼저 레이아웃에 추가할 위젯을 만듭니다. 그런 다음 생성자에서 window
을 부모로 설정하여 QHBoxLayout 객체를 생성하고, 다음으로 레이아웃에 위젯을 추가합니다. window
은 레이아웃에 추가되는 위젯의 부모가 됩니다.
생성자에 window
부모를 전달하지 않으면 나중에 QWidget::setLayout()를 사용하여 QHBoxLayout 객체를 window
에 설치할 수 있습니다. 이 시점에서 레이아웃의 위젯은 window
을 부모로 갖도록 부모가 다시 지정됩니다.
QVBoxLayout, QGridLayout, QStackedLayout, 레이아웃 관리 및 기본 레이아웃 예제를참조하세요 .
멤버 함수 문서
QHBoxLayout::QHBoxLayout()
새 가로 상자를 만듭니다. 다른 레이아웃에 추가해야 합니다.
[explicit]
QHBoxLayout::QHBoxLayout(QWidget *parent)
부모가 parent 인 새 최상위 가로 상자를 만듭니다.
이 레이아웃은 parent 의 최상위 레이아웃으로 직접 설정됩니다. 위젯에 대한 최상위 레이아웃은 하나만 있을 수 있습니다. 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.