I've tried to convert this into pyqt5 but I can't do it correctly. I want to convert the widget into pyqt5 this is reference How to make an expandable/collapsable section widget in QT
Complete code is here: https://github.com/Elypson/qt-collapsible-section
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "Section.h"
#include <QBoxLayout>
#include <QLabel>
#include <QPushButton>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
Section* section = new Section("Section", 300, ui->centralWidget);
ui->centralWidget->layout()->addWidget(section);
auto* anyLayout = new QVBoxLayout();
anyLayout->addWidget(new QLabel("Some Text in Section", section));
anyLayout->addWidget(new QPushButton("Button in Section", section));
section->setContentLayout(*anyLayout);
}
MainWindow::~MainWindow()
{
delete ui;
}