Commit ef35d1d0 authored by Jan Möbius's avatar Jan Möbius

Better handling of toolbars in core

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@3572 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 25455fd0
......@@ -140,8 +140,9 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
// ======================================================================
mainToolbar_ = new QToolBar("Main Toolbar");
mainToolbar_->setWindowTitle("Main Toolbar");
mainToolbar_->setObjectName("MainToolbar");
addToolBar(mainToolbar_);
slotAddToolbar(mainToolbar_);
// ======================================================================
// Get Toolbar from examiner and integrate it into main window
......
......@@ -52,16 +52,13 @@
void CoreWidget::slotAddToolbar(QToolBar* _toolbar) {
// int newNumber = toolbarCount_;
// toolbarCount_++;
// QString number = QString::number(newNumber);
// _toolbar->setObjectName("Toolbar" + number);
for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
if ( toolbars_[i]->windowTitle() == _toolbar->windowTitle() ) {
std::cerr << "Toolbar exists! " << std::endl;
emit log(LOGERR,"slotAddToolbar: Toolbar already added to system: " + _toolbar->windowTitle() );
return;
}
}
_toolbar->setObjectName( _toolbar->windowTitle() );
toolbars_.push_back( _toolbar );
addToolBar( _toolbar );
......@@ -70,23 +67,28 @@ void CoreWidget::slotAddToolbar(QToolBar* _toolbar) {
void CoreWidget::getToolBar( QString _name, QToolBar*& _toolbar) {
for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
if ( toolbars_[i]->windowTitle() == _name ) {
std::cerr << "Toolbar found! " << std::endl;
_toolbar = toolbars_[i];
return;
}
}
_toolbar = 0;
emit log(LOGERR,"getToolBar: Toolbar not found." );
}
void CoreWidget::slotRemoveToolbar(QToolBar* _toolbar) {
for ( uint i = 0 ; i < toolbars_.size(); ++i ) {
if ( toolbars_[i]->windowTitle() == _toolbar->windowTitle() ) {
std::cerr << "Todo : erase Toolbar from list" << std::endl;
removeToolBar( _toolbar );
return;
}
}
emit log(LOGERR,"Remove Toolbar: Toolbar not found." );
......
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