Call tips

Call tips are small windows displaying the arguments to a function and are displayed after the user has typed the name of the function. The Call tip window helps you to fill in the proper function arguments.

Usually you get an Autocompletion window while typing the name of the function. Once the name is completed and you type the first ‘(‘ parenthesis, the Autocompletion window makes space for a Call tip window:

There is some interaction between Call tips and Autocompletion in that showing a call tip cancels any active autocompletion list, and vice versa.

 

Basic options

In this paragraph, we’ll go through some basic options.

Call tips source

Call tips pour from the same QsciAPIs source as the Autocompletion engine. In fact, the underlying engine can recognize functions listed in the QsciAPIs-object. The function names are used for Autocompletions, the parameters for Call tips.

self.__api = QsciAPIs(self.__lexer)

autocompletions = [
    "variable_one",              # Used for Autocompletion only
    "variable_two",              # Used for Autocompletion only
    "function_one(int arg_1)",   # Name used for Autocompletion, args for Call tips
    "function_two(float arg_1)"  # Name used for Autocompletion, args for Call tips
]

for ac in autocompletions:
    self.__api.add(ac)

 

Call tips style

This function selects sets at which context the call tip will be shown. (I do not know how context works with call tips yet, I usually just use the CallTipsNoContext option to get all of the call tips every time)

self.__editor.setCallTipsStyle(style)

The style parameter can be one of the following:

  • QsciScintilla.CallTipsNoContext                There is no context, all call tips
                                                   are always shown (default).
     
  • QsciScintilla.CallTipsNone                     Call tips are disabled.
     
  • QsciScintilla.CallTipsNoAutoCompletionContext  Call tips are displayed with a context
                                                   only if the user hasn’t already implicitly
                                                   identified the context using
                                                   autocompletion.
     
  • QsciScintilla.CallTipsContext                  Call tips are displayed with a context.

 

Nr of visible Call tips

This function sets the number of call tips visible in the popup rectangle.

self.__editor.setCallTipsVisible(number)

Enter 0 to display all applicable Call tips:

Enter -1 to show only one call tip with an up and down arrow for scrolling:

 

Call tips popup rectangle position

This function select where the call tip popup rectangle will appear.

self.__editor.setCallTipsPosition(position)
  • QsciScintilla.CallTipsBelowText   Call tips displayed below text.

     
  • QsciScintilla.CallTipsAboveText   Call tips displayed above text.

     

 

Call tips look and feel

 

Call tips background color

This function selects the background color of the call tips popup rectangle background color.

self.__editor.setCallTipsBackgroundColor(color)

Example:

The parameter color should be a QColor-object:

# QColor-object example
# R: 0x20
# G: 0x30
# B: 0xff
# Opacity: 0xff
QColor(0x20, 0x30, 0xff, 0xff)

 

Call tips foreground color

This function selects the non-highlighted text color of the call tips.

self.__editor.setCallTipsForegroundColor(color)

Example:

 

Call tips highlight color

This function selects the highlighted text color of the call tips. This marks the current parameter that the user is typing into the editor.

self.__editor.setCallTipsHighlightColor(color)

Example: