BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
GroupInfoBox Class Reference

The class which extends QGroupBox with clickable icon next to the label. More...

Inheritance diagram for GroupInfoBox:
[legend]
Collaboration diagram for GroupInfoBox:
[legend]

Public Member Functions

 GroupInfoBox (const QString &title, QWidget *parent=0)
 
 GroupInfoBox (QWidget *parent=0)
 
void setButtonToolTip (const QString &text)
 

Protected Member Functions

void mouseMoveEvent (QMouseEvent *event)
 
void mousePressEvent (QMouseEvent *e)
 
void paintEvent (QPaintEvent *)
 

Private Member Functions

void init_box ()
 

Private Attributes

QString m_title
 
QString m_toolTipText
 
int m_xImage
 
int m_yImage
 

Detailed Description

The class which extends QGroupBox with clickable icon next to the label.

Definition at line 21 of file GroupInfoBox.h.

Constructor & Destructor Documentation

◆ GroupInfoBox() [1/2]

GroupInfoBox::GroupInfoBox ( QWidget *  parent = 0)

Definition at line 34 of file GroupInfoBox.cpp.

34  : QGroupBox(parent), m_xImage(0), m_yImage(0)
35 {
36  init_box();
37 }

References init_box().

Here is the call graph for this function:

◆ GroupInfoBox() [2/2]

GroupInfoBox::GroupInfoBox ( const QString &  title,
QWidget *  parent = 0 
)

Definition at line 39 of file GroupInfoBox.cpp.

40  : QGroupBox(title, parent), m_title(title)
41 {
42  init_box();
43 }
QString m_title
Definition: GroupInfoBox.h:38

References init_box().

Here is the call graph for this function:

Member Function Documentation

◆ init_box()

void GroupInfoBox::init_box ( )
private

Definition at line 72 of file GroupInfoBox.cpp.

73 {
74  setMouseTracking(true);
75  m_toolTipText = "Gives access to the extended distribution viewer.";
76 }
QString m_toolTipText
Definition: GroupInfoBox.h:39

References m_toolTipText.

Referenced by GroupInfoBox().

◆ mouseMoveEvent()

void GroupInfoBox::mouseMoveEvent ( QMouseEvent *  event)
protected

Definition at line 61 of file GroupInfoBox.cpp.

62 {
63  QRect buttonArea(m_xImage, m_yImage, imageWidth, imageheigth);
64 
65  if (buttonArea.contains(event->pos())) {
66  QToolTip::showText(
67  this->mapToGlobal(QPoint(m_xImage + offset_of_tooltip_position, m_yImage)),
69  }
70 }

References m_toolTipText, m_xImage, and m_yImage.

◆ mousePressEvent()

void GroupInfoBox::mousePressEvent ( QMouseEvent *  e)
protected

Definition at line 50 of file GroupInfoBox.cpp.

51 {
52  if (e->button() == Qt::LeftButton) {
53  QStyleOptionGroupBox option;
54  initStyleOption(&option);
55  QRect buttonArea(m_xImage, m_yImage, imageWidth, imageheigth);
56  if (buttonArea.contains(e->pos()))
57  emit clicked(true);
58  }
59 }

References m_xImage, and m_yImage.

◆ paintEvent()

void GroupInfoBox::paintEvent ( QPaintEvent *  )
protected

Definition at line 78 of file GroupInfoBox.cpp.

79 {
80  QStylePainter paint(this);
81  QStyleOptionGroupBox option;
82  initStyleOption(&option);
83  paint.drawComplexControl(QStyle::CC_GroupBox, option);
84 
85  m_xImage = this->geometry().topRight().x() - offset_of_icon_position;
86  m_yImage = 0;
87 
88  // draw groupbox
89  int shift(1);
91  shift = 3;
92 
93  paint.drawItemPixmap(option.rect.adjusted(0, shift, 0, 0), Qt::AlignTop | Qt::AlignRight,
94  QPixmap(":/images/magnifier.png"));
95 }
static bool isLinuxHost()
Definition: hostosinfo.h:68

References GUI_OS_Utils::HostOsInfo::isLinuxHost(), m_xImage, and m_yImage.

Here is the call graph for this function:

◆ setButtonToolTip()

void GroupInfoBox::setButtonToolTip ( const QString &  text)

Definition at line 45 of file GroupInfoBox.cpp.

46 {
47  m_toolTipText = text;
48 }

References m_toolTipText.

Member Data Documentation

◆ m_title

QString GroupInfoBox::m_title
private

Definition at line 38 of file GroupInfoBox.h.

◆ m_toolTipText

QString GroupInfoBox::m_toolTipText
private

Definition at line 39 of file GroupInfoBox.h.

Referenced by init_box(), mouseMoveEvent(), and setButtonToolTip().

◆ m_xImage

int GroupInfoBox::m_xImage
private

Definition at line 40 of file GroupInfoBox.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and paintEvent().

◆ m_yImage

int GroupInfoBox::m_yImage
private

Definition at line 41 of file GroupInfoBox.h.

Referenced by mouseMoveEvent(), mousePressEvent(), and paintEvent().


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