ATLAS Offline Software
Classes | Public Slots | Signals | Public Member Functions | Static Public Member Functions | Protected Slots | Private Attributes | List of all members
VP1ColorSelectButton Class Reference

#include <VP1ColorSelectButton.h>

Inheritance diagram for VP1ColorSelectButton:
Collaboration diagram for VP1ColorSelectButton:

Classes

class  Imp
 

Public Slots

void launchColorChooser ()
 
void setColor (const QColor &)
 
void setDimension (int dim)
 

Signals

void colorChanged (const QColor &)
 
void aboutToShowColorDialog ()
 

Public Member Functions

 VP1ColorSelectButton (QWidget *parent=0, const QColor &initialcolor=Qt::black, int dim=24)
 
virtual ~VP1ColorSelectButton ()
 
QColor color () const
 
void setText (const QString &)
 

Static Public Member Functions

static void setColButtonProperties (QPushButton *, const QColor &col, int dim)
 

Protected Slots

void updateButton ()
 

Private Attributes

Impm_d
 

Detailed Description

Definition at line 20 of file VP1ColorSelectButton.h.

Constructor & Destructor Documentation

◆ VP1ColorSelectButton()

VP1ColorSelectButton::VP1ColorSelectButton ( QWidget *  parent = 0,
const QColor &  initialcolor = Qt::black,
int  dim = 24 
)

Definition at line 33 of file VP1ColorSelectButton.cxx.

34  : QPushButton(parent), m_d(new Imp(initialcolor,this,dim))
35 {
36  connect (this,SIGNAL(clicked()),this,SLOT(launchColorChooser()));
37  QTimer::singleShot(0, this, SLOT(updateButton()));
38 }

◆ ~VP1ColorSelectButton()

VP1ColorSelectButton::~VP1ColorSelectButton ( )
virtual

Definition at line 80 of file VP1ColorSelectButton.cxx.

81 {
82  delete m_d; m_d=0;
83 }

Member Function Documentation

◆ aboutToShowColorDialog

void VP1ColorSelectButton::aboutToShowColorDialog ( )
signal

◆ color()

QColor VP1ColorSelectButton::color ( ) const

Definition at line 108 of file VP1ColorSelectButton.cxx.

109 {
110  return m_d->presentcolor;
111 }

◆ colorChanged

void VP1ColorSelectButton::colorChanged ( const QColor &  )
signal

◆ launchColorChooser

void VP1ColorSelectButton::launchColorChooser ( )
slot

Definition at line 86 of file VP1ColorSelectButton.cxx.

87 {
88  VP1Msg::messageVerbose("VP1ColorSelectButton emitting aboutToShowColorDialog()");
91  setColor(color);
92 }

◆ setColButtonProperties()

void VP1ColorSelectButton::setColButtonProperties ( QPushButton *  pb,
const QColor &  col,
int  dim 
)
static

Definition at line 49 of file VP1ColorSelectButton.cxx.

49  {
50 
51 // if (VP1Msg::verbose())
52 // VP1Msg::messageVerbose("setColButtonProperties: button="+VP1Msg::str(pb)+", color="+VP1Msg::str(col));
53 
54  if (pb->objectName().isEmpty()) {
55  VP1Msg::messageDebug("VP1ColorSelectButton::setColButtonProperties() WARNING: Empty objectName()!!");
56  pb->setObjectName("VP1ColorSelectButton_setColButtonProperties");
57  }
58 
59  if (!pb->text().isEmpty()) {
60  VP1Msg::messageDebug("VP1ColorSelectButton::setColButtonProperties() WARNING: Noticed non-empty text field. Clearing!");
61  pb->QPushButton::setText("");
62  }
63 
64  pb->setStyleSheet("QPushButton#"+pb->objectName()+" { background-color: "
65  +col.name()+"; border-color: "+col.name()+"; }");
66  pb->setFocusPolicy(Qt::NoFocus);
67  if (dim>0) {
68  QSize sz = QSize(dim,dim);
69  QSizePolicy sp(QSizePolicy::Fixed, QSizePolicy::Fixed);
70  sp.setHorizontalStretch(0);
71  sp.setVerticalStretch(0);
72  sp.setHeightForWidth(pb->sizePolicy().hasHeightForWidth());
73  pb->setSizePolicy(sp);
74  pb->setMinimumSize(sz);
75  pb->setMaximumSize(sz);
76  }
77 }

◆ setColor

void VP1ColorSelectButton::setColor ( const QColor &  col)
slot

Definition at line 95 of file VP1ColorSelectButton.cxx.

96 {
97  if (!col.isValid())
98  return;
99  if (m_d->presentcolor==col)
100  return;
102  updateButton();
103  VP1Msg::messageVerbose("VP1ColorSelectButton emitting colorChanged("+col.name()+")");
104  emit colorChanged(col);
105 }

◆ setDimension

void VP1ColorSelectButton::setDimension ( int  dim)
slot

Definition at line 121 of file VP1ColorSelectButton.cxx.

122 {
123  if (m_d->dim == dim)
124  return;
125  m_d->dim = dim;
126  updateButton();
127 }

◆ setText()

void VP1ColorSelectButton::setText ( const QString &  s)

Definition at line 114 of file VP1ColorSelectButton.cxx.

115 {
116  if (!s.isEmpty())
117  VP1Msg::messageDebug("VP1ColorSelectButton::setText() called (with '"+s+"'), but not allowed!");
118 }

◆ updateButton

void VP1ColorSelectButton::updateButton ( )
protectedslot

Definition at line 41 of file VP1ColorSelectButton.cxx.

42 {
43  if (objectName().isEmpty())
44  setObjectName("VP1ColorSelectButton");
46 }

Member Data Documentation

◆ m_d

Imp* VP1ColorSelectButton::m_d
private

Definition at line 45 of file VP1ColorSelectButton.h.


The documentation for this class was generated from the following files:
color
Definition: jFexInputByteStreamTool.cxx:25
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
yodamerge_tmp.dim
dim
Definition: yodamerge_tmp.py:239
fitman.sz
sz
Definition: fitman.py:527
keylayer_zslicemap.pb
pb
Definition: keylayer_zslicemap.py:188
VP1ColorSelectButton::setColor
void setColor(const QColor &)
Definition: VP1ColorSelectButton.cxx:95
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
VP1ColorSelectButton::setColButtonProperties
static void setColButtonProperties(QPushButton *, const QColor &col, int dim)
Definition: VP1ColorSelectButton.cxx:49
VP1ColorSelectButton::Imp::presentcolor
QColor presentcolor
Definition: VP1ColorSelectButton.cxx:27
getColor
unsigned long getColor(unsigned int r, unsigned int g, unsigned int b)
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1ColorSelectButton::updateButton
void updateButton()
Definition: VP1ColorSelectButton.cxx:41
VP1ColorSelectButton::colorChanged
void colorChanged(const QColor &)
VP1ColorSelectButton::Imp::dim
int dim
Definition: VP1ColorSelectButton.cxx:29
VP1Msg::messageVerbose
static void messageVerbose(const QString &)
Definition: VP1Msg.cxx:84
query_example.col
col
Definition: query_example.py:7
VP1ColorSelectButton::m_d
Imp * m_d
Definition: VP1ColorSelectButton.h:44
VP1Msg::messageDebug
static void messageDebug(const QString &)
Definition: VP1Msg.cxx:39
VP1ColorSelectButton::aboutToShowColorDialog
void aboutToShowColorDialog()
VP1ColorSelectButton::launchColorChooser
void launchColorChooser()
Definition: VP1ColorSelectButton.cxx:86