Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
2718542e
Commit
2718542e
authored
Dec 18, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QT: Made xtt_keyboard resizable.
parent
82b8cdcf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
27 deletions
+24
-27
xtt/lib/xtt/qt/xtt_keyboard_qt.cpp
xtt/lib/xtt/qt/xtt_keyboard_qt.cpp
+21
-24
xtt/lib/xtt/qt/xtt_keyboard_qt.h
xtt/lib/xtt/qt/xtt_keyboard_qt.h
+3
-3
No files found.
xtt/lib/xtt/qt/xtt_keyboard_qt.cpp
View file @
2718542e
...
...
@@ -44,11 +44,11 @@
#include <QApplication>
#include <QDesktopWidget>
#include <QResizeEvent>
#include <QVBoxLayout>
void
XttKeyboardQtWidget
::
closeEvent
(
QCloseEvent
*
event
)
{
debug_print
(
"XttKeyboardQtWidget::closeEvent
\n
"
);
if
(
kb
->
close_cb
)
{
(
kb
->
close_cb
)(
kb
->
parent_ctx
);
}
else
{
...
...
@@ -61,26 +61,19 @@ XttKeyboardQt::XttKeyboardQt(void* xn_parent_ctx, QWidget* xn_parent_wid,
const
char
*
xn_name
,
QWidget
**
w
,
keyboard_eKeymap
xn_keymap
,
keyboard_eType
xn_type
,
int
xn_color_theme
,
pwr_tStatus
*
status
)
:
XttKeyboard
(
xn_parent_ctx
,
xn_name
,
xn_keymap
,
xn_type
,
xn_color_theme
,
status
),
displayed
(
0
),
closing_down
(
0
)
xn_parent_ctx
,
xn_name
,
xn_keymap
,
xn_type
,
xn_color_theme
,
status
)
{
int
width
=
1145
;
int
height
=
161
;
toplevel
=
new
XttKeyboardQtWidget
(
this
,
xn_parent_wid
);
toplevel
->
setToolTip
(
fl
(
"xtt_keyboard widget"
));
toplevel
->
setMinimumSize
(
width
,
height
);
toplevel
->
setWindowTitle
(
translate_utf8
(
xn_name
));
toplevel
->
setAttribute
(
Qt
::
WA_DeleteOnClose
);
debug_print
(
"creating a keyboardwidgetqt
\n
"
);
keyboard_widget
=
keyboardwidgetqt_new
(
init_keyboard_cb
,
this
);
QVBoxLayout
*
vbox
=
new
QVBoxLayout
(
toplevel
);
add_expanding
(
vbox
,
keyboard_widget
);
toplevel
->
setLayout
(
vbox
);
toplevel
->
show
();
...
...
@@ -97,40 +90,44 @@ XttKeyboardQt::XttKeyboardQt(void* xn_parent_ctx, QWidget* xn_parent_wid,
keyboard_SetSize
(
keyboardctx
,
width
,
height
);
}
aspectRatio
=
width
/
((
double
)
height
);
toplevel
->
resize
(
width
,
height
);
int
x
=
screen_width
/
2
-
width
/
2
;
int
y
=
screen_height
-
height
;
toplevel
->
move
(
x
,
y
);
displayed
=
1
;
toplevel
->
move
(
screen_width
/
2
-
width
/
2
,
screen_height
-
height
);
*
status
=
1
;
}
XttKeyboardQt
::~
XttKeyboardQt
()
{
debug_print
(
"XttKeyboardQt::~XttKeyboardQt
\n
"
);
closing_down
=
1
;
}
void
XttKeyboardQt
::
set_inputfocus
()
{
if
(
displayed
)
{
if
(
toplevel
->
isVisible
()
)
{
keyboard_widget
->
setFocus
();
}
}
void
XttKeyboardQtWidget
::
focusInEvent
(
QFocusEvent
*
event
)
{
if
(
kb
->
displayed
)
{
if
(
isVisible
()
)
{
// kb->set_input_focus();
}
QWidget
::
focusInEvent
(
event
);
}
void
XttKeyboardQtWidget
::
resizeEvent
(
QResizeEvent
*
event
)
{
if
(
kb
->
aspectRatio
==
0
)
{
return
;
}
if
(
event
->
size
().
width
()
==
prevWidth
)
{
QWidget
::
resize
(
event
->
size
().
height
()
*
kb
->
aspectRatio
,
event
->
size
().
height
());
}
else
{
QWidget
::
resize
(
event
->
size
().
width
(),
event
->
size
().
width
()
/
kb
->
aspectRatio
);
}
keyboard_SetSize
(
kb
->
keyboardctx
,
width
(),
height
());
prevWidth
=
width
();
}
void
XttKeyboardQt
::
pop
()
{
::
pop
(
toplevel
);
...
...
xtt/lib/xtt/qt/xtt_keyboard_qt.h
View file @
2718542e
...
...
@@ -49,7 +49,6 @@ public:
XttKeyboardQt
(
void
*
xn_parent_ctx
,
QWidget
*
xn_parent_wid
,
const
char
*
xn_name
,
QWidget
**
w
,
keyboard_eKeymap
keymap
,
keyboard_eType
type
,
int
xn_color_theme
,
pwr_tStatus
*
status
);
~
XttKeyboardQt
();
void
set_inputfocus
();
void
pop
();
...
...
@@ -57,8 +56,7 @@ public:
QWidget
*
keyboard_widget
;
QWidget
*
form_widget
;
int
displayed
;
int
closing_down
;
double
aspectRatio
=
0
;
private:
QDialog
*
toplevel
;
...
...
@@ -74,9 +72,11 @@ public:
protected:
void
focusInEvent
(
QFocusEvent
*
event
);
void
closeEvent
(
QCloseEvent
*
event
);
void
resizeEvent
(
QResizeEvent
*
event
);
private:
XttKeyboardQt
*
kb
;
int
prevWidth
;
};
#endif
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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