Files
qt-migration-legatus/qt6-after/qt6-migrated-legatus/Lts/Common/LtsWidgets/lts_combo_box.cpp
T
torstenandCopilot bafed3705f 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>
2026-08-19 14:04:26 +02:00

100 lines
2.4 KiB
C++

#include "lts_combo_box.h"
#include "lts_message_dialog.h"
#include "lts_selection_popup.h"
#include <QGuiApplication>
#include <QShowEvent>
#ifdef NEVER
#include <QDebug>
#endif
namespace LtsWidgets
{
bool LtsComboBox::s_useSelectionDialog = false;
LtsComboBox::LtsComboBox(QWidget* parent) : QComboBox(parent), m_currentIndex(-1)
{
connect(this, &LtsComboBox::signalExternallyChanged, this, &LtsComboBox::signalRefill);
}
void LtsComboBox::setUseSelectionDialog(bool bUseSelectionDialog)
{
s_useSelectionDialog = bUseSelectionDialog;
}
void LtsComboBox::showEvent(QShowEvent* e)
{
QComboBox::showEvent(e);
m_currentIndex = currentIndex();
}
void LtsComboBox::enterEvent(QEnterEvent* e)
{
BaseClass::enterEvent(e);
emit signalEnterEvent();
}
void LtsComboBox::leaveEvent(QEvent* e)
{
BaseClass::leaveEvent(e);
emit signalLeaveEvent();
}
void LtsComboBox::showPopup()
{
bool bUseSelectionDialog = s_useSelectionDialog;
if (QGuiApplication::queryKeyboardModifiers() == Qt::ControlModifier)
bUseSelectionDialog = !bUseSelectionDialog;
if (!bUseSelectionDialog)
{
QComboBox::showPopup();
return;
}
if (!model()->rowCount())
{
LtsWidgets::LtsMessageDialog::showMessage(this, tr("There are no items available!"));
return;
}
LtsSelectionPopup* popup = new LtsSelectionPopup(model(), currentIndex(), this);
popup->setAttribute(Qt::WA_DeleteOnClose);
#ifdef NEVER
connect(popup, static_cast<void (LtsSelectionPopup::*)(int)>(&LtsSelectionPopup::currentIndexChanged), this,
[](int idx) { qCritical() << " LtsComboBox: called: currentIndexChanged(int), idx=" << idx; });
connect(popup, static_cast<void (LtsSelectionPopup::*)(int)>(&LtsSelectionPopup::activated), this,
[](int idx) { qCritical() << " LtsComboBox: called: activated(int), idx=" << idx; });
#endif
connect(popup, &LtsSelectionPopup::currentIndexChanged, this, &LtsComboBox::userChangedIndex);
connect(popup, &LtsSelectionPopup::activated, this,
static_cast<void (LtsComboBox::*)(int)>(&LtsComboBox::activated));
popup->show();
}
void LtsComboBox::userChangedIndex(int index)
{
m_currentIndex = index;
setCurrentIndex(index);
}
bool LtsComboBox::hasValueChanged() const
{
if (m_currentIndex == -1)
return false;
return !(currentIndex() == m_currentIndex);
}
} // namespace LtsWidgets