Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ansus:KDE3
yast2-qt3
YQCheckBox.cc
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File YQCheckBox.cc of Package yast2-qt3
/************************************************************************** Copyright (C) 2000 - 2010 Novell, Inc. All Rights Reserved. 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. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. **************************************************************************/ /*---------------------------------------------------------------------\ | | | __ __ ____ _____ ____ | | \ \ / /_ _/ ___|_ _|___ \ | | \ V / _` \___ \ | | __) | | | | | (_| |___) || | / __/ | | |_|\__,_|____/ |_| |_____| | | | | core system | | (C) SuSE GmbH | \----------------------------------------------------------------------/ File: YQCheckBox.cc Author: Stefan Hundhammer <sh@suse.de> /-*/ #include <qcheckbox.h> #include <QBoxLayout> #define YUILogComponent "qt-ui" #include "YUILog.h" #include "utf8.h" #include "YQApplication.h" #include "YQUI.h" #include "YEvent.h" #include "YQCheckBox.h" #define SPACING 8 YQCheckBox::YQCheckBox( YWidget * parent, const string & label, bool checked ) : QCheckBox( fromUTF8( label ), (QWidget *) parent->widgetRep() ) , YCheckBox( parent, label ) { setWidgetRep( this ); QCheckBox::setChecked( checked ); connect( this, SIGNAL( stateChanged( int ) ), this, SLOT ( stateChanged( int ) ) ); } YQCheckBox::~YQCheckBox() { // NOP } YCheckBoxState YQCheckBox::value() { switch ( state() ) { case QButton::On: return YCheckBox_on; case QButton::Off: return YCheckBox_off; case QButton::NoChange: return YCheckBox_dont_care; } return YCheckBox_off; } void YQCheckBox::setValue( YCheckBoxState newValue ) { switch ( newValue ) { case YCheckBox_on: QCheckBox::setChecked( true ); setTristate( false ); break; case YCheckBox_off: QCheckBox::setChecked( false ); setTristate( false ); break; case YCheckBox_dont_care: QCheckBox::setTristate( true ); setNoChange(); break; } } void YQCheckBox::setLabel( const string & label ) { setText( fromUTF8( label ) ); YCheckBox::setLabel( label ); } void YQCheckBox::setUseBoldFont( bool useBold ) { setFont( useBold ? YQUI::yqApp()->boldFont() : YQUI::yqApp()->currentFont() ); YCheckBox::setUseBoldFont( useBold ); } void YQCheckBox::setEnabled( bool enabled ) { QCheckBox::setEnabled( enabled ); YWidget::setEnabled( enabled ); } int YQCheckBox::preferredWidth() { return 2*SPACING + sizeHint().width(); } int YQCheckBox::preferredHeight() { return sizeHint().height(); } void YQCheckBox::setSize( int newWidth, int newHeight ) { resize( newWidth, newHeight ); } bool YQCheckBox::setKeyboardFocus() { setFocus(); return true; } void YQCheckBox::stateChanged( int newState ) { // yuiMilestone() << "new state: " << newState << endl; if ( notify() ) YQUI::ui()->sendEvent( new YWidgetEvent( this, YEvent::ValueChanged ) ); } #include "YQCheckBox.moc"
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor