Commit 14670a90 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[CHANGE] Changed the compatibles toolbar to be a simple qtoolbar so that it

does not change the size of the window if there are too many buttons.
Instead it shows an extension button. Additionally made the toolbar be shown
below the ribbon menu.
parent 6925c70a
......@@ -190,8 +190,8 @@ void WMainWindow::setupCompatiblesToolBar()
{
m_iconManager.addIcon( std::string( "o" ), o_xpm ); // duumy icon for modules
m_compatiblesToolBar = new WQtRibbonMenu( this );
m_compatiblesToolBar = new WQtToolBar( this );
addToolBarBreak( Qt::TopToolBarArea );
addToolBar( Qt::TopToolBarArea, m_compatiblesToolBar );
}
......@@ -205,7 +205,7 @@ WQtRibbonMenu* WMainWindow::getRibbonMenu()
return m_ribbonMenu;
}
WQtRibbonMenu* WMainWindow::getCompatiblesToolBar()
WQtToolBar* WMainWindow::getCompatiblesToolBar()
{
return m_compatiblesToolBar;
}
......
......@@ -43,6 +43,7 @@
#include "WQtNavGLWidget.h"
#include "ribbonMenu/WQtRibbonMenu.h"
#include "WQtCustomDockWidget.h"
#include "WQtToolBar.h"
#include "WIconManager.h"
#include "WPropertyManager.h"
......@@ -86,7 +87,7 @@ public:
/**
* returns a pointer to the tool bar showing the compatible modules
*/
WQtRibbonMenu* getCompatiblesToolBar();
WQtToolBar* getCompatiblesToolBar();
/**
......@@ -184,7 +185,7 @@ private:
WQtRibbonMenu* m_ribbonMenu; //!< The ribbon menu of the main window.
WQtRibbonMenu* m_compatiblesToolBar; //!< This toolbar shows the compatible modules if a module is selcted in the dataset browser
WQtToolBar* m_compatiblesToolBar; //!< This toolbar shows the compatible modules if a module is selected in the dataset browser
WQtDatasetBrowser* m_datasetBrowser; //!< dataset browser
......
//---------------------------------------------------------------------------
//
// 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 "WQtToolBar.h"
WQtToolBar::WQtToolBar( QWidget* parent )
: QToolBar( parent )
{
this->setAllowedAreas( Qt::TopToolBarArea | Qt::BottomToolBarArea );
}
WQtToolBar::~WQtToolBar()
{
}
WQtPushButton* WQtToolBar::addPushButton( QString name, QIcon icon, QString label )
{
WQtPushButton* button = new WQtPushButton( icon, label );
button->setName( name );
addWidget( button );
return button;
}
void WQtToolBar::clearButtons()
{
clear();
}
//---------------------------------------------------------------------------
//
// 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 WQTTOOLBAR_H
#define WQTTOOLBAR_H
#include <QtGui/QToolBar>
#include "guiElements/WQtPushButton.h"
/**
* TODO(wiebel): Document this!
*/
class WQtToolBar : public QToolBar
{
public:
/**
* Constructs the toolbar.
* \param parent the parent widget of this widget, i.e. the widget that manages it.
*/
explicit WQtToolBar( QWidget* parent );
/**
* destructor
*/
virtual ~WQtToolBar();
/**
* Adds a push button to the toolbar. The button is identifiable by its name.
* \param name a name for the new button to identifie it
* \param icon and icon for the button
* \param label The optional text that is displayed besides the icon on the button.
*/
WQtPushButton* addPushButton( QString name, QIcon icon, QString label = 0 );
/**
* Removes all buttons,
*/
void clearButtons();
protected:
private:
};
#endif // WQTTOOLBAR_H
......@@ -242,7 +242,7 @@ void WQtDatasetBrowser::selectTreeItem()
}
boost::shared_ptr< WModule >module;
m_mainWindow->getCompatiblesToolBar()->clearNonPersistentTabs();
m_mainWindow->getCompatiblesToolBar()->clearButtons();
if ( m_treeWidget->selectedItems().at( 0 )->type() == 1 )
{
......@@ -254,12 +254,10 @@ void WQtDatasetBrowser::selectTreeItem()
}
// every module may have compatibles: create ribbon menu entry
m_mainWindow->getCompatiblesToolBar()->addTab( QString( "Compatible Modules" ), false );
std::set< boost::shared_ptr< WModule > > comps = WModuleFactory::getModuleFactory()->getCompatiblePrototypes( module );
for ( std::set< boost::shared_ptr< WModule > >::iterator iter = comps.begin(); iter != comps.end(); ++iter )
{
WQtPushButton* button = m_mainWindow->getCompatiblesToolBar()->addPushButton( QString( ( *iter )->getName().c_str() ),
QString( "Compatible Modules" ),
m_mainWindow->getIconManager()->getIcon( "o" ),
QString( ( *iter )->getName().c_str() ) );
......
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