Commit b83b8def authored by schurade's avatar schurade
Browse files

[ADD] put the push button in line with the other gui elements so they can...

[ADD] put the push button in line with the other gui elements so they can directly access properties too
parent 28f6cc77
......@@ -14,6 +14,7 @@ SET(GUI_QT4_MOC_HDRS
WMainWindow.h
WQtNavGLWidget.h
WPropertyManager.h
WQtPushButton.h
datasetbrowser/WQtCheckBox.h
datasetbrowser/WQtDatasetBrowser.h
datasetbrowser/WQtDSBWidget.h
......
......@@ -104,9 +104,10 @@ void WMainWindow::setupGUI( QMainWindow *mainWindow )
connect( m_toolBar->getQuitButton(), SIGNAL( pressed() ), mainWindow, SLOT( close() ) );
connect( m_toolBar->getLoadButton(), SIGNAL( pressed() ), this, SLOT( openLoadDialog() ) );
connect( m_toolBar->getAxiButton(), SIGNAL( toggled( bool ) ), this, SLOT( toggleAxial( bool ) ) );
connect( m_toolBar->getCorButton(), SIGNAL( toggled( bool ) ), this, SLOT( toggleCoronal( bool ) ) );
connect( m_toolBar->getSagButton(), SIGNAL( toggled( bool ) ), this, SLOT( toggleSagittal( bool ) ) );
connect( m_toolBar->getAxiButton(), SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_toolBar->getCorButton(), SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_toolBar->getSagButton(), SIGNAL( pushButtonToggled( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
connect( m_datasetBrowser, SIGNAL( dataSetBrowserEvent( QString, bool ) ), m_propertyManager, SLOT( slotBoolChanged( QString, bool ) ) );
}
......@@ -150,21 +151,6 @@ void WMainWindow::openLoadDialog()
m_loaderSignal( stdFileNames );
}
void WMainWindow::toggleAxial( bool check )
{
m_propertyManager->slotBoolChanged( "showAxial", check );
}
void WMainWindow::toggleCoronal( bool check )
{
m_propertyManager->slotBoolChanged( "showCoronal", check );
}
void WMainWindow::toggleSagittal( bool check )
{
m_propertyManager->slotBoolChanged( "showSagittal", check );
}
boost::signal1< void, std::vector< std::string > >* WMainWindow::getLoaderSignal()
{
return &m_loaderSignal;
......
......@@ -95,10 +95,6 @@ public slots:
*/
void openLoadDialog();
void toggleAxial( bool check );
void toggleCoronal( bool check );
void toggleSagittal( bool check );
private:
QIcon m_mainWindowIcon;
......
//---------------------------------------------------------------------------
//
// 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 <string>
#include "WQtPushButton.h"
WQtPushButton::WQtPushButton( QIcon icon, QString label )
: QPushButton( icon, label )
{
m_name = label;
connect( this, SIGNAL( pressed() ), this, SLOT( emitPressed() ) );
}
WQtPushButton::~WQtPushButton()
{
}
void WQtPushButton::setName( QString name )
{
m_name = name;
}
void WQtPushButton::emitPressed()
{
emit pushButtonPressed( m_name, true );
emit pushButtonToggled( m_name, this->isChecked() );
}
//---------------------------------------------------------------------------
//
// 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 WQTPUSHBUTTON_H
#define WQTPUSHBUTTON_H
#include <string>
#include <QtGui/QPushButton>
/**
* implements a QPushButton with a boost signal
*/
class WQtPushButton : public QPushButton
{
Q_OBJECT
public:
/**
* standard constructor
*/
explicit WQtPushButton( QIcon icon, QString label );
/**
* destructor
*/
virtual ~WQtPushButton();
/**
* setter for name
*/
void setName( QString name );
private:
QString m_name;
public slots:
void emitPressed();
signals:
void pushButtonPressed( QString name, bool value );
void pushButtonToggled( QString name, bool value );
};
#endif // WQTPUSHBUTTON_H
......@@ -22,7 +22,6 @@
//
//---------------------------------------------------------------------------
#include <QtGui/QPushButton>
#include <QtGui/QTabWidget>
#include <QtGui/QHBoxLayout>
......@@ -65,9 +64,9 @@ QWidget* WQtRibbonMenu::setupFileTab()
m_loadIcon.addPixmap( QPixmap( fileopen_xpm ) );
QWidget* filePage = new QWidget();
m_loadButton = new QPushButton( m_loadIcon, QString( "load" ) );
m_saveButton = new QPushButton( m_saveIcon, QString( "save" ) );
m_quitButton = new QPushButton( m_quitIcon, QString( "exit" ) );
m_loadButton = new WQtPushButton( m_loadIcon, QString( "load" ) );
m_saveButton = new WQtPushButton( m_saveIcon, QString( "save" ) );
m_quitButton = new WQtPushButton( m_quitIcon, QString( "exit" ) );
m_loadButton->setMaximumWidth( 50 );
m_saveButton->setMaximumWidth( 50 );
......@@ -93,9 +92,13 @@ QWidget* WQtRibbonMenu::setupModuleTab()
QWidget* modulPage = new QWidget();
m_axiButton = new QPushButton( m_axiIcon, QString( "" ) );
m_corButton = new QPushButton( m_corIcon, QString( "" ) );
m_sagButton = new QPushButton( m_sagIcon, QString( "" ) );
m_axiButton = new WQtPushButton( m_axiIcon, QString( "" ) );
m_corButton = new WQtPushButton( m_corIcon, QString( "" ) );
m_sagButton = new WQtPushButton( m_sagIcon, QString( "" ) );
m_axiButton->setName( QString( "showAxial" ) );
m_corButton->setName( QString( "showCoronal" ) );
m_sagButton->setName( QString( "showSagittal" ) );
m_axiButton->setMaximumWidth( 24 );
m_corButton->setMaximumWidth( 24 );
......@@ -121,31 +124,31 @@ QWidget* WQtRibbonMenu::setupModuleTab()
return modulPage;
}
QPushButton* WQtRibbonMenu::getLoadButton()
WQtPushButton* WQtRibbonMenu::getLoadButton()
{
return m_loadButton;
}
QPushButton* WQtRibbonMenu::getQuitButton()
WQtPushButton* WQtRibbonMenu::getQuitButton()
{
return m_quitButton;
}
QPushButton* WQtRibbonMenu::getAxiButton()
WQtPushButton* WQtRibbonMenu::getAxiButton()
{
return m_axiButton;
}
QPushButton* WQtRibbonMenu::getCorButton()
WQtPushButton* WQtRibbonMenu::getCorButton()
{
return m_corButton;
}
QPushButton* WQtRibbonMenu::getSagButton()
WQtPushButton* WQtRibbonMenu::getSagButton()
{
return m_sagButton;
}
......@@ -25,8 +25,9 @@
#ifndef WQTRIBBONMENU_H
#define WQTRIBBONMENU_H
#include <QtGui/QPushButton>
#include <QtGui/QToolBar>
#include "WQtPushButton.h"
/**
* implementation of a ribbon menu like widget
*/
......@@ -57,12 +58,12 @@ public:
/**
* getter for standard control widgets
*/
QPushButton* getLoadButton();
QPushButton* getQuitButton();
WQtPushButton* getLoadButton();
WQtPushButton* getQuitButton();
QPushButton* getAxiButton();
QPushButton* getCorButton();
QPushButton* getSagButton();
WQtPushButton* getAxiButton();
WQtPushButton* getCorButton();
WQtPushButton* getSagButton();
protected:
private:
......@@ -77,13 +78,13 @@ private:
QIcon m_corIcon;
QIcon m_sagIcon;
QPushButton* m_loadButton;
QPushButton* m_saveButton;
QPushButton* m_quitButton;
WQtPushButton* m_loadButton;
WQtPushButton* m_saveButton;
WQtPushButton* m_quitButton;
QPushButton* m_axiButton;
QPushButton* m_corButton;
QPushButton* m_sagButton;
WQtPushButton* m_axiButton;
WQtPushButton* m_corButton;
WQtPushButton* m_sagButton;
};
#endif // WQTRIBBONMENU_H
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment