Пример #1
0
void CEditDialog::ShowList(const QString& TopNode)
{
    XML.clear("OCStuff","Stuff");
    XML.load(settingsfile);
    this->TopNode=TopNode;
    InitLayout(true);
    if (XML.documentElement->childCount(TopNode)==0)
    {
        theNode=XML.documentElement->appendChild(TopNode);
        if (TopNode=="Controller")
        {
            QDomLiteElement* ctl=theNode->appendChild(TopNode+"Element");
            ctl->setAttribute("Name","Pan");
            ctl->setAttribute("Controller",10);
            ctl->setAttribute("Value",80);
        }
    }
    else
    {
        theNode=XML.documentElement->elementByTag(TopNode);
    }
    for (int i=0;i<theNode->childCount();i++)
    {
        QListWidgetItem* item=new QListWidgetItem(theNode->childElement(i)->attribute("Name"));
        item->setFlags( item->flags() | Qt::ItemIsEditable);
        ui->listWidget->addItem(item);
    }
    ui->SaveItem->setEnabled(ui->listWidget->currentRow()>-1);
    connect(ui->AddItem,SIGNAL(clicked()),this,SLOT(AddItem()));
    connect(ui->RemoveItem,SIGNAL(clicked()),this,SLOT(RemoveItem()));
    connect(ui->listWidget,SIGNAL(itemChanged(QListWidgetItem*)),this,SLOT(RenameItem(QListWidgetItem*)));
    connect(ui->listWidget,SIGNAL(currentRowChanged(int)),this,SLOT(SetItem(int)));
    connect(this,SIGNAL(accepted()),this,SLOT(HideList()));
    connect(ui->SaveItem,SIGNAL(clicked()),this,SLOT(SaveItem()));
}
Пример #2
0
void ComboBox::OnListSelect(AWEvent* event)
{
	if (list) {
		int new_seln = list->GetSelectedIndex();
		
		if (new_seln >= 0 && new_seln < items.size())
		seln = new_seln;

		HideList();
		OnSelect();
		Button::PlaySound(Button::SND_COMBO_SELECT);
	}
}