Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members

LayerItem Class Reference

Used in view modes edit dialog. Is there to reuse some code for the QListView. More...

Inheritance diagram for LayerItem:

Inheritance graph
[legend]
Collaboration diagram for LayerItem:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 LayerItem (QListViewItem *item, ShowModesDlg *dlg, int height, QString allowOverlapStr)
QString name ()
void setAttributes (QDomElement elem)
 ~LayerItem ()
void parseDom (QDomElement elem)
void edit ()
bool deletable ()
void add ()
void setTextInListView ()

Protected Attributes

int m_height
QString m_allowOverlapStr

Detailed Description

Used in view modes edit dialog. Is there to reuse some code for the QListView.

Definition at line 155 of file showmodesdlg.cpp.


Constructor & Destructor Documentation

LayerItem::LayerItem QListViewItem *  item,
ShowModesDlg dlg,
int  height,
QString  allowOverlapStr
[inline]
 

Definition at line 158 of file showmodesdlg.cpp.

References add(), edit(), Item::menu, and setTextInListView().

00159                                        : Item( item , dlg), m_height( height ), m_allowOverlapStr( allowOverlapStr)
00160     {
00161         menu = new QPopupMenu( dlg );
00162         menu->insertItem( "add feature",dlg , SLOT(add
00163                           ()) );
00164         menu->insertItem( "remove this layer", dlg , SLOT(remove
00165                           ()) );
00166         menu->insertItem( "edit this layer", dlg , SLOT(edit()) );
00167         setTextInListView();
00168     }

LayerItem::~LayerItem  )  [inline]
 

Definition at line 180 of file showmodesdlg.cpp.

00181     {}


Member Function Documentation

void LayerItem::add  )  [virtual]
 

Reimplemented from Item.

Definition at line 582 of file showmodesdlg.cpp.

References GeneralMaker::listRegistered().

Referenced by LayerItem().

00583 {
00584     QStringList lst;
00585     std::list< std::string > aList = GeneralMaker::listRegistered();
00586     for ( std::list< std::string >::iterator it = aList.begin();  it != aList.end(); ++it )
00587     {
00588      lst << it->c_str();
00589     }
00590     bool ok;
00591     QString res = QInputDialog::getItem(
00592                       "MyApp 3000", "Select an feature:", lst, 1, false, &ok,
00593                       showModesDlg );
00594     if ( ok )
00595     {
00596         FeatureItem *item =  new FeatureItem( this, showModesDlg, res );
00597         setOpen( true );
00598     }
00599     else
00600     {
00601         return;
00602     }
00603 }

bool LayerItem::deletable  )  [inline, virtual]
 

Implements Item.

Definition at line 208 of file showmodesdlg.cpp.

00209     {
00210         return true;
00211     }

void LayerItem::edit  )  [virtual]
 

Reimplemented from Item.

Definition at line 567 of file showmodesdlg.cpp.

References m_allowOverlapStr, m_height, setTextInListView(), and Item::showModesDlg.

Referenced by LayerItem().

00568 {
00569     QString allowOverlapString = m_allowOverlapStr;
00570     int height = m_height;
00571     LayerEditDlg * dlg = new LayerEditDlg( height, allowOverlapString, showModesDlg, "edit layer" );
00572     if ( dlg->exec() == QDialog::Accepted )
00573     {
00574         m_height = height;
00575         m_allowOverlapStr = allowOverlapString;
00576         setTextInListView();
00577     }
00578     return;
00579 }

QString LayerItem::name  )  [inline, virtual]
 

Implements Item.

Definition at line 169 of file showmodesdlg.cpp.

Referenced by parseDom().

00170     {
00171         return QString( "layer" );
00172     }

void LayerItem::parseDom QDomElement  elem  )  [inline]
 

Definition at line 182 of file showmodesdlg.cpp.

References name(), and Item::showModesDlg.

Referenced by ModeItem::parseDom().

00183     {
00184 
00185         QDomNode node = elem.firstChild();
00186 
00187         while ( !node.isNull() )
00188         {
00189 
00190             if ( node.isElement() && node.nodeName() == "feature" )
00191             {
00192 
00193                 QDomElement elem = node.toElement();
00194 
00195                 Q_ASSERT((elem.hasAttribute("name")));
00196 
00197                 QString name = elem.attribute( "name" ,"");
00198 
00199 
00200                 new FeatureItem( this, showModesDlg , name   );
00201 
00202             }
00203             node = node.nextSibling();
00204         }
00205     }

void LayerItem::setAttributes QDomElement  elem  )  [inline, virtual]
 

Implements Item.

Definition at line 173 of file showmodesdlg.cpp.

References m_allowOverlapStr, and m_height.

00174     {
00175         elem.setAttribute( "height", QString("%1").arg(m_height)  );
00176         elem.setAttribute( "allowOverlapStr", m_allowOverlapStr );
00177         return;
00178 
00179     }

void LayerItem::setTextInListView  )  [inline]
 

Definition at line 215 of file showmodesdlg.cpp.

References m_allowOverlapStr, and m_height.

Referenced by edit(), and LayerItem().

00216     {
00217         setText(0,"layer");
00218         setText(2, QString("%1").arg( m_height ));
00219         setText(3, m_allowOverlapStr );
00220     }


Member Data Documentation

QString LayerItem::m_allowOverlapStr [protected]
 

Definition at line 224 of file showmodesdlg.cpp.

Referenced by edit(), setAttributes(), and setTextInListView().

int LayerItem::m_height [protected]
 

Definition at line 223 of file showmodesdlg.cpp.

Referenced by edit(), setAttributes(), and setTextInListView().


The documentation for this class was generated from the following file:
Generated on Fri Mar 17 17:44:59 2006 for trapper by  doxygen 1.4.4