Commit 01ff9703 authored by Sylvain Thery's avatar Sylvain Thery
Browse files

update Qt popup (transmit key event to interface

mysterious bug of setFocus(Qt::MouseFocusReason)
parent 7557ba83
......@@ -402,7 +402,7 @@ public:
* @param dir base directory
* @param filters file filters (syntax: "label1 (filter1);; label2 (filter2);; ...")
*/
std::string selectFileSave(const std::string& title = "open file", const std::string& dir = ".", const std::string& filters = "all (*.*)");
std::string selectFileSave(const std::string& title = "save file", const std::string& dir = ".", const std::string& filters = "all (*.*)");
void snapshot(const QString& filename, const char* format = 0, const int& quality = -1);
......
......@@ -27,6 +27,7 @@
#include <QGridLayout>
#include <QDialog>
#include "Utils/Qt/qtSimple.h"
namespace CGoGN
......@@ -47,6 +48,8 @@ class QtPopUp : public QDialog
{
Q_OBJECT
Utils::QT::SimpleQT * m_cbs;
QGridLayout* m_layout;
public:
......@@ -55,7 +58,7 @@ public:
* create an empty popup
* @param withButtons add OK/CANCEL to the popup (exec launch blocking popup & return 1/0)
*/
QtPopUp(bool withButtons=false);
QtPopUp(Utils::QT::SimpleQT* sqt=NULL, bool withButtons=false);
/**
*
......
......@@ -108,6 +108,7 @@ SimpleQT::SimpleQT() :
m_transfo_matrix = glm::mat4(1.0f);
resize(1200,800);
m_glWidget->setFocus(Qt::MouseFocusReason);
}
SimpleQT::SimpleQT(const SimpleQT& sqt):
......@@ -133,6 +134,8 @@ SimpleQT::SimpleQT(const SimpleQT& sqt):
m_trans_x = sqt.m_trans_x ;
m_trans_y = sqt.m_trans_y ;
m_trans_z = sqt.m_trans_z ;
m_glWidget->setFocus(Qt::MouseFocusReason);
}
SimpleQT::~SimpleQT()
......
......@@ -25,7 +25,7 @@
#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>
#include <QKeyEvent>
namespace CGoGN
{
namespace Utils
......@@ -34,9 +34,9 @@ namespace QT
{
QtPopUp::QtPopUp(bool withButtons)
QtPopUp::QtPopUp(SimpleQT* sqt, bool withButtons):
m_cbs(sqt)
{
if (withButtons)
{
QVBoxLayout *vlayout = new QVBoxLayout(this);
......@@ -75,8 +75,15 @@ void QtPopUp::addWidget(QWidget* wid, int col, int row)
m_layout->addWidget(wid,col,row);
}
void QtPopUp::keyPressEvent ( QKeyEvent * e )
{}
void QtPopUp::keyPressEvent ( QKeyEvent * event )
{
int k = event->key();
if ( (k >= 65) && (k <= 91) && !(event->modifiers() & Qt::ShiftModifier) )
k += 32;
if (m_cbs)
m_cbs->cb_keyPress(k);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment