Mantid
Loading...
Searching...
No Matches
Signals | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
MantidQt::MantidWidgets::CheckboxHeader Class Reference

This class subclasses and overwrites QHeaderView methods to enable checkboxes to exist in the table header. More...

#include <CheckboxHeader.h>

Inheritance diagram for MantidQt::MantidWidgets::CheckboxHeader:

Signals

void toggled (bool checked)
 

Public Member Functions

 CheckboxHeader (Qt::Orientation orientation, QWidget *parent=nullptr)
 Override QHeaderView constructor. More...
 
void setChecked (bool checked)
 Has the user checked the checkbox in the header? More...
 

Protected Member Functions

void mousePressEvent (QMouseEvent *event) override
 Set the checkbox to checked when it is clicked. More...
 
void paintSection (QPainter *painter, const QRect &rect, int logicalIndex) const override
 Overrides QHeaderView allowing checkbox functionality in the first column of the table. More...
 

Private Member Functions

QRect checkBoxRect (const QRect &sourceRect) const
 The area around the checkbox. More...
 

Private Attributes

bool m_checked
 The state of the checkbox in the column header. More...
 

Detailed Description

This class subclasses and overwrites QHeaderView methods to enable checkboxes to exist in the table header.

Author
Jay Rainey
Date
15/10/2013

Definition at line 25 of file CheckboxHeader.h.

Constructor & Destructor Documentation

◆ CheckboxHeader()

MantidQt::MantidWidgets::CheckboxHeader::CheckboxHeader ( Qt::Orientation  orientation,
QWidget *  parent = nullptr 
)
explicit

Override QHeaderView constructor.

Constructor.

Parameters
orientation:: The orientation (horizontal or vertical) of the header.
parent:: The table to apply the header to.

Definition at line 17 of file CheckboxHeader.cpp.

Member Function Documentation

◆ checkBoxRect()

QRect MantidQt::MantidWidgets::CheckboxHeader::checkBoxRect ( const QRect &  sourceRect) const
private

The area around the checkbox.

Definition at line 77 of file CheckboxHeader.cpp.

References checkBoxRect().

Referenced by checkBoxRect(), and paintSection().

◆ mousePressEvent()

void MantidQt::MantidWidgets::CheckboxHeader::mousePressEvent ( QMouseEvent *  event)
overrideprotected

Set the checkbox to checked when it is clicked.

Set the checkbox to checked if clicked, otherwise unchecked.

Parameters
event:: The mouse event the user performs.

Definition at line 67 of file CheckboxHeader.cpp.

References m_checked, and toggled().

◆ paintSection()

void MantidQt::MantidWidgets::CheckboxHeader::paintSection ( QPainter *  painter,
const QRect &  rect,
int  logicalIndex 
) const
overrideprotected

Overrides QHeaderView allowing checkbox functionality in the first column of the table.

Implements the checkbox functionality into the first column of the table.

Parameters
painter:: Paints the specific widget.
rect:: The area to paint.
logicalIndex:: The column in the table.

Definition at line 41 of file CheckboxHeader.cpp.

References checkBoxRect(), m_checked, and Mantid::Geometry::rect.

◆ setChecked()

void MantidQt::MantidWidgets::CheckboxHeader::setChecked ( bool  checked)

Has the user checked the checkbox in the header?

Parameters
checked:: True if user has checked the checkbox in the header.

Definition at line 27 of file CheckboxHeader.cpp.

References m_checked, and toggled().

◆ toggled

void MantidQt::MantidWidgets::CheckboxHeader::toggled ( bool  checked)
signal

Referenced by mousePressEvent(), and setChecked().

Member Data Documentation

◆ m_checked

bool MantidQt::MantidWidgets::CheckboxHeader::m_checked
private

The state of the checkbox in the column header.

Definition at line 47 of file CheckboxHeader.h.

Referenced by mousePressEvent(), paintSection(), and setChecked().


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