BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
Utils::DetailsWidgetPrivate Class Reference
Collaboration diagram for Utils::DetailsWidgetPrivate:
[legend]

Public Member Functions

 DetailsWidgetPrivate (QWidget *parent)
 
void changeHoverState (bool hovered)
 
void updateControls ()
 

Public Attributes

QLabel * m_additionalSummaryLabel
 
QPixmap m_collapsedPixmap
 
DetailsButtonm_detailsButton
 
QPixmap m_expandedPixmap
 
QGridLayout * m_grid
 
bool m_hovered
 
DetailsWidget::State m_state
 
QCheckBox * m_summaryCheckBox
 
QLabel * m_summaryLabel
 
QLabel * m_summaryLabelIcon
 
FadingPanelm_toolWidget
 
bool m_useCheckBox
 
QWidget * m_widget
 
QWidget * q
 

Detailed Description

Definition at line 66 of file detailswidget.cpp.

Constructor & Destructor Documentation

◆ DetailsWidgetPrivate()

Utils::DetailsWidgetPrivate::DetailsWidgetPrivate ( QWidget *  parent)

Definition at line 91 of file detailswidget.cpp.

92  : q(parent)
93  , m_detailsButton(new DetailsButton)
94  , m_grid(new QGridLayout)
95  , m_summaryLabelIcon(new QLabel(parent))
96  , m_summaryLabel(new QLabel(parent))
97  , m_summaryCheckBox(new QCheckBox(parent))
98  , m_additionalSummaryLabel(new QLabel(parent))
99  , m_toolWidget(nullptr)
100  , m_widget(nullptr)
102  , m_hovered(false)
103  , m_useCheckBox(false)
104 {
105  QHBoxLayout* summaryLayout = new QHBoxLayout;
106  summaryLayout->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
107  summaryLayout->setSpacing(0);
108 
109  m_summaryLabelIcon->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
110  m_summaryLabelIcon->setContentsMargins(0, 0, 0, 0);
111  m_summaryLabelIcon->setFixedWidth(0);
112  summaryLayout->addWidget(m_summaryLabelIcon);
113 
114  m_summaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse);
115  m_summaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
116  m_summaryLabel->setContentsMargins(0, 0, 0, 0);
117  summaryLayout->addWidget(m_summaryLabel);
118 
119  m_summaryCheckBox->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
120  m_summaryCheckBox->setAttribute(
121  Qt::WA_LayoutUsesWidgetRect); /* broken layout on mac otherwise */
122  m_summaryCheckBox->setVisible(false);
123  m_summaryCheckBox->setContentsMargins(0, 0, 0, 0);
124  summaryLayout->addWidget(m_summaryCheckBox);
125 
126  m_additionalSummaryLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
127  m_additionalSummaryLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
128  m_additionalSummaryLabel->setContentsMargins(MARGIN, MARGIN, MARGIN, MARGIN);
129  m_additionalSummaryLabel->setWordWrap(true);
130  m_additionalSummaryLabel->setVisible(false);
131 
132  m_grid->setContentsMargins(0, 0, 0, 0);
133  m_grid->setSpacing(0);
134  m_grid->addLayout(summaryLayout, 0, 0);
135  m_grid->addWidget(m_detailsButton, 0, 2);
136  m_grid->addWidget(m_additionalSummaryLabel, 1, 0, 1, 3);
137 }
DetailsButton * m_detailsButton
DetailsWidget::State m_state
const int MARGIN

References m_additionalSummaryLabel, m_detailsButton, m_grid, m_summaryCheckBox, m_summaryLabel, m_summaryLabelIcon, and Utils::MARGIN.

Member Function Documentation

◆ changeHoverState()

void Utils::DetailsWidgetPrivate::changeHoverState ( bool  hovered)

Definition at line 203 of file detailswidget.cpp.

204 {
205  if (!m_toolWidget)
206  return;
208  m_toolWidget->setOpacity(hovered ? 1.0 : 0);
209  else
210  m_toolWidget->fadeTo(hovered ? 1.0 : 0);
211  m_hovered = hovered;
212 }
static bool isMacHost()
Definition: hostosinfo.h:69
virtual void setOpacity(qreal value)=0
virtual void fadeTo(qreal value)=0

References Utils::FadingPanel::fadeTo(), GUI_OS_Utils::HostOsInfo::isMacHost(), m_hovered, m_toolWidget, and Utils::FadingPanel::setOpacity().

Referenced by Utils::DetailsWidget::enterEvent(), Utils::DetailsWidget::leaveEvent(), and Utils::DetailsWidget::setToolWidget().

Here is the call graph for this function:

◆ updateControls()

void Utils::DetailsWidgetPrivate::updateControls ( )

Definition at line 181 of file detailswidget.cpp.

182 {
183  if (m_widget)
192 
193  for (QWidget* w = q; w; w = w->parentWidget()) {
194  if (w->layout())
195  w->layout()->activate();
196  if (QScrollArea* area = qobject_cast<QScrollArea*>(w)) {
197  QEvent e(QEvent::LayoutRequest);
198  QCoreApplication::sendEvent(area, &e);
199  }
200  }
201 }

References Utils::DetailsWidget::Collapsed, Utils::DetailsWidget::Expanded, m_detailsButton, m_state, m_summaryCheckBox, m_summaryLabel, m_summaryLabelIcon, m_useCheckBox, m_widget, Utils::DetailsWidget::NoSummary, and q.

Referenced by Utils::DetailsWidget::DetailsWidget(), Utils::DetailsWidget::setState(), Utils::DetailsWidget::setUseCheckBox(), and Utils::DetailsWidget::setWidget().

Member Data Documentation

◆ m_additionalSummaryLabel

QLabel* Utils::DetailsWidgetPrivate::m_additionalSummaryLabel

◆ m_collapsedPixmap

QPixmap Utils::DetailsWidgetPrivate::m_collapsedPixmap

Definition at line 83 of file detailswidget.cpp.

Referenced by Utils::DetailsWidget::paintEvent().

◆ m_detailsButton

DetailsButton* Utils::DetailsWidgetPrivate::m_detailsButton

◆ m_expandedPixmap

QPixmap Utils::DetailsWidgetPrivate::m_expandedPixmap

Definition at line 84 of file detailswidget.cpp.

Referenced by Utils::DetailsWidget::paintEvent().

◆ m_grid

◆ m_hovered

bool Utils::DetailsWidgetPrivate::m_hovered

Definition at line 87 of file detailswidget.cpp.

Referenced by changeHoverState(), and Utils::DetailsWidget::setToolWidget().

◆ m_state

◆ m_summaryCheckBox

◆ m_summaryLabel

◆ m_summaryLabelIcon

QLabel* Utils::DetailsWidgetPrivate::m_summaryLabelIcon

◆ m_toolWidget

FadingPanel* Utils::DetailsWidgetPrivate::m_toolWidget

◆ m_useCheckBox

◆ m_widget

QWidget* Utils::DetailsWidgetPrivate::m_widget

◆ q

QWidget* Utils::DetailsWidgetPrivate::q

Definition at line 73 of file detailswidget.cpp.

Referenced by updateControls().


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