Back to index

texmacs  1.0.7.15
Public Member Functions | Private Attributes
QTMMenuButton Class Reference

List of all members.

Public Member Functions

 QTMMenuButton (QWidget *parent=0)
void mouseReleaseEvent (QMouseEvent *event)
void mousePressEvent (QMouseEvent *event)
void paintEvent (QPaintEvent *event)

Private Attributes

QStyleOptionMenuItem option

Detailed Description

Definition at line 73 of file qt_ui_element.cpp.


Constructor & Destructor Documentation

QTMMenuButton::QTMMenuButton ( QWidget *  parent = 0) [inline]

Definition at line 76 of file qt_ui_element.cpp.

                                     : QToolButton(parent) {
    QTMAuxMenu m;
    m.myInitStyleOption (&option);
    setAttribute (Qt::WA_Hover);
  }  

Here is the call graph for this function:


Member Function Documentation

void QTMMenuButton::mousePressEvent ( QMouseEvent *  event)

Definition at line 87 of file qt_ui_element.cpp.

                                                  {
  // this one triggers the action and toggles the button
  QToolButton::mousePressEvent (event);
  // this one forwards the event to the parent
  // (which eventually is the menu)
  QWidget::mousePressEvent (event);
}
void QTMMenuButton::mouseReleaseEvent ( QMouseEvent *  event)

Definition at line 96 of file qt_ui_element.cpp.

                                                    {
  // this one triggers the action and untoggles the button
  QToolButton::mouseReleaseEvent (event);
  // this one forwards the event to the parent
  // (which eventually is the menu which then close itself)
  QWidget::mouseReleaseEvent (event);
}
void QTMMenuButton::paintEvent ( QPaintEvent *  event)

Definition at line 105 of file qt_ui_element.cpp.

                                             {
  (void) event;
  QPainter p (this);
  
  // initialize the options
  QStyleOptionToolButton buttonOpt;
  initStyleOption (&buttonOpt);
  QRect r = rect ();
  option.rect = r;
  option.state = QStyle::State_Enabled |
  ( buttonOpt.state & QStyle::State_MouseOver ? 
   QStyle::State_Selected : QStyle::State_None ); 
  // draw the control background as a menu item
  style () -> drawControl (QStyle::CE_MenuItem, &option, &p, this); 
  // draw the icon with a bit of inset.
  r.adjust (2,2,-2,-2);
  defaultAction ()-> icon ().paint (&p, r);
}

Member Data Documentation

QStyleOptionMenuItem QTMMenuButton::option [private]

Definition at line 74 of file qt_ui_element.cpp.


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