first re-commit.
This commit is contained in:
72
swdialwidget.cpp
Normal file
72
swdialwidget.cpp
Normal file
@@ -0,0 +1,72 @@
|
||||
/***************************************************************************
|
||||
|
||||
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 );
|
||||
}
|
Reference in New Issue
Block a user