{
if(m_pGlobalToolTip == NULL )
m_pGlobalToolTip = new CToolTip(widget,heading,tip);
m_pGlobalToolTip->setToolTip(heading, tip);
if(widget == NULL )
{
return;
}
QRect rect
= widget
->rect
();
QPoint point
= widget
->mapToGlobal
(widget
->rect
().
topLeft());
int rect_height = rect.height();
int rect_width = rect.width();
int tooltip_width = m_pGlobalToolTip->getWidth();
int xpos;
int ypos;
if(m_pGlobalToolTip->isShownOnRight(widget))
{
xpos = point.x() + rect_width + 5 ;
if(xpos < 0)
xpos = 0;
ypos = point.y() + (rect_height/2) - 26 - CORNER_RADIUS;
if(ypos < 0)
ypos = 0;
}
else
{
xpos = point.x() - tooltip_width - 5;
if(xpos < 0)
xpos = 0;
ypos = point.y() + (rect_height/2) - 26 - CORNER_RADIUS;
if(ypos < 0)
ypos = 0;
}
m_pGlobalToolTip->showToolTip(pos);
}
void CToolTip::showTip(QWidget* widget,QString heading,QString tip)
{
if(m_pGlobalToolTip == NULL )
m_pGlobalToolTip = new CToolTip(widget,heading,tip);
m_pGlobalToolTip->setToolTip(heading, tip);
if(widget == NULL )
{
return;
}
QRect rect = widget->rect();
QPoint point = widget->mapToGlobal(widget->rect().topLeft());
int rect_height = rect.height();
int rect_width = rect.width();
int tooltip_width = m_pGlobalToolTip->getWidth();
int xpos;
int ypos;
if(m_pGlobalToolTip->isShownOnRight(widget))
{
xpos = point.x() + rect_width + 5 ;
if(xpos < 0)
xpos = 0;
ypos = point.y() + (rect_height/2) - 26 - CORNER_RADIUS;
if(ypos < 0)
ypos = 0;
}
else
{
xpos = point.x() - tooltip_width - 5;
if(xpos < 0)
xpos = 0;
ypos = point.y() + (rect_height/2) - 26 - CORNER_RADIUS;
if(ypos < 0)
ypos = 0;
}
QPoint pos(xpos, ypos);
m_pGlobalToolTip->showToolTip(pos);
}
To copy to clipboard, switch view to plain text mode
{
int x1, y1, x2, y2;
rc.getCoords(&x1, &y1, &x2, &y2);
if(m_bShowRight)
{
roundPath.moveTo(x2, y1+CORNER_RADIUS);
roundPath.arcTo(x2-CORNER_RADIUS, y1, CORNER_RADIUS, CORNER_RADIUS, 0.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS,y1);
roundPath.arcTo(x1+ARROW, y1, CORNER_RADIUS, CORNER_RADIUS, 90.0, 90.0);
roundPath.lineTo(x1+ARROW, y1+20);
roundPath.lineTo(x1, y1+20+6);
roundPath.lineTo(x1+ARROW, y1+20+6+6);
roundPath.lineTo(x1+ARROW, y2-CORNER_RADIUS);
roundPath.arcTo(x1+ARROW, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 180.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS, y2);
roundPath.arcTo(x2-CORNER_RADIUS, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 270.0, 90.0);
roundPath.closeSubpath();
}
else
{
roundPath.moveTo(x2-ARROW, y1+CORNER_RADIUS);
roundPath.arcTo(x2-CORNER_RADIUS-ARROW, y1, CORNER_RADIUS, CORNER_RADIUS, 0.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS,y1);
roundPath.arcTo(x1, y1, CORNER_RADIUS, CORNER_RADIUS, 90.0, 90.0);
roundPath.lineTo(x1, y2-CORNER_RADIUS);
roundPath.arcTo(x1, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 180.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS, y2);
roundPath.arcTo(x2-CORNER_RADIUS-ARROW, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 270.0, 90.0);
roundPath.lineTo(x2-ARROW,y1+20+6+6);
roundPath.lineTo(x2,y1+20+6);
roundPath.lineTo(x2-ARROW,y1+20);
roundPath.lineTo(x2-ARROW,y1+CORNER_RADIUS);
roundPath.closeSubpath();
}
return roundPath;
}
QPainterPath CToolTip::getRoundPath(QRect rc)
{
int x1, y1, x2, y2;
rc.getCoords(&x1, &y1, &x2, &y2);
QPainterPath roundPath;
if(m_bShowRight)
{
roundPath.moveTo(x2, y1+CORNER_RADIUS);
roundPath.arcTo(x2-CORNER_RADIUS, y1, CORNER_RADIUS, CORNER_RADIUS, 0.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS,y1);
roundPath.arcTo(x1+ARROW, y1, CORNER_RADIUS, CORNER_RADIUS, 90.0, 90.0);
roundPath.lineTo(x1+ARROW, y1+20);
roundPath.lineTo(x1, y1+20+6);
roundPath.lineTo(x1+ARROW, y1+20+6+6);
roundPath.lineTo(x1+ARROW, y2-CORNER_RADIUS);
roundPath.arcTo(x1+ARROW, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 180.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS, y2);
roundPath.arcTo(x2-CORNER_RADIUS, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 270.0, 90.0);
roundPath.closeSubpath();
}
else
{
roundPath.moveTo(x2-ARROW, y1+CORNER_RADIUS);
roundPath.arcTo(x2-CORNER_RADIUS-ARROW, y1, CORNER_RADIUS, CORNER_RADIUS, 0.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS,y1);
roundPath.arcTo(x1, y1, CORNER_RADIUS, CORNER_RADIUS, 90.0, 90.0);
roundPath.lineTo(x1, y2-CORNER_RADIUS);
roundPath.arcTo(x1, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 180.0, 90.0);
roundPath.lineTo(x1+CORNER_RADIUS, y2);
roundPath.arcTo(x2-CORNER_RADIUS-ARROW, y2-CORNER_RADIUS, CORNER_RADIUS, CORNER_RADIUS, 270.0, 90.0);
roundPath.lineTo(x2-ARROW,y1+20+6+6);
roundPath.lineTo(x2,y1+20+6);
roundPath.lineTo(x2-ARROW,y1+20);
roundPath.lineTo(x2-ARROW,y1+CORNER_RADIUS);
roundPath.closeSubpath();
}
return roundPath;
}
To copy to clipboard, switch view to plain text mode
Bookmarks