From d75cf405f119f85fb83593a4b40b25fd54e584d7 Mon Sep 17 00:00:00 2001 From: Hane Date: Tue, 7 May 2024 18:46:24 +0200 Subject: [PATCH] new layout every compose --- src/qt/qtclasses.cpp | 26 ++++++++++++++++++++++---- src/qt/qtclasses.h | 3 ++- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/qt/qtclasses.cpp b/src/qt/qtclasses.cpp index e0080a6..56fa131 100644 --- a/src/qt/qtclasses.cpp +++ b/src/qt/qtclasses.cpp @@ -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 */ diff --git a/src/qt/qtclasses.h b/src/qt/qtclasses.h index c4eb958..37e0974 100644 --- a/src/qt/qtclasses.h +++ b/src/qt/qtclasses.h @@ -233,7 +233,8 @@ protected: void customEvent(QEvent* ev) override; QRect setSizePosition(QScreen* screen, int width, int height); QScreen* getCurrentScreen(); - + void createLayout(QGridLayout *newLayout); + private slots: void trayIconActivated(QSystemTrayIcon::ActivationReason reason); void removeEndpointWidget(CustomWidgetEvent* ev);