Back to index

texmacs  1.0.7.15
Public Slots | Public Member Functions | Public Attributes | Protected Slots | Private Attributes
QTMAction Class Reference

This custom action frees its menu if it does not already have an owner. More...

#include <QTMMenuHelper.hpp>

Collaboration diagram for QTMAction:
Collaboration graph
[legend]

List of all members.

Public Slots

void doRefresh ()
void showToolTip ()

Public Member Functions

 QTMAction (QObject *parent=NULL)
 ~QTMAction ()

Public Attributes

string str

Protected Slots

void doShowToolTip ()

Private Attributes

QTimer * _timer
QPoint _pos

Detailed Description

This custom action frees its menu if it does not already have an owner.

What's with the timer? the toolTips are not shown for items in the menu bar, because no mouse related events are ever sent to QActions placed there under MacOSX. We must use the signal hover() and add a timer to avoid instantly displaying the tooltip. This implies however ugly tradeoffs, see doShowToolTip().

Definition at line 93 of file QTMMenuHelper.hpp.


Constructor & Destructor Documentation

QTMAction::QTMAction ( QObject *  parent = NULL)

Definition at line 51 of file qt_menu.cpp.

                                    : QAction(parent) { 
  QObject::connect(the_gui->gui_helper, SIGNAL(refresh()), this, SLOT(doRefresh()));
  _timer = new QTimer(this);
  QObject::connect(_timer, SIGNAL(timeout()), this, SLOT(doShowToolTip()));
  
}

Here is the call graph for this function:

Definition at line 58 of file qt_menu.cpp.

                      { 
  if (menu() && !(menu()->parent())) delete menu(); 
}

Here is the call graph for this function:


Member Function Documentation

void QTMAction::doRefresh ( ) [slot]

Definition at line 64 of file qt_menu.cpp.

                     {
  if (N(str)) {
    string t= tm_var_encode (str);
    if (t == "Help") t= "Help ";
    setText(to_qstring (t));
  }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void QTMAction::doShowToolTip ( ) [protected, slot]

Definition at line 92 of file qt_menu.cpp.

                         {
  static int step = QApplication::font().pointSize();
  _timer->stop();
  if((QCursor::pos() - _pos).manhattanLength() < step)  // Hideous HACK
    QToolTip::showText(QCursor::pos(), toolTip());
  else
    QToolTip::hideText();
}

Here is the caller graph for this function:

void QTMAction::showToolTip ( ) [slot]

Definition at line 73 of file qt_menu.cpp.

{
  _timer->start(500);   // Restarts the timer if already running
  _pos = QCursor::pos();
}

Member Data Documentation

QPoint QTMAction::_pos [private]

Definition at line 97 of file QTMMenuHelper.hpp.

QTimer* QTMAction::_timer [private]

Definition at line 96 of file QTMMenuHelper.hpp.

Definition at line 99 of file QTMMenuHelper.hpp.


The documentation for this class was generated from the following files: