Commit ff858c7f authored by Mike Kremer's avatar Mike Kremer
Browse files

Do not reset picking toolbar's position and orientation each time it is shown....

Do not reset picking toolbar's position and orientation each time it is shown. This only accounts if the picking toolbar is not rendered into the scene.

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@13197 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 5e3b1896
...@@ -58,6 +58,8 @@ ...@@ -58,6 +58,8 @@
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include <set>
#include "OpenFlipper/common/Types.hh" #include "OpenFlipper/common/Types.hh"
#include <OpenFlipper/common/GlobalOptions.hh> #include <OpenFlipper/common/GlobalOptions.hh>
#include <OpenFlipper/BasePlugin/ContextMenuInterface.hh> #include <OpenFlipper/BasePlugin/ContextMenuInterface.hh>
...@@ -674,6 +676,9 @@ public: ...@@ -674,6 +676,9 @@ public:
/// Extra toolbar not in scene for picking /// Extra toolbar not in scene for picking
QToolBar* pickToolBarExternal_; QToolBar* pickToolBarExternal_;
/// Store all toolbars that once have been registered
std::set<QToolBar*> registeredToolbars_;
/// Cursor handling /// Cursor handling
CursorPainter* cursorPainter_; CursorPainter* cursorPainter_;
......
...@@ -228,10 +228,27 @@ void CoreWidget::setActivePickToolBar(QToolBar* _tool) { ...@@ -228,10 +228,27 @@ void CoreWidget::setActivePickToolBar(QToolBar* _tool) {
pickToolBarExternal_ = _tool; pickToolBarExternal_ = _tool;
// size // Check whether this toolbar has been displayed before
pickToolBarExternal_->setOrientation(Qt::Vertical); if(registeredToolbars_.count(_tool) == 0) {
pickToolBarExternal_->adjustSize();
addToolBar(Qt::LeftToolBarArea,_tool); /*
* This code makes sure that the orientation and size
* of a toolbar is only set once (the first time it is added).
* In some cases, the user wants to move the toolbar somewhere
* else and thus this check makes sure that it does not
* loose its position and orientation after a pickmode change.
*/
// Adjust its size and orientation
pickToolBarExternal_->setOrientation(Qt::Vertical);
pickToolBarExternal_->adjustSize();
addToolBar(Qt::LeftToolBarArea,_tool);
// Add to registered toolbars
registeredToolbars_.insert(_tool);
}
_tool->show(); _tool->show();
} }
} else { } else {
...@@ -252,9 +269,7 @@ void CoreWidget::hidePickToolBar() { ...@@ -252,9 +269,7 @@ void CoreWidget::hidePickToolBar() {
// if a toolbar is in the global scene, we remove it here. // if a toolbar is in the global scene, we remove it here.
if ( pickToolBarExternal_ != 0 ) { if ( pickToolBarExternal_ != 0 ) {
pickToolBarExternal_->hide(); pickToolBarExternal_->hide();
removeToolBar(pickToolBarExternal_); pickToolBarExternal_ = NULL;
pickToolBarExternal_->setParent(0);
pickToolBarExternal_ = 0;
} }
......
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