KParts::ReadOnlyPart *BasketPlugin::createPart() { KParts::ReadOnlyPart *part = loadPart(); connect( part, SIGNAL(showPart()), this, SLOT(showPart()) ); return part; }
void ListBox::setSelected(const int selected) { if (!mListModel) { mSelected = -1; } else { if (selected < 0) mSelected = -1; else if (selected >= mListModel->getNumberOfElements()) mSelected = mListModel->getNumberOfElements() - 1; else mSelected = selected; } Rect scroll; if (mSelected < 0) scroll.y = 0; else scroll.y = getRowHeight() * mSelected; scroll.height = getRowHeight(); showPart(scroll); distributeValueChangedEvent(); }
void SystemTray::mouseReleaseEvent(QMouseEvent *event) { m_canDrag = false; if (event->button() == Qt::LeftButton) // Show / hide main window if ( rect().contains(event->pos()) ) { // Accept only if released in systemTray toggleActive(); emit showPart(); event->accept(); } else event->ignore(); }
void ListBox::setSelected(int selected) { if (mListModel == NULL) { mSelected = -1; } else { if (selected < 0) { mSelected = -1; } else if (selected >= mListModel->getNumberOfElements()) { mSelected = mListModel->getNumberOfElements() - 1; } else { mSelected = selected; } } Rectangle scroll; if (mSelected < 0) { scroll.y = 0; } else { scroll.y = getRowHeight() * mSelected; } scroll.height = getRowHeight(); showPart(scroll); distributeValueChangedEvent(); }
void ItemContainer::setSelectedItemIndex(int index) { int newSelectedItemIndex; Item* item = mInventory->getItem(index); if (item && passesFilter(item)) newSelectedItemIndex = index; else newSelectedItemIndex = NO_ITEM; if (mSelectedItemIndex != newSelectedItemIndex) { mSelectedItemIndex = newSelectedItemIndex; if (mSelectedItemIndex == NO_ITEM) mLastSelectedItemId = NO_ITEM; else mLastSelectedItemId = item->getId(); gcn::Rectangle scroll; const int columns = std::max(1, getWidth() / gridWidth); const int itemY = getVisibleSlot(item) / columns; if (mSelectedItemIndex == NO_ITEM) scroll.y = 0; else scroll.y = gridHeight * itemY; scroll.height = gridHeight; showPart(scroll); showItemPopup(mShowItemInfo); distributeValueChangedEvent(); } }
void ChangePartManager::changeSuitArmet(SPersonMainPartChangeContext & context) { ulong curBody = getCurrentBody(); SPersonMainPartChangeContext & curContext = m_CurrentPart[EEntityPart_Suit_Armet]; if( curBody != EEntityPart_Suit_Armor)//当前显示的不是时装装备的模型,只存储数据 { curContext = context; return; } if( !m_bCanRequestRes)//不能申请资源了 { curContext = context; return; } if(0 == m_pModelNode )//当前显示的节点还没有加载上来,只存储数据 { curContext = context; return; } //首先卸载旧的模型 const char * pOldBP = gGlobalClient->getEntityClient()->GetSchemeCenter()->getBindPoint(curContext.bindPoint[0] ); ModelNode * pOld = m_pModelNode->getFirstChildNodeByBone(pOldBP); if( pOld ) m_pModelNode->destroyChild( pOld); if( context.perform)//穿上装备 { ModelNode * pNode = 0; ConfigCreature* pCreatureConfig = ConfigCreatures::Instance()->getCreature(context.resId[0]); if( pCreatureConfig ) { pNode = ModelNodeCreater::create(pCreatureConfig); if( pNode) pNode->setScale(xs::Vector3::UNIT_SCALE); } else { const std::string & filename = ConfigCreatureRes::Instance()->getResFromId(context.resId[0]); pNode = ModelNodeCreater::create(filename.c_str() ); } if( pNode ) { const char * pBP = gGlobalClient->getEntityClient()->GetSchemeCenter()->getBindPoint(context.bindPoint[0]); if( !m_pModelNode->addChild(pNode, pBP) ) { pNode->release(); pNode = 0; } else { //设置时装头盔的颜色 pNode->setGlobalDiffuse(m_vSuitArmetColor); } } } else { //已经卸载了 } //保存换装环境 curContext = context; //设置头盔的显示 showPart(EEntityPart_Suit_Armet, m_bShowPart[EEntityPart_Suit_Armet]); return; }
void TextBox::scrollToCaret() { showPart(mText->getCaretDimension(getFont())); }