Beispiel #1
0
void Screen::slot_mouseMoved( GenericCell * c )
{
	if( _currentCell != c ) {
		updateStatusBar( c );
		if( c->getLord() ) {
			setCursor( Qt::WaitCursor );
		} else if( c->getBase() ) {
			setCursor( Qt::WaitCursor );
		} else if( c->getBuilding() ) {
			setCursor( Qt::WaitCursor );
		} else if( c->getEvent() ) {
			setCursor( Qt::WaitCursor );
		} else if( c->getCreature() ) {
			setCursor( Qt::WaitCursor );
		} else if( c->getDecorationGroup() ) {
			setCursor( Qt::PointingHandCursor );
		} else if( c->getCoeff() < 0  || !c->isStoppable() || !c->isFree() ) {
			setCursor( Qt::ForbiddenCursor );
	//	} else if( c->getTransition() ) {
	//		setCursor( Qt::upArrowCursor );
		} else {
			setCursor( Qt::ArrowCursor );
		}
		// XXX: _currentCell->setBorder( false );
		_currentCell = c;
		if( _leftPressed ) {
			_selector->handleLeftClick( c );
			cellChanged( c );
		}
		// XXX: _currentCell->setBorder( true );
	}
}
Beispiel #2
0
void Screen::handleDelete()
{
	if( _currentCell->getLord() ) {
		GenericLord * lord = _currentCell->getLord();
		if(lord->getOwner()){
			lord->getOwner()->removeLord(lord);
		}
		lord->setCell( NULL );
	} else if( _currentCell->getCreature() ) {
		GenericMapCreature * creature = _currentCell->getCreature();
		removeMapCreature(creature);
		_currentCell->setCreature( NULL );
	} else if( _currentCell->getBuilding() ) {
		GenericBuilding * build = _currentCell->getBuilding();
		removeBuilding( build );
		_currentCell->setBuilding( NULL );
	} else if( _currentCell->getBase() ) {
		GenericBase * base = _currentCell->getBase();
		removeBase(  base );
		_currentCell->setBase( NULL );
	} else if( _currentCell->getEvent() ) {
		Event * event = (Event *)( _currentCell->getEvent() );
		removeEvent( event );
		_currentCell->setEvent( NULL );
	}

	_currentCell->setDecoration( 0, 0 );
	_currentCell->setTransition( 0 );
	_currentCell->setTransitionCellType( 0 );

	cellChanged( _currentCell );
}
Beispiel #3
0
void Hive::onDied(int position)
{
    {
        QMutexLocker locker(&m_mutex);
        --m_field[position].first;
        ++m_field[position].second;
    }
    emit cellChanged(position, m_field[position]);
}
Beispiel #4
0
void Hive::positionChanged(int oldPos, int newPos)
{
    {
        QMutexLocker locker(&m_mutex);
        --m_field[oldPos].first;
    }
    emit cellChanged(oldPos, m_field[oldPos]);
    increaseFliesCount(newPos);
}
Beispiel #5
0
void Hive::increaseFliesCount(int position)
{
    {
        QMutexLocker locker(&m_mutex);
        if (!m_field.contains(position))
        {
            m_field.insert(position, qMakePair(0, 0));
        }
        ++m_field[position].first;
    }
    emit cellChanged(position, m_field[position]);
}
Beispiel #6
0
void SingleTable::selectionArrangement()
{


    // Model holds selected rows
    SelectionModel_ = Ctv->selectionModel();

    connect(SelectionModel_,SIGNAL(selectionChanged(const QItemSelection&,const QItemSelection&)),this,SLOT(selectChanged(const QItemSelection&,const QItemSelection&)));
    //prevent loss of focus on tabs by pressing arrow keys
    connect(SelectionModel_,SIGNAL(currentChanged(QModelIndex,QModelIndex)),Ctv,SLOT(cellChanged(QModelIndex,QModelIndex)));
    //connect(SelectionModel_,SIGNAL(currentChanged(QItemSelection,QItemSelection)),this,SLOT(selectChanged(const QItemSelection&,const QItemSelection&)));

}
Beispiel #7
0
void ScriptingCellListener::slotChanged(const KCRegion& region)
{
    KCRegion::ConstIterator end(region.constEnd());

    QVariantList ranges;
    for (KCRegion::ConstIterator it = region.constBegin(); it != end; ++it)
        ranges << (*it)->rect();
    emit regionChanged(ranges);

    for (KCRegion::ConstIterator it = region.constBegin(); it != end; ++it) {
        const QRect r((*it)->rect());
        for (int row = r.top(); row <= r.bottom(); ++row)
            for (int col = r.left(); col <= r.right(); ++col)
                emit cellChanged(col, row);
    }
}
void RKVariable::setText (int row, const QString &text) {
	RK_TRACE (OBJECTS);
	RK_ASSERT (row < getLength ());

	if (myData ()->cell_states[row] & RKVarEditData::Invalid) {
		myData ()->cell_states[row] = RKVarEditData::UnsyncedInvalidState;
		myData ()->invalid_fields.remove (row);
	} else {
		myData ()->cell_states[row] = 0;
	}

	if (text.isNull ()) {
		myData ()->cell_states[row] |= RKVarEditData::NA;
	} else {
		if (getDataType () == DataCharacter) {
			RK_ASSERT (myData ()->cell_strings != 0);
			myData ()->cell_strings[row] = text;
			myData ()->cell_states[row] |= RKVarEditData::Valid;
		} else if (getDataType () == DataFactor) {
			RK_ASSERT (myData ()->cell_doubles != 0);
			if (text.isEmpty ()) {
				myData ()->cell_states[row] |= RKVarEditData::NA;
			} else if (myData ()->value_labels && myData ()->value_labels->contains (text)) {
				myData ()->cell_doubles[row] = text.toInt ();
				myData ()->cell_states[row] |= RKVarEditData::Valid;
			} else {
				myData ()->invalid_fields.replace (row, new QString (text));
				myData ()->cell_states[row] |= RKVarEditData::Invalid | RKVarEditData::UnsyncedInvalidState;
			}
		} else {
			RK_ASSERT (myData ()->cell_doubles != 0);
			bool ok;
			if (text.isEmpty ()) {
				myData ()->cell_states[row] |= RKVarEditData::NA;
			} else {
				myData ()->cell_doubles[row] = text.toDouble (&ok);
				if (ok) {
					myData ()->cell_states[row] |= RKVarEditData::Valid;
				} else {
					myData ()->invalid_fields.replace (row, new QString (text));
					myData ()->cell_states[row] |= RKVarEditData::Invalid | RKVarEditData::UnsyncedInvalidState;
				}
			}
		}
	}
	cellChanged (row);
}
bool CSVRender::UnpagedWorldspaceWidget::handleDrop (const std::vector<CSMWorld::UniversalId>& data, DropType type)
{
    if (WorldspaceWidget::handleDrop (data, type))
        return true;

    if (type!=Type_CellsInterior)
        return false;

    mCellId = data.begin()->getId();

    mCell.reset (new Cell (getDocument().getData(), mRootNode, mCellId));

    update();
    emit cellChanged(*data.begin());

    return true;
}
  CEAbstractEditor::CEAbstractEditor(CrystallographyExtension *ext)
    : CEAbstractDockWidget(ext),
      m_isLocked(false)
  {
    connect(this, SIGNAL(invalidInput()),
            this, SLOT(markAsInvalid()));
    connect(this, SIGNAL(validInput()),
            this, SLOT(markAsValid()));

    connect(m_ext, SIGNAL(cellChanged()),
            this, SLOT(refreshEditor()));

    connect(this, SIGNAL(visibilityChanged()),
            m_ext, SLOT(refreshActions()));

    connect(this, SIGNAL(editStarted()),
            m_ext, SLOT(lockEditors()));
    connect(this, SIGNAL(editAccepted()),
            m_ext, SLOT(unlockEditors()));
    connect(this, SIGNAL(editRejected()),
            m_ext, SLOT(unlockEditors()));

  }
