Example #1
0
void GraphView::ShowContextMenu(const QPoint &pos)
{
    //Move menu
    QPoint globalPos = viewport()->mapToGlobal(pos);

    //Get what is selected
    QList<Node *> nodes = scene()->selectedNodes();
    QList<LinkVisual *> links = scene()->selectedLinks();
    QList<ObjectVisual *> objects = scene()->selectedObjects();

    emit objectsSelected(objects.size());
    emit objectsCanConnect(nodes.size() + links.size() == 2);
    emit objectSelected(objects.size() == 1);
    emit nodeSelected(nodes.size() == 1);


    emit linkSelected(links.size() == 1);

    if (links.size() == 1)
    {
        if(links.at(0)->getSource().x() < links.at(0)->getDestin().x())
        {
            emit linkHasLeftArrow(links.at(0)->getSourceArrow() != NULL);
            emit linkHasRightArrow(links.at(0)->getDestinArrow() != NULL);
        }
        else
        {
            emit linkHasLeftArrow(links.at(0)->getDestinArrow() != NULL);
            emit linkHasRightArrow(links.at(0)->getSourceArrow() != NULL);
        }
    }
    else
    {
        emit linkHasLeftArrow(false);
        emit linkHasRightArrow(false);
    }

    if(nodes.size() == 1)
    {
        ScaObjectConverter conv;

        Node *node = nodes.at(0);
        int id = scene()->getObjectId(node);
        QVariant var = m_model->data(m_model->index(id, 0), rawObjectRole);
        IScaObject *obj = qvariant_cast<IScaObject *>(var);

        emit canConvertToText(conv.canConvert(obj, IScaObject::TEXTBLOCK));
        emit canConvertToIdent(conv.canConvert(obj, IScaObject::IDENTIFIER));
    }
    else
    {
        emit canConvertToText(false);
        emit canConvertToIdent(false);
    }

    m_menu->exec(globalPos);
}
	void ObjectPicker::object_Clicked(UIElement *sender)
	{
		if(objectSelected != NULL)
		{
			ObjectPickerItem *opi = (ObjectPickerItem *)sender;
			assert(opi);

			PhysicsObject *p = opi->getObject();
			assert(p);

			objectSelected(this, p);
		}
	}
