Results 1 to 3 of 3

Thread: displaying text

  1. #1
    Join Date
    Jul 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default displaying text

    Hi,
    I have a QTGLWdiget that I use as canvas for drawing. Now i want to add the following functionality:
    when user clicks on some location over the camvas, a small text area appears over the canvas, containing some information about the drawing and the location where the user clicked.

    I am a novoice to the QT, so I am not sure what widgets do i look into to make this popup text area possible.

    thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: displaying text

    You don't need any widgets. Either use a tooltip or implement drawing of the tip in the paint event of the GL widget (you'll have to do some 3D math there anyway to do the proper projection).

  3. #3
    Join Date
    Jul 2007
    Posts
    12
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: displaying text

    thanks for the help, another question though

    I have a main window where I am placing a QTextEdit as below:
    Qt Code:
    1. Window::Window(QWidget *parent) : QWidget(parent) {
    2.  
    3. // code here
    4.  
    5. QTextEdit *metaDataText = new QTextEdit;
    6. metaDataText->setText(str);
    7.  
    8. // code here
    9.  
    10. }
    To copy to clipboard, switch view to plain text mode 

    I want that the string "str" is modified in another class and updated in the Window automatically. I am not sure how to implement this?

    which signal should be emitted by the class that is modifying the string?

    secondly, how should I implemented the slot in the main window?

    regards

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. Problem pasting text into a QTextEdit
    By Spockmeat in forum Qt Programming
    Replies: 8
    Last Post: 14th March 2009, 14:36
  3. displaying Text in QTAble dynamically
    By raghvendramisra in forum Qt Programming
    Replies: 8
    Last Post: 31st August 2007, 10:47
  4. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  5. visible text of textedit
    By regix in forum Qt Programming
    Replies: 3
    Last Post: 26th June 2006, 09:02

Bookmarks

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.