Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Invalid Y coordinate index in model mapper error

Invalid Y coordinate index in model mapper error

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 322 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #1

    A class that inherits Abstractmodel connects charts and tables. If the chart is drawn again after initializing the table data, the message Invalid Y coordinate index in model mapper is generated.
    what is this error message

    void usrTableModel::InitData(const QList< QPair<QString, QList<qreal>> >& data)
    {
    	this->beginResetModel();
    	{
    		m_lstData = data;
    	}
    	this->endResetModel();
    }
    
    void wSpectrum::AddChartSeries(bool isData, usrTableModel* pModel)
    {
    	QLineSeries* pSeries = new QLineSeries(m_pChart);
        pSeries->setUseOpenGL(true);							// 속도 향상
    
    	QVXYModelMapper* mapper = new QVXYModelMapper(this);
    	mapper->setXColumn(0);
    	mapper->setYColumn(pModel->GetColCount()-1);
    	
    	if(isData)
    		mapper->setSeries(pSeries);
    
    	mapper->setModel(pModel);
    
    	m_pChart->addSeries(pSeries); 
    	m_pChart->createDefaultAxes();
    
    	// [축 재설정] 
    	{
    		QValueAxis* axisx = qobject_cast<QValueAxis*>(m_pChart->axes(Qt::Horizontal).first());
    		axisx->setTickCount(5);
    
    		m_pChart->axisX()->setTitleFont(cGlobalParam::gGetChartAxis(true));
    		m_pChart->axisX()->setTitleText("Wave Length");
    		m_pChart->axisX()->setTitleBrush(QBrush(QColor(76, 127, 185)));		
    
    		m_pChart->axisY()->setTitleFont(cGlobalParam::gGetChartAxis(true));
    		m_pChart->axisY()->setTitleText("Absorbance.");
    		m_pChart->axisY()->setTitleBrush(QBrush(QColor(76, 127, 185)));
    	}
    
    	// [행의 마지막 위치로 이동]
    	QModelIndex index = pModel->index(0, pModel->GetColCount()-1, QModelIndex());
    	this->ui.tableWidget->scrollTo(index, QAbstractItemView::PositionAtTop);
    }
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved