Results 1 to 3 of 3

Thread: Creating an Intellisense style window or dialog

  1. #1
    Join Date
    Mar 2013
    Qt products

    Default Creating an Intellisense style window or dialog

    Hi I am trying to learn pyqt by writing my own texteditor, using pyQT one of the things i want to have is intellisense/word suggestions. i.e so that as you type in the text editor it offers you suggestions of words that would be suitable. I have a list of words, and i can already generate a list of suggestions. My difficulty is presenting it, I am unable to bring up a window/dialog at the cursor location which shows a list of possible words. So far I have succesfully got QMenu to work, but it is limited as in it has no scrollbars and can only display a limited number of suggestions. I tried QListWidget, but this displayed a popup window(complete with max,min buttons) this just isn't right, though it did allow me to have scrollbars. I would like to know what object I should use to display suggestions to a user at the cursor location just like one sees in any good IDE. This is what I am trying to do

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,013 Times in 4,791 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: Creating an Intellisense style window or dialog

    The widget you need to use is QListView or QListWidget. You need to position it manually and handle its key events -- most likely by installing an event filter on it and forwarding some events to the text editor or eating them directly in the view. In doubt you can see how QtCreator does it for its own completion support. All in all it is not that complicated if you understand how Qt works.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.

  3. #3
    Join Date
    Mar 2009
    Brisbane, Australia
    Thanked 1,596 Times in 1,524 Posts
    Qt products
    Qt4 Qt5
    Unix/X11 Windows
    Wiki edits

    Default Re: Creating an Intellisense style window or dialog

    You can (generally) turn off the window frame that you see on the QListWidget: See QWidget::setWindowFlags() and Qt::FramelessWindowHint.

    You might want to take a good look at the Custom Completer Example and how it makes use of QCompleter.
    Last edited by ChrisW67; 8th March 2013 at 00:04. Reason: Typos, 3rd edit is the treat

Similar Threads

  1. MSVC2010 - Faster update for Intellisense?
    By Terreox in forum Qt Tools
    Replies: 0
    Last Post: 17th February 2012, 19:58
  2. creating custom curve style
    By kja in forum Qwt
    Replies: 1
    Last Post: 16th March 2011, 07:53
  3. Replies: 2
    Last Post: 4th August 2010, 20:10
  4. Creating a style for a button
    By Luc4 in forum Qt Programming
    Replies: 2
    Last Post: 23rd April 2010, 14:16
  5. Replies: 1
    Last Post: 1st February 2007, 18:07

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.