hi,
i have QGLwidget inside the mainwindow. for mouseMoveEvent( )in GLwidget i would like to dispaly my object coordinates in statusbar of Mainwindow().
but inside mouseMoveEvent() of QGLwidget() we can't access statusbar() of mainwindow. so inside mouseMoveEvent() i call one function which is declared in class which is derived from mainwindow.this function is successfully receving values correctly. but it not showing .
could anyone help me what is the reason. here i am sending snap shot
GLWidget:public QGLidget;
window:public QMainwindow()
GLWidget:public QGLidget;
window:public QMainwindow()
To copy to clipboard, switch view to plain text mode
{
------------
------------
longitude=wx;
latitude=wy;
window->Display(longitude,latitude);
}
void GLWidget::mouseMoveEvent(QMouseEvent *event)
{
------------
------------
longitude=wx;
latitude=wy;
window->Display(longitude,latitude);
}
To copy to clipboard, switch view to plain text mode
bool Window::Display(double a,double b)
{
double longitude=a;
double latitude=b;
statusBar()->setLayoutDirection(Qt::RightToLeft);
statusBar()->showMessage(str);
//QMessageBox::information(this, "Test",str);
return true;
}
bool Window::Display(double a,double b)
{
double longitude=a;
double latitude=b;
QString str1 = QString("Lon: %1 , ").arg(longitude, 0, 'E', 3);
QString str2 = QString(" Lat: %1").arg(latitude, 0, 'E', 3);
QString str=str1+str2;
statusBar()->setLayoutDirection(Qt::RightToLeft);
statusBar()->showMessage(str);
//QMessageBox::information(this, "Test",str);
return true;
}
To copy to clipboard, switch view to plain text mode
Bookmarks