new layout every compose

This commit is contained in:
Hane 2024-05-07 18:46:24 +02:00
commit d75cf405f1
2 changed files with 24 additions and 5 deletions

View file

@ -214,6 +214,7 @@ void MainWindow::compose() {
uint64_t screenHeight = (uint64_t)std::abs(screenRes.height());
log_debugcpp("Window Width: " + std::to_string(windowWidth));
this->createLayout(new QGridLayout());
this->setAttribute(Qt::WA_DontShowOnScreen, true);
this->show();
this->widget->layout()->update();
@ -398,9 +399,9 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
widgetLayout->getContentsMargins(&left, &top, &right, &bottom);
widgetLayout->setContentsMargins(0, top, 0, bottom);
/*
* Channel sliders setup
*/
/*
* Channel sliders setup
*/
//uint32_t epChannelCount = eph->getChannelCount();
for(uint64_t channel = 0, col = 0, row = 0; channel < channelCount && channelCount > 1; channel++){
QSlider* tmp = new QSlider(Qt::Horizontal);
@ -824,6 +825,23 @@ HeaderWidget::HeaderWidget(QWidget *parent) : QWidget(parent) {
this->setLayout(widgetLayout);
}
void MainWindow::createLayout(QGridLayout *newLayout) {
//int row = 0;
//QGridLayout *newLayout = new QGridLayout();
delete this->widgetLayout;
widget->setLayout(newLayout);
this->widgetLayout = newLayout;
//this->reloadEndpointWidgets();
uint64_t i = 0;
for (EndpointWidget *epw : ews) {
if (!epw) continue;
log_debugcpp("EPWidget positioning");
log_wdebugcpp(L"epw name: " + epw->getEndpointHandler()->getName());
this->widgetLayout->addWidget(epw, i++, 0);
}
}
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
//setWindowState(Qt::WindowFullScreen);
//setCentralWidget(centralWidget);
@ -861,7 +879,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
ewsUpdateTimer->setInterval(ewsUpdateTimerFrequency);
connect(ewsUpdateTimer, &QTimer::timeout, this, &MainWindow::reorderEndpointWidgetCollection);
//widget->setMinimumSize(QSize(300,300));
widget->setLayout(widgetLayout);
//widget->setLayout(widgetLayout);
/*
* Scroll bar code
*/