flagobj.cpp
changeset 370 97f5d07bf47d
parent 172 fbb8c8560551
child 406 1c8ff1928b97
     1.1 --- a/flagobj.cpp	Tue Jan 03 09:44:41 2006 +0000
     1.2 +++ b/flagobj.cpp	Tue Sep 05 11:53:54 2006 +0000
     1.3 @@ -1,4 +1,6 @@
     1.4  #include "flagobj.h"
     1.5 +//Added by qt3to4:
     1.6 +#include <QPixmap>
     1.7  
     1.8  /////////////////////////////////////////////////////////////////
     1.9  // FlagObj
    1.10 @@ -9,7 +11,7 @@
    1.11      init ();
    1.12  }
    1.13  
    1.14 -FlagObj::FlagObj(QCanvas* c):MapObj(c) 
    1.15 +FlagObj::FlagObj(Q3Canvas* c):MapObj(c) 
    1.16  {
    1.17  //	cout << "Const FlagObj  canvas="<<c<<endl;
    1.18      init ();
    1.19 @@ -34,8 +36,8 @@
    1.20  
    1.21  	icon=new ImageObj (canvas);
    1.22  	icon->move (absPos.x(), absPos.y() );
    1.23 -	button=NULL;
    1.24  	state=false;
    1.25 +	action=NULL;
    1.26  }
    1.27  
    1.28  void FlagObj::copy (FlagObj* other)
    1.29 @@ -46,10 +48,8 @@
    1.30  	tooltip=other->tooltip;
    1.31  	state=other->state;
    1.32  	icon->copy(other->icon);
    1.33 +	action=other->action;
    1.34  	setVisibility (other->isVisibleObj() );
    1.35 -	// button is not copied, because
    1.36 -	// we won't copy to a parentRow and
    1.37 -	// all others don't need a button
    1.38  }
    1.39  
    1.40  void FlagObj::move(double x, double y)
    1.41 @@ -117,24 +117,21 @@
    1.42  	return tooltip;
    1.43  }
    1.44  
    1.45 -void FlagObj::setButton(QAction* b)
    1.46 -{
    1.47 -    button=b;
    1.48 -}
    1.49 -
    1.50 -void FlagObj::updateButton()
    1.51 -{
    1.52 -	if (button)
    1.53 -		button->setOn(state);
    1.54 -	else
    1.55 -		qWarning ("FlagObj::updateButton  no button defined");
    1.56 -}
    1.57 -
    1.58  QPixmap FlagObj::getPixmap()
    1.59  {
    1.60  	return icon->getPixmap();
    1.61  }
    1.62  
    1.63 +void FlagObj::setAction (QAction* a)
    1.64 +{
    1.65 +	action=a;
    1.66 +}
    1.67 +
    1.68 +void FlagObj::updateAction ()
    1.69 +{
    1.70 +	if (action) action->setChecked(state);
    1.71 +}
    1.72 +
    1.73  bool FlagObj::isActive()
    1.74  {
    1.75  	return state;
    1.76 @@ -170,12 +167,6 @@
    1.77  	}	
    1.78  }
    1.79  
    1.80 -void FlagObj::setEnabled(bool b)
    1.81 -{
    1.82 -	button->setEnabled (b);
    1.83 -}	
    1.84 -	
    1.85 -
    1.86  void FlagObj::setUsed (bool b)
    1.87  {
    1.88  	used=b;