Richard Heck wrote:
> I'm afraid I re-invented the wheel here, though. The layout combo now does 
> something similar, and it uses native Qt models and such to do what I was 
> trying to do. So, well, you might want to replace these custom models with 
> normal Qt ones. I'm guessing that might otherwise make your job easier.

i finally found this myself, but its somewhat bit tough to go through this
this stuff for me ;) but i still belive we can reuse it - do you see a way howto
do in your model something which would be similar to this QTreeView code
which i wanted reuse from shortcuts code:


families of classes added like this:
                                                                            
editItem_ = new QTreeWidgetItem(shortcutsTW);                        
editItem_->setText(0, qt_("Cursor, Mouse and Editing functions"));   
editItem_->setFlags(editItem_->flags() & ~Qt::ItemIsSelectable);     
                                                                     
mathItem_ = new QTreeWidgetItem(shortcutsTW);                        
mathItem_->setText(0, qt_("Mathematical Symbols"));                  
mathItem_->setFlags(mathItem_->flags() & ~Qt::ItemIsSelectable);     

....

inserting particular modules from classes into the list like this:
                                                                    
KeyMap::BindingList::const_iterator it = bindinglist.begin();       
KeyMap::BindingList::const_iterator it_end = bindinglist.end();     
for (; it != it_end; ++it)                                          
        insertShortcutItem(it->request, it->sequence, 
KeyMap::ItemType(it->tag));   
                                                                         
shortcutsTW->sortItems(0, Qt::AscendingOrder);                           

... (from  PrefShortcuts::updateShortcutsTW())


where insertShortcutItem is like this (:

        switch(lyxaction.getActionType(action)) {              
         case LyXAction::Edit:                                  
                 newItem = new QTreeWidgetItem(editItem_);      
                 break;                                         
         case LyXAction::Math:                                  
                 newItem = new QTreeWidgetItem(mathItem_);      
                 break;                                         
.....
 }                                                              
                                                                
 newItem->setText(0, lfun_name);  newItem->setText(1, shortcut);                
                 
 setItemType(newItem, item_tag);                                
 return newItem;                                                
}                        

for the time being i commited the switch to QTreeView, but if it appears
there is no way to continue i'll revert it later.

pavel

Reply via email to