int LevelGraphicsView::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGraphicsView::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: objectChanged((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< QPointF(*)>(_a[3])),(*reinterpret_cast< QSizeF(*)>(_a[4])),(*reinterpret_cast< bool(*)>(_a[5]))); break;
        case 1: objectSelected((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 2: needToRescale((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< double(*)>(_a[3])),(*reinterpret_cast< double(*)>(_a[4])),(*reinterpret_cast< bool(*)>(_a[5]))); break;
        default: ;
        }
        _id -= 3;
    }
    return _id;
}
void ClassDialog::slotObjectSelected( const QString& oid )
{
	ObjectsIterator it( m_object->objectsBegin() );
	ObjectsIterator end( m_object->objectsEnd() );
	for ( ; it != end; ++it ) {

		if ( it.data() != 0 ) {
			kdDebug() << k_funcinfo << " Oid: " << (*it)->oid() << endl;
			if ( (*it)->oid() == stringToOid(oid) ) {
				kdDebug() << k_funcinfo << " Object oid. " << oid << endl;
				emit objectSelected( it.data() );
				return;
			}
		}
	}
	kdDebug() << k_funcinfo << "Object " << oid << " not found" << endl;
}
Example #5
0
bool SarlLatticeView::qt_emit( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->signalOffset() ) {
    case 0:
        conceptSelected((sarl_unsigned_int)(*((sarl_unsigned_int*)static_QUType_ptr.get(_o+1))),(QMouseEvent&)*((QMouseEvent*)static_QUType_ptr.get(_o+2)));
        break;
    case 1:
        objectSelected((sarl_unsigned_int)(*((sarl_unsigned_int*)static_QUType_ptr.get(_o+1))),(QMouseEvent&)*((QMouseEvent*)static_QUType_ptr.get(_o+2)));
        break;
    case 2:
        attributeSelected((sarl_unsigned_int)(*((sarl_unsigned_int*)static_QUType_ptr.get(_o+1))),(QMouseEvent&)*((QMouseEvent*)static_QUType_ptr.get(_o+2)));
        break;
    default:
        return QWidget::qt_emit(_id,_o);
    }
    return TRUE;
}
Example #6
0
void ObjectListModel::
addObject(
  WoolzObject * object)
{
  Q_ASSERT(object);
  objects.append(object);
  int row = objects.size() - 1;
  beginInsertRows(QModelIndex(), row, row);
  endInsertRows();

  if(object->ID() < 0)
  {
    object->setID(++m_objectIDCounter);
    object->setupConnections(this);
  }
  emit addObjectSignal(object);
  objectSelected(object);
}
Example #7
0
void DialogObjects::initConnections()
{

    proxyModel = new QSortFilterProxyModel(this);
    proxyModel->setSourceModel(objectModel);
    proxyModel->setFilterKeyColumn(0);
    ui->objectListView->setModel(proxyModel);
    connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), proxyModel, SLOT(setFilterFixedString(QString)));

    ui->objectTableView->setModel(objectDetailsModel);

    connect(ui->objectListView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
            this, SLOT(selected(QModelIndex)));
    connect(objectModel, SIGNAL(objectSelected(qmf::Data)),
            objectDetailsModel, SLOT(showObjectDetail(qmf::Data)));

    connect(objectDetailsModel, SIGNAL(detailReady()), this, SLOT(resizeDetail()));

}
Example #8
0
void cUnit::draw() {

	if(mapIndexGet() == 0xFFFF)
		return;

	_surface->clear( 0xFF );
	
	if( _UnitData->UnitGfxID != 0xFFFF)
		drawBase();

	// Is there a turret?
	if(_UnitData->turretGfxID != 0xFFFF)
		drawTurret();

	// If this object is selected, draw the selected cursor
	if(objectSelected()) {
		SDL_Surface *surface = g_DuneEngine->resourcesGet()->shpGet( 6, 0 );
		_surface->surfacePut( surface, _X, _Y );
	}
}
Example #9
0
	void RelationalComboBox::selectionChanged(int index) {
		RelationalObjectRef object;

		// Check if this is a relational model
		RelationalCollection *r_model = dynamic_cast<RelationalCollection*>(model());

		// Couldn't get the relational collection (possibly view is using a proxy)
		// FIXME elegant way of doing this using the indexes ?
		if (not r_model) {
			QAbstractProxyModel *proxy_model = dynamic_cast<QAbstractProxyModel*>(model());
				if (not proxy_model)
					return;
			r_model = dynamic_cast<RelationalCollection*>(proxy_model->sourceModel());
			// Still couldn't find a relational model => give up
			if (not r_model)
				return;
		}

		if (index != -1) {
			object = r_model->getObjectRef(index);
		}
		emit objectSelected(object);
	}
