OpenWalnut
1.5.0dev
src
qtgui
WQtToolBarBase.cpp
1
//---------------------------------------------------------------------------
2
//
3
// Project: OpenWalnut ( http://www.openwalnut.org )
4
//
5
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
6
// For more information see http://www.openwalnut.org/copying
7
//
8
// This file is part of OpenWalnut.
9
//
10
// OpenWalnut is free software: you can redistribute it and/or modify
11
// it under the terms of the GNU Lesser General Public License as published by
12
// the Free Software Foundation, either version 3 of the License, or
13
// (at your option) any later version.
14
//
15
// OpenWalnut is distributed in the hope that it will be useful,
16
// but WITHOUT ANY WARRANTY; without even the implied warranty of
17
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
// GNU Lesser General Public License for more details.
19
//
20
// You should have received a copy of the GNU Lesser General Public License
21
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
22
//
23
//---------------------------------------------------------------------------
24
25
#include "WMainWindow.h"
26
27
#include "WSettingMenu.h"
28
29
#include "WQtToolBarBase.h"
30
31
WQtToolBarBase::WQtToolBarBase
(
const
QString& title,
WMainWindow
* parent ):
32
QToolBar
( title, parent )
33
{
34
setObjectName( title );
35
36
setAllowedAreas( Qt::AllToolBarAreas );
37
38
setMinimumWidth( 60 );
39
setMinimumHeight( 40 );
40
41
// automatism for toolbar style
42
QList< QString >
styleOptions;
43
styleOptions.push_back(
"Icon Only"
);
44
styleOptions.push_back(
"Text Only"
);
45
styleOptions.push_back(
"Text Besides Icon"
);
46
styleOptions.push_back(
"Text Under Icon"
);
47
styleOptions.push_back(
"Follow Style"
);
48
m_styleOptionMenu
=
new
WSettingMenu
( parent,
"qtgui/"
+ windowTitle().toStdString() +
"toolbarStyle"
,
49
title.toStdString(),
50
"Allows one to change the style of toolbars."
,
51
0,
52
styleOptions );
53
connect(
m_styleOptionMenu
, SIGNAL( change(
unsigned
int
) ),
this
, SLOT(
handleStyleUpdate
(
unsigned
int
) ) );
54
handleStyleUpdate
(
m_styleOptionMenu
->
get
() );
55
}
56
57
WQtToolBarBase::~WQtToolBarBase
()
58
{
59
// cleanup
60
}
61
62
QMenu
*
WQtToolBarBase::getStyleMenu
( QString title )
const
63
{
64
m_styleOptionMenu
->setTitle( title );
65
return
m_styleOptionMenu
;
66
}
67
68
void
WQtToolBarBase::handleStyleUpdate
(
unsigned
int
index )
69
{
70
setToolButtonStyle(
static_cast<
Qt::ToolButtonStyle
>
( index ) );
71
}
72
QList
QMenu
QToolBar
WMainWindow
This class contains the main window and the layout of the widgets within the window.
Definition:
WMainWindow.h:66
WQtToolBarBase::~WQtToolBarBase
virtual ~WQtToolBarBase()
Destructor.
Definition:
WQtToolBarBase.cpp:57
WQtToolBarBase::m_styleOptionMenu
WSettingMenu * m_styleOptionMenu
The options for toolbar style.
Definition:
WQtToolBarBase.h:67
WQtToolBarBase::WQtToolBarBase
WQtToolBarBase(const QString &title, WMainWindow *parent)
Constructs the toolbar.
Definition:
WQtToolBarBase.cpp:31
WQtToolBarBase::handleStyleUpdate
void handleStyleUpdate(unsigned int index)
Used to update the style of this toolbar.
Definition:
WQtToolBarBase.cpp:68
WQtToolBarBase::getStyleMenu
QMenu * getStyleMenu(QString title=QString("Toolbar Style")) const
Returns a menu for styling the menu items.
Definition:
WQtToolBarBase.cpp:62
WSettingMenu
Similar to WSettingAction, this can handle a multi-option setting as QMenu.
Definition:
WSettingMenu.h:36
WSettingMenu::get
unsigned int get() const
Returns the current setting.
Definition:
WSettingMenu.cpp:88
Generated by
1.9.1