Esempio n. 1
0
/**
 *\fn           HTREEITEM createItem(const char *path)
 *\brief        创建并得到树节点
 *\param[in]    const char * path 路径
 *\return       HTREEITEM 0成功,其它失败
 */
HTREEITEM CBrowseWnd::createItem(const char *path)
{
    VECTOR_STR vectorStr;
    CStrConver::TokenizeData(path, "/", vectorStr);

    HTREEITEM hItem = TreeView_GetRoot(tree_.m_hWnd);

    if (NULL == hItem)
    {
        hItem = addTreeItem(NULL, "/", false); // 根节点
    }

    HTREEITEM hChild = NULL;

    for (UINT i = 0; i < vectorStr.size(); i++)
    {
        hChild = findTreeItem(hItem, vectorStr[i].c_str());

        if (NULL == hChild)
        {
            hChild = addTreeItem(hItem, vectorStr[i].c_str(), false);
        }

        tree_.SendMessage(TVM_EXPAND, TVE_EXPAND, (LPARAM)hItem);

        hItem = hChild;
    }

    return hItem;
}
void ViewItemHandler::setCheckState(QTreeWidget* treeWidget, TasCommand& command)
{
    Qt::CheckState newState = static_cast<Qt::CheckState>(command.parameter("state").toInt());
    int column = command.parameter("column").toInt();
    //look for the item
    QTreeWidgetItem* item = findTreeItem(treeWidget, command.parameter("item"));
    if(item){
        item->setCheckState(column, newState);
    }
}
void GTUtilsWorkflowDesigner::addSample(HI::GUITestOpStatus &os, const QString &sampName) {
    expandTabs(os);
    QTabWidget *tabs = qobject_cast<QTabWidget *>(GTWidget::findWidget(os, "tabs"));
    GT_CHECK(tabs != NULL, "tabs widget not found");

    GTTabWidget::setCurrentIndex(os, tabs, 1);

    QTreeWidgetItem *samp = findTreeItem(os, sampName, samples);
    GTGlobals::sleep(100);
    GT_CHECK(samp != NULL,"sample is NULL");

    selectSample(os, samp);
    GTGlobals::sleep(500);
}
Esempio n. 4
0
void DirectoryDialog::DMRemoveDirectory(DM_COMPONENT *component)
{
	QTreeWidgetItem *twi;
	int treePos;

	if ((twi = findTreeItem(component)) == NULL)
		return;												// can't find it anyway
	if (m_currentItem != NULL) {
		if (m_currentDirIndex == m_currentItem->data(0, Qt::UserRole).toInt()) {
			m_currentDirIndex = -1;
			while (m_table->rowCount() > 0)
				m_table->removeRow(0);							// clear table
		}
	}
	treePos = m_tree->indexOfTopLevelItem(twi);
	if (treePos == -1)
		return;												// should never happen
	m_tree->takeTopLevelItem(treePos);
}
Esempio n. 5
0
void DirectoryDialog::DMNewDirectory(int index)
{
	QMutexLocker locker(&(m_directoryMgr->m_lock));
	QTreeWidgetItem *twi;

	DM_CONNECTEDCOMPONENT *connectedComponent = m_directoryMgr->m_directory + index;
	if (!connectedComponent->valid)
		return;												// not a valid entry
	TRACE1("Displaying new directory from %s", qPrintable(SyntroUtils::displayUID(&(connectedComponent->connectedComponentUID))));

	DM_COMPONENT *component = connectedComponent->componentDE;

	while (component != NULL) {
		if ((twi = findTreeItem(component)) == NULL)
			addTreeItem(connectedComponent, component);
		else
			updateTreeItem(twi, component);
		component = component->next;
	}
}
void GTUtilsWorkflowDesigner::addAlgorithm(HI::GUITestOpStatus &os, QString algName, bool exactMatch, bool useDragAndDrop){
    expandTabs(os);
    QTabWidget* tabs = qobject_cast<QTabWidget*>(GTWidget::findWidget(os,"tabs"));
    GT_CHECK(tabs!=NULL, "tabs widget not found");

    GTTabWidget::setCurrentIndex(os,tabs,0);
    GTGlobals::sleep(500);

    QTreeWidgetItem *alg = findTreeItem(os, algName, algoriths, exactMatch);
    GTGlobals::sleep(100);
    GT_CHECK(alg!=NULL,"algorithm is NULL");

    selectAlgorithm(os,alg);
    QWidget* w = GTWidget::findWidget(os,"sceneView");

    int workerNum = getWorkers(os).size();
    QPoint p(w->rect().topLeft() + QPoint(100+300*(workerNum-(workerNum/2)*2),100 + 200*(workerNum/2)));//shifting workers position
    if(useDragAndDrop){
        GTMouseDriver::dragAndDrop(os, GTMouseDriver::getMousePosition(), w->mapToGlobal(p));
    }else{
        GTWidget::click(os, w,Qt::LeftButton, p);
    }
    GTGlobals::sleep(1000);
}
void GTUtilsWorkflowDesigner::clickOnPalette(HI::GUITestOpStatus &os, const QString &itemName, Qt::MouseButton mouseButton) {
    selectAlgorithm(os, findTreeItem(os, itemName, algoriths, true));
    GTMouseDriver::click(os, mouseButton);
}