Beispiel #11
0
int Mgr::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: cellChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 1: readFinish((*reinterpret_cast< QNetworkReply*(*)>(_a[1]))); break;
        case 2: onCid((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 3: timecall(); break;
        case 4: debugfn(); break;
        case 5: savescode((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 6: saveLoc((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
        case 7: { bool _r = isSaved((*reinterpret_cast< QString(*)>(_a[1])));
            if (_a[0]) *reinterpret_cast< bool*>(_a[0]) = _r; }  break;
        case 8: overWrite((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QString(*)>(_a[2])),(*reinterpret_cast< QString(*)>(_a[3]))); break;
        case 9: quit(); break;
        default: ;
        }
        _id -= 10;
    }
    return _id;
}
Beispiel #12
0
void Screen::slot_mouseLeftPressed( GenericCell * c )
{
	_selector->handleLeftClick( c );
	cellChanged( c );
	_leftPressed = true;
}
  CEViewOptionsWidget::CEViewOptionsWidget(CrystallographyExtension *ext)
    : CEAbstractDockWidget(ext),
      m_glWidget(NULL),
      m_currentArea(Qt::NoDockWidgetArea),
      m_ncc(NCC_Invalid),
      m_colorDialog(0),
      m_origColor(new QColor())
  {
    this->setPreferredDockWidgetArea(Qt::BottomDockWidgetArea);

    ui.setupUi(this);

    // Initialize the view axis button group
    ui.rad_axis_default->setChecked(true);

    connect(ui.aCellSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(updateRepeatCells()));
    connect(ui.bCellSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(updateRepeatCells()));
    connect(ui.cCellSpinBox, SIGNAL(valueChanged(int)),
            this, SLOT(updateRepeatCells()));

    connect(ui.spin_mi_h, SIGNAL(valueChanged(int)),
            this, SLOT(millerIndexChanged()));
    connect(ui.spin_mi_k, SIGNAL(valueChanged(int)),
            this, SLOT(millerIndexChanged()));
    connect(ui.spin_mi_l, SIGNAL(valueChanged(int)),
            this, SLOT(millerIndexChanged()));
    connect(ui.buttonGroup_camera, SIGNAL(buttonClicked(int)),
            this, SLOT(updateCamera()));

    connect(ui.combo_numCells, SIGNAL(currentIndexChanged(int)),
            this, SLOT(updateCellRenderOptions()));

    connect(ui.push_changeColor, SIGNAL(clicked()),
            this, SLOT(selectCellColor()));

    /*
    connect(ui.aButton, SIGNAL(clicked()),
            this, SLOT(updateViewAxis()));
    connect(ui.aStarButton, SIGNAL(clicked()),
            this, SLOT(updateViewAxis()));
    connect(ui.bButton, SIGNAL(clicked()),
            this, SLOT(updateViewAxis()));
    connect(ui.aStarButton, SIGNAL(clicked()),
            this, SLOT(updateViewAxis()));
    connect(ui.cButton, SIGNAL(clicked()),
            this, SLOT(updateViewAxis()));
    connect(ui.cStarButton, SIGNAL(clicked()),
            this, SLOT(updateViewAxis()));
    */

    connect(ext, SIGNAL(cellChanged()),
            this, SLOT(cellChanged()));

    // Rearrange the widgets when we change from left/right to top/bottom
    // position
    connect(this, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
            this, SLOT(updateLayout(Qt::DockWidgetArea)));
    // Also update when the floating state changes
    connect(this, SIGNAL(topLevelChanged(bool)),
            this, SLOT(updateLayout(bool)));

    this->updateLayout(this->isFloating());

    // Check if we have a hexagonal unit cell for mi_i box
    cellChanged();

    QSettings settings;
    int ncc = settings.value("crystallography/viewWidget/numCellChoice",
                             static_cast<int>(NCC_All)).toInt();
    ui.combo_numCells->setCurrentIndex(ncc);
  }