Results 1 to 6 of 6

Thread: how i use the tooltips

  1. #1
    Join Date
    Sep 2012
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default how i use the tooltips

    Hi every one
    i want to display the name of my object when i make the mouse on it
    The problem that the object in my scene they are not created with Qt i will explain

    i defined class that derived from qwidget like that
    Qt Code:
    1. class QmyWidget : public QWidget, public Ogre::FrameListener
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6.  
    7.  
    8. QmyWidget(QWidget *parent = 0);
    9. ~QmyWidget();
    To copy to clipboard, switch view to plain text mode 
    in this class i defined method namde "create_sphere" in this methode i create my spheres but not using qt paint or qt method
    so i can't use "objet->getmane()"

    is i can use the tooltips with those constraint ?

  2. #2
    Join Date
    May 2012
    Location
    Bangalore, India
    Posts
    271
    Thanks
    29
    Thanked 50 Times in 47 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: how i use the tooltips

    I didn't understand your question. You can use Tool tip anywhere. Send the whole code so that we could understand the question.
    Heavy Metal Rules. For those about to rock, we salute you.
    HIT THANKS IF I HELPED.

  3. #3
    Join Date
    Sep 2012
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how i use the tooltips

    Hi ,
    ok , that's how i declare my object
    Qt Code:
    1. class QmyWidget : public QWidget, public Ogre::FrameListener
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6.  
    7.  
    8. QmyWidget(QWidget *parent = 0);
    9. ~QmyWidget();
    10. struct sphere
    11.  
    12. {
    13. int num_sphere;
    14. float x,y,z;
    15.  
    16. };
    17. std::vector<Ogre::SceneNode *> sphereNodes;
    To copy to clipboard, switch view to plain text mode 
    and
    Qt Code:
    1. void QmyWidget:: create_sphere()
    2. {
    3. std::string name("sphere_" + Ogre::StringConverter::toString(i));
    4. Ogre::Entity *ent = mSceneMgr->createEntity( name,Ogre::SceneManager:: PT_SPHERE);
    5. Ogre::SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode(name,pos);
    6. }
    To copy to clipboard, switch view to plain text mode 
    i want to display just the "name" in the tooltip
    i do not yet write the code of the tooltip

    But i tried to dsplay the name in the list view , it work , i added just this twi lines to my function "create_sphere"
    Qt Code:
    1. QStandardItem *item=new QStandardItem(QString ("sphere %0").arg(num_sphere));
    2. emit itemAded(item);
    To copy to clipboard, switch view to plain text mode 
    Last edited by robelle; 24th September 2012 at 09:41.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,688
    Thanks
    13
    Thanked 1,598 Times in 1,526 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: how i use the tooltips

    QWidget::setToolTip() will set the tool tip that shows when the mouse hovers over your widget.

    If you want to set a tool tip to appear when your mouse hovers over an item in a OGRE scene then you will have to ask the OGRE people how you do that.

  5. #5
    Join Date
    Sep 2012
    Posts
    18
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: how i use the tooltips

    that mean i can't usr the tooltip of qt in my scene ogre even if i create the gui with Qt ? if yes , whey then i can display the name of the objects of the scène in list view its the same case no ?

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

    Default Re: how i use the tooltips

    The whole question boils down to one thing -- whether you display your OGRE scene in a Qt widget or not. If yes, then you can use QWidget::setToolTip() or QToolTip::showText() to show a tooltip. But to determine what to show in the tooltip (meaning, what object the mouse is actually pointing) you need to deal with OGRE.
    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.


Similar Threads

  1. No ToolTips in my application
    By rambo83 in forum Newbie
    Replies: 3
    Last Post: 30th December 2012, 15:13
  2. enable all Tooltips
    By clive in forum Qt Programming
    Replies: 3
    Last Post: 2nd January 2008, 12:08
  3. Turning off ToolTips
    By steg90 in forum Qt Programming
    Replies: 11
    Last Post: 16th May 2007, 18:00
  4. Tooltips for QListViewItems (QT3)?
    By gadnio in forum Newbie
    Replies: 3
    Last Post: 13th March 2006, 18:02
  5. toolTips?
    By mickey in forum Qt Programming
    Replies: 11
    Last Post: 23rd February 2006, 20:10

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.