1.11.2 split up of xml helper functions. started to work on attributes
3 /////////////////////////////////////////////////////////////////
5 /////////////////////////////////////////////////////////////////
8 // cout << "Const FlagObj ()\n";
12 FlagObj::FlagObj(QGraphicsScene* s):MapObj(s)
14 // cout << "Const FlagObj this="<<this<<" scene="<<s<<endl;
18 FlagObj::FlagObj (FlagObj* io)
25 // cout << "Destr FlagObj this="<<this <<" " << name.ascii() << "\n";
26 if (icon) delete (icon);
35 icon=new ImageObj (scene);
36 icon->setPos (absPos.x(), absPos.y() );
43 void FlagObj::copy (FlagObj* other)
48 tooltip=other->tooltip;
52 icon->copy(other->icon);
54 setVisibility (other->isVisibleObj() );
57 void FlagObj::move(double x, double y)
64 void FlagObj::moveBy(double x, double y)
66 move (x+absPos.x(),y+absPos.y() );
69 void FlagObj::setVisibility (bool v)
71 MapObj::setVisibility(v);
73 icon->setVisibility(true);
75 icon->setVisibility(false);
78 void FlagObj::load (const QString &fn)
85 void FlagObj::load (const QPixmap &pm)
92 void FlagObj::setName(const QString &n)
97 const QString FlagObj::getName()
102 void FlagObj::setGroup (const QString &n)
107 const QString FlagObj::getGroup()
112 void FlagObj::unsetGroup()
117 void FlagObj::setToolTip(const QString &n)
122 const QString FlagObj::getToolTip()
127 QPixmap FlagObj::getPixmap()
129 return icon->pixmap();
132 void FlagObj::setAction (QAction* a)
137 void FlagObj::updateAction ()
141 action->setChecked(state);
143 action->setVisible(state);
147 void FlagObj::setAlwaysVisible(bool b)
152 bool FlagObj::isAlwaysVisible()
157 bool FlagObj::isActive()
162 void FlagObj::toggle()
170 void FlagObj::activate()
173 // only show icon, if flag itself is visible
176 icon->setVisibility (true);
177 //icon->setPos (100,100);
178 //icon->setPos (rand()%100,rand()%130);
183 void FlagObj::deactivate()
186 // if flag itself is invisible we don't need to call
189 icon->setVisibility (false);
194 void FlagObj::setUsed (bool b)
199 bool FlagObj::isUsed()
204 void FlagObj::saveToDir (const QString &tmpdir, const QString &prefix)
206 QString fn=tmpdir + prefix + name + ".png";
207 icon->save (fn,"PNG");
210 void FlagObj::positionBBox()
212 bbox.moveTopLeft (absPos );
213 clickBox.moveTopLeft (absPos );
216 void FlagObj::calcBBoxSize()
218 if (visible && state)
220 bbox.setSize ( QSizeF(
221 icon->boundingRect().width(),
222 icon->boundingRect().height() ) );
225 bbox.setSize (QSizeF(0,0));
227 clickBox.setSize (bbox.size());