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()); uint64_t screenHeight = (uint64_t)std::abs(screenRes.height());
log_debugcpp("Window Width: " + std::to_string(windowWidth)); log_debugcpp("Window Width: " + std::to_string(windowWidth));
this->createLayout(new QGridLayout());
this->setAttribute(Qt::WA_DontShowOnScreen, true); this->setAttribute(Qt::WA_DontShowOnScreen, true);
this->show(); this->show();
this->widget->layout()->update(); this->widget->layout()->update();
@ -398,7 +399,7 @@ ChannelWidget::ChannelWidget(uint32_t channelCount, EndpointHandler* eph, QWidge
widgetLayout->getContentsMargins(&left, &top, &right, &bottom); widgetLayout->getContentsMargins(&left, &top, &right, &bottom);
widgetLayout->setContentsMargins(0, top, 0, bottom); widgetLayout->setContentsMargins(0, top, 0, bottom);
/* /*
* Channel sliders setup * Channel sliders setup
*/ */
//uint32_t epChannelCount = eph->getChannelCount(); //uint32_t epChannelCount = eph->getChannelCount();
@ -824,6 +825,23 @@ HeaderWidget::HeaderWidget(QWidget *parent) : QWidget(parent) {
this->setLayout(widgetLayout); 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) { MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
//setWindowState(Qt::WindowFullScreen); //setWindowState(Qt::WindowFullScreen);
//setCentralWidget(centralWidget); //setCentralWidget(centralWidget);
@ -861,7 +879,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) {
ewsUpdateTimer->setInterval(ewsUpdateTimerFrequency); ewsUpdateTimer->setInterval(ewsUpdateTimerFrequency);
connect(ewsUpdateTimer, &QTimer::timeout, this, &MainWindow::reorderEndpointWidgetCollection); connect(ewsUpdateTimer, &QTimer::timeout, this, &MainWindow::reorderEndpointWidgetCollection);
//widget->setMinimumSize(QSize(300,300)); //widget->setMinimumSize(QSize(300,300));
widget->setLayout(widgetLayout); //widget->setLayout(widgetLayout);
/* /*
* Scroll bar code * Scroll bar code
*/ */

View file

@ -233,6 +233,7 @@ protected:
void customEvent(QEvent* ev) override; void customEvent(QEvent* ev) override;
QRect setSizePosition(QScreen* screen, int width, int height); QRect setSizePosition(QScreen* screen, int width, int height);
QScreen* getCurrentScreen(); QScreen* getCurrentScreen();
void createLayout(QGridLayout *newLayout);
private slots: private slots:
void trayIconActivated(QSystemTrayIcon::ActivationReason reason); void trayIconActivated(QSystemTrayIcon::ActivationReason reason);