Qt6 migration: LtsWidgets API fixes, LtsWebSocket logger init, RTI Docker install
- LtsWidgets: Fixed Qt6 API compatibility issues - QWheelEvent::delta() → angleDelta().y() - QStyleOption::init() → initFrom() - QComboBox activated signal signature change - QTextCodec removal (UTF-8 default in Qt6) - Missing widget includes added - LtsWebSocket: Fixed m_logger reference initialization - Added NGLLoggerBootstrap includes - Proper initialization in constructor initializer lists - CMake: Added BUILD_LTSWEBSOCKET option for temporary exclusion - Docker: RTI Connext permanent installation script added - ci/install-rti-in-docker.sh for persistent RTI setup - Removes need for volume mounting RTI into container - BUILD options: FilterManagement, RTI, Codification, Grantlee, LtsWebSocket can be disabled for partial builds during migration Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
69 files changed
+12765
-14202
No files matched your search
Executable → Regular
+79
-86
@@ -1,129 +1,122 @@
|
||||
|
||||
|
||||
|
||||
#include "lts_grid_layout.h"
|
||||
#include <utility>
|
||||
|
||||
#include <QResizeEvent>
|
||||
#include <utility>
|
||||
|
||||
namespace LtsWidgets
|
||||
{
|
||||
|
||||
LtsGridLayout::LtsGridLayout(LtsWidgets::ButtonSize buttonSize, QWidget *parent, int maxColumn)
|
||||
: QGridLayout(parent)
|
||||
, m_buttonSize(buttonSize)
|
||||
, m_defaultMaxColumn(maxColumn)
|
||||
, m_maxColumn(maxColumn)
|
||||
, m_colSize(0)
|
||||
, m_autoSize(maxColumn < 0)
|
||||
LtsGridLayout::LtsGridLayout(LtsWidgets::ButtonSize buttonSize, QWidget* parent, int maxColumn)
|
||||
: QGridLayout(parent), m_buttonSize(buttonSize), m_defaultMaxColumn(maxColumn), m_maxColumn(maxColumn),
|
||||
m_colSize(0), m_autoSize(maxColumn < 0)
|
||||
{
|
||||
setSizeConstraint(SizeConstraint::SetNoConstraint);
|
||||
|
||||
setVerticalSpacing(1);
|
||||
setMargin(0);
|
||||
setSizeConstraint(SizeConstraint::SetNoConstraint);
|
||||
|
||||
setVerticalSpacing(1);
|
||||
setContentsMargins(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void LtsGridLayout::add_widget(QWidget *widget)
|
||||
void LtsGridLayout::add_widget(QWidget* widget)
|
||||
{
|
||||
for (auto it = m_widgetList.cbegin(); it != m_widgetList.cend(); ++it)
|
||||
{
|
||||
if (*it == widget)
|
||||
return;
|
||||
}
|
||||
connect(widget, &QWidget::destroyed, this, &LtsGridLayout::onWidgetDestroyed);
|
||||
addWidgetInternal(widget);
|
||||
m_widgetList.push_back(widget);
|
||||
for (auto it = m_widgetList.cbegin(); it != m_widgetList.cend(); ++it)
|
||||
{
|
||||
if (*it == widget)
|
||||
return;
|
||||
}
|
||||
connect(widget, &QWidget::destroyed, this, &LtsGridLayout::onWidgetDestroyed);
|
||||
addWidgetInternal(widget);
|
||||
m_widgetList.push_back(widget);
|
||||
}
|
||||
|
||||
void LtsGridLayout::setAutoSize(bool enable)
|
||||
{
|
||||
m_autoSize = enable;
|
||||
if (m_autoSize == false)
|
||||
setMaxColumn(1);
|
||||
else
|
||||
{
|
||||
m_maxColumn = -1;
|
||||
m_oldSize = QSize();
|
||||
m_oldGeo = QRect();
|
||||
QResizeEvent e(sizeHint(), sizeHint());
|
||||
onParentResize(&e);
|
||||
setGeometry(QRect(0, 0, sizeHint().width(), sizeHint().height()));
|
||||
}
|
||||
m_autoSize = enable;
|
||||
if (m_autoSize == false)
|
||||
setMaxColumn(1);
|
||||
else
|
||||
{
|
||||
m_maxColumn = -1;
|
||||
m_oldSize = QSize();
|
||||
m_oldGeo = QRect();
|
||||
QResizeEvent e(sizeHint(), sizeHint());
|
||||
onParentResize(&e);
|
||||
setGeometry(QRect(0, 0, sizeHint().width(), sizeHint().height()));
|
||||
}
|
||||
}
|
||||
|
||||
void LtsGridLayout::setMaxColumn(int max)
|
||||
{
|
||||
m_maxColumn = max;
|
||||
m_defaultMaxColumn = max;
|
||||
m_maxColumn = max;
|
||||
m_defaultMaxColumn = max;
|
||||
|
||||
|
||||
m_colSize = 0;
|
||||
m_colSize = 0;
|
||||
|
||||
for (QWidget *wid : std::as_const(m_widgetList))
|
||||
removeWidget(wid);
|
||||
|
||||
for (QWidget *wid : std::as_const(m_widgetList))
|
||||
addWidgetInternal(wid);
|
||||
for (QWidget* wid : std::as_const(m_widgetList))
|
||||
removeWidget(wid);
|
||||
|
||||
for (QWidget* wid : std::as_const(m_widgetList))
|
||||
addWidgetInternal(wid);
|
||||
}
|
||||
|
||||
void LtsGridLayout::addWidgetInternal(QWidget *widget)
|
||||
void LtsGridLayout::addWidgetInternal(QWidget* widget)
|
||||
{
|
||||
int current_row = 0;
|
||||
int current_column = 0;
|
||||
int current_row = 0;
|
||||
int current_column = 0;
|
||||
|
||||
while (QLayoutItem *item = itemAtPosition(current_row, current_column))
|
||||
{
|
||||
if (!item->widget())
|
||||
while (QLayoutItem* item = itemAtPosition(current_row, current_column))
|
||||
{
|
||||
removeItem(item);
|
||||
continue;
|
||||
if (!item->widget())
|
||||
{
|
||||
removeItem(item);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (current_column == (m_maxColumn - 1))
|
||||
{
|
||||
current_column = 0;
|
||||
++current_row;
|
||||
}
|
||||
else
|
||||
++current_column;
|
||||
}
|
||||
|
||||
if (current_column == (m_maxColumn - 1))
|
||||
{
|
||||
current_column = 0;
|
||||
++current_row;
|
||||
}
|
||||
else
|
||||
++current_column;
|
||||
}
|
||||
if (current_row == 0)
|
||||
m_colSize += 1;
|
||||
|
||||
if (current_row == 0)
|
||||
m_colSize += 1;
|
||||
|
||||
QGridLayout::addWidget(widget, current_row, current_column);
|
||||
QGridLayout::addWidget(widget, current_row, current_column);
|
||||
}
|
||||
|
||||
|
||||
void LtsGridLayout::onParentResize(QResizeEvent *e)
|
||||
void LtsGridLayout::onParentResize(QResizeEvent* e)
|
||||
{
|
||||
if (m_autoSize && m_oldSize != e->size())
|
||||
{
|
||||
bool bigger = (e->size().width() > m_oldSize.width());
|
||||
m_oldSize = e->size();
|
||||
int newWidth = m_oldSize.width();
|
||||
int maxIconsInRow = newWidth / (static_cast<int>(m_buttonSize) + 4);
|
||||
if (m_autoSize && m_oldSize != e->size())
|
||||
{
|
||||
bool bigger = (e->size().width() > m_oldSize.width());
|
||||
m_oldSize = e->size();
|
||||
int newWidth = m_oldSize.width();
|
||||
int maxIconsInRow = newWidth / (static_cast<int>(m_buttonSize) + 4);
|
||||
|
||||
if (!bigger && newWidth <= (static_cast<int>(m_buttonSize)*m_colSize - static_cast<int>(m_buttonSize) / 2))
|
||||
maxIconsInRow--;
|
||||
if (m_maxColumn != maxIconsInRow)
|
||||
setMaxColumn(maxIconsInRow);
|
||||
}
|
||||
if (!bigger && newWidth <= (static_cast<int>(m_buttonSize) * m_colSize - static_cast<int>(m_buttonSize) / 2))
|
||||
maxIconsInRow--;
|
||||
if (m_maxColumn != maxIconsInRow)
|
||||
setMaxColumn(maxIconsInRow);
|
||||
}
|
||||
}
|
||||
|
||||
void LtsGridLayout::onWidgetDestroyed()
|
||||
{
|
||||
QWidget *s = qobject_cast<QWidget*>(sender());
|
||||
for (auto it = m_widgetList.begin(); it != m_widgetList.end(); ++it)
|
||||
{
|
||||
if (*it == s)
|
||||
QWidget* s = qobject_cast<QWidget*>(sender());
|
||||
for (auto it = m_widgetList.begin(); it != m_widgetList.end(); ++it)
|
||||
{
|
||||
QGridLayout::removeWidget(s);
|
||||
m_widgetList.erase(it);
|
||||
setMaxColumn(m_maxColumn);
|
||||
break;
|
||||
if (*it == s)
|
||||
{
|
||||
QGridLayout::removeWidget(s);
|
||||
m_widgetList.erase(it);
|
||||
setMaxColumn(m_maxColumn);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace LtsWidgets
|
||||
Reference in new issue
Block a user