コード例 #1
0
medDatabaseSearchPanel::medDatabaseSearchPanel( QWidget *parent /*= 0*/ ) : medToolBox(parent), d(new medDatabaseSearchPanelPrivate)
{
    d->page = new QWidget(this);

    d->columnBox = new QComboBox();
	d->columnBox->setToolTip(tr("Search criteria"));

    d->addButton = new QPushButton("+");
    d->addButton->setFocusPolicy(Qt::NoFocus);
	d->addButton->setToolTip(tr("Add a search criterion"));
	
    d->removeButton = new QPushButton("-");
    d->removeButton->setFocusPolicy(Qt::NoFocus);
	d->removeButton->setToolTip(tr("Remove a search criterion"));

    QHBoxLayout *vlayout = new QHBoxLayout();
    vlayout->addWidget(d->columnBox);
    vlayout->addWidget(d->addButton);
    vlayout->addWidget(d->removeButton);

    d->layout = new QVBoxLayout();

    this->setTitle(tr("Filter"));

    QVBoxLayout *mainLayout = new QVBoxLayout();
    mainLayout->addLayout(vlayout);
    mainLayout->addLayout(d->layout);

    d->page->setLayout(mainLayout);
    this->addWidget(d->page);

    connect(d->addButton, SIGNAL(clicked()),this, SLOT(addBox()));
    connect(d->removeButton, SIGNAL(clicked()),this, SLOT(removeBox()));

}
コード例 #2
0
ファイル: IMToolBox.cpp プロジェクト: anchowee/LAN_IM
/*************************************************
Function Name: creatMenu
Description: 创建右键菜单
*************************************************/
void IMToolItem:: creatMenu()
{
    m_menu = new QMenu(this);
    QAction *rename = new QAction(tr("重命名"), m_menu);
    QAction *remove = new QAction(tr("删除"), m_menu);

    connect(rename, SIGNAL(triggered()),
            this, SLOT(renameBox()));
    connect(remove, SIGNAL(triggered()),
            this, SLOT(removeBox()));

    m_menu->addAction(rename);
    m_menu->addAction(remove);
}
コード例 #3
0
ファイル: Editor.cpp プロジェクト: raphaelmarczak/libIscore
void Editor::removeBox(unsigned int boxId)
{
	if (m_boxIdToContainingCSP.find(boxId) != m_boxIdToContainingCSP.end()) {
		CSP* containingCSP = m_boxIdToContainingCSP[boxId];
		ConstrainedBox* currentBox = containingCSP->getBoxById(boxId);
		ConstrainedBox* mother = currentBox->mother();
		std::vector<unsigned int> boxesId;
		std::vector<unsigned int> relationId;
		std::vector<unsigned int> triggerId;


		CSP* boxCSP = currentBox->getCSP();

		if (boxCSP != NULL) {
			boxCSP->getAllBoxesId(boxesId);

			for (unsigned int i = 0; i < boxesId.size(); ++i) {
				removeBox(boxesId[i]);
			}
		}

		containingCSP->getAllBoxesId(boxesId);

		if (boxesId.size() == 0) {
			unsigned int motherHierarchyRelationId = mother->getHierarchyRelationId();

			if (motherHierarchyRelationId != NO_ID) {
				if (m_boxIdToContainingCSP.find(mother->getId()) != m_boxIdToContainingCSP.end()) {
					CSP* motherCSP = m_boxIdToContainingCSP[mother->getId()];
					motherCSP->removeTemporalRelation(motherHierarchyRelationId);
				}
			}
		}

		containingCSP->removeBox(boxId, relationId, triggerId);

		for (unsigned int i = 0; i < relationId.size(); ++i) {
			removeTemporalRelation(relationId[i]);
		}

		for (unsigned int i = 0; i < triggerId.size(); ++i) {
			removeTriggerPoint(triggerId[i]);
		}

		m_boxIdToContainingCSP.erase(boxId);
	}
}
コード例 #4
0
int IMToolItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: renameBoxSignal((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 1: removeBoxSignal((*reinterpret_cast< const QString(*)>(_a[1]))); break;
        case 2: renameBox(); break;
        case 3: removeBox(); break;
        case 4: onClickRightButton(); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
コード例 #5
0
ファイル: Octree.hpp プロジェクト: keeler/simplex
 void removeBox( OrientedBoundingBox * box ) { removeBox( box, mRoot ); };
コード例 #6
0
// Update input to the screen 
void LightScreen::updateInput(KeyHandler* mKeyH, MouseHandler* mMouseH){
	UIScreen::updateInput(mKeyH, mMouseH);

	// Update UI Based on state 
	if (screenShown)
	{
		// Update move state
		if (state == LSTATE_MOVE){
			if (subState == SMOVE_START){
				// Check for click and make sure not clicking on menu 
				if (mMouseH->isLeftDown() && !mMouseH->wasLeftDown()
					&& mMouseH->getX() > menuWidth)
				{
					x1 = clampX(mMouseH->getX());
					y1 = clampY(mMouseH->getY());

					// Check if clicking box
					Box* b = bHand->contains(x1, y1);
					if (b != NULL){
						moveBox = b;
						subState = SMOVE_BOX;
						lTitle->setText(getStateString());
						return;
					}
				}
			}
			else if (subState == SMOVE_BOX){
				// Check for release 
				if (!mMouseH->isLeftDown()){
					moveBox = NULL;
					subState = SMOVE_START;
					lTitle->setText(getStateString());
					return;
				}

				// Get distance change 
				x2 = clampX(mMouseH->getX()) - x1;
				y2 = clampY(mMouseH->getY()) - y1;

				// Check if valid 
				bool validMove = true;
				if (!validX(moveBox->getX() + x2) ||
					!validX(moveBox->getX() + moveBox->getWidth() + x2) ||
					!validY(moveBox->getY() + y2) ||
					!validY(moveBox->getY() + moveBox->getHeight() + y2))
					validMove = false;
				
				// Move if valid 
				if (validMove){
					moveBox->setLocation(moveBox->getX() + x2, moveBox->getY() + y2);
					lMap.invalidate();
				}

				// Set old location 
				x1 = clampX(mMouseH->getX());
				y1 = clampY(mMouseH->getY());

				return;
			}
		}
		// Update add state 
		else if (state == LSTATE_ADD){
			if (subState == SADD_START){
				// Check for click and make sure not clicking on menu 
				if (mMouseH->isLeftDown() && !mMouseH->wasLeftDown() 
					&& mMouseH->getX() > menuWidth)
				{
					x1 = x2 = clampX(mMouseH->getX());
					y1 = y2 = clampY(mMouseH->getY());
					subState = SADD_DRAG;
					lTitle->setText(getStateString());
				}
			}
			else if (subState == SADD_DRAG){
				x2 = clampX(mMouseH->getX());
				y2 = clampY(mMouseH->getY());

				// Check for release 
				if (!mMouseH->isLeftDown() && mMouseH->wasLeftDown())
				{
					addBox(std::min(x1,x2), std::min(y1,y2), abs(x1-x2), abs(y1-y2));
					subState = SADD_START;
					lTitle->setText(getStateString());
				}
			} 
		}
		// Update remove state 
		else if (state == LSTATE_REMOVE){
			if (mMouseH->isLeftDown() && !mMouseH->wasLeftDown()){
				removeBox(bHand->contains(mMouseH->getX(), mMouseH->getY()));
			}
		}
		// Update set light
		else if (state == LSTATE_SETLIGHT){
			if (mMouseH->isLeftDown() && mMouseH->getX() > menuWidth){
				lMap.setLightLoc(
					clampX(mMouseH->getX()), clampY(mMouseH->getY()));
			}
		}

		// Swap screen states
		bMove->updateInput(mKeyH, mMouseH);
		if (bMove->wasClicked()){
			state = LSTATE_MOVE;
			subState = SMOVE_START;
			lTitle->setText(getStateString());
		}
		bAdd->updateInput(mKeyH, mMouseH);
		if (bAdd->wasClicked()){
			state = LSTATE_ADD;
			subState = SADD_START;
			lTitle->setText(getStateString());
		}
		bRemove->updateInput(mKeyH, mMouseH);
		if (bRemove->wasClicked()){
			state = LSTATE_REMOVE;
			lTitle->setText(getStateString());
		}
		bSetLight->updateInput(mKeyH, mMouseH);
		if (bSetLight->wasClicked()){
			state = LSTATE_SETLIGHT;
			lTitle->setText(getStateString());
		}
		
		// Check for clear boxes
		bClear->updateInput(mKeyH, mMouseH);
		if (bClear->wasClicked()){
			bHand->clear();
			lMap.clear();

			// Readd corners 
			lMap.addPoint(&tlC);
			lMap.addPoint(&trC);
			lMap.addPoint(&blC);
			lMap.addPoint(&brC);
		}

		// Check for show light
		cbShowLight->updateInput(mKeyH, mMouseH);
		drawLight = cbShowLight->Checked();

		// Update light size
		vsLightSize->updateInput(mKeyH, mMouseH);
		if (abs(vsLightSize->getValue() - lMap.getLightSize()) > 0.000001f){
			lMap.setLightSize(vsLightSize->getValue());
			if (state != LSTATE_CHANGE_LIGHT_SIZE){
				state = LSTATE_CHANGE_LIGHT_SIZE;
				lTitle->setText(getStateString());
			}
		}

		// Update ray count
		vsRayCount->updateInput(mKeyH, mMouseH);
		if (abs((int)vsRayCount->getValue() - lMap.getRayCount()) > 0.000001f){
			lMap.setRayCount((int)vsRayCount->getValue());
			lRayCount->setText(std::string("Ray Count: ") + toString(lMap.getRayCount()));
			if (state != LSTATE_CHANGE_LIGHT_SIZE){
				state = LSTATE_CHANGE_LIGHT_SIZE;
				lTitle->setText(getStateString());
			}
		}

		// Update darkness 
		vsDarkness->updateInput(mKeyH, mMouseH);
		if (abs(vsDarkness->getValue() - lightDarkness) > 0.000001f){
			lightDarkness = vsDarkness->getValue();
			if (state != LSTATE_DARKNESS){
				state = LSTATE_DARKNESS;
				lTitle->setText(getStateString());
			}
		}

		// Update checkboxes
		cbMethod1->updateInput(mKeyH, mMouseH);
		if (cbMethod1->CheckChanged()){
			cbMethod2->setChecked(!cbMethod1->Checked());
			lMap.setMethod1(cbMethod1->Checked());
			lMap.invalidate();
		}
		cbMethod2->updateInput(mKeyH, mMouseH);
		if (cbMethod2->CheckChanged()){
			cbMethod1->setChecked(!cbMethod2->Checked());
			lMap.setMethod1(!cbMethod2->Checked());
			lMap.invalidate();
		}

		// Check for hide screen
		bHide->updateInput(mKeyH, mMouseH);
		if (bHide->wasClicked()) hide();
	}
	else {
		// Check for show screen
		bShow->updateInput(mKeyH, mMouseH);
		if (bShow->wasClicked()) show();
	}
}