Commit 437eb059 authored by Matthias Möller's avatar Matthias Möller
Browse files

toolbar buttons keeps checked, if pressed twice

refs #1378

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16084 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 01d58157
...@@ -414,6 +414,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -414,6 +414,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
moveButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"transform-move.png") ); moveButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"transform-move.png") );
moveButton_->setMinimumSize( 16, 16 ); moveButton_->setMinimumSize( 16, 16 );
moveButton_->setMaximumSize( 32, 32 ); moveButton_->setMaximumSize( 32, 32 );
moveButton_->setCheckable(true);
moveButton_->setToolTip( tr("Switch to <b>move</b> mode.") ); moveButton_->setToolTip( tr("Switch to <b>move</b> mode.") );
moveButton_->setWhatsThis(tr( moveButton_->setWhatsThis(tr(
"Switch to <b>move</b> mode.<br>" "Switch to <b>move</b> mode.<br>"
...@@ -427,13 +428,14 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -427,13 +428,14 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
this, SLOT( slotActionModeChanged(Viewer::ActionMode) ) );*/ this, SLOT( slotActionModeChanged(Viewer::ActionMode) ) );*/
viewerToolbar_->addWidget( moveButton_ )->setText(tr("Move")); viewerToolbar_->addWidget( moveButton_ )->setText(tr("Move"));
moveButton_->setDown(true); moveButton_->setChecked(true);
pickButton_ = new QToolButton( viewerToolbar_ ); pickButton_ = new QToolButton( viewerToolbar_ );
pickButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"pick.png") ); pickButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"pick.png") );
pickButton_->setMinimumSize( 16, 16 ); pickButton_->setMinimumSize( 16, 16 );
pickButton_->setMaximumSize( 32, 32 ); pickButton_->setMaximumSize( 32, 32 );
pickButton_->setCheckable(true);
pickButton_->setToolTip(tr("Switch to <b>picking</b> mode.")); pickButton_->setToolTip(tr("Switch to <b>picking</b> mode."));
pickButton_->setWhatsThis(tr( pickButton_->setWhatsThis(tr(
"Switch to <b>picking</b> mode.<br>" "Switch to <b>picking</b> mode.<br>"
...@@ -448,6 +450,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes, ...@@ -448,6 +450,7 @@ CoreWidget( QVector<ViewMode*>& _viewModes,
questionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-about.png") ); questionButton_->setIcon( QIcon(OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator()+"help-about.png") );
questionButton_->setMinimumSize( 16, 16 ); questionButton_->setMinimumSize( 16, 16 );
questionButton_->setMaximumSize( 32, 32 ); questionButton_->setMaximumSize( 32, 32 );
questionButton_->setCheckable(true);
questionButton_->setToolTip(tr("Switch to <b>identification</b> mode.")); questionButton_->setToolTip(tr("Switch to <b>identification</b> mode."));
questionButton_->setWhatsThis(tr( questionButton_->setWhatsThis(tr(
"Switch to <b>identification</b> mode.<br>" "Switch to <b>identification</b> mode.<br>"
......
...@@ -62,70 +62,69 @@ ...@@ -62,70 +62,69 @@
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void CoreWidget::setActionMode(const Viewer::ActionMode _am){ void CoreWidget::setActionMode(const Viewer::ActionMode _am){
if (_am != actionMode_) {
lastActionMode_ = actionMode_;
actionMode_ = _am;
// update Buttons // update Buttons
moveButton_->setChecked(false);
pickButton_->setChecked(false);
questionButton_->setChecked(false);
moveButton_->setDown(false); switch (_am)
pickButton_->setDown(false); {
questionButton_->setDown(false); case Viewer::ExamineMode:
moveButton_->setChecked(true);
break;
case Viewer::LightMode:
break;
case Viewer::PickingMode:
pickButton_->setChecked(true);
break;
case Viewer::QuestionMode:
questionButton_->setChecked(true);
break;
}
switch (_am) if (_am != actionMode_) {
{ lastActionMode_ = actionMode_;
case Viewer::ExamineMode: actionMode_ = _am;
moveButton_->setDown(true);
break;
case Viewer::LightMode:
break;
case Viewer::PickingMode:
pickButton_->setDown(true);
break;
case Viewer::QuestionMode:
questionButton_->setDown(true);
break;
}
// update cursor // update cursor
switch ( _am ) switch ( _am )
{ {
case Viewer::ExamineMode: case Viewer::ExamineMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_move.png" ) ,0,0 )); cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_move.png" ) ,0,0 ));
break; break;
case Viewer::LightMode: case Viewer::LightMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_light.png" ) ,0,0 )); cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_light.png" ) ,0,0 ));
break; break;
case Viewer::PickingMode: case Viewer::PickingMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_arrow.png" ) ,0,0 )); cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_arrow.png" ) ,0,0 ));
if (pick_mode_idx_ != -1) { if (pick_mode_idx_ != -1) {
cursorPainter_->setCursor(pick_modes_[pick_mode_idx_].cursor() ); cursorPainter_->setCursor(pick_modes_[pick_mode_idx_].cursor() );
} }
break; break;
case Viewer::QuestionMode: case Viewer::QuestionMode:
cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_whatsthis.png" ) ,0,0 )); cursorPainter_->setCursor(QCursor( QPixmap( OpenFlipper::Options::iconDirStr() + QDir::separator() + "cursor_whatsthis.png" ) ,0,0 ));
break; break;
} }
// Update pickmode toolbar // Update pickmode toolbar
switch ( _am ) { switch ( _am ) {
case Viewer::ExamineMode: case Viewer::ExamineMode:
hidePickToolBar(); hidePickToolBar();
break; break;
case Viewer::PickingMode: case Viewer::PickingMode:
// Show the pickMode Toolbar for this picking mode if it is set // Show the pickMode Toolbar for this picking mode if it is set
if (pick_mode_idx_ != -1) { if (pick_mode_idx_ != -1) {
if (pick_modes_[pick_mode_idx_].toolbar() ) if (pick_modes_[pick_mode_idx_].toolbar() )
setActivePickToolBar(pick_modes_[pick_mode_idx_].toolbar()); setActivePickToolBar(pick_modes_[pick_mode_idx_].toolbar());
else else
hidePickToolBar(); hidePickToolBar();
} }
break; break;
default: default:
break; break;
} }
unsigned int maxPases = 1; unsigned int maxPases = 1;
...@@ -139,9 +138,9 @@ void CoreWidget::setActionMode(const Viewer::ActionMode _am){ ...@@ -139,9 +138,9 @@ void CoreWidget::setActionMode(const Viewer::ActionMode _am){
examiner_widgets_[i]->trackMouse(false); examiner_widgets_[i]->trackMouse(false);
if(_am == Viewer::PickingMode) { if(_am == Viewer::PickingMode) {
if (pick_mode_idx_ != -1) { if (pick_mode_idx_ != -1) {
examiner_widgets_[i]->trackMouse(pick_modes_[pick_mode_idx_].tracking() ); examiner_widgets_[i]->trackMouse(pick_modes_[pick_mode_idx_].tracking() );
} }
} }
} }
......
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