Example #1
0
KBlocksScene::KBlocksScene(GameLogicInterface *p, int capacity)
{
    mpGameLogic = p;
    mGameStarted = false;

    mSnapshotMode = false;
    mTopGameLevel = 0;
    mGroupCount = 0;
    mMaxCapacity = capacity;
    mSceneGamesPerLine = 4;
    mGameAnimEnabled = true;
    mWaitForAllUpdate = false;

    maGroupList = new KBlocksItemGroup*[capacity]();
    maGameScoreList = new KBlocksScore*[capacity]();
    maGameReadySignal = new bool[capacity]();

    QString themeFile(Settings::theme());
    mpGrafx = new KBlocksGraphics(themeFile);
    mpSnd = new KBlocksSound(themeFile);

    int width = (capacity >= mSceneGamesPerLine) ? mSceneGamesPerLine : (capacity % mSceneGamesPerLine);
    int height = (int)(capacity / (mSceneGamesPerLine + 1)) + 1;
    setSceneRect(0, 0, mpGrafx->m_View_Size_Width * width,
                 mpGrafx->m_View_Size_Height * height);

    setItemIndexMethod(NoIndex);

    mUpdateInterval = 50;
    mUpdateTimer.setInterval(mUpdateInterval);
    connect(&mUpdateTimer, &QTimer::timeout, this, &KBlocksScene::updateGame);
    mUpdateTimer.stop();
}
Example #2
0
ResultScene::ResultScene(SharedResultData *resultData, Plasma::RunnerManager *manager, QWidget *focusBase, QObject *parent)
    : QGraphicsScene(parent),
      m_runnerManager(manager),
      m_viewableHeight(0),
      m_currentIndex(0),
      m_focusBase(focusBase),
      m_resultData(resultData)
{
    setItemIndexMethod(NoIndex);

    connect(m_runnerManager, SIGNAL(matchesChanged(QList<Plasma::QueryMatch>)),
            this, SLOT(setQueryMatches(QList<Plasma::QueryMatch>)));

    m_clearTimer.setSingleShot(true);
    m_clearTimer.setInterval(200);
    connect(&m_clearTimer, SIGNAL(timeout()), this, SLOT(clearMatches()));

    m_arrangeTimer.setSingleShot(true);
    m_arrangeTimer.setInterval(50);
    connect(&m_arrangeTimer, SIGNAL(timeout()), this, SLOT(arrangeItems()));

    m_selectionBar = new SelectionBar(0);
    connect(m_selectionBar, SIGNAL(appearanceChanged()), this, SLOT(updateItemMargins()));
    connect(m_selectionBar, SIGNAL(targetItemReached(QGraphicsItem*)), this, SLOT(highlightItem(QGraphicsItem*)));
    m_selectionBar->hide();
    updateItemMargins();

    addItem(m_selectionBar);
}
QBlockDiagramModel::QBlockDiagramModel(QObject *parent)
  : QGraphicsScene(parent)
  , m_pMouseGrabberItem(nullptr)
  , m_pUserData(nullptr)
{
    setItemIndexMethod(NoIndex);
    setBackgroundBrush(QColor(33,33,33));
}
Example #4
0
void eGuiOpPage::_initialize()
{
    const eU32 width = eOperatorPage::WIDTH*eGuiOperator::WIDTH;
    const eU32 height = eOperatorPage::HEIGHT*eGuiOperator::HEIGHT;

    setSceneRect(0, 0, width, height);
    setItemIndexMethod(NoIndex);
}
FormEditorScene::FormEditorScene(FormEditorWidget *view, FormEditorView *editorView)
        : QGraphicsScene(),
        m_editorView(editorView),
        m_showBoundingRects(true)
{
    setupScene();
    view->setScene(this);
    setItemIndexMethod(QGraphicsScene::NoIndex);
}
GraphicsScene::GraphicsScene(QObject *parent)
	: QGraphicsScene(parent)
	, mRatio(0.9)
	, mOffset(QPointF(0,0))
	, mBackColor(QColor(242,239,232))
	, mLeftBtnPressed(false)
{
	setItemIndexMethod(QGraphicsScene::NoIndex);
}
Example #7
0
FormEditorScene::FormEditorScene(FormEditorWidget *view, FormEditorView *editorView)
        : QGraphicsScene(),
        m_editorView(editorView),
        m_showBoundingRects(true)
{
    setupScene();
    view->setScene(this);
    setItemIndexMethod(QGraphicsScene::NoIndex);
    setSceneRect(-canvasWidth()/2., -canvasHeight()/2., canvasWidth(), canvasHeight());
}
Example #8
0
BattleArea::BattleArea(Map *map){
	setItemIndexMethod(QGraphicsScene::NoIndex);

	///
	QTimer *timer = new QTimer();
	timer->setInterval(1000);

	m_width = m_height = map->size() * SIZE;
	setSceneRect(0, 0, m_width, m_height);

	BotPack *bpack = new BotPack("data/robots/botpacks/tank-0.bpack"); // must be dynamic, too (maybe by reference)

	MapList *mapList = map->mapList();
	int mapSize = map->size();
	int i, j;
	int listpos = 0;

	// the TileObject used as BattleArea "background"
	TileObject *tile = new TileObject("data/textures/" + map->pathTexture() + ".svgz", map->pathColor(), map->pathAltColor());
	setBackgroundBrush(tile->pixmap());

	// must add on KWB::Map a method to load the map
	for (i = 0; i < mapSize; i++){
		for (j = 0; j < mapSize; j++){
			listpos = (j * mapSize) + i;
			
			// iteratte trough the map list (objects and items)
			if (mapList->at(listpos) == Ammo){
				AmmoItem *ammo = new AmmoItem("data/items/" + map->ammoTexture() + ".svgz", QPoint(i, j), map->ammoValue());
				addItem(ammo);
			} else if (mapList->at(listpos) == Block){
				BlockObject *block = new BlockObject("data/textures/" + map->blockTexture() + ".svgz", QPoint(i, j), map->blockColor());
				addItem(block);
			} else if (mapList->at(listpos) == Enemy){
				// TODO
			} else if (mapList->at(listpos) == Energy){
				EnergyItem *energy = new EnergyItem("data/items/" + map->energyTexture() + ".svgz", QPoint(i, j), map->energyValue());
				addItem(energy);
			} else if (mapList->at(listpos) == StartPoint){
				// the user programmed Robot
				m_robot = new Robot(bpack, this, QPoint(i, j));
				addItem(m_robot->robotObject()); 
			} else if (mapList->at(listpos) == Wall){
				WallObject *wall = new WallObject("data/textures/" + map->wallTexture() + ".svgz", QPoint(i, j), map->wallColor());
				addItem(wall);

				connect(wall, SIGNAL(deleteMe(QGraphicsItem*)), this, SLOT(deleteItem(QGraphicsItem*)));
			} else if (mapList->at(listpos) == Water){
				WaterObject *water = new WaterObject("data/textures/" + map->waterTexture() + ".svgz", QPoint(i, j), timer);
				addItem(water);
			} else if (mapList->at(listpos) == Weapon){
				WeaponItem *weapon = new WeaponItem("data/items/" + map->weaponTexture() + ".svgz", QPoint(i, j), map->weaponValue());
				addItem(weapon);
			}
		}
Example #9
0
int QGraphicsScene::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) {
        if (_id < 16)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 16;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QBrush*>(_v) = backgroundBrush(); break;
        case 1: *reinterpret_cast< QBrush*>(_v) = foregroundBrush(); break;
        case 2: *reinterpret_cast< ItemIndexMethod*>(_v) = itemIndexMethod(); break;
        case 3: *reinterpret_cast< QRectF*>(_v) = sceneRect(); break;
        case 4: *reinterpret_cast< int*>(_v) = bspTreeDepth(); break;
        case 5: *reinterpret_cast< QPalette*>(_v) = palette(); break;
        case 6: *reinterpret_cast< QFont*>(_v) = font(); break;
        case 7: *reinterpret_cast< bool*>(_v) = isSortCacheEnabled(); break;
        case 8: *reinterpret_cast< bool*>(_v) = stickyFocus(); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setBackgroundBrush(*reinterpret_cast< QBrush*>(_v)); break;
        case 1: setForegroundBrush(*reinterpret_cast< QBrush*>(_v)); break;
        case 2: setItemIndexMethod(*reinterpret_cast< ItemIndexMethod*>(_v)); break;
        case 3: setSceneRect(*reinterpret_cast< QRectF*>(_v)); break;
        case 4: setBspTreeDepth(*reinterpret_cast< int*>(_v)); break;
        case 5: setPalette(*reinterpret_cast< QPalette*>(_v)); break;
        case 6: setFont(*reinterpret_cast< QFont*>(_v)); break;
        case 7: setSortCacheEnabled(*reinterpret_cast< bool*>(_v)); break;
        case 8: setStickyFocus(*reinterpret_cast< bool*>(_v)); break;
        }
        _id -= 9;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 9;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 9;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
CustomGraphicsScene::CustomGraphicsScene(QObject* _parent) :
	QGraphicsScene(_parent),
	m_afterMoving(false)
{
	setItemIndexMethod(QGraphicsScene::NoIndex);

	setBackgroundBrush(Qt::transparent);

	QGraphicsRectItem *item;
	addItem(item = new QGraphicsRectItem(QRectF(0,0,10000,10000)));
	item->setVisible(false);
}
void QMapGraphicsScene::update(void)
{
    map_image = w->map_image;
    //if(show_mask)
    {
        tipl::grayscale_image edge(w->map_mask);
        tipl::morphology::edge(edge);
        for(unsigned int index = 0;index < edge.size();++index)
            if(edge[index])
                map_image[index] = tipl::rgb(255,0,0);
    }
    //if(main_window->ui->show_reco_on_map->isChecked())
    {
        double rx = double(map_image.width()-1)/w->dim[0];
        double ry = double(map_image.height()-1)/w->dim[1];
        int shift[9] = {-map_image.width()*2,-map_image.width(),-2,-1,0,1,2,map_image.width(),map_image.width()*2};
        for(int i = 0;i < main_window->output.size();++i)
        {
            bool red = (i == main_window->ui->recog_result->currentRow());
            int x = main_window->output[i][0]*rx;
            int y = main_window->output[i][1]*ry;
            int pos = y*map_image.width()+x;
            for(int j = 0;j < 9;++j)
            {
                int p = pos + shift[j];
                if(p >=0 && p < map_image.size())
                    map_image[p] = red ? tipl::rgb(255,0,0) : tipl::rgb(0,0,255);
            }
        }
    }


    QImage I((unsigned char*)&*map_image.begin(),map_image.width(),map_image.height(),QImage::Format_RGB32);


    qimage = I.scaledToWidth(map_image.width()*10.0f/(float)resolution);
    {
        QPainter paint(&qimage);
        double x = qimage.width()*main_scene.x/w->dim[0];
        double y = qimage.height()*main_scene.y/w->dim[1];
        double rx = qimage.width()*main_scene.main_image.width()*w->get_r(main_scene.level)/w->dim[0];
        double ry = qimage.height()*main_scene.main_image.height()*w->get_r(main_scene.level)/w->dim[1];
        paint.setPen(Qt::red);
        paint.drawLine(x,y,x+rx,y);
        paint.drawLine(x,y+ry,x+rx,y+ry);
        paint.drawLine(x,y,x,y+ry);
        paint.drawLine(x+rx,y,x+rx,y+ry);
    }
    setSceneRect(0, 0, qimage.width(),qimage.height());
    clear();
    setItemIndexMethod(QGraphicsScene::NoIndex);
    addRect(0, 0, qimage.width(),qimage.height(),QPen(),qimage);
}
Example #12
0
ezQtNodeScene::ezQtNodeScene(QObject* parent)
    : QGraphicsScene(parent)
    , m_pManager(nullptr)
    , m_pStartPin(nullptr)
    , m_pTempConnection(nullptr)
{
  setItemIndexMethod(QGraphicsScene::NoIndex);
  m_vPos = ezVec2::ZeroVector();
  m_bIgnoreSelectionChange = false;

  // setSceneRect(-1000, -1000, 2000, 2000);
}
Example #13
0
Scene::Scene(View *view, QObject * parent)
	:  QGraphicsScene(parent), mItemType(none), mWaitMove(false), mCount(0), mGraphicsItem(NULL), mSelectedTextPicture(NULL)
{
	mView = view;
	setItemIndexMethod(NoIndex);
	mEmptyRect = addRect(0, 0, sizeEmptyRectX, sizeEmptyRectY, QPen(Qt::white));
	setEmptyPenBrushItems();
	mCopyPaste = nonePaste;
	connect(this, SIGNAL(selectionChanged()), this, SLOT(changePalette()));
	connect(this, SIGNAL(selectionChanged()), this, SLOT(changeFontPalette()));
	mZValue = 0;
}
Example #14
0
LinkDialogGraphicsScene::LinkDialogGraphicsScene(QWidget* parent, ProcessorNetwork* network,
                                                 Processor* srcProcessor, Processor* dstProcessor)
    : QGraphicsScene(parent)
    , currentScrollSteps_(0)
    , linkCurve_(nullptr)
    , startProperty_(nullptr)
    , endProperty_(nullptr)
    , srcProcessor_(nullptr)
    , dstProcessor_(nullptr)
    , network_(network)
    , expandProperties_(false)
    , mouseOnLeftSide_(false) {
    // The default bsp tends to crash...
    setItemIndexMethod(QGraphicsScene::NoIndex);

    network_->addObserver(this);

    srcProcessor_ =
        new LinkDialogProcessorGraphicsItem(LinkDialogParent::Side::Left, srcProcessor);
    dstProcessor_ =
        new LinkDialogProcessorGraphicsItem(LinkDialogParent::Side::Right, dstProcessor);

    float xPos1 = linkdialog::dialogWidth / 10.0 + linkdialog::processorWidth/2;
    addItem(srcProcessor_);
    srcProcessor_->setPos(QPointF(xPos1, 2*linkdialog::processorHeight));
    srcProcessor_->show();

    float xPos2 = linkdialog::dialogWidth * 9.0 / 10.0 - linkdialog::processorWidth/2;
    addItem(dstProcessor_);
    dstProcessor_->setPos(QPointF(xPos2, 2*linkdialog::processorHeight));
    dstProcessor_->show();


    std::function<void(LinkDialogPropertyGraphicsItem*)> buildCache = [this, &buildCache](
        LinkDialogPropertyGraphicsItem* item) {
        propertyMap_[item->getItem()] = item;
        for (auto i : item->getSubPropertyItemList()) {
            buildCache(i);
        }
    };

    for (auto item : srcProcessor_->getPropertyItemList()) buildCache(item);
    for (auto item : dstProcessor_->getPropertyItemList()) buildCache(item);

    // add links
    auto links = network_->getLinksBetweenProcessors(srcProcessor, dstProcessor);
    for (auto& link : links) {
        initializePropertyLinkRepresentation(link);
    }
    update();

}
Example #15
0
CanvasScene::CanvasScene(QObject *parent)
	: QGraphicsScene(parent), _image(0), m_model(nullptr),
	  m_selection(nullptr),
	  _showAnnotationBorders(false), _showAnnotations(true), _showUserMarkers(true), _showUserLayers(true), _showLaserTrails(true), _thickLaserTrails(false)
{
	setItemIndexMethod(NoIndex);

	// Timer for on-canvas animations (user pointer fadeout, laser trail flickering and such)
	_animTickTimer = new QTimer(this);
	connect(_animTickTimer, &QTimer::timeout, this, &CanvasScene::advanceUsermarkerAnimation);
	_animTickTimer->setInterval(200);
	_animTickTimer->start(200);
}
void QMapGraphicsScene::mouseMoveEvent ( QGraphicsSceneMouseEvent * mouseEvent )
{
    float Y = mouseEvent->scenePos().y();
    float X = mouseEvent->scenePos().x();
    QImage bitmap(qimage);
    QPainter paint(&bitmap);
    sel_point.push_back(tipl::vector<2,short>(X, Y));
    for (unsigned int index = 1; index < sel_point.size(); ++index)
        paint.drawLine(sel_point[index-1][0], sel_point[index-1][1],sel_point[index][0], sel_point[index][1]);
    clear();
    setItemIndexMethod(QGraphicsScene::NoIndex);
    addRect(0, 0, bitmap.width(),bitmap.height(),QPen(),bitmap);
}
Example #17
0
TileScene::TileScene()
{
    tileController = NULL;
    currentLayer = NULL;
    brushController = NULL;

    gridLines = new QGraphicsItemGroup;
    addItem(gridLines);
    gridLines->setPos(0, 0);
    gridLines->hide();

    setItemIndexMethod(NoIndex);
}
Example #18
0
CanvasScene::CanvasScene(QObject *parent)
	: QGraphicsScene(parent), _image(0), _statetracker(0),
	  _toolpreview(0),
	  _selection(0),
	  _showAnnotations(true), _showAnnotationBorders(false), _showUserMarkers(true), _showUserLayers(true), _showLaserTrails(true), _thickLaserTrails(false)
{
	setItemIndexMethod(NoIndex);

	// Timer for on-canvas animations (user pointer fadeout, laser trail flickering and such)
	_animTickTimer = new QTimer(this);
	connect(_animTickTimer, SIGNAL(timeout()), this, SLOT(advanceUsermarkerAnimation()));
	_animTickTimer->setInterval(200);
	_animTickTimer->start(200);
}
Example #19
0
void Enviroment::init()
{
	visibleGrid = true;
	visibleCenterMarker = true;

	gridSpace = 10;
	grid = QPixmap(gridSpace, gridSpace);
	grid.fill(Qt::white);
	QPainter gridPainter(&grid);
	gridPainter.drawPoint(0,0);
	gridPainter.drawPoint(gridSpace, gridSpace);

	setItemIndexMethod(NoIndex);

}
Example #20
0
RSceneDevice::RSceneDevice(double width, double height,
			   double pointsize, 
			   const char *family)
    : QGraphicsScene(0)
{
    setItemIndexMethod(QGraphicsScene::NoIndex);
    debug = false;
    force_repaint = false;
    zclip = 0.0;
    zitem = 0.0;
    default_family = QString(family);
    setDeviceNumber(curDevice());
    setSceneRect(0.0, 0.0, width, height);
    clip_rect = addRect(sceneRect());
    do_QTScene(width, height, pointsize, this);
}
/**
	Constructeur
	@param editor L'editeur d'element concerne
	@param parent le Widget parent
*/
ElementScene::ElementScene(QETElementEditor *editor, QObject *parent) :
	QGraphicsScene(parent),
	m_elmt_type("simple"),
	qgi_manager(this),
	m_event_interface(NULL),
	element_editor(editor),
	decorator_(0)
{
	behavior = Normal;
	setItemIndexMethod(NoIndex);
	setGrid(1, 1);
	initPasteArea();
	undo_stack.setClean();
	decorator_lock_ = new QMutex(QMutex::NonRecursive);
	connect(&undo_stack, SIGNAL(indexChanged(int)), this, SLOT(managePrimitivesGroups()));
	connect(this, SIGNAL(selectionChanged()), this, SLOT(managePrimitivesGroups()));
}
Example #22
0
//=================================================================================================
SlideScene::SlideScene( QWidget *parent ):
  QGraphicsScene( parent ),
  view( (SlideViewer *)parent ),
  image(0)
{
  if (!view->getNode()->getLua()->getSlide()->fields["filename"].toString().isEmpty())
  {
    image = new QImage( PathUtils::nativePath( view->getNode()->getNodeName() + "/"
                                               + view->getNode()->getLua()->getSlide()->fields["filename"].toString() ) );

    //view->setBackgroundBrush( QPixmap( PathUtils::nativePath( view->getNode()->getNodeName() + "/"
    //                                                          + view->getNode()->getLua()->getSlide()->fields["filename"].toString() ) ) );

    setSceneRect( 0, 0, image->width(), image->height() );
    update();
  }

  setItemIndexMethod( QGraphicsScene::NoIndex );
}
Example #23
0
MScene::MScene(QObject *parent)
    : QGraphicsScene(parent),
      d_ptr(new MScenePrivate)
{
    Q_D(MScene);

    d->q_ptr = this;
    d->manager = 0;
    QColor fpsBackgroundColor(FpsBackgroundColor);
    fpsBackgroundColor.setAlphaF(FpsBackgroundOpacity);
    d->fpsBackgroundBrush = QBrush(fpsBackgroundColor);

    QColor boundingRectLineColor(BoundingRectLineColor);
    d->boundingRectLinePen = QPen(boundingRectLineColor);

    QColor boundingRectFillColor(BoundingRectFillColor);
    d->boundingRectFillBrush = QBrush(boundingRectFillColor);

    setItemIndexMethod(QGraphicsScene::NoIndex);

    d->eventEater->setParent(this);
    addItem(d->eventEater);
}
Example #24
0
TupGraphicsScene::TupGraphicsScene() : QGraphicsScene(), k(new Private)
{
    #ifdef K_DEBUG
           T_FUNCINFO;
    #endif

    setItemIndexMethod(QGraphicsScene::NoIndex);

    k->framePosition.layer = -1;
    k->framePosition.frame = -1;
    k->spaceMode = TupProject::FRAMES_EDITION;

    setCurrentFrame(0, 0);

    k->onionSkin.next = 0;
    k->onionSkin.previous = 0;
    k->tool = 0;
    k->isDrawing = false;

    setBackgroundBrush(Qt::gray);

    k->inputInformation = new TupInputDeviceInformation(this);
    k->brushManager = new TupBrushManager(this);
}
Example #25
0
ChatScene::ChatScene(QAbstractItemModel *model, const QString &idString, qreal width, ChatView *parent)
  : QGraphicsScene(0, 0, width, 0, (QObject *)parent),
    _chatView(parent),
    _idString(idString),
    _model(model),
    _singleBufferId(BufferId()),
    _sceneRect(0, 0, width, 0),
    _firstLineRow(-1),
    _viewportHeight(0),
    _markerLine(new MarkerLineItem(width)),
    _markerLineVisible(false),
    _markerLineValid(false),
    _markerLineJumpPending(false),
    _cutoffMode(CutoffRight),
    _selectingItem(0),
    _selectionStart(-1),
    _isSelecting(false),
    _clickMode(NoClick),
    _clickHandled(true),
    _leftButtonPressed(false)
{
  MessageFilter *filter = qobject_cast<MessageFilter*>(model);
  if(filter && filter->isSingleBufferFilter()) {
    _singleBufferId = filter->singleBufferId();
  }

  addItem(_markerLine);
  connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _markerLine, SLOT(sceneRectChanged(const QRectF &)));

  ChatViewSettings defaultSettings;
  int defaultFirstColHandlePos = defaultSettings.value("FirstColumnHandlePos", 80).toInt();
  int defaultSecondColHandlePos = defaultSettings.value("SecondColumnHandlePos", 200).toInt();

  ChatViewSettings viewSettings(this);
  _firstColHandlePos = viewSettings.value("FirstColumnHandlePos", defaultFirstColHandlePos).toInt();
  _secondColHandlePos = viewSettings.value("SecondColumnHandlePos", defaultSecondColHandlePos).toInt();

  _firstColHandle = new ColumnHandleItem(QtUi::style()->firstColumnSeparator());
  addItem(_firstColHandle);
  _firstColHandle->setXPos(_firstColHandlePos);
  connect(_firstColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(firstHandlePositionChanged(qreal)));
  connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _firstColHandle, SLOT(sceneRectChanged(const QRectF &)));

  _secondColHandle = new ColumnHandleItem(QtUi::style()->secondColumnSeparator());
  addItem(_secondColHandle);
  _secondColHandle->setXPos(_secondColHandlePos);
  connect(_secondColHandle, SIGNAL(positionChanged(qreal)), this, SLOT(secondHandlePositionChanged(qreal)));

  connect(this, SIGNAL(sceneRectChanged(const QRectF &)), _secondColHandle, SLOT(sceneRectChanged(const QRectF &)));

  setHandleXLimits();

  if(model->rowCount() > 0)
    rowsInserted(QModelIndex(), 0, model->rowCount() - 1);

  connect(model, SIGNAL(rowsInserted(const QModelIndex &, int, int)),
          this, SLOT(rowsInserted(const QModelIndex &, int, int)));
  connect(model, SIGNAL(rowsAboutToBeRemoved(const QModelIndex &, int, int)),
          this, SLOT(rowsAboutToBeRemoved(const QModelIndex &, int, int)));
  connect(model, SIGNAL(rowsRemoved(QModelIndex,int,int)),
          this, SLOT(rowsRemoved()));
  connect(model, SIGNAL(dataChanged(QModelIndex, QModelIndex)), SLOT(dataChanged(QModelIndex, QModelIndex)));

