File: boolbutton.cpp

package info (click to toggle)
odin 2.0.5-8
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,196 kB
  • sloc: cpp: 62,638; sh: 4,541; makefile: 779
file content (46 lines) | stat: -rw-r--r-- 1,140 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include "boolbutton.h"

buttonBox::buttonBox(const char *text, QWidget *parent, const char *buttonlabel)
 : QGroupBox(buttonlabel,parent) {

  grid=new GuiGridLayout( this, 1, 1);
  gb=new GuiButton(this, this, SLOT(reportclicked()), text);

  grid->add_widget( gb->get_widget(), 0, 0, GuiGridLayout::VCenter);

//  connect( gb->get_widget(), SIGNAL(clicked()), SLOT(reportclicked()) );
}


buttonBox::buttonBox(const char *ontext,const char *offtext, bool initstate, QWidget *parent, const char *buttonlabel)
 : QGroupBox(buttonlabel,parent) {

  grid=new GuiGridLayout( this, 1, 1);
  gb=new GuiButton(this, this, SLOT(setButtonState()), ontext, offtext, initstate);

  grid->add_widget( gb->get_widget(), 0, 0, GuiGridLayout::VCenter);

//  connect( gb->get_widget(), SIGNAL(toggled(bool)), SLOT(setButtonState(bool)) );
}


void buttonBox::reportclicked() {
    emit  buttonClicked();
}

void buttonBox::setToggleState(bool state) {
  gb->set_toggled(state);
}

void buttonBox::setButtonState() {
  bool state=gb->is_on();
  gb->set_text(state);
  emit buttonToggled(state);
}

buttonBox::~buttonBox(){
  delete gb;
  delete grid;
}