libyui-qt
2.43.5
|
00001 /* 00002 Copyright (C) 2000-2012 Novell, Inc 00003 This library is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU Lesser General Public License as 00005 published by the Free Software Foundation; either version 2.1 of the 00006 License, or (at your option) version 3.0 of the License. This library 00007 is distributed in the hope that it will be useful, but WITHOUT ANY 00008 WARRANTY; without even the implied warranty of MERCHANTABILITY or 00009 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00010 License for more details. You should have received a copy of the GNU 00011 Lesser General Public License along with this library; if not, write 00012 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth 00013 Floor, Boston, MA 02110-1301 USA 00014 */ 00015 00016 00017 /*-/ 00018 00019 File: YQWizardButton.cc 00020 00021 Author: Stefan Hundhammer <sh@suse.de> 00022 00023 /-*/ 00024 00025 00026 #include <qpushbutton.h> 00027 #include <qsize.h> 00028 #define YUILogComponent "qt-ui" 00029 #include <yui/YUILog.h> 00030 00031 #include "utf8.h" 00032 #include "YQUI.h" 00033 #include "YQWizardButton.h" 00034 #include "YQWizard.h" 00035 00036 00037 YQWizardButton::YQWizardButton( YQWizard * wizard, 00038 QWidget * buttonParent, 00039 const std::string & label ) 00040 : YQGenericButton( wizard, label ) 00041 , _wizard( wizard ) 00042 { 00043 QPushButton * button = new QPushButton( fromUTF8( label ), buttonParent ); 00044 Q_CHECK_PTR( button ); 00045 00046 setQPushButton( button ); 00047 setWidgetRep( button ); 00048 00049 connect( button, SIGNAL( clicked() ), 00050 this, SIGNAL( clicked() ) ); 00051 00052 00053 // This widget itself will never be visible, only its button - which is not 00054 // a child of this widget. 00055 QWidget::hide(); 00056 } 00057 00058 00059 YQWizardButton::~YQWizardButton() 00060 { 00061 // Don't delete qPushButton() here - its parent (buttonParent) will take 00062 // care of that! 00063 } 00064 00065 00066 void YQWizardButton::hide() 00067 { 00068 if ( qPushButton() ) 00069 qPushButton()->hide(); 00070 } 00071 00072 00073 void YQWizardButton::show() 00074 { 00075 if ( qPushButton() ) 00076 qPushButton()->show(); 00077 } 00078 00079 00080 bool YQWizardButton::isShown() const 00081 { 00082 if ( qPushButton() ) 00083 return !qPushButton()->isHidden(); 00084 else 00085 return false; 00086 } 00087 00088 00089 bool YQWizardButton::isHidden() const 00090 { 00091 return ! isShown(); 00092 } 00093 00094 00095 int YQWizardButton::preferredWidth() 00096 { 00097 // This widget doesn't have a YWidget-based visual representation, it's 00098 // only a YWidget for shortcut checking etc. 00099 00100 return 0; 00101 } 00102 00103 00104 int YQWizardButton::preferredHeight() 00105 { 00106 // This widget doesn't have a YWidget-based visual representation, it's 00107 // only a YWidget for shortcut checking etc. 00108 00109 return 0; 00110 } 00111 00112 00113 void YQWizardButton::setSize( int newWidth, int newHeight ) 00114 { 00115 // NOP 00116 } 00117 00118 00119 00120 #include "YQWizardButton.moc"