Skip to content
Snippets Groups Projects
Commit 9d6e3ba7 authored by andreas's avatar andreas
Browse files

changed Keyboard modfifiers for arrow keys to take care of difference in

OSX ans Linuzx/Windows Changed positioning of completer window to
increas change to get it working in Windows


git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/branches/new_shell@2262 5a81b35b-ba03-0410-adc8-b2c5c5119f08
parent fa50d035
No related branches found
No related tags found
No related merge requests found
......@@ -61,7 +61,7 @@ void OstCompleterBase::complete(const QRect & rect,bool inline_completion)
(popup()->verticalScrollBar()->isVisible() ?
popup()->verticalScrollBar()->width():0);
popup()->setFixedWidth(popup_width);
popup()->move(popup()->pos()+QPoint(0,-popup()->height()-rect.height()));
popup()->move(widget()->mapToGlobal(rect.topLeft()+QPoint(0,-popup()->height())));
}
QString OstCompleterBase::GetCommonMatch()
......
......@@ -144,6 +144,11 @@ void PythonShellWidget::setup_readonly_state_machine_()
void PythonShellWidget::setup_state_machine_()
{
#ifdef __APPLE__
QFlags<Qt::KeyboardModifier> DNG_ARROW_MODIFIERS = Qt::KeypadModifier;
#else
QFlags<Qt::KeyboardModifier> DNG_ARROW_MODIFIERS = Qt::NoModifier;
#endif
State* single_line=new State;
State* multi_line_inactive=new State;
State* completing=new State;
......@@ -180,8 +185,8 @@ void PythonShellWidget::setup_state_machine_()
new BlockStatusGuard(this,CODE_BLOCK_INCOMPLETE));
single_line->addTransition(tr3);
connect(tr3,SIGNAL(triggered()),this,SLOT(OnEnterTransition()));
single_line->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Up,Qt::KeypadModifier,history_up));
single_line->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Down,Qt::KeypadModifier,history_down));
single_line->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Up,DNG_ARROW_MODIFIERS,history_up));
single_line->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Down,DNG_ARROW_MODIFIERS,history_down));
KeyEventTransition* tr4=new KeyEventTransition(QEvent::KeyPress,
Qt::Key_Return,
......@@ -198,11 +203,11 @@ void PythonShellWidget::setup_state_machine_()
new BlockStatusGuard(this,CODE_BLOCK_INCOMPLETE));
multi_line_inactive->addTransition(tr6);
connect(tr6,SIGNAL(triggered()),this,SLOT(OnEnterTransition()));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Left,Qt::KeypadModifier,multiline_active_state_));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Right,Qt::KeypadModifier,multiline_active_state_));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Left,DNG_ARROW_MODIFIERS,multiline_active_state_));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Right,DNG_ARROW_MODIFIERS,multiline_active_state_));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Return,Qt::ControlModifier,multiline_active_state_));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Up,Qt::KeypadModifier,history_up));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Down,Qt::KeypadModifier,history_down));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Up,DNG_ARROW_MODIFIERS,history_up));
multi_line_inactive->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Down,DNG_ARROW_MODIFIERS,history_down));
KeyEventTransition* tr7=new KeyEventTransition(QEvent::KeyPress,
Qt::Key_Return,
......@@ -221,8 +226,8 @@ void PythonShellWidget::setup_state_machine_()
connect(tr8,SIGNAL(triggered()),this,SLOT(OnEnterTransition()));
multiline_active_state_->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Escape,Qt::NoModifier,multi_line_inactive));
multiline_active_state_->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Up,Qt::ControlModifier | Qt::KeypadModifier,history_up));
multiline_active_state_->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Down,Qt::ControlModifier | Qt::KeypadModifier,history_down));
multiline_active_state_->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Up,Qt::ControlModifier | DNG_ARROW_MODIFIERS,history_up));
multiline_active_state_->addTransition(new KeyEventTransition(QEvent::KeyPress,Qt::Key_Down,Qt::ControlModifier | DNG_ARROW_MODIFIERS,history_down));
history_up->addTransition(new AutomaticTransition(multi_line_inactive,new HistoryGuard(&history_,EDITMODE_MULTILINE_INACTIVE)));
history_up->addTransition(new AutomaticTransition(single_line,new HistoryGuard(&history_,EDITMODE_SINGLELINE)));
......@@ -695,10 +700,5 @@ void PythonShellWidget::showEvent(QShowEvent* event)
}
}
void PythonShellWidget::AquireFocus()
{
setFocus(Qt::OtherFocusReason);
}
}}
......@@ -70,7 +70,6 @@ public slots:
void AppendOutput(unsigned int id,const QString& output);
void AppendError(unsigned int id,const QString& output);
void OutputFinished(unsigned int id, bool error);
void AquireFocus();
void Complete(bool inline_completion=true);
void Recomplete(const QString& completion);
// slots for state machine
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment