View Full Version : how i use the tooltips
robelle
23rd September 2012, 16:35
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
class QmyWidget : public QWidget, public Ogre::FrameListener
{
Q_OBJECT
public:
QmyWidget(QWidget *parent = 0);
~QmyWidget();
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 ?
sonulohani
24th September 2012, 07:12
I didn't understand your question. You can use Tool tip anywhere. Send the whole code so that we could understand the question.
robelle
24th September 2012, 08:17
Hi ,
ok , that's how i declare my object
class QmyWidget : public QWidget, public Ogre::FrameListener
{
Q_OBJECT
public:
QmyWidget(QWidget *parent = 0);
~QmyWidget();
struct sphere
{
int num_sphere;
float x,y,z;
};
std::vector<Ogre::SceneNode *> sphereNodes;
and
void QmyWidget:: create_sphere()
{
std::string name("sphere_" + Ogre::StringConverter::toString(i));
Ogre::Entity *ent = mSceneMgr->createEntity( name,Ogre::SceneManager:: PT_SPHERE);
Ogre::SceneNode *node = mSceneMgr->getRootSceneNode()->createChildSceneNode(name,pos);
}
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"
QStandardItem *item=new QStandardItem(QString ("sphere %0").arg(num_sphere));
emit itemAded(item);
ChrisW67
24th September 2012, 09:28
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.
robelle
24th September 2012, 09:36
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 ?
wysota
24th September 2012, 15:51
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.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.