Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Thomas Pitiot
CGoGN
Commits
01ff9703
Commit
01ff9703
authored
Jun 12, 2012
by
Sylvain Thery
Browse files
update Qt popup (transmit key event to interface
mysterious bug of setFocus(Qt::MouseFocusReason)
parent
7557ba83
Changes
4
Hide whitespace changes
Inline
Side-by-side
include/Utils/Qt/qtSimple.h
View file @
01ff9703
...
...
@@ -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
);
...
...
include/Utils/Qt/qtpopup.h
View file @
01ff9703
...
...
@@ -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
);
/**
*
...
...
src/Utils/Qt/qtSimple.cpp
View file @
01ff9703
...
...
@@ -108,6 +108,7 @@ SimpleQT::SimpleQT() :
m_transfo_matrix
=
glm
::
mat4
(
1.0
f
);
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
()
...
...
src/Utils/Qt/qtpopup.cpp
View file @
01ff9703
...
...
@@ -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
);
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment