Commit 6db23ea6 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum

[CHANGE] - now, bool properties are handled by QActions in the gui and the toolbars

parent 6fa7f7db
...@@ -31,6 +31,13 @@ useAutoDisplay = no # automatically add a standard module after loading a data m ...@@ -31,6 +31,13 @@ useAutoDisplay = no # automatically add a standard module after loading a data m
toolBarStyle = 0 toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style
# Position of the compatibles toolbar
# 0 -> top
# 1 -> bottom
# 2 -> left
# 3 -> right
compatiblesToolBarPos = 0 # position of the compatibles toolbar
#################################################################### ####################################################################
# Dataset Browser # Dataset Browser
......
...@@ -37,6 +37,13 @@ toolBarIconText = no # show text next to module's icon ...@@ -37,6 +37,13 @@ toolBarIconText = no # show text next to module's icon
toolBarStyle = 0 toolBarStyle = 0
compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style compatiblesToolBarStyle = 0 # this pref allows the compatibles toolbar to have a different style
# Position of the compatibles toolbar
# 0 -> top
# 1 -> bottom
# 2 -> left
# 3 -> right
compatiblesToolBarPos = 0 # position of the compatibles toolbar
#################################################################### ####################################################################
# Dataset Browser # Dataset Browser
......
...@@ -14,8 +14,10 @@ SET(GUI_QT4_MOC_HDRS ...@@ -14,8 +14,10 @@ SET(GUI_QT4_MOC_HDRS
WMainWindow.h WMainWindow.h
WQtConfigWidget.h WQtConfigWidget.h
WQtNavGLWidget.h WQtNavGLWidget.h
WQtCombinerToolbar.h
guiElements/WQtPushButton.h guiElements/WQtPushButton.h
guiElements/WQtApplyModuleAction.h guiElements/WQtApplyModuleAction.h
guiElements/WQtPropertyBoolAction.h
datasetbrowser/WPropertyWidget.h datasetbrowser/WPropertyWidget.h
datasetbrowser/WPropertyBoolWidget.h datasetbrowser/WPropertyBoolWidget.h
datasetbrowser/WPropertyIntWidget.h datasetbrowser/WPropertyIntWidget.h
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "events/WModuleReadyEvent.h" #include "events/WModuleReadyEvent.h"
#include "events/WModuleCrashEvent.h" #include "events/WModuleCrashEvent.h"
#include "events/WEventTypes.h" #include "events/WEventTypes.h"
#include "guiElements/WQtPropertyBoolAction.h"
#include "datasetbrowser/WPropertyBoolWidget.h" #include "datasetbrowser/WPropertyBoolWidget.h"
#include "../../common/WColor.h" #include "../../common/WColor.h"
#include "../../common/WPreferences.h" #include "../../common/WPreferences.h"
...@@ -66,6 +67,7 @@ ...@@ -66,6 +67,7 @@
WMainWindow::WMainWindow() : WMainWindow::WMainWindow() :
QMainWindow(), QMainWindow(),
m_currentCompatiblesToolbar( NULL ),
m_iconManager(), m_iconManager(),
m_fibLoaded( false ) m_fibLoaded( false )
{ {
...@@ -82,6 +84,7 @@ void WMainWindow::setupGUI() ...@@ -82,6 +84,7 @@ void WMainWindow::setupGUI()
m_iconManager.addIcon( std::string( "moduleBusy" ), moduleBusy_xpm ); m_iconManager.addIcon( std::string( "moduleBusy" ), moduleBusy_xpm );
m_iconManager.addIcon( std::string( "moduleCrashed" ), moduleCrashed_xpm ); m_iconManager.addIcon( std::string( "moduleCrashed" ), moduleCrashed_xpm );
m_iconManager.addIcon( std::string( "remove" ), remove_xpm ); m_iconManager.addIcon( std::string( "remove" ), remove_xpm );
m_iconManager.addIcon( std::string( "o" ), o_xpm ); // duumy icon for modules
if( objectName().isEmpty() ) if( objectName().isEmpty() )
{ {
...@@ -215,8 +218,6 @@ void WMainWindow::setupGUI() ...@@ -215,8 +218,6 @@ void WMainWindow::setupGUI()
} }
setupPermanentToolBar(); setupPermanentToolBar();
setupCompatiblesToolBar();
} }
void WMainWindow::setupPermanentToolBar() void WMainWindow::setupPermanentToolBar()
...@@ -263,7 +264,6 @@ void WMainWindow::setupPermanentToolBar() ...@@ -263,7 +264,6 @@ void WMainWindow::setupPermanentToolBar()
m_permanentToolBar->addWidget( projectSaveButton ); m_permanentToolBar->addWidget( projectSaveButton );
m_permanentToolBar->addSeparator(); m_permanentToolBar->addSeparator();
m_permanentToolBar->addWidget( roiButton ); m_permanentToolBar->addWidget( roiButton );
m_permanentToolBar->addSeparator(); m_permanentToolBar->addSeparator();
addToolBar( Qt::TopToolBarArea, m_permanentToolBar ); addToolBar( Qt::TopToolBarArea, m_permanentToolBar );
...@@ -337,11 +337,11 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module ) ...@@ -337,11 +337,11 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
} }
else else
{ {
WPropertyBoolWidget* button = new WPropertyBoolWidget( prop->toPropBool(), NULL, m_permanentToolBar, true ); WQtPropertyBoolAction* a = new WQtPropertyBoolAction( prop->toPropBool(), m_permanentToolBar );
button->setToolTip( "Toggle Axial Slice" ); a->setToolTip( "Toggle Axial Slice" );
button->getButton()->setMaximumSize( 24, 24 ); a->setText( "Toggle Axial Slice" );
button->getButton()->setIcon( m_iconManager.getIcon( "axial" ) ); a->setIcon( m_iconManager.getIcon( "axial" ) );
m_permanentToolBar->addWidget( button ); m_permanentToolBar->addAction( a );
} }
prop = module->getProperties()->findProperty( "showCoronal" ); prop = module->getProperties()->findProperty( "showCoronal" );
...@@ -353,11 +353,11 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module ) ...@@ -353,11 +353,11 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
} }
else else
{ {
WPropertyBoolWidget* button = new WPropertyBoolWidget( prop->toPropBool(), NULL, m_permanentToolBar, true ); WQtPropertyBoolAction* a = new WQtPropertyBoolAction( prop->toPropBool(), m_permanentToolBar );
button->setToolTip( "Toggle Coronal Slice" ); a->setToolTip( "Toggle Coronal Slice" );
button->getButton()->setMaximumSize( 24, 24 ); a->setText( "Toggle Coronal Slice" );
button->getButton()->setIcon( m_iconManager.getIcon( "coronal" ) ); a->setIcon( m_iconManager.getIcon( "coronal" ) );
m_permanentToolBar->addWidget( button ); m_permanentToolBar->addAction( a );
} }
prop = module->getProperties()->findProperty( "showSagittal" ); prop = module->getProperties()->findProperty( "showSagittal" );
...@@ -369,11 +369,11 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module ) ...@@ -369,11 +369,11 @@ void WMainWindow::moduleSpecificSetup( boost::shared_ptr< WModule > module )
} }
else else
{ {
WPropertyBoolWidget* button = new WPropertyBoolWidget( prop->toPropBool(), NULL, m_permanentToolBar, true ); WQtPropertyBoolAction* a = new WQtPropertyBoolAction( prop->toPropBool(), m_permanentToolBar );
button->setToolTip( "Toggle Sagittal Slice" ); a->setToolTip( "Toggle Saggital Slice" );
button->getButton()->setMaximumSize( 24, 24 ); a->setText( "Toggle Saggital Slice" );
button->getButton()->setIcon( m_iconManager.getIcon( "sagittal" ) ); a->setIcon( m_iconManager.getIcon( "sagittal" ) );
m_permanentToolBar->addWidget( button ); m_permanentToolBar->addAction( a );
} }
// now setup the nav widget sliders // now setup the nav widget sliders
...@@ -438,28 +438,10 @@ Qt::ToolButtonStyle WMainWindow::getToolbarStyle() const ...@@ -438,28 +438,10 @@ Qt::ToolButtonStyle WMainWindow::getToolbarStyle() const
return static_cast< Qt::ToolButtonStyle >( toolBarStyle ); return static_cast< Qt::ToolButtonStyle >( toolBarStyle );
} }
Qt::ToolButtonStyle WMainWindow::getCompatiblesToolbarStyle() const void WMainWindow::setCompatiblesToolbar( WQtCombinerToolbar* toolbar )
{
// this sets the toolbar style
int compToolBarStyle = getToolbarStyle(); // this defaults to the global toolbar style
WPreferences::getPreference( "qt4gui.compatiblesToolBarStyle", &compToolBarStyle );
if ( ( compToolBarStyle < 0 ) || ( compToolBarStyle > 3 ) ) // ensure a valid value
{
compToolBarStyle = 0;
}
// cast and return
return static_cast< Qt::ToolButtonStyle >( compToolBarStyle );
}
void WMainWindow::setupCompatiblesToolBar()
{ {
m_iconManager.addIcon( std::string( "o" ), o_xpm ); // duumy icon for modules delete m_currentCompatiblesToolbar;
m_currentCompatiblesToolbar = toolbar;
m_compatiblesToolBar = new WQtToolBar( "Compatible Modules Toolbar", this );
// this sets the toolbar style
m_compatiblesToolBar->setToolButtonStyle( getCompatiblesToolbarStyle() );
// optional toolbar break // optional toolbar break
{ {
...@@ -469,13 +451,35 @@ void WMainWindow::setupCompatiblesToolBar() ...@@ -469,13 +451,35 @@ void WMainWindow::setupCompatiblesToolBar()
{ {
// Blank toolbar for nicer layout in case of toolbar break // Blank toolbar for nicer layout in case of toolbar break
// This can be done nicer very probably. // This can be done nicer very probably.
WQtToolBar* blankToolBar = new WQtToolBar( "Blank Toolbar", this ); //WQtToolBar* blankToolBar = new WQtToolBar( "Blank Toolbar", this );
addToolBar( Qt::TopToolBarArea, blankToolBar ); //addToolBar( Qt::TopToolBarArea, blankToolBar );
addToolBarBreak( Qt::TopToolBarArea ); addToolBarBreak( Qt::TopToolBarArea );
} }
} }
addToolBar( Qt::TopToolBarArea, m_compatiblesToolBar ); // and the position of the toolbar
int compatiblesToolbarPos = 0;
WPreferences::getPreference( "qt4gui.compatiblesToolBarPos", &compatiblesToolbarPos );
Qt::ToolBarArea pos = Qt::TopToolBarArea;
switch ( compatiblesToolbarPos )
{
case 0:
pos = Qt::TopToolBarArea;
break;
case 1:
pos = Qt::BottomToolBarArea;
break;
case 2:
pos = Qt::LeftToolBarArea;
break;
case 3:
pos = Qt::RightToolBarArea;
break;
default:
pos = Qt::TopToolBarArea;
break;
}
addToolBar( pos, m_currentCompatiblesToolbar );
} }
WQtDatasetBrowser* WMainWindow::getDatasetBrowser() WQtDatasetBrowser* WMainWindow::getDatasetBrowser()
...@@ -483,11 +487,6 @@ WQtDatasetBrowser* WMainWindow::getDatasetBrowser() ...@@ -483,11 +487,6 @@ WQtDatasetBrowser* WMainWindow::getDatasetBrowser()
return m_datasetBrowser; return m_datasetBrowser;
} }
WQtToolBar* WMainWindow::getCompatiblesToolBar()
{
return m_compatiblesToolBar;
}
void WMainWindow::projectSave( const std::vector< boost::shared_ptr< WProjectFileIO > >& writer ) void WMainWindow::projectSave( const std::vector< boost::shared_ptr< WProjectFileIO > >& writer )
{ {
QFileDialog fd; QFileDialog fd;
......
...@@ -45,6 +45,7 @@ ...@@ -45,6 +45,7 @@
#include "ribbonMenu/WQtRibbonMenu.h" #include "ribbonMenu/WQtRibbonMenu.h"
#include "WQtCustomDockWidget.h" #include "WQtCustomDockWidget.h"
#include "WQtToolBar.h" #include "WQtToolBar.h"
#include "WQtCombinerToolbar.h"
#include "WIconManager.h" #include "WIconManager.h"
#include "datasetbrowser/WQtDatasetBrowser.h" #include "datasetbrowser/WQtDatasetBrowser.h"
...@@ -86,11 +87,6 @@ public: ...@@ -86,11 +87,6 @@ public:
*/ */
WQtRibbonMenu* getRibbonMenu(); WQtRibbonMenu* getRibbonMenu();
/**
* returns a pointer to the tool bar showing the compatible modules
*/
WQtToolBar* getCompatiblesToolBar();
/** /**
* Return icon manager * Return icon manager
*/ */
...@@ -127,12 +123,11 @@ public: ...@@ -127,12 +123,11 @@ public:
Qt::ToolButtonStyle getToolbarStyle() const; Qt::ToolButtonStyle getToolbarStyle() const;
/** /**
* This method returns the default style for the compatibles toolbar. It allows modification of the style for especially for the compatibles * This method removes the old compatibles toolbar and sets the specified one.
* toolbar.
* *
* \return the toolbar style for the compatibles toolbar * \param toolbar the toolbar to set. If NULL, the toolbar gets reset.
*/ */
Qt::ToolButtonStyle getCompatiblesToolbarStyle() const; void setCompatiblesToolbar( WQtCombinerToolbar* toolbar = NULL );
protected: protected:
...@@ -239,9 +234,9 @@ private: ...@@ -239,9 +234,9 @@ private:
void setupPermanentToolBar(); void setupPermanentToolBar();
/** /**
* Sets up the initial state of the tool bar showing the compatible modules * The currently set compatibles toolbar
*/ */
void setupCompatiblesToolBar(); WQtCombinerToolbar* m_currentCompatiblesToolbar;
WIconManager m_iconManager; //!< manager to provide icons in the gui thread WIconManager m_iconManager; //!< manager to provide icons in the gui thread
...@@ -251,8 +246,6 @@ private: ...@@ -251,8 +246,6 @@ private:
WQtToolBar* m_permanentToolBar; //!< The permanent toolbar of the main window. WQtToolBar* m_permanentToolBar; //!< The permanent toolbar of the main window.
WQtToolBar* m_compatiblesToolBar; //!< This toolbar shows the compatible modules if a module is selected in the dataset browser
WQtDatasetBrowser* m_datasetBrowser; //!< dataset browser WQtDatasetBrowser* m_datasetBrowser; //!< dataset browser
boost::shared_ptr<WQtGLWidget> m_mainGLWidget; //!< the main GL widget of the GUI boost::shared_ptr<WQtGLWidget> m_mainGLWidget; //!< the main GL widget of the GUI
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <list>
#include <QtGui/QAction>
#include <QtGui/QPushButton>
#include <QtGui/QMenu>
#include "../../common/WPreferences.h"
#include "WMainWindow.h"
#include "WQtToolBar.h"
#include "guiElements/WQtApplyModuleAction.h"
#include "WQtCombinerToolbar.h"
WQtCombinerToolbar::WQtCombinerToolbar( WMainWindow* parent, WModuleFactory::CompatiblesList compatibles )
: QToolBar( "Compatible Modules", parent )
{
// setup toolbar
setAllowedAreas( Qt::AllToolBarAreas );
// this sets the toolbar style
int compToolBarStyle = parent->getToolbarStyle(); // this defaults to the global toolbar style
WPreferences::getPreference( "qt4gui.compatiblesToolBarStyle", &compToolBarStyle );
if ( ( compToolBarStyle < 0 ) || ( compToolBarStyle > 3 ) ) // ensure a valid value
{
compToolBarStyle = 0;
}
// cast and set
setToolButtonStyle( static_cast< Qt::ToolButtonStyle >( compToolBarStyle ) );
// create an action for each group:
for ( WModuleFactory::CompatiblesList::const_iterator groups = compatibles.begin(); groups != compatibles.end(); ++groups )
{
// create a new action for this group
WQtApplyModuleAction* group = new WQtApplyModuleAction( this,
parent->getIconManager(),
*( *groups ).second.begin() );
addAction( group );
// only add a sub menu if there are more than 1 items in the group
if ( ( *groups ).second.size() > 1 )
{
QMenu* groupMenu = new QMenu( this );
// iterate all the children
for ( WModuleFactory::CompatibleCombiners::const_iterator combiner = ( *groups ).second.begin();
combiner != ( *groups ).second.end(); ++combiner )
{
WQtApplyModuleAction* a = new WQtApplyModuleAction( this,
parent->getIconManager(),
( *combiner ),
true );
a->setIconVisibleInMenu( true );
groupMenu->addAction( a );
}
group->setMenu( groupMenu );
}
}
// The following makes the bar having button size from the beginning.
QPushButton* dummyButton = new QPushButton;
dummyButton->setFixedWidth( 0 );
addWidget( dummyButton );
}
WQtCombinerToolbar::~WQtCombinerToolbar()
{
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTCOMBINERTOOLBAR_H
#define WQTCOMBINERTOOLBAR_H
#include <QtGui/QToolBar>
#include "../../kernel/WModuleFactory.h"
class WMainWindow;
/**
* This is a toolbar. Its main usage for now is the "compatible modules" toolbar.
*/
class WQtCombinerToolbar : public QToolBar
{
Q_OBJECT
public:
/**
* Constructs the toolbar.
* \param parent the parent widget of this widget, i.e. the widget that manages it.
* \param compatibles the list of combiners
*/
explicit WQtCombinerToolbar( WMainWindow* parent, WModuleFactory::CompatiblesList compatibles );
/**
* destructor
*/
virtual ~WQtCombinerToolbar();
protected:
private:
};
#endif // WQTCOMBINERTOOLBAR_H
...@@ -269,6 +269,10 @@ void WQtConfigWidget::registerComponents() ...@@ -269,6 +269,10 @@ void WQtConfigWidget::registerComponents()
tbs->setMax( 3 ); tbs->setMax( 3 );
ctbs->setMin( 0 ); ctbs->setMin( 0 );
ctbs->setMax( 3 ); ctbs->setMax( 3 );
WPropInt ctbpos = m_defaultProperties->addProperty( "qt4gui.compatiblesToolBarPos", "The position of the compatibles toolbar in OpenWalnut", 0,
m_propCondition );
ctbpos->setMin( 0 );
ctbpos->setMax( 3 );
WPropGroup moduleWhiteList = m_defaultProperties->addPropertyGroup( "modules.whiteListGroup", "moduleWhiteList" ); WPropGroup moduleWhiteList = m_defaultProperties->addPropertyGroup( "modules.whiteListGroup", "moduleWhiteList" );
m_skipPropertyWrite.push_back( "modules.whiteListGroup" ); m_skipPropertyWrite.push_back( "modules.whiteListGroup" );
......
...@@ -24,6 +24,8 @@ ...@@ -24,6 +24,8 @@
#include <list> #include <list>
#include <QtGui/QAction>
#include "WQtToolBar.h" #include "WQtToolBar.h"
WQtToolBar::WQtToolBar( const QString & title, QWidget* parent ) WQtToolBar::WQtToolBar( const QString & title, QWidget* parent )
......
...@@ -26,29 +26,19 @@ ...@@ -26,29 +26,19 @@
#include "../../../common/WPropertyVariable.h" #include "../../../common/WPropertyVariable.h"
WPropertyBoolWidget::WPropertyBoolWidget( WPropBool property, QGridLayout* propertyGrid, QWidget* parent, bool asButton ): WPropertyBoolWidget::WPropertyBoolWidget( WPropBool property, QGridLayout* propertyGrid, QWidget* parent ):
WPropertyWidget( property, propertyGrid, parent ), WPropertyWidget( property, propertyGrid, parent ),
m_boolProperty( property ), m_boolProperty( property ),
m_checkbox( &m_parameterWidgets ), m_checkbox( &m_parameterWidgets ),
m_button( &m_parameterWidgets ),
m_layout( &m_parameterWidgets ), m_layout( &m_parameterWidgets ),
m_asButton( asButton ),
m_asText( &m_informationWidgets ), m_asText( &m_informationWidgets ),
m_infoLayout( &m_informationWidgets ) m_infoLayout( &m_informationWidgets )
{ {
// initialize members // initialize members
m_button.setCheckable( true );
update(); update();
// layout both against each other // layout both against each other
m_button.setVisible( m_asButton ); m_layout.addWidget( static_cast< QWidget* >( &m_checkbox ) );
m_checkbox.setVisible( !m_asButton );
m_layout.addWidget( m_asButton ? static_cast< QWidget* >( &m_button ) : static_cast< QWidget* >( &m_checkbox ) );
if ( m_asButton )
{
m_layout.setContentsMargins( 1, 1, 1, 1 );
}
m_parameterWidgets.setLayout( &m_layout ); m_parameterWidgets.setLayout( &m_layout );
// Information Output ( Property Purpose = PV_PURPOSE_INFORMATION ) // Information Output ( Property Purpose = PV_PURPOSE_INFORMATION )
...@@ -56,8 +46,7 @@ WPropertyBoolWidget::WPropertyBoolWidget( WPropBool property, QGridLayout* prope ...@@ -56,8 +46,7 @@ WPropertyBoolWidget::WPropertyBoolWidget( WPropBool property, QGridLayout* prope
m_informationWidgets.setLayout( &m_infoLayout ); m_informationWidgets.setLayout( &m_infoLayout );
// connect the modification signal of m_checkbox with our callback // connect the modification signal of m_checkbox with our callback
connect( &m_checkbox, SIGNAL( toggled( bool ) ), this, SLOT( changed() ) ); connect( &m_checkbox, SIGNAL( toggled( bool ) ), this, SLOT( checkboxChanged() ) );
connect( &m_button, SIGNAL( toggled( bool ) ), this, SLOT( changed() ) );
} }
WPropertyBoolWidget::~WPropertyBoolWidget() WPropertyBoolWidget::~WPropertyBoolWidget()
...@@ -69,25 +58,12 @@ void WPropertyBoolWidget::update() ...@@ -69,25 +58,12 @@ void WPropertyBoolWidget::update()
{ {
// simply set the new state // simply set the new state
m_checkbox.setChecked( m_boolProperty->get() ); m_checkbox.setChecked( m_boolProperty->get() );
m_button.setChecked( m_boolProperty->get() );
m_asText.setText( m_boolProperty->get() ? QString( "Yes" ) : QString( "No" ) ); m_asText.setText( m_boolProperty->get() ? QString( "Yes" ) : QString( "No" ) );
} }
QPushButton* WPropertyBoolWidget::getButton() void WPropertyBoolWidget::checkboxChanged()
{ {
return &m_button; invalidate( !m_boolProperty->set( m_checkbox.isChecked() ) );
} m_checkbox.setChecked( m_boolProperty->get() );
void WPropertyBoolWidget::changed()
{
// set the value
if ( m_asButton )
{
invalidate( !m_boolProperty->set( m_button.isChecked() ) );
}
else
{
invalidate( !m_boolProperty->set( m_checkbox.isChecked() ) );
}
} }
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include <string> #include <string>