- training_area_telegrams.cpp: Fixed QJsonObject initializer syntax (Qt6 requires {{}} not ({}))
- training_area_telegrams.cpp: Fixed fromJson() methods to access m_* members directly
- training_area_telegrams.cpp: Fixed brace mismatches in multiple toJson() methods
- training_area_telegrams.h: Changed Header struct to public members for consistency
- tx_mixin.cpp: Fixed getEquipmentNumber() template for direct member access
- lts_coordinate.cpp: Added missing #include <iomanip>
- MIGRATION_STATUS.md: Added migration progress tracking document
C++17 constraint enforced due to RTI Connext DDS 7.7.0 incompatibility with C++20+
Build status: BUILD_RTI=OFF successful (0 errors, warnings only)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
91 lines
1.9 KiB
C++
91 lines
1.9 KiB
C++
/**
|
|
* @RDE_HEADER@
|
|
* ToolBox for Menus
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*/
|
|
|
|
#include "lts_tool_box.h"
|
|
|
|
#include "lts_drag_icon.h"
|
|
#include "lts_grid_layout.h"
|
|
|
|
#include <QtWidgets/QMenu>
|
|
#include <QScroller>
|
|
#include <QtWidgets/QScrollArea>
|
|
|
|
using namespace LtsWidgets;
|
|
|
|
|
|
LtsToolBox::LtsToolBox(QWidget *parent)
|
|
: QToolBox(parent)
|
|
{
|
|
|
|
setMinimumSize(17, 200);
|
|
setContextMenuPolicy(Qt::CustomContextMenu);
|
|
connect(this, &LtsToolBox::customContextMenuRequested,
|
|
this, &LtsToolBox::showContextMenu);
|
|
|
|
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
|
|
|
|
}
|
|
|
|
LtsToolBox::~LtsToolBox()
|
|
{
|
|
}
|
|
|
|
void LtsToolBox::resizeEvent(QResizeEvent *e)
|
|
{
|
|
emit resized(e);
|
|
QToolBox::resizeEvent(e);
|
|
|
|
}
|
|
|
|
void LtsToolBox::addItem(QWidget *widget, const QString &text)
|
|
{
|
|
setMinimumSize(120, 100);
|
|
QToolBox::addItem(widget, text);
|
|
}
|
|
|
|
|
|
void LtsToolBox::showContextMenu(const QPoint &pos)
|
|
{
|
|
|
|
// for most widgets
|
|
QPoint globalPos = this->mapToGlobal(pos);
|
|
// for QAbstractScrollArea and derived classes you would use:
|
|
// QPoint globalPos = myWidget->viewport()->mapToGlobal(pos);
|
|
|
|
QMenu myMenu;
|
|
myMenu.addAction(tr("Icon and Text"));
|
|
QAction *to = myMenu.addAction(tr("Text Only"));
|
|
QAction *io = myMenu.addAction(tr("Icon Only"));
|
|
|
|
|
|
QAction *selectedItem = myMenu.exec(globalPos); // TODO: use popup, use signals & slots
|
|
if (selectedItem)
|
|
{
|
|
ButtonStyle newStyle = ButtonStyle::eTextNextToIcon;
|
|
if (selectedItem == to)
|
|
newStyle = ButtonStyle::eTextOnly;
|
|
if (selectedItem == io)
|
|
newStyle = ButtonStyle::eIconOnly;
|
|
|
|
for (int i = 0; i < count(); i++)
|
|
{
|
|
const QList<LtsDragIcon *> list = widget(i)->findChildren<LtsDragIcon *>();
|
|
for (LtsDragIcon *icon : list)
|
|
icon->setButtonStyle(newStyle);
|
|
LtsGridLayout *lay = qobject_cast<LtsGridLayout *>(widget(i)->layout());
|
|
if (lay)
|
|
lay->setAutoSize((newStyle == ButtonStyle::eIconOnly));
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
// nothing was chosen
|
|
}
|
|
}
|