Commit d83a335b authored by Christoffer Ackelman's avatar Christoffer Ackelman

Fixed crash when opening help several times.

parent 2299fc12
......@@ -2443,7 +2443,7 @@ void OptionsDialog::activate_options_cancel()
}
OptionsDialog::OptionsDialog(WttQt *parent_ctx, QWidget *parent)
: QDialog(parent), wtt(parent_ctx)
: QDialog(), wtt(parent_ctx)
{
setMinimumSize(650, 450);
setWindowTitle(fl("Options"));
......@@ -2455,7 +2455,7 @@ OptionsDialog::OptionsDialog(WttQt *parent_ctx, QWidget *parent)
wtt->show_plant_w = new QCheckBox(fl("Plant Configuration"), this);
wtt->show_node_w = new QCheckBox(fl("Node Configuration"), this);
QVBoxLayout *hier_vbox = new QVBoxLayout(this);
QVBoxLayout *hier_vbox = new QVBoxLayout();
hier_vbox->addWidget(hier_label);
hier_vbox->addWidget(wtt->enable_comment_w);
hier_vbox->addWidget(wtt->enable_revisions_w);
......@@ -2471,7 +2471,7 @@ OptionsDialog::OptionsDialog(WttQt *parent_ctx, QWidget *parent)
wtt->show_attrref_w = new QCheckBox(fl("Attribute Reference"), this);
wtt->show_attrxref_w = new QCheckBox(fl("Attribute Cross Reference"), this);
QVBoxLayout *entry_vbox = new QVBoxLayout(this);
QVBoxLayout *entry_vbox = new QVBoxLayout();
entry_vbox->addWidget(entry_label);
entry_vbox->addWidget(wtt->show_class_w);
entry_vbox->addWidget(wtt->show_alias_w);
......@@ -2490,7 +2490,7 @@ OptionsDialog::OptionsDialog(WttQt *parent_ctx, QWidget *parent)
wtt->build_manual_w = new QCheckBox(fl("Manual"), this);
wtt->build_nocopy_w = new QCheckBox(fl("Disable Copy"), this);
QVBoxLayout *build_vbox = new QVBoxLayout(this);
QVBoxLayout *build_vbox = new QVBoxLayout();
build_vbox->addWidget(build_label);
build_vbox->addWidget(wtt->build_force_w);
build_vbox->addWidget(wtt->build_debug_w);
......@@ -2500,7 +2500,7 @@ OptionsDialog::OptionsDialog(WttQt *parent_ctx, QWidget *parent)
build_vbox->addWidget(wtt->build_manual_w);
build_vbox->addWidget(wtt->build_nocopy_w);
QHBoxLayout *hbox = new QHBoxLayout(this);
QHBoxLayout *hbox = new QHBoxLayout();
hbox->addLayout(hier_vbox);
hbox->addWidget(separator(QFrame::VLine));
hbox->addLayout(entry_vbox);
......
......@@ -208,7 +208,6 @@ CoXHelpQt::CoXHelpQt(QWidget *xa_parent_wid, void *xa_parent_ctx,
toplevel->setToolTip(fl("cow_xhelp widget"));
toplevel->setFixedSize(700, 600);
toplevel->setWindowTitle(fl(title));
toplevel->setAttribute(Qt::WA_DeleteOnClose);
CoWowQt::SetWindowIcon(toplevel);
......
......@@ -68,7 +68,7 @@ CoXHelpNavQt::CoXHelpNavQt(void *xn_parent_ctx, QWidget *xn_parent_wid,
QWidget **w, pwr_tStatus *status)
: CoXHelpNav(xn_parent_ctx, xn_name, xn_utility, status)
{
debug_print("creating a scrolledbrowwidgetqt\n");
debug_print("CoXHelpNavQt: creating a scrolledbrowwidgetqt\n");
form_widget = scrolledbrowwidgetqt_new(CoXHelpNav::init_brow_base_cb, this,
&brow_widget);
......
......@@ -1582,7 +1582,7 @@ void FlowDrawQt::clear(FlowCtx *ctx)
painter->setBackground(QBrush(background));
//debug_print("clear color=%s\n", painter->background().color().name().toAscii().data());
painter->eraseRect(window->rect());
painter->eraseRect(window_canvas->rect());
delete painter;
}
......@@ -1595,7 +1595,7 @@ void FlowDrawQt::nav_clear(FlowCtx *ctx)
painter->setBackground(QBrush(background));
//debug_print("nav_clear color=%s\n", painter->background().color().name().toAscii().data());
painter->eraseRect(nav_window->rect());
painter->eraseRect(nav_window_canvas->rect());
delete painter;
}
......
......@@ -46,12 +46,11 @@
#include "cow_qt_helpers.h"
QImage QtScrollWidgetFlow::createBuffer(QSize size)
void QtScrollWidgetFlow::createBuffer(QSize size)
{
QImage image = QImage(size, QImage::Format_RGB32);
this->image = QImage(size, QImage::Format_RGB32);
QPainter imPainter(&image);
imPainter.fillRect(image.rect(), palette().color(QPalette::Background));
return image;
}
void QtScrollWidgetFlow::init(
......@@ -59,7 +58,7 @@ void QtScrollWidgetFlow::init(
void *client_data, int (*init_proc2)(QWidget *w, FlowCtx *ctx,
void *client_data))
{
this->image = createBuffer(size());
createBuffer(size());
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
......@@ -71,7 +70,7 @@ QWidget *QtScrollWidgetFlow::initScroll(
void *client_data, int (*init_proc2)(QWidget *w, FlowCtx *ctx,
void *client_data))
{
this->image = createBuffer(size());
createBuffer(size());
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
......@@ -103,7 +102,7 @@ bool QScrollAreaFlow::event(QEvent *event)
void QtScrollWidgetFlow::init(unsigned int eCtxType, QWidget *main)
{
this->image = createBuffer(size());
createBuffer(size());
this->ctxType = eCtxType;
is_navigator = 1;
main_widget = main;
......@@ -260,7 +259,7 @@ void QtScrollWidgetFlow::handleEvent(QEvent *event)
bool QtScrollWidgetFlow::event(QEvent *event)
{
if (event->type() == QEvent::Resize) {
this->image = createBuffer(((QResizeEvent *) event)->size());
createBuffer(((QResizeEvent *) event)->size());
}
if (!is_realized && (event->type() == QEvent::Show || event->type() == QEvent::Resize)) {
realize();
......
......@@ -122,7 +122,7 @@ protected:
unsigned int ctxType;
private:
QImage createBuffer(QSize size);
void createBuffer(QSize size);
public slots:
void scroll_h_action(int value);
......
......@@ -1498,7 +1498,7 @@ void GlowDrawQt::clear(GlowWind *wind)
DrawWindQt *w = (DrawWindQt *) wind->window;
if (!w->double_buffer_on) {
QPainter(w->buffer).eraseRect(w->window->rect());
QPainter(w->buffer).eraseRect(w->buffer->rect());
} else {
buffer_background(w, 0);
}
......
......@@ -46,12 +46,11 @@
#include "cow_qt_helpers.h"
QImage QtScrollWidgetGlow::createBuffer(QSize size)
void QtScrollWidgetGlow::createBuffer(QSize size)
{
QImage image = QImage(size, QImage::Format_RGB32);
this->image = QImage(size, QImage::Format_RGB32);
QPainter imPainter(&image);
imPainter.fillRect(image.rect(), palette().color(QPalette::Background));
return image;
}
void QtScrollWidgetGlow::init(
......@@ -59,7 +58,7 @@ void QtScrollWidgetGlow::init(
void *client_data, int (*init_proc2)(QWidget *w, GlowCtx *ctx,
void *client_data))
{
this->image = createBuffer(size());
createBuffer(size());
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
......@@ -71,7 +70,7 @@ QWidget *QtScrollWidgetGlow::initScroll(
void *client_data, int (*init_proc2)(QWidget *w, GlowCtx *ctx,
void *client_data))
{
this->image = createBuffer(size());
createBuffer(size());
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
......@@ -103,7 +102,7 @@ bool QScrollAreaGlow::event(QEvent *event)
void QtScrollWidgetGlow::init(unsigned int eCtxType, QWidget *main)
{
this->image = createBuffer(size());
createBuffer(size());
this->ctxType = eCtxType;
is_navigator = 1;
main_widget = main;
......@@ -260,7 +259,7 @@ void QtScrollWidgetGlow::handleEvent(QEvent *event)
bool QtScrollWidgetGlow::event(QEvent *event)
{
if (event->type() == QEvent::Resize) {
this->image = createBuffer(((QResizeEvent *) event)->size());
createBuffer(((QResizeEvent *) event)->size());
}
if (!is_realized && (event->type() == QEvent::Show || event->type() == QEvent::Resize)) {
realize();
......
......@@ -122,7 +122,7 @@ protected:
unsigned int ctxType;
private:
QImage createBuffer(QSize size);
void createBuffer(QSize size);
public slots:
void scroll_h_action(int value);
......
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