Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Education
Cantor
Commits
6ebdc012
Commit
6ebdc012
authored
Jul 01, 2020
by
Shubham .
Browse files
Fix logic for context sensitve help on F2
parent
5459d983
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/worksheettextitem.cpp
View file @
6ebdc012
...
...
@@ -472,21 +472,9 @@ void WorksheetTextItem::keyPressEvent(QKeyEvent *event)
qDebug
()
<<
"Tab"
;
break
;
case
Qt
::
Key_F2
:
// logic to display help for keyword under selection
if
(
textCursor
().
hasSelection
())
{
QString
keyword
=
textCursor
().
selectedText
();
// remove extra whitespaces from the selection
keyword
=
keyword
.
simplified
();
keyword
.
replace
(
QStringLiteral
(
" "
),
QStringLiteral
(
""
));
{
const
QString
&
keyword
=
textCursor
().
block
().
text
();
emit
worksheet
()
->
requestDocumentation
(
keyword
);
return
;
}
else
{
// when the keyword is not under selection and the user presses key
QTextCursor
cursor
;
cursor
.
select
(
QTextCursor
::
WordUnderCursor
);
setTextCursor
(
cursor
);
const
QString
keyword
=
textCursor
().
selectedText
();
emit
worksheet
()
->
requestDocumentation
(
keyword
);
return
;
}
break
;
default:
...
...
@@ -496,8 +484,10 @@ void WorksheetTextItem::keyPressEvent(QKeyEvent *event)
int
p
=
textCursor
().
position
();
bool
b
=
textCursor
().
hasSelection
();
QGraphicsTextItem
::
keyPressEvent
(
event
);
if
(
p
!=
textCursor
().
position
())
emit
cursorPositionChanged
(
textCursor
());
if
(
b
!=
textCursor
().
hasSelection
())
selectionChanged
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment