71 lines
1.6 KiB
C++
71 lines
1.6 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 <swradiobutton.h>
|
||
|
#include <QDebug>
|
||
|
|
||
|
/**
|
||
|
* @brief Standardkostruktor.
|
||
|
*/
|
||
|
|
||
|
SWRadioButton::SWRadioButton( QWidget* parent )
|
||
|
: QPushButton( parent )
|
||
|
{
|
||
|
//setAcceptDial( false );
|
||
|
// semi schlimmer hack: clicks auf mich weiterleiten
|
||
|
//connect( this, &QPushButton::clicked, this, [=]{ emit widgetClicked(this); } );
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Setzt den Zugriffsschlüssel für diesen Butten. Der Schlüssel bestimmt das
|
||
|
* für diesen Button vorgesehen Icon.
|
||
|
*/
|
||
|
|
||
|
void SWRadioButton::setKey( const QString& key )
|
||
|
{
|
||
|
_hoverStyle = QString( ButtonIcon ).arg( key );
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Simuliert pprogrammatisch einen Mousehover-Effekt, in dem ein
|
||
|
* entsprechendes Icon gesetzt wird.
|
||
|
* @see setKey
|
||
|
*/
|
||
|
|
||
|
void SWRadioButton::hover()
|
||
|
{
|
||
|
setIcon( QIcon( _hoverStyle ) );
|
||
|
}
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Macht den Hover-Effekt rückgängig, in dem das Hover-Icon
|
||
|
* wieder entfernt wird.
|
||
|
*/
|
||
|
|
||
|
void SWRadioButton::unHover()
|
||
|
{
|
||
|
|
||
|
// hatten wir schon einen button gehovert?
|
||
|
// dann ebendiesen restaurieren, in das Hover-Icon glöscht
|
||
|
// und des StyleSheet dadurch wieder aktiviert wird.
|
||
|
|
||
|
setIcon( QIcon() );
|
||
|
setChecked( false );
|
||
|
}
|
||
|
|