{
str.clear();
str1.clear();
str2.clear();
lastX=event->pos().x();
lastY=event->pos().y();
str1
= QString("x: %1 , ").
arg(lastx,
0,
'E',
3);
str2
= QString(" y: %1").
arg(lasty,
0,
'E',
3);
str=str1+str2;
statusBar1->setLayoutDirection(Qt::RightToLeft);
statusBar1->showMessage(str);
}
{
setFocusPolicy (Qt::StrongFocus );
setFocus(Qt::OtherFocusReason);
setMouseTracking(true);
statusBar1
->setGeometry
(QRect(0,
475,
1015,
55));
label1
=new QLabel(statusBar1
);
label1-> setFont(font);
label1->setGeometry(10,20,300,10);
statusBar1-> setFont(font);
// statusBar1->insertPermanentWidget(0,label1);
// window->setStatusBar(statusBar1);
}
void GLWidget::mouseMoveEvent(QMouseEvent *event)
{
QString str;
QString str1;
QString str2;
str.clear();
str1.clear();
str2.clear();
lastX=event->pos().x();
lastY=event->pos().y();
str1 = QString("x: %1 , ").arg(lastx, 0, 'E', 3);
str2 = QString(" y: %1").arg(lasty, 0, 'E', 3);
str=str1+str2;
statusBar1->setLayoutDirection(Qt::RightToLeft);
statusBar1->showMessage(str);
}
GLWidget::GLWidget(QWidget *parent):QGLWidget(parent)
{
setFocusPolicy (Qt::StrongFocus );
setFocus(Qt::OtherFocusReason);
setMouseTracking(true);
statusBar1=new QStatusBar(this);
statusBar1->setGeometry(QRect(0,475,1015,55));
label1=new QLabel(statusBar1);
QFont font("Helvetica", 12, QFont::Bold);
label1-> setFont(font);
label1-> setPalette(QPalette(QColor(225,22,45),QColor(23,12,34)));
label1->setGeometry(10,20,300,10);
statusBar1->setPalette(QPalette(QColor(225,22,45),QColor(23,12,34)));
statusBar1-> setFont(font);
// statusBar1->insertPermanentWidget(0,label1);
// window->setStatusBar(statusBar1);
}
To copy to clipboard, switch view to plain text mode
Bookmarks