#ifdef HAVE_WEBKIT
  webPreview.timer.setSingleShot(true);
  connect(&webPreview.timer, SIGNAL(timeout()), this, SLOT(webPreviewNextStep()));
#endif
  _showWebPreview = defaultSettings.showWebPreview();
  defaultSettings.notify("ShowWebPreview", this, SLOT(showWebPreviewChanged()));

  _clickTimer.setInterval(QApplication::doubleClickInterval());
  _clickTimer.setSingleShot(true);
  connect(&_clickTimer, SIGNAL(timeout()), SLOT(clickTimeout()));

  setItemIndexMethod(QGraphicsScene::NoIndex);
}
Example #26
0
LvlScene::LvlScene(dataconfigs &configs, LevelData &FileData, QObject *parent) : QGraphicsScene(parent)
{
    setItemIndexMethod(NoIndex);

    //Pointerss
    pConfigs = &configs; // Pointer to Main Configs
    LvlData = &FileData; //Ad pointer to level data

    //Options
    opts.animationEnabled = true;
    opts.collisionsEnabled = true;
    grid = true;

    //Indexes
    index_blocks = pConfigs->index_blocks; //Applaying blocks indexes
    index_bgo = pConfigs->index_bgo;
    index_npc = pConfigs->index_npc;

    //Editing mode
    EditingMode = 0;
    EraserEnabled = false;
    PasteFromBuffer = false;
    disableMoveItems = false;
    DrawMode=false;

    //Editing process flags
    IsMoved = false;
    haveSelected = false;

    placingItem=0;

    pResizer = NULL;

    contextMenuOpened = false;

    //Events flags
    resetPosition = false;
    /*
    wasPasted = false;  //call to cursor reset to normal select
    doCopy = false;     //call to copy
    doCut = false;      //call to cut
    SyncLayerList = false; //Call to refresh layer list
    resetResizingSection = false; //Reset resizing applying buttons
    */
    cursor = NULL;
    resetCursor();

    //set dummy images if target not exist or wrong
    uBlockImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_block.gif");
    npcmask = QBitmap(QApplication::applicationDirPath() + "/" + "data/unknown_npcm.gif");
    uNpcImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_npc.gif");
    uNpcImg.setMask(npcmask);
    uBgoImg = QPixmap(QApplication::applicationDirPath() + "/" + "data/unknown_bgo.gif");


    //set Default Z Indexes
    bgZ = -1000;
    blockZs = -150; // sizable blocks
    bgoZb = -100; // backround BGO

    blockZ = 1; // standart block
    playerZ = 5; //player Point

    bgoZf = 50; // foreground BGO

    npcZb = 20; // background NPC

    npcZs = 30; // standart NPC

    blockZl = 100; //LavaBlock
    npcZf = 150; // foreground NPC
    waterZ = 500;
    doorZ = 700;
    spaceZ1 = 1000; // interSection space layer
    spaceZ2 = 1020; // section Border

    //HistoryIndex
    historyIndex=0;

    historyChanged = false;

    //Locks
    lock_bgo=false;
    lock_block=false;
    lock_npc=false;
    lock_door=false;
    lock_water=false;

}
Example #27
0
ezQtImageScene::ezQtImageScene(QObject* pParent)
    : QGraphicsScene(pParent)
{
  m_pImageItem = nullptr;
  setItemIndexMethod(QGraphicsScene::NoIndex);
}
Example #28
0
FlowScene::
FlowScene()
{
  setItemIndexMethod(QGraphicsScene::NoIndex);
}
Example #29
0
/*!
  Creates a new instance of GraphicsScene with some optimizations.
*/
GraphicsScene::GraphicsScene(){
    setItemIndexMethod(QGraphicsScene::BspTreeIndex);
    setSceneRect(0,0,BASE_X_RESOLUTION, BASE_Y_RESOLUTION);
}
Example #30
0
/*!
  Creates a new instance of GraphicsScene with some optimizations and assigns to it the position and the size.
*/
GraphicsScene::GraphicsScene(int x, int y, int w, int h) : QGraphicsScene(x, y, w, h){
    setItemIndexMethod(QGraphicsScene::BspTreeIndex);
    setSceneRect(0,0,BASE_X_RESOLUTION, BASE_Y_RESOLUTION);
}