Files
raDIYo/swdialwidget.cpp
2025-08-05 22:36:00 +02:00

73 lines
1.4 KiB
C++

/***************************************************************************
source::worx raDIYo
Copyright © 2020-2022 c.holzheuer
chris@sourceworx.org
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
***************************************************************************/
#include <QDebug>
#include <QWidget>
#include <swdialwidget.h>
//??
const QPen SWDialWidget::MarkPen1 = QPen( Qt::white, 4 );
const QPen SWDialWidget::MarkPen2 = QPen( Qt::darkRed, 4 );
const QPen& SWDialWidget::getPen()
{
if( hasDialInput() )
return MarkPen2;
return MarkPen1;
}
bool SWDialWidget::isHighlighted()
{
return _isHighlighted;
}
void SWDialWidget::setHightlighted( bool marked )
{
_isHighlighted = marked;
}
bool SWDialWidget::hasDialInput()
{
return _hasDialInput;
}
void SWDialWidget::toggleDialInput()
{
setDialInput( !hasDialInput() );
}
void SWDialWidget::setDialInput( bool active )
{
_hasDialInput = active;
}
void SWDialWidget::drawMark( QWidget* target )
{
if( !isHighlighted() )
return;
QPainter painter( target );
painter.setPen( getPen() );
painter.setBrush( Qt::NoBrush );
//painter.drawRect( target->rect() );
painter.drawRoundedRect( target->rect(), 8, 8 );
}