Major Changes:
- Merged latest Qt5 devel content from dlbo (292 files changed, 7 new dirs)
- Consolidated forward-declarations and include folders
- Removed unneeded modules per Niklas' repo check list
Build System Fixes:
- Fixed CMake VERSION_GREATER syntax in ParticipantManagement/CMakeLists.txt
- Added VLC packages (libvlc-dev, vlc-plugin-base) to docker_build.sh
- Added PostgreSQL dev packages (libpq-dev, postgresql-server-dev-all) to Dockerfile
- Fixed locale warnings (ANSI_X3.4-1968 → C.UTF-8)
- Fixed ArcGIS SDK path warnings when BUILD_ARCGIS=OFF
Code Generation Fixes:
- Fixed IDL enum collisions (PortType→CorePortType/DdsutPortType, PdmEventType)
- Fixed Grantlee template svc_translation.cpp.grantlee:
- Changed {{ idl_enum.name }}_def:: to {{ idl_enum.name }}::
- Fixed .underlying() calls for C++11 scoped enums (enum class)
- Removed generated files from repo (moc_*, *_dtc.h, *_ftc.h)
Validation:
- BUILD_RTI=ON: SUCCESS
- BUILD_RTI=OFF: SUCCESS
- C++17 standard maintained for RTI 7.7 compatibility
- Ubuntu 26.04 Docker environment verified
Remaining Warnings (expected):
- BgViewer, KDChart, KDReports, Poppler-Qt6 not found (optional features)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
141 lines
3.3 KiB
C++
141 lines
3.3 KiB
C++
/**
|
|
* @RDE_HEADER@
|
|
* A Button with an elliptic Pixmap and a menu icon when hovering. In the style of LtsStyle.
|
|
* $Id$
|
|
* $HeadURL$
|
|
* $Author$
|
|
*
|
|
* Created by Mike Wille, SLSE, 2016-06-20
|
|
*/
|
|
|
|
#include "lts_profile_button.h"
|
|
|
|
#include <QPainter>
|
|
#include <QPainterPath>
|
|
#include <QPaintEvent>
|
|
#include <QBrush>
|
|
#include <QPen>
|
|
#include <QRect>
|
|
#include <QEvent>
|
|
|
|
using namespace LtsWidgets;
|
|
|
|
|
|
LtsProfileButton::LtsProfileButton(QWidget *parent)
|
|
: QWidget(parent)
|
|
, m_isHovered(false)
|
|
, m_menuEnabled(true) // enabled by default
|
|
{
|
|
QSizePolicy qsp = QSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
|
qsp.setHeightForWidth(true);
|
|
setSizePolicy(qsp);
|
|
}
|
|
|
|
|
|
void LtsProfileButton::setPixmap(const QPixmap &pixmap)
|
|
{
|
|
if (pixmap.isNull()) // invalid / empty pixmap given, trying to replace it with one from lts_resources
|
|
m_pixmap = QPixmap(QStringLiteral("icon:no_pic.svg")); // when this fails, the pixmap is still invalid, so no checks needed
|
|
else
|
|
m_pixmap = pixmap;
|
|
|
|
update();
|
|
}
|
|
|
|
|
|
void LtsProfileButton::enterEvent(QEvent *event)
|
|
{
|
|
//qWarning() << "enter";
|
|
m_isHovered = true;
|
|
update();
|
|
QWidget::enterEvent(event);
|
|
}
|
|
|
|
|
|
void LtsProfileButton::leaveEvent(QEvent *event)
|
|
{
|
|
//qWarning() << "leave";
|
|
m_isHovered = false;
|
|
update();
|
|
QWidget::leaveEvent(event);
|
|
}
|
|
|
|
|
|
bool LtsProfileButton::event(QEvent *event)
|
|
{
|
|
if (event->type() == QEvent::MouseButtonPress && m_menuEnabled)
|
|
{
|
|
emit signalClicked();
|
|
event->accept();
|
|
// m_isHovered = false; // unhovered on click
|
|
update();
|
|
return true;
|
|
}
|
|
|
|
return QWidget::event(event); // otherwise..
|
|
}
|
|
|
|
|
|
void LtsProfileButton::paintEvent(QPaintEvent* event) // TODO: colors from palette (style plugin) ?
|
|
{
|
|
QPainter p(this);
|
|
p.save();
|
|
|
|
int minSize;
|
|
QPointF center;
|
|
minSize = height() > width() ? width() : height();
|
|
center = QPointF(width() / 2.0, height() / 2.0);
|
|
|
|
|
|
// draw profile picture
|
|
p.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
|
|
// QBrush brush = QColor(QStringLiteral("white")); // TODO: from palette
|
|
|
|
QPixmap pixmap(minSize, minSize);
|
|
pixmap.fill(Qt::white);
|
|
|
|
if (!m_pixmap.isNull())
|
|
{
|
|
if (!(m_isHovered && m_menuEnabled)) // draw if NOT hovered or draw when hovered but menu is disabled
|
|
{
|
|
pixmap = m_pixmap.scaled(minSize, minSize, Qt::KeepAspectRatioByExpanding);
|
|
}
|
|
}
|
|
|
|
// p.setBrush(Qt::white);
|
|
// p.setPen(Qt::NoPen);
|
|
QPainterPath path;
|
|
path.addEllipse(center,
|
|
minSize / 2.0 - 4,
|
|
minSize / 2.0 - 4);
|
|
p.setClipPath(path);
|
|
p.drawPixmap(center - QPointF(minSize/2.0,minSize/2.0),pixmap);
|
|
|
|
|
|
|
|
// draw frame
|
|
p.setPen(QPen(QColor("gray"), 2));
|
|
p.drawEllipse(center,
|
|
minSize / 2.0 - 4,
|
|
minSize / 2.0 - 4);
|
|
|
|
|
|
// draw menu icon
|
|
if (m_isHovered && m_menuEnabled)
|
|
{
|
|
p.setPen(QPen(QColor(QStringLiteral("gray")), (minSize / 48 * 2))); // respect height, width is unnecessary
|
|
|
|
double xc = size().width()/2.012;
|
|
double yc = size().height()/2.012;
|
|
double diff = minSize/2.012;
|
|
|
|
p.drawLine(QPointF(xc - (diff/2.01f), yc - (diff/3.01f)), QPointF(xc + (diff/2.02f), yc - (diff/3.02f)));
|
|
p.drawLine(QPointF(xc - (diff/2.01f), yc - 0.01f), QPointF(xc + (diff/2.02f), yc - 0));
|
|
p.drawLine(QPointF(xc - (diff/2.01f), yc + (diff/3.01f)), QPointF(xc + (diff/2.02f), yc + (diff/3.02f)));
|
|
}
|
|
|
|
|
|
event->accept();
|
|
p.restore();
|
|
}
|