flagobj.cpp
branchqt4-port
changeset 18 70c41284cb48
parent 2 608f976aa7bb
     1.1 --- a/flagobj.cpp	Tue Jun 06 14:58:11 2006 +0000
     1.2 +++ b/flagobj.cpp	Thu Aug 31 11:55:33 2006 +0000
     1.3 @@ -36,8 +36,8 @@
     1.4  
     1.5  	icon=new ImageObj (canvas);
     1.6  	icon->move (absPos.x(), absPos.y() );
     1.7 -	button=NULL;
     1.8  	state=false;
     1.9 +	action=NULL;
    1.10  }
    1.11  
    1.12  void FlagObj::copy (FlagObj* other)
    1.13 @@ -48,10 +48,8 @@
    1.14  	tooltip=other->tooltip;
    1.15  	state=other->state;
    1.16  	icon->copy(other->icon);
    1.17 +	action=other->action;
    1.18  	setVisibility (other->isVisibleObj() );
    1.19 -	// button is not copied, because
    1.20 -	// we won't copy to a parentRow and
    1.21 -	// all others don't need a button
    1.22  }
    1.23  
    1.24  void FlagObj::move(double x, double y)
    1.25 @@ -119,24 +117,21 @@
    1.26  	return tooltip;
    1.27  }
    1.28  
    1.29 -void FlagObj::setButton(QAction* b)
    1.30 -{
    1.31 -    button=b;
    1.32 -}
    1.33 -
    1.34 -void FlagObj::updateButton()
    1.35 -{
    1.36 -	if (button)
    1.37 -		button->setOn(state);
    1.38 -	else
    1.39 -		qWarning ("FlagObj::updateButton  no button defined");
    1.40 -}
    1.41 -
    1.42  QPixmap FlagObj::getPixmap()
    1.43  {
    1.44  	return icon->getPixmap();
    1.45  }
    1.46  
    1.47 +void FlagObj::setAction (QAction* a)
    1.48 +{
    1.49 +	action=a;
    1.50 +}
    1.51 +
    1.52 +void FlagObj::updateAction ()
    1.53 +{
    1.54 +	if (action) action->setChecked(state);
    1.55 +}
    1.56 +
    1.57  bool FlagObj::isActive()
    1.58  {
    1.59  	return state;
    1.60 @@ -172,12 +167,6 @@
    1.61  	}	
    1.62  }
    1.63  
    1.64 -void FlagObj::setEnabled(bool b)
    1.65 -{
    1.66 -	button->setEnabled (b);
    1.67 -}	
    1.68 -	
    1.69 -
    1.70  void FlagObj::setUsed (bool b)
    1.71  {
    1.72  	used=b;