Example #10
0
void ObjectListModel::
setSelectObject(
  WoolzObject *object)
{
  emit objectSelected(object);
}
Example #11
0
MainWindow::MainWindow(QApplication* app)
{
	m_modified = true;
	m_tmp_file = NULL;

	// load the splash screen
	SplashScreen splash(100);
	splash.show();
	app->processEvents();

	util::ErrorAdapter::instance().addListener(new QtErrorListerner());

	initialize();
	splash.updateProgress(5, "Creating UI – Menues");

	createMenu();
	splash.updateProgress(15, "Creating UI – Notification area");
	app->processEvents();

	createStatusBar();
	splash.updateProgress(20, "Creating UI – Building interfaces");
	app->processEvents();

	m_toolBox = new ToolBox();
	splash.updateProgress(50, "Loading materials");
	m_toolBox->loadMaterials(QString::fromStdString(util::Config::instance().get<std::string>("materialsxml", "data/materials.xml")));
	splash.updateProgress(60, "Loading sounds");
	snd::SoundMgr::instance().LoadSound(util::Config::instance().get<std::string>("sounds", "data/sounds"));
	splash.updateProgress(70, "Loading music");
	snd::SoundMgr::instance().LoadMusic(util::Config::instance().get<std::string>("music", "data/music"));
	snd::SoundMgr::instance().setMusicEnabled(util::Config::instance().get("enableMusic", false));
	app->processEvents();
	splash.updateProgress(80, "Creating UI – Apply screen resolution");

	m_renderWidget = new RenderWidget(this);
	m_renderWidget->setMinimumWidth(400);
	m_renderWidget->show();
	app->processEvents();
	splash.updateProgress(85, "Creating UI – Building dependencies");

	m_splitter = new QSplitter(Qt::Horizontal);
	m_splitter->insertWidget(0, m_toolBox);
	m_splitter->insertWidget(1, m_renderWidget);

	QList<int> sizes;
	sizes.append(200);
	sizes.append(1300);
	m_splitter->setSizes(sizes);
	m_splitter->setStretchFactor(0, 1);
	m_splitter->setStretchFactor(1, 1);
	m_splitter->setChildrenCollapsible(false);

	setCentralWidget(m_splitter);

	// connect the newly created widgets with specific slots
	connect(m_renderWidget, SIGNAL(framesPerSecondChanged(int)), this, SLOT(updateFramesPerSecond(int)));
	connect(m_renderWidget, SIGNAL(objectsCountChanged(int)), this, SLOT(updateObjectsCount(int)));

	connect(m_renderWidget, SIGNAL(objectSelected(sim::Object)), m_toolBox, SLOT(updateData(sim::Object)));
	connect(m_renderWidget, SIGNAL(objectSelected(sim::__Object::Type)), m_toolBox, SLOT(showModificationWidgets(sim::__Object::Type)));
	connect(m_renderWidget, SIGNAL(objectSelected()), m_toolBox, SLOT(deselectInteraction()));
	connect(m_renderWidget, SIGNAL(objectSelected()), m_toolBox, SLOT(hideModificationWidgets()));

	connect(m_toolBox, SIGNAL(interactionSelected(sim::Simulation::InteractionType)), this, SLOT(selectInteraction(sim::Simulation::InteractionType)));
	splash.updateProgress(90, "Finished loading");

	showMaximized();
	m_renderWidget->updateGL();
	m_renderWidget->m_timer->start();
	m_toolBox->updateMaterials();
	splash.updateProgress(100, "Starting ...");

	splash.finish(this);
}
Example #12
0
	void MainWindow::setupTableViews() {

		/** Groups **/
		groupsTableView = new GroupsView;
		groupsTableView->setModel(document->groups_search_proxy);
		groupsTableView->setupHeaders();

		// Upon selecting a group, the filters on other models and the availability of some
		// widgets changes.
		connect(groupsTableView, SIGNAL(objectSelected(RelationalObjectRef)), this, SLOT(updateGroupSelection(RelationalObjectRef)));

		/** Albums **/
		albumsTableView = new AlbumsView;
		albumsTableView->setModel(document->albums_search_proxy);
		albumsTableView->setupHeaders();

		connect(albumsTableView, SIGNAL(objectSelected(RelationalObjectRef)), this, SLOT(updateAlbumSelection(RelationalObjectRef)));

		/** People **/
		peopleTableView = new PeopleView(this);
		peopleTableView->setModel(document->people_search_proxy);
		peopleTableView->setupHeaders();

		/** Unphotographed people **/
		unphotographedPeopleTableView = new PeopleView(this);
		unphotographedPeopleTableView->setModel(document->unphotographed_people);

		/** Photographed people **/
		photographedPeopleTableView = new PhotographedPeopleView(this);
		photographedPeopleTableView->setModel(document->photographed_people_names);
		photographedPeopleTableView->setupHeaders();

		/** Photograph import photo view **/
		photosImportView = new PhotosImportView(this);
		photosImportView->setModel(document->photo_import);

		/** Photograph import people view **/
		photoImportPeopleTableView = new PeopleView(this);
		photoImportPeopleTableView->setModel(document->photo_import_people_search_proxy);
		photoImportPeopleTableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
		photoImportPeopleTableView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);

		/** Photograph selection people view **/
		peopleWithPhotosTableView = new PeopleView(this);
		peopleWithPhotosTableView->setModel(document->people_with_photos);

		/** Photograph selection photo view **/
		photosSelectionView = new PhotosSelectionView(this);
		photosSelectionView->setModel(document->person_photos);

		/** People order view **/
		orderedPeopleTableView = new PeopleView(this);
		orderedPeopleTableView->setModel(document->ordered_people_proxy);
// 		orderedPeopleTableView->setSortingEnabled(true); // NOT USED: enables sorting by user.
		// The following 2 expressions force sorting. Sorting is turned on, but user cannot change sort order by clicking on the headers.
		orderedPeopleTableView->horizontalHeader()->setClickable(false);
		orderedPeopleTableView->sortByColumn(0, Qt::AscendingOrder);
// 		qDebug() << "Clickable" << orderedPeopleTableView->horizontalHeader()->isClickable();

		pictureTemplatesView = new TemplatesView(this);
		pictureTemplatesView->setModel(document->picture_templates);

		albumTemplatesView = new TemplatesView(this);
		albumTemplatesView->setModel(document->album_templates);

	}