Results 1 to 2 of 2

Thread: ScrollZoomer not working properly..

  1. #1
    Join Date
    Sep 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default ScrollZoomer not working properly..

    Hi,
    Iam using ScrollZoomer class to zoom/out.but the problem is that when i zooom in by selecting some part of the plot the zoomer does not reflect the whole graph .The part which is below 0 does not get shown.Please help.

  2. #2
    Join Date
    Sep 2009
    Posts
    26
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: ScrollZoomer not working properly..

    This is the code for my plotting the curves.Iam using the scrollbar .h and .cpp and scrollzoomer .h and .cpp as it is with Qwt version 5.2.0.What wrong iam doing?




    plotWidget:lotWidget ( char *FileName,QWidget* parent, Qt::WFlags fl )
    : QWidget ( parent, fl ), Ui::GraphPlot(){
    setupUi ( this );
    UploadFileSize = 0;
    int i = 0;
    this->posMarker = 0;
    QString tStr;
    grid = new QwtPlotGrid;

    UploadFileSize = strlen(FileName);
    this->Upload_FileName = (char *) malloc((UploadFileSize + 1)* sizeof(char));
    strncpy(this->Upload_FileName,FileName,UploadFileSize);
    this->Upload_FileName[UploadFileSize] = 0;

    this->CurrentSelectedGraph = -1;

    listWidget = new QListWidget(this);
    ListItem = new QListWidgetItem;
    listWidget->hide();


    QString filename(this->Upload_FileName);
    FileYear = filename.mid(10,4);
    FileMonth =filename.mid(14,2);
    FileDay = filename.mid(16,2);
    FileHour = filename.mid(18,2);
    FileMins = filename.mid(20,2);
    FileSec = filename.mid(22,2);

    FormTitle = FileYear + "-" + FileMonth + "-" + FileDay + " " + FileHour + ":" + FileMins + ":" + FileSec;
    this->setWindowTitle(FormTitle);

    while(i<MaxPlotCurve){
    Scale[i] = 1;
    OffSet[i] = 0;
    indexToGraphNum[i] = -1;
    ToBeDeletedTotalCurvesPlotted[i] = -1;
    i++;
    }

    InsertItemsInListWidget();

    connect(this->listWidget,SIGNAL( itemClicked( QListWidgetItem* )),this,SLOT(Slot_for_Item_Changed( QListWidgetItem*)));
    connect(this->listWidget_PlotMemebers,SIGNAL( itemClicked( QListWidgetItem* )),this,SLOT(Slot_For_ItemChanged(QListWidgetItem* )));
    connect(this->comboBox_DataMarker,SIGNAL(currentIndexChanged(in t)),this,SLOT(Slot_for_ComboBoxItemChanged(int)));

    ZoomRectangle = NULL;
    scrollzoomer = NULL;
    zoomedOut = false;

    marker = new QwtPlotMarker;
    MarkerBrush = new QBrush(Qt::black);
    PenMarker = new QPen(Qt::black,3);
    size = new QSize(10,10);
    sym = new QwtSymbol(QwtSymbol::Cross,*MarkerBrush,*PenMarker ,*size);

    MapMarker = new QwtPlotMarker;
    MapMarkerBrush = new QBrush(Qt::blue);
    MapPenMarker = new QPen(Qt::blue,2);
    MapMarkerSize = new QSize(10,10);
    Mapsym = new QwtSymbol(QwtSymbol::Cross,*MapMarkerBrush,*MapPen Marker,*MapMarkerSize);

    VerGraphMarker = new QwtPlotMarker;

    this->masterCopy = ProcessFile(this->Upload_FileName);
    this->displayCopy = ProcessFile(this->Upload_FileName);

    this->Home_lat = this->masterCopy->Home_Lat;
    this->Home_long = this->masterCopy->Home_Long;

    this->attachStates = false;
    this->displayStates = false;
    this->setAllaDataForPlot();

    connect(this->pH,SIGNAL(SendMouseEvent(QMouseEvent *)),this,SLOT(CatchMouseEventSignalFromPlot(QMouse Event *)));

    PlotLatandLong();

    comboBox_DataMarker->insertItem(0, "--");


    }






    void plotWidget:isplay_Graph(){

    this->myPlot->replot();

    if(scrollzoomer == NULL) {
    scrollzoomer = new ScrollZoomer(this->myPlot->canvas());
    scrollzoomer->setRubberBandPen(QPen(Qt::red, 2, Qt:otLine));
    scrollzoomer->setTrackerPen(QPen(Qt::black));
    scrollzoomer->setMousePattern(QwtEventPattern::MouseSelect2, Qt::LeftButton, Qt::ControlModifier);
    connect(this->scrollzoomer,SIGNAL(zoomed(const QwtDoubleRect &)),this,SLOT(IsZoomed(const QwtDoubleRect &)));
    ZoomRectangle = new QwtDoubleRect(this->scrollzoomer->zoomRect());

    }

    this->myPlot->insertLegend(this->legend,QwtPlot::RightLegend,-1.0);
    }


    void plotWidget::IsZoomed(const QwtDoubleRect & rect) {
    QwtPlot::Axis axID = (QwtPlot::Axis) 0;
    QwtPlot::Axis axIDx = (QwtPlot::Axis) 2;

    if(zoomedOut) {
    this->tmpStack.pop();
    this->tmpStack = scrollzoomer->zoomStack();
    zoomedOut = false;
    }
    else {
    this->tmpStack.push(rect);
    this->tmpStack = scrollzoomer->zoomStack();
    }
    scrollzoomer->rescale();
    this->myPlot->setAxisAutoScale(axID);
    this->myPlot->setAxisAutoScale(axIDx);
    this->myPlot->setAutoReplot(true);
    }

Similar Threads

  1. Replies: 1
    Last Post: 23rd February 2012, 11:13
  2. Qt+QWebKit+Java+Flash not working
    By progDes in forum Qt Programming
    Replies: 2
    Last Post: 30th April 2009, 16:49
  3. QDevelop and CTags -> Not working
    By philwinder in forum Qt-based Software
    Replies: 13
    Last Post: 9th May 2008, 21:40
  4. GUI thread and Working thread comunication
    By FasTTo in forum Qt Programming
    Replies: 2
    Last Post: 13th September 2007, 15:31
  5. Replies: 1
    Last Post: 1st June 2006, 23:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.