Logo Search packages:      
Sourcecode: ktechlab version File versions  Download package

void ItemDocument::slotInitItemActions ( Item item = 0l  )  [virtual, slot, inherited]

Enables / disables / selects various actions depending on what is selected or not.

Reimplemented in CircuitDocument.

Definition at line 620 of file itemdocument.cpp.

References View::action(), Document::activeView(), ItemGroup::itemCount(), and ItemDocument::selectList().

Referenced by ICNDocument::fillContextMenu(), and CircuitDocument::slotInitItemActions().

{
      Q_UNUSED(item);
      
      ItemView * activeItemView = dynamic_cast<ItemView*>(activeView());
      if ( !p_ktechlab || !activeItemView )
            return;
      
      KAction * align_actions[] = { 
            activeItemView->action("align_horizontally"),
            activeItemView->action("align_vertically"),
            activeItemView->action("distribute_horizontally"),
            activeItemView->action("distribute_vertically") };
      
      bool enableAlignment = selectList()->itemCount() > 1;
      for ( unsigned i = 0; i < 4; ++i )
            align_actions[i]->setEnabled(enableAlignment);
}


Generated by  Doxygen 1.6.0   Back to index