[F] React on mouse pressing ig view only.
parent
f56432f713
commit
fd7f07068c
|
@ -128,13 +128,26 @@ void MainWindow::LogError(const QString& pMessage)
|
||||||
|
|
||||||
void MainWindow::mousePressEvent(QMouseEvent* pEvent)
|
void MainWindow::mousePressEvent(QMouseEvent* pEvent)
|
||||||
{
|
{
|
||||||
|
const QPoint ms_pt = pEvent->pos();
|
||||||
|
|
||||||
|
// Check if GLView is pointed.
|
||||||
|
if(childAt(ms_pt) == mGLView)
|
||||||
|
{
|
||||||
|
mPosition_Pressed_Valid = true;
|
||||||
if(pEvent->button() & Qt::LeftButton)
|
if(pEvent->button() & Qt::LeftButton)
|
||||||
mPosition_Pressed_LMB = pEvent->pos();
|
mPosition_Pressed_LMB = ms_pt;
|
||||||
else if(pEvent->button() & Qt::RightButton)
|
else if(pEvent->button() & Qt::RightButton)
|
||||||
mPosition_Pressed_RMB = pEvent->pos();
|
mPosition_Pressed_RMB = ms_pt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mPosition_Pressed_Valid = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::mouseMoveEvent(QMouseEvent* pEvent)
|
void MainWindow::mouseMoveEvent(QMouseEvent* pEvent)
|
||||||
|
{
|
||||||
|
if(mPosition_Pressed_Valid)
|
||||||
{
|
{
|
||||||
if(pEvent->buttons() & Qt::LeftButton)
|
if(pEvent->buttons() & Qt::LeftButton)
|
||||||
{
|
{
|
||||||
|
@ -164,6 +177,7 @@ void MainWindow::mouseMoveEvent(QMouseEvent* pEvent)
|
||||||
mPosition_Pressed_RMB = pEvent->pos();
|
mPosition_Pressed_RMB = pEvent->pos();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::keyPressEvent(QKeyEvent* pEvent)
|
void MainWindow::keyPressEvent(QKeyEvent* pEvent)
|
||||||
{
|
{
|
||||||
|
@ -198,7 +212,7 @@ GLfloat step;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow),
|
: QMainWindow(parent), ui(new Ui::MainWindow),
|
||||||
mScene(nullptr)
|
mScene(nullptr), mPosition_Pressed_Valid(false)
|
||||||
{
|
{
|
||||||
using namespace Assimp;
|
using namespace Assimp;
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ private:
|
||||||
CLoggerView* mLoggerView;///< Pointer to logging object.
|
CLoggerView* mLoggerView;///< Pointer to logging object.
|
||||||
Assimp::Importer mImporter;///< Assimp importer.
|
Assimp::Importer mImporter;///< Assimp importer.
|
||||||
const aiScene* mScene;///< Pointer to loaded scene (\ref aiScene).
|
const aiScene* mScene;///< Pointer to loaded scene (\ref aiScene).
|
||||||
|
bool mPosition_Pressed_Valid;///< Mouse button pressed on GLView.
|
||||||
QPoint mPosition_Pressed_LMB;///< Position where was pressed left mouse button.
|
QPoint mPosition_Pressed_LMB;///< Position where was pressed left mouse button.
|
||||||
QPoint mPosition_Pressed_RMB;///< Position where was pressed right mouse button.
|
QPoint mPosition_Pressed_RMB;///< Position where was pressed right mouse button.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue