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
48e3a402
Commit
48e3a402
authored
Aug 21, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
QT: fixed error when loading certain image files.
parent
d259aa92
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
51 deletions
+97
-51
wb/exe/wb/qt/wb_qt.cpp
wb/exe/wb/qt/wb_qt.cpp
+7
-4
wb/lib/wb/qt/wb_wge_qt.cqt
wb/lib/wb/qt/wb_wge_qt.cqt
+7
-1
wb/lib/wb/qt/wb_wnav_qt.cqt
wb/lib/wb/qt/wb_wnav_qt.cqt
+5
-0
xtt/lib/cow/qt/cow_msglist_qt.cpp
xtt/lib/cow/qt/cow_msglist_qt.cpp
+0
-4
xtt/lib/flow/qt/flow_draw_qt.cqt
xtt/lib/flow/qt/flow_draw_qt.cqt
+29
-26
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
+4
-2
xtt/lib/glow/qt/glow_draw_qt.cqt
xtt/lib/glow/qt/glow_draw_qt.cqt
+41
-12
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
+4
-2
No files found.
wb/exe/wb/qt/wb_qt.cpp
View file @
48e3a402
...
@@ -63,7 +63,6 @@ Wtt* WbQt::wtt_new(const char* name, const char* iconname,
...
@@ -63,7 +63,6 @@ Wtt* WbQt::wtt_new(const char* name, const char* iconname,
ldh_tWBContext
ldhwbctx
,
pwr_tVolumeId
volid
,
ldh_tVolume
volctx
,
ldh_tWBContext
ldhwbctx
,
pwr_tVolumeId
volid
,
ldh_tVolume
volctx
,
wnav_sStartMenu
*
root_menu
,
pwr_tStatus
*
status
)
wnav_sStartMenu
*
root_menu
,
pwr_tStatus
*
status
)
{
{
debug_print
(
"Creating a WttQt
\n
"
);
return
new
WttQt
(
return
new
WttQt
(
0
,
toplevel
,
name
,
iconname
,
ldhwbctx
,
volid
,
volctx
,
root_menu
,
status
);
0
,
toplevel
,
name
,
iconname
,
ldhwbctx
,
volid
,
volctx
,
root_menu
,
status
);
}
}
...
@@ -273,14 +272,15 @@ WbQt::WbQt(int argc, char* argv[]) : mainwindow(0)
...
@@ -273,14 +272,15 @@ WbQt::WbQt(int argc, char* argv[]) : mainwindow(0)
}
}
if
(
sw_projectvolume
&&
!
login_display
)
{
if
(
sw_projectvolume
&&
!
login_display
)
{
Wtt
*
wtt
;
char
projectname
[
80
];
char
projectname
[
80
];
pwr_tVolumeId
volume
=
ldh_cDirectoryVolume
;
pwr_tVolumeId
volume
=
ldh_cDirectoryVolume
;
utl_get_projectname
(
projectname
);
utl_get_projectname
(
projectname
);
strcpy
(
title
,
CoLogin
::
username
());
strcpy
(
title
,
CoLogin
::
username
());
strcat
(
title
,
" on "
);
strcat
(
title
,
" on "
);
strcat
(
title
,
projectname
);
strcat
(
title
,
projectname
);
wtt
=
wtt_new
(
title
,
"Navigator"
,
wbctx
,
volume
,
0
,
0
,
&
sts
);
debug_print
(
"Opening project volume %s
\n
"
,
projectname
);
Wtt
*
wtt
=
wtt_new
(
title
,
"Navigator"
,
wbctx
,
volume
,
0
,
0
,
&
sts
);
debug_print
(
"Opening project volume sts=%d
\n
"
,
sts
);
if
(
ODD
(
sts
))
{
if
(
ODD
(
sts
))
{
appl_count
++
;
appl_count
++
;
wtt
->
close_cb
=
Wb
::
wtt_close
;
wtt
->
close_cb
=
Wb
::
wtt_close
;
...
@@ -291,11 +291,14 @@ WbQt::WbQt(int argc, char* argv[]) : mainwindow(0)
...
@@ -291,11 +291,14 @@ WbQt::WbQt(int argc, char* argv[]) : mainwindow(0)
psts
(
sts
,
NULL
);
psts
(
sts
,
NULL
);
}
}
}
else
if
(
sw_classeditor
)
{
}
else
if
(
sw_classeditor
)
{
debug_print
(
"Opening class editor
\n
"
);
wtt_open_volume
(
wtt_open_volume
(
0
,
wb_eType_ClassEditor
,
filename
,
wow_eFileSelType_WblClass
);
0
,
wb_eType_ClassEditor
,
filename
,
wow_eFileSelType_WblClass
);
}
else
if
(
sw_projectlist
)
{
}
else
if
(
sw_projectlist
)
{
debug_print
(
"Opening project list
\n
"
);
wtt_open_volume
(
0
,
wb_eType_ExternVolume
,
"ProjectList"
,
wow_eFileSelType_
);
wtt_open_volume
(
0
,
wb_eType_ExternVolume
,
"ProjectList"
,
wow_eFileSelType_
);
}
else
if
(
nav_display
&&
!
login_display
)
{
}
else
if
(
nav_display
&&
!
login_display
)
{
debug_print
(
"Opening navigator
\n
"
);
if
(
CoLogin
::
privilege
()
&
pwr_mPrv_DevRead
)
{
if
(
CoLogin
::
privilege
()
&
pwr_mPrv_DevRead
)
{
strcpy
(
title
,
"PwR Navigator: "
);
strcpy
(
title
,
"PwR Navigator: "
);
strcat
(
title
,
CoLogin
::
username
());
strcat
(
title
,
CoLogin
::
username
());
...
@@ -308,7 +311,7 @@ WbQt::WbQt(int argc, char* argv[]) : mainwindow(0)
...
@@ -308,7 +311,7 @@ WbQt::WbQt(int argc, char* argv[]) : mainwindow(0)
exit
(
LOGIN__NOPRIV
);
exit
(
LOGIN__NOPRIV
);
}
}
}
else
if
(
login_display
)
{
}
else
if
(
login_display
)
{
debug_print
(
"
Creat
ing a CoLoginQt
\n
"
);
debug_print
(
"
Open
ing a CoLoginQt
\n
"
);
new
CoLoginQt
(
NULL
,
mainwindow
,
"PwR Login"
,
systemgroup
,
new
CoLoginQt
(
NULL
,
mainwindow
,
"PwR Login"
,
systemgroup
,
&
Wb
::
login_success
,
&
Wb
::
login_cancel
,
0
,
&
sts
);
&
Wb
::
login_success
,
&
Wb
::
login_cancel
,
0
,
&
sts
);
}
}
...
...
wb/lib/wb/qt/wb_wge_qt.cqt
View file @
48e3a402
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include "wb_wge_qt.h"
#include "wb_wge_qt.h"
#include <QApplication>
#include <QMenuBar>
#include <QMenuBar>
#include <QMessageBox>
#include <QMessageBox>
#include <QVBoxLayout>
#include <QVBoxLayout>
...
@@ -170,6 +171,8 @@ void WGeQt::set_size(int width, int height)
...
@@ -170,6 +171,8 @@ void WGeQt::set_size(int width, int height)
void WGeQt::set_subwindow_release()
void WGeQt::set_subwindow_release()
{
{
subwindow_release = 1;
subwindow_release = 1;
debug_print("Shutting down...\n");
QApplication::exit();
}
}
void WGeQt::pop()
void WGeQt::pop()
...
@@ -182,6 +185,8 @@ void WGeQtWidget::closeEvent(QCloseEvent* event)
...
@@ -182,6 +185,8 @@ void WGeQtWidget::closeEvent(QCloseEvent* event)
debug_print("WGeQtWidget::closeEvent\n");
debug_print("WGeQtWidget::closeEvent\n");
if (ge->modal) {
if (ge->modal) {
ge->terminated = 1;
ge->terminated = 1;
debug_print("Shutting down...\n");
QApplication::exit();
} else {
} else {
delete ge;
delete ge;
}
}
...
@@ -235,7 +240,6 @@ WGeQt::WGeQt(QWidget* wge_parent_wid, void* wge_parent_ctx, char* wge_name,
...
@@ -235,7 +240,6 @@ WGeQt::WGeQt(QWidget* wge_parent_wid, void* wge_parent_ctx, char* wge_name,
QObject::connect(((GraphQt*)graph)->grow_widget,
QObject::connect(((GraphQt*)graph)->grow_widget,
SIGNAL(resize_signal(QResizeEvent*)), toplevel,
SIGNAL(resize_signal(QResizeEvent*)), toplevel,
SLOT(action_resize(QResizeEvent*)));
SLOT(action_resize(QResizeEvent*)));
// TODO: grow_widget must emit a resize_signal signal in resizeEvent()
if (wge_menu) {
if (wge_menu) {
QMenuBar* menu_bar = new QMenuBar();
QMenuBar* menu_bar = new QMenuBar();
...
@@ -267,6 +271,8 @@ WGeQt::WGeQt(QWidget* wge_parent_wid, void* wge_parent_ctx, char* wge_name,
...
@@ -267,6 +271,8 @@ WGeQt::WGeQt(QWidget* wge_parent_wid, void* wge_parent_ctx, char* wge_name,
toplevel->setLayout(graph_form);
toplevel->setLayout(graph_form);
toplevel->show();
toplevel->show();
debug_print("Should be visible now...\n");
if (navigator) {
if (navigator) {
// Create navigator popup
// Create navigator popup
nav_shell = new QWidget();
nav_shell = new QWidget();
...
...
wb/lib/wb/qt/wb_wnav_qt.cqt
View file @
48e3a402
...
@@ -59,6 +59,7 @@
...
@@ -59,6 +59,7 @@
#include "wb_wrev_qt.h"
#include "wb_wrev_qt.h"
#include "wb_xcrr_qt.h"
#include "wb_xcrr_qt.h"
#include <QApplication>
#include <QColor>
#include <QColor>
#include <QInputDialog>
#include <QInputDialog>
#include <QLayout>
#include <QLayout>
...
@@ -447,10 +448,14 @@ WAttText* WNavQt::watttext_new(
...
@@ -447,10 +448,14 @@ WAttText* WNavQt::watttext_new(
void WNavQt::wge_subwindow_loop(WGe* wge)
void WNavQt::wge_subwindow_loop(WGe* wge)
{
{
debug_print(" before wge_subwindow_loop\n");
QApplication::exec();
debug_print(" after wge_subwindow_loop\n");
}
}
void WNavQt::wge_modal_loop(WGe* wge)
void WNavQt::wge_modal_loop(WGe* wge)
{
{
QApplication::exec();
}
}
void WNavQt::message_dialog(char* title, char* text)
void WNavQt::message_dialog(char* title, char* text)
...
...
xtt/lib/cow/qt/cow_msglist_qt.cpp
View file @
48e3a402
...
@@ -48,10 +48,6 @@ MsgListQt::MsgListQt(void* ev_parent_ctx, QWidget* ev_parent_wid, QWidget** w)
...
@@ -48,10 +48,6 @@ MsgListQt::MsgListQt(void* ev_parent_ctx, QWidget* ev_parent_wid, QWidget** w)
form_widget
form_widget
=
scrolledbrowwidgetqt_new
(
MsgList
::
init_brow_cb
,
this
,
&
brow_widget
);
=
scrolledbrowwidgetqt_new
(
MsgList
::
init_brow_cb
,
this
,
&
brow_widget
);
// The widget is not realized until it has processed a show event. By calling
// widget->show(), Qt processes the show event at some arbitrary time in the
// future. But in order to use the widget, we need to realize it NOW!
// This way, we force Qt to process the show() event immediately.
showNow
(
brow_widget
);
showNow
(
brow_widget
);
// Create the root item
// Create the root item
...
...
xtt/lib/flow/qt/flow_draw_qt.cqt
View file @
48e3a402
...
@@ -93,7 +93,7 @@ static char font_names[draw_eFont__][DRAW_FONT_SIZE][80]
...
@@ -93,7 +93,7 @@ static char font_names[draw_eFont__][DRAW_FONT_SIZE][80]
"-*-Helvetica-Medium-R-Normal--18-*-*-*-P-*-ISO8859-1",
"-*-Helvetica-Medium-R-Normal--18-*-*-*-P-*-ISO8859-1",
"-*-Helvetica-Medium-R-Normal--24-*-*-*-P-*-ISO8859-1" } };
"-*-Helvetica-Medium-R-Normal--24-*-*-*-P-*-ISO8859-1" } };
static QMouseEvent
*
last_event;
static QMouseEvent
*
last_event;
static QColor flow_allocate_color(
static QColor flow_allocate_color(
FlowDrawQt* draw_ctx, const char* named_color);
FlowDrawQt* draw_ctx, const char* named_color);
...
@@ -253,7 +253,8 @@ void FlowDrawQt::delete_secondary_ctx(FlowCtx* ctx)
...
@@ -253,7 +253,8 @@ void FlowDrawQt::delete_secondary_ctx(FlowCtx* ctx)
FlowDrawQt::FlowDrawQt(QWidget* x_toplevel, void** flow_ctx,
FlowDrawQt::FlowDrawQt(QWidget* x_toplevel, void** flow_ctx,
int (*init_proc)(QWidget* w, FlowCtx* ctx, void* client_data),
int (*init_proc)(QWidget* w, FlowCtx* ctx, void* client_data),
void* client_data, flow_eCtxType type)
void* client_data, flow_eCtxType type)
: toplevel(x_toplevel), nav_toplevel(0), window(0), nav_window(0), closing_down(0)
: toplevel(x_toplevel), nav_toplevel(0), window(0), nav_window(0),
closing_down(0)
{
{
timer_id = new QTimer(this);
timer_id = new QTimer(this);
...
@@ -331,8 +332,8 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -331,8 +332,8 @@ int FlowDrawQt::event_handler(QEvent* event)
switch (event->type()) {
switch (event->type()) {
case QEvent::KeyPress: {
case QEvent::KeyPress: {
QKeyEvent* keyEvent = ((QKeyEvent*)event);
QKeyEvent* keyEvent = ((QKeyEvent*)event);
debug_print("event_handler: KeyPress key=%s\n",
//
debug_print("event_handler: KeyPress key=%s\n",
QKeySequence(keyEvent->key()).toString().toAscii().data());
//
QKeySequence(keyEvent->key()).toString().toAscii().data());
switch (keyEvent->key()) {
switch (keyEvent->key()) {
case Qt::Key_Return:
case Qt::Key_Return:
...
@@ -396,10 +397,9 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -396,10 +397,9 @@ int FlowDrawQt::event_handler(QEvent* event)
}
}
case QEvent::MouseButtonPress: {
case QEvent::MouseButtonPress: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
debug_print("event_handler: MouseButtonPress button=%d, x=%d, y=%d, "
// debug_print("event_handler: MouseButtonPress button=%d, x=%d, y=%d,
"globalX=%d, globalY=%d\n",
// globalX=%d, globalY=%d\n", mouseEvent->button(), mouseEvent->x(),
mouseEvent->button(), mouseEvent->x(), mouseEvent->y(),
// mouseEvent->y(), mouseEvent->globalX(), mouseEvent->globalY());
mouseEvent->globalX(), mouseEvent->globalY());
switch (mouseEvent->button()) {
switch (mouseEvent->button()) {
case Qt::LeftButton:
case Qt::LeftButton:
basectx->event_handler(
basectx->event_handler(
...
@@ -474,7 +474,7 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -474,7 +474,7 @@ int FlowDrawQt::event_handler(QEvent* event)
event_timer(mouseEvent);
event_timer(mouseEvent);
return 1;
return 1;
} else {
} else {
debug_print("event_handler: MouseButtonPress from timer\n");
//
debug_print("event_handler: MouseButtonPress from timer\n");
/* Press event, callback from timer */
/* Press event, callback from timer */
button_pressed = 0;
button_pressed = 0;
button_clicked_and_pressed = 0;
button_clicked_and_pressed = 0;
...
@@ -533,8 +533,8 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -533,8 +533,8 @@ int FlowDrawQt::event_handler(QEvent* event)
}
}
case QEvent::MouseButtonRelease: {
case QEvent::MouseButtonRelease: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
debug_print("event_handler: MouseButtonRelease button=%d\n",
//
debug_print("event_handler: MouseButtonRelease button=%d\n",
mouseEvent->button());
//
mouseEvent->button());
button1_pressed = 0;
button1_pressed = 0;
button2_pressed = 0;
button2_pressed = 0;
button3_pressed = 0;
button3_pressed = 0;
...
@@ -777,7 +777,7 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -777,7 +777,7 @@ int FlowDrawQt::event_handler(QEvent* event)
case QEvent::FocusOut:
case QEvent::FocusOut:
break;
break;
case QEvent::Wheel: {
case QEvent::Wheel: {
debug_print("event_handler: Wheel\n");
//
debug_print("event_handler: Wheel\n");
QWheelEvent* wheelEvent = ((QWheelEvent*)event);
QWheelEvent* wheelEvent = ((QWheelEvent*)event);
if (wheelEvent->delta() > 0) {
if (wheelEvent->delta() > 0) {
sts = basectx->event_handler(flow_eEvent_ScrollUp, 0, 0, 0, 0);
sts = basectx->event_handler(flow_eEvent_ScrollUp, 0, 0, 0, 0);
...
@@ -793,8 +793,8 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -793,8 +793,8 @@ int FlowDrawQt::event_handler(QEvent* event)
switch (event->type()) {
switch (event->type()) {
case QEvent::MouseButtonPress: {
case QEvent::MouseButtonPress: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
debug_print(
// debug_print("event_handler: MouseButtonPress button=%d\n",
"event_handler: MouseButtonPress button=%d\n",
mouseEvent->button());
//
mouseEvent->button());
switch (mouseEvent->button()) {
switch (mouseEvent->button()) {
case Qt::LeftButton: // Button1
case Qt::LeftButton: // Button1
button1_pressed = 1;
button1_pressed = 1;
...
@@ -816,8 +816,8 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -816,8 +816,8 @@ int FlowDrawQt::event_handler(QEvent* event)
}
}
case QEvent::MouseButtonRelease: {
case QEvent::MouseButtonRelease: {
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
QMouseEvent* mouseEvent = ((QMouseEvent*)event);
debug_print("event_handler: MouseButtonRelease button=%d\n",
//
debug_print("event_handler: MouseButtonRelease button=%d\n",
mouseEvent->button());
//
mouseEvent->button());
switch (mouseEvent->button()) {
switch (mouseEvent->button()) {
case Qt::LeftButton: // Button1
case Qt::LeftButton: // Button1
button1_pressed = 0;
button1_pressed = 0;
...
@@ -847,7 +847,7 @@ int FlowDrawQt::event_handler(QEvent* event)
...
@@ -847,7 +847,7 @@ int FlowDrawQt::event_handler(QEvent* event)
break;
break;
}
}
case QEvent::MouseMove: {
case QEvent::MouseMove: {
debug_print("event_handler: MouseMove\n");
//
debug_print("event_handler: MouseMove\n");
QPoint pos = QCursor::pos();
QPoint pos = QCursor::pos();
if (button1_pressed || button2_pressed || button3_pressed) {
if (button1_pressed || button2_pressed || button3_pressed) {
sts = basectx->event_handler_nav(
sts = basectx->event_handler_nav(
...
@@ -1223,7 +1223,8 @@ static QFont font(flow_eDrawType painter_type, double size)
...
@@ -1223,7 +1223,8 @@ static QFont font(flow_eDrawType painter_type, double size)
{
{
QFont res(FONTSTR);
QFont res(FONTSTR);
res.setPointSizeF(FONT_SCALE * size);
res.setPointSizeF(FONT_SCALE * size);
if (painter_type == flow_eDrawType_TextHelveticaBold || painter_type == flow_eDrawType_TextHelveticaEraseBold) {
if (painter_type == flow_eDrawType_TextHelveticaBold
|| painter_type == flow_eDrawType_TextHelveticaEraseBold) {
res.setWeight(QFont::Bold);
res.setWeight(QFont::Bold);
}
}
return res;
return res;
...
@@ -1373,7 +1374,7 @@ int FlowDrawQt::pixmaps_create(
...
@@ -1373,7 +1374,7 @@ int FlowDrawQt::pixmaps_create(
{
{
draw_sPixmap* pms;
draw_sPixmap* pms;
flow_sPixmapDataElem *prev_pdata = NULL,
flow_sPixmapDataElem *prev_pdata = NULL,
*pdata = (flow_sPixmapDataElem *)pixmap_data;
*pdata = (flow_sPixmapDataElem *)pixmap_data;
int i;
int i;
pms = new draw_sPixmap();
pms = new draw_sPixmap();
...
@@ -1598,8 +1599,8 @@ void FlowDrawQt::get_window_size(FlowCtx* ctx, int* width, int* height)
...
@@ -1598,8 +1599,8 @@ void FlowDrawQt::get_window_size(FlowCtx* ctx, int* width, int* height)
void FlowDrawQt::get_nav_window_size(FlowCtx* ctx, int* width, int* height)
void FlowDrawQt::get_nav_window_size(FlowCtx* ctx, int* width, int* height)
{
{
debug_print(
// debug_print("get_nav_window_size, nav_window == NULL ? %d\n", (nav_window
"get_nav_window_size, nav_window == NULL ? %d\n", (nav_window
== NULL));
//
== NULL));
*width = nav_window->width();
*width = nav_window->width();
*height = nav_window->height();
*height = nav_window->height();
}
}
...
@@ -1634,12 +1635,13 @@ void FlowDrawQt::cancel_event_timer()
...
@@ -1634,12 +1635,13 @@ void FlowDrawQt::cancel_event_timer()
}
}
}
}
void FlowDrawQt::event_timer(QMouseEvent
*
event)
void FlowDrawQt::event_timer(QMouseEvent
*
event)
{
{
if (last_event) {
if (last_event) {
delete last_event;
delete last_event;
}
}
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(),
event->button(), event->buttons(), event->modifiers());
initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
}
}
...
@@ -1743,7 +1745,7 @@ void FlowDrawQt::copy_area(FlowCtx* ctx, int x, int y)
...
@@ -1743,7 +1745,7 @@ void FlowDrawQt::copy_area(FlowCtx* ctx, int x, int y)
return;
return;
}
}
debug_print("copy_area: x=%d, y=%d\n", x, y);
//
debug_print("copy_area: x=%d, y=%d\n", x, y);
QPixmap screenShot = QPixmap::grabWidget(window);
QPixmap screenShot = QPixmap::grabWidget(window);
QPainter* painter = get_painter(flow_eDrawType_Line, 3);
QPainter* painter = get_painter(flow_eDrawType_Line, 3);
...
@@ -1810,7 +1812,7 @@ void FlowDrawQt::clear_area(
...
@@ -1810,7 +1812,7 @@ void FlowDrawQt::clear_area(
void FlowDrawQt::set_inputfocus(FlowCtx* ctx)
void FlowDrawQt::set_inputfocus(FlowCtx* ctx)
{
{
debug_print("set_inputfocus\n");
//
debug_print("set_inputfocus\n");
window->setFocus(Qt::OtherFocusReason);
window->setFocus(Qt::OtherFocusReason);
}
}
...
@@ -1869,6 +1871,7 @@ void FlowDrawQt::image_scale(float scale, flow_tImImage orig_im,
...
@@ -1869,6 +1871,7 @@ void FlowDrawQt::image_scale(float scale, flow_tImImage orig_im,
if (*im) {
if (*im) {
delete ((QImage*)*im);
delete ((QImage*)*im);
}
}
// debug_print("image_scale\n");
*im = new QImage(((QImage*)orig_im)->scaled(width, height));
*im = new QImage(((QImage*)orig_im)->scaled(width, height));
}
}
...
@@ -1882,7 +1885,7 @@ int FlowDrawQt::image_load(const char* imagefile, float scale, float nav_scale,
...
@@ -1882,7 +1885,7 @@ int FlowDrawQt::image_load(const char* imagefile, float scale, float nav_scale,
strcpy(filename, imagefile);
strcpy(filename, imagefile);
debug_print("image_load %s\n", imagefile);
//
debug_print("image_load %s\n", imagefile);
// Look for file in $pwrp_exe, $pwr_doc/en_us/orm and $pwr_exe
// Look for file in $pwrp_exe, $pwr_doc/en_us/orm and $pwr_exe
for (int i = 0; i < 3; i++) {
for (int i = 0; i < 3; i++) {
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
View file @
48e3a402
...
@@ -49,6 +49,9 @@
...
@@ -49,6 +49,9 @@
void QtScrollWidgetFlow::createBuffer(QSize size)
void QtScrollWidgetFlow::createBuffer(QSize size)
{
{
if (size.isEmpty()) {
return;
}
this->image = QImage(size, QImage::Format_RGB32);
this->image = QImage(size, QImage::Format_RGB32);
QPainter imPainter(&image);
QPainter imPainter(&image);
imPainter.fillRect(image.rect(), palette().color(QPalette::Background));
imPainter.fillRect(image.rect(), palette().color(QPalette::Background));
...
@@ -253,8 +256,7 @@ bool QtScrollWidgetFlow::event(QEvent* event)
...
@@ -253,8 +256,7 @@ bool QtScrollWidgetFlow::event(QEvent* event)
if (event->type() == QEvent::Resize) {
if (event->type() == QEvent::Resize) {
createBuffer(((QResizeEvent*)event)->size());
createBuffer(((QResizeEvent*)event)->size());
}
}
if (!is_realized
if (!is_realized && event->type() == QEvent::Show) {
&& (event->type() == QEvent::Show || event->type() == QEvent::Resize)) {
realize();
realize();
is_realized = true;
is_realized = true;
}
}
...
...
xtt/lib/glow/qt/glow_draw_qt.cqt
View file @
48e3a402
...
@@ -141,7 +141,7 @@ static char font_names[glow_eFont__][glow_eDrawFont__][DRAW_FONT_SIZE][80] = {
...
@@ -141,7 +141,7 @@ static char font_names[glow_eFont__][glow_eDrawFont__][DRAW_FONT_SIZE][80] = {
"-*-courier-Medium-R-Normal--24-*-*-*-m-*-ISO8859-1" } }
"-*-courier-Medium-R-Normal--24-*-*-*-m-*-ISO8859-1" } }
};
};
static QMouseEvent
*
last_event;
static QMouseEvent
*
last_event;
static QColor glow_allocate_named_color(
static QColor glow_allocate_named_color(
GlowDrawQt* draw_ctx, const char* named_color);
GlowDrawQt* draw_ctx, const char* named_color);
...
@@ -179,14 +179,13 @@ static QColor draw_type_to_color(
...
@@ -179,14 +179,13 @@ static QColor draw_type_to_color(
QColor* color_array;
QColor* color_array;
int sts = glow_read_color_file(
int sts = glow_read_color_file(
"/home/claes/test/ge_colors.dat", &color_array, &size);
"/home/claes/test/ge_colors.dat", &color_array, &size);
if (
sts
) {
if (
ODD(sts)
) {
QColor
* color_p = color_array + (painter_type - glow_eDrawType_Color4)
;
QColor
color_p = color_array[painter_type - glow_eDrawType_Color4]
;
QColor color = glow_allocate_color(
QColor color = glow_allocate_color(
draw_ctx, color_p
->red(), color_p->green(), color_p->
blue());
draw_ctx, color_p
.red(), color_p.green(), color_p.
blue());
delete color_array;
delete color_array;
return color;
return color;
}
}
return glow_allocate_named_color(draw_ctx, "black");
}
}
double r, g, b;
double r, g, b;
...
@@ -970,8 +969,12 @@ int GlowDrawQt::rect_helper(GlowWind* wind, int painter_type, int size, int x,
...
@@ -970,8 +969,12 @@ int GlowDrawQt::rect_helper(GlowWind* wind, int painter_type, int size, int x,
}
}
if (fill) {
if (fill) {
// debug_print("fillRect [%d, %d, %d, %d] painter_type=%d, with color %s\n",
// x, y, width, height, painter_type,
// qPrintable(painter->brush().color().name()));
painter->fillRect(x, y, width, height, painter->brush());
painter->fillRect(x, y, width, height, painter->brush());
} else {
} else {
// debug_print("drawRect [%d, %d, %d, %d]\n", x, y, width, height);
painter->setBrush(Qt::NoBrush);
painter->setBrush(Qt::NoBrush);
painter->drawRect(x, y, width, height);
painter->drawRect(x, y, width, height);
}
}
...
@@ -1019,6 +1022,7 @@ int GlowDrawQt::arrow_helper(GlowWind* wind, int painter_type, int size, int x1,
...
@@ -1019,6 +1022,7 @@ int GlowDrawQt::arrow_helper(GlowWind* wind, int painter_type, int size, int x1,
QPainterPath path;
QPainterPath path;
path.addPolygon(poly);
path.addPolygon(poly);
// debug_print("arrow (%d, %d) (%d, %d) (%d, %d)\n", x1, y1, x2, y2, x3, y3);
painter->fillPath(path, painter->brush());
painter->fillPath(path, painter->brush());
delete painter;
delete painter;
...
@@ -1072,8 +1076,12 @@ int GlowDrawQt::arc_helper(GlowWind* wind, int painter_type, int size, int x,
...
@@ -1072,8 +1076,12 @@ int GlowDrawQt::arc_helper(GlowWind* wind, int painter_type, int size, int x,
}
}
if (fill) {
if (fill) {
// debug_print("pie [%d, %d, %d, %d], %d, %d\n", x, y, width, height, angle1
// * 64, angle2 * 64);
painter->drawPie(x, y, width, height, angle1 * 64, angle2 * 64);
painter->drawPie(x, y, width, height, angle1 * 64, angle2 * 64);
} else {
} else {
// debug_print("arc [%d, %d, %d, %d], %d, %d\n", x, y, width, height, angle1
// * 64, angle2 * 64);
painter->setBrush(Qt::NoBrush);
painter->setBrush(Qt::NoBrush);
painter->drawArc(x, y, width, height, angle1 * 64, angle2 * 64);
painter->drawArc(x, y, width, height, angle1 * 64, angle2 * 64);
}
}
...
@@ -1206,6 +1214,7 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1,
...
@@ -1206,6 +1214,7 @@ int GlowDrawQt::line_helper(GlowWind* wind, int painter_type, int size, int x1,
painter->setPen(pen);
painter->setPen(pen);
}
}
// debug_print("line (%d, %d) (%d, %d)\n", x1, y1, x2, y2);
painter->drawLine(x1, y1, x2, y2);
painter->drawLine(x1, y1, x2, y2);
delete painter;
delete painter;
...
@@ -1271,6 +1280,8 @@ int GlowDrawQt::polyline_helper(GlowWind* wind, int painter_type, int size,
...
@@ -1271,6 +1280,8 @@ int GlowDrawQt::polyline_helper(GlowWind* wind, int painter_type, int size,
if (!fill) {
if (!fill) {
painter->setBrush(Qt::NoBrush);
painter->setBrush(Qt::NoBrush);
}
}
// debug_print("polyline painter_type=%d, fill=%d, point_cnt=%d\n",
// painter_type, fill, point_cnt);
painter->drawPolygon(qpoints, point_cnt);
painter->drawPolygon(qpoints, point_cnt);
delete qpoints;
delete qpoints;
...
@@ -1484,6 +1495,7 @@ int GlowDrawQt::image_helper(GlowWind* wind, int x, int y, int width,
...
@@ -1484,6 +1495,7 @@ int GlowDrawQt::image_helper(GlowWind* wind, int x, int y, int width,
set_clip(w, painter);
set_clip(w, painter);
}
}
// debug_print("image [%d, %d, %d, %d]\n", x, y, width, height);
if (d) {
if (d) {
painter->drawImage(QPoint(x, y), *((QImage*)image));
painter->drawImage(QPoint(x, y), *((QImage*)image));
} else {
} else {
...
@@ -1599,12 +1611,13 @@ void GlowDrawQt::cancel_event_timer()
...
@@ -1599,12 +1611,13 @@ void GlowDrawQt::cancel_event_timer()
timer_id->stop();
timer_id->stop();
}
}
void GlowDrawQt::event_timer(QMouseEvent
*
event)
void GlowDrawQt::event_timer(QMouseEvent
*
event)
{
{
if (last_event) {
if (last_event) {
delete last_event;
delete last_event;
}
}
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(), event->button(), event->buttons(), event->modifiers());
last_event = new QMouseEvent(event->type(), event->pos(), event->globalPos(),
event->button(), event->buttons(), event->modifiers());
initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
initOneShotTimer(timer_id, SLOT(event_timer_cb()), 200);
}
}
...
@@ -1686,7 +1699,8 @@ int GlowDrawQt::get_text_extent(const char* text, int len,
...
@@ -1686,7 +1699,8 @@ int GlowDrawQt::get_text_extent(const char* text, int len,
int font_type = get_font_type(painter_type);
int font_type = get_font_type(painter_type);
QFontMetrics fontMetrics = QFontMetrics(QFont(font_names[font_idx][font_type][idx]));
QFontMetrics fontMetrics
= QFontMetrics(QFont(font_names[font_idx][font_type][idx]));
QRect rect = fontMetrics.boundingRect(QString::fromLocal8Bit(text, len));
QRect rect = fontMetrics.boundingRect(QString::fromLocal8Bit(text, len));
*width = rect.width();
*width = rect.width();
int text_ascent = fontMetrics.ascent();
int text_ascent = fontMetrics.ascent();
...
@@ -1850,6 +1864,8 @@ void GlowDrawQt::set_background(GlowWind* wind, glow_eDrawType drawtype,
...
@@ -1850,6 +1864,8 @@ void GlowDrawQt::set_background(GlowWind* wind, glow_eDrawType drawtype,
delete w->background_pixmap;
delete w->background_pixmap;
}
}
// debug_print("set_background\n");
*(w->background_pixmap) = QPixmap::fromImage(*((QImage*)image));
*(w->background_pixmap) = QPixmap::fromImage(*((QImage*)image));
w->background_pixmap_width = pixmap_width;
w->background_pixmap_width = pixmap_width;
w->background_pixmap_height = pixmap_height;
w->background_pixmap_height = pixmap_height;
...
@@ -2392,7 +2408,9 @@ void GlowDrawQt::image_copy(glow_tImImage orig_image, glow_tImImage* image)
...
@@ -2392,7 +2408,9 @@ void GlowDrawQt::image_copy(glow_tImImage orig_image, glow_tImImage* image)
delete ((QImage*)*image);
delete ((QImage*)*image);
}
}
*(*((QImage**)image)) = ((QImage*)orig_image)->copy();
// debug_print("image_copy\n");
*image = new QImage(((QImage*)orig_image)->copy());
}
}
void GlowDrawQt::image_rotate(
void GlowDrawQt::image_rotate(
...
@@ -2402,6 +2420,9 @@ void GlowDrawQt::image_rotate(
...
@@ -2402,6 +2420,9 @@ void GlowDrawQt::image_rotate(
drot = int((float(drot) / 360 - floor(float(drot) / 360)) * 360);
drot = int((float(drot) / 360 - floor(float(drot) / 360)) * 360);
QTransform trans;
QTransform trans;
trans.rotate(drot);
trans.rotate(drot);
// debug_print("image_rotate\n");
QImage* im = new QImage(((QImage*)*image)->transformed(trans));
QImage* im = new QImage(((QImage*)*image)->transformed(trans));
delete ((QImage*)*image);
delete ((QImage*)*image);
*image = (glow_tImImage)im;
*image = (glow_tImImage)im;
...
@@ -2409,6 +2430,8 @@ void GlowDrawQt::image_rotate(
...
@@ -2409,6 +2430,8 @@ void GlowDrawQt::image_rotate(
void GlowDrawQt::image_flip_vertical(glow_tImImage* image)
void GlowDrawQt::image_flip_vertical(glow_tImImage* image)
{
{
// debug_print("image_flip_vertical\n");
QImage* im = new QImage(((QImage*)*image)->mirrored());
QImage* im = new QImage(((QImage*)*image)->mirrored());
delete ((QImage*)*image);
delete ((QImage*)*image);
*image = (glow_tImImage)im;
*image = (glow_tImImage)im;
...
@@ -2416,6 +2439,8 @@ void GlowDrawQt::image_flip_vertical(glow_tImImage* image)
...
@@ -2416,6 +2439,8 @@ void GlowDrawQt::image_flip_vertical(glow_tImImage* image)
void GlowDrawQt::image_flip_horizontal(glow_tImImage* image)
void GlowDrawQt::image_flip_horizontal(glow_tImImage* image)
{
{
// debug_print("image_flip_horizontal\n");
QImage* im = new QImage(((QImage*)*image)->mirrored(true, false));
QImage* im = new QImage(((QImage*)*image)->mirrored(true, false));
delete ((QImage*)*image);
delete ((QImage*)*image);
*image = (glow_tImImage)im;
*image = (glow_tImImage)im;
...
@@ -2425,6 +2450,8 @@ int GlowDrawQt::image_scale(int width, int height, glow_tImImage orig_im,
...
@@ -2425,6 +2450,8 @@ int GlowDrawQt::image_scale(int width, int height, glow_tImImage orig_im,
glow_tImImage* im, glow_tImData* im_data, glow_tPixmap* im_pixmap,
glow_tImImage* im, glow_tImData* im_data, glow_tPixmap* im_pixmap,
glow_tPixmap* im_mask)
glow_tPixmap* im_mask)
{
{
// debug_print("image_scale\n");
if (width == ((QImage*)*im)->width() && height == ((QImage*)*im)->height()) {
if (width == ((QImage*)*im)->width() && height == ((QImage*)*im)->height()) {
return 0;
return 0;
}
}
...
@@ -2485,7 +2512,7 @@ int GlowDrawQt::image_load(char* imagefile, glow_tImImage* orig_im,
...
@@ -2485,7 +2512,7 @@ int GlowDrawQt::image_load(char* imagefile, glow_tImImage* orig_im,
} else
} else
#endif
#endif
{
{
*orig_im =
((glow_tImImage*)new QImage(imagefile)
);
*orig_im =
new QImage(imagefile
);
if (!*orig_im) {
if (!*orig_im) {
if (im) {
if (im) {
*im = 0;
*im = 0;
...
@@ -2494,7 +2521,7 @@ int GlowDrawQt::image_load(char* imagefile, glow_tImImage* orig_im,
...
@@ -2494,7 +2521,7 @@ int GlowDrawQt::image_load(char* imagefile, glow_tImImage* orig_im,
}
}
}
}
if (im) {
if (im) {
*
((QImage*)*im) = ((QImage*)*orig_im)->copy(
);
*
im = new QImage(((QImage*)*orig_im)->copy()
);
}
}
return 1;
return 1;
}
}
...
@@ -2523,6 +2550,8 @@ void GlowDrawQt::image_pixel_iter(glow_tImImage orig_image,
...
@@ -2523,6 +2550,8 @@ void GlowDrawQt::image_pixel_iter(glow_tImImage orig_image,
int rgb_width;
int rgb_width;
int rowstride;
int rowstride;
// debug_print("image_pixel_iter\n");
if (orig_image) {
if (orig_image) {
if (image && *image != orig_image) {
if (image && *image != orig_image) {
delete ((QImage*)*image);
delete ((QImage*)*image);
...
@@ -3368,7 +3397,7 @@ void GlowDrawQt::event_exec(void* event, unsigned int size)
...
@@ -3368,7 +3397,7 @@ void GlowDrawQt::event_exec(void* event, unsigned int size)
return;
return;
}
}
memcpy((void
*)&e, (void
*)event, size);
memcpy((void
*)&e, (void
*)event, size);
// e.any.window = m_wind->window;
// e.any.window = m_wind->window;
switch (e.type()) {
switch (e.type()) {
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
View file @
48e3a402
...
@@ -50,6 +50,9 @@
...
@@ -50,6 +50,9 @@
void QtScrollWidgetGlow::createBuffer(QSize size)
void QtScrollWidgetGlow::createBuffer(QSize size)
{
{
if (size.isEmpty()) {
return;
}
this->image = QImage(size, QImage::Format_RGB32);
this->image = QImage(size, QImage::Format_RGB32);
QPainter imPainter(&image);
QPainter imPainter(&image);
imPainter.fillRect(image.rect(), palette().color(QPalette::Background));
imPainter.fillRect(image.rect(), palette().color(QPalette::Background));
...
@@ -259,8 +262,7 @@ bool QtScrollWidgetGlow::event(QEvent* event)
...
@@ -259,8 +262,7 @@ bool QtScrollWidgetGlow::event(QEvent* event)
emit resize_signal((QResizeEvent*)event);
emit resize_signal((QResizeEvent*)event);
createBuffer(((QResizeEvent*)event)->size());
createBuffer(((QResizeEvent*)event)->size());
}
}
if (!is_realized
if (!is_realized && event->type() == QEvent::Show) {
&& (event->type() == QEvent::Show || event->type() == QEvent::Resize)) {
realize();
realize();
is_realized = true;
is_realized = true;
}
}
...
...
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