[GB.QT4]
* BUG: Found a workaround to the QT4 bug that made it crash when destroying a ProgressBar explicitely. git-svn-id: svn://localhost/gambas/trunk@2124 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
49e0d1788d
commit
e5e537e27a
3 changed files with 37 additions and 1 deletions
|
@ -22,18 +22,33 @@
|
|||
|
||||
#define __CPROGRESS_CPP
|
||||
|
||||
#include <QStyle>
|
||||
#include <QWindowsStyle>
|
||||
#include <QProgressBar>
|
||||
|
||||
#include "gambas.h"
|
||||
|
||||
#include "CProgress.h"
|
||||
|
||||
static MyWindowsStyle _style;
|
||||
|
||||
void MyWindowsStyle::timerEvent(QTimerEvent *e)
|
||||
{
|
||||
e->ignore();
|
||||
}
|
||||
|
||||
void CPROGRESS_style_hack(void *_object)
|
||||
{
|
||||
THIS->widget.widget->setStyle(&_style);
|
||||
}
|
||||
|
||||
BEGIN_METHOD(CPROGRESS_new, GB_OBJECT parent)
|
||||
|
||||
QProgressBar *wid = new QProgressBar(QCONTAINER(VARG(parent)));
|
||||
|
||||
wid->setMaximum(10000);
|
||||
//QObject::connect(wid, SIGNAL(destroyed()), &CProgress::manager, SLOT(destroy()));
|
||||
|
||||
wid->setMaximum(10000);
|
||||
wid->setTextVisible(true);
|
||||
|
||||
CWIDGET_new(wid, (void *)_object);
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#ifndef __CPROGRESS_H
|
||||
#define __CPROGRESS_H
|
||||
|
||||
#include <QWindowsStyle>
|
||||
|
||||
#include "gambas.h"
|
||||
|
||||
#include "CWidget.h"
|
||||
|
@ -42,4 +44,18 @@ typedef
|
|||
}
|
||||
CPROGRESS;
|
||||
|
||||
class MyWindowsStyle : public QWindowsStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
//MyCleanlooksStyle();
|
||||
//~MyCleanlooksStyle();
|
||||
|
||||
protected:
|
||||
void timerEvent(QTimerEvent *event);
|
||||
};
|
||||
|
||||
void CPROGRESS_style_hack(void *_object);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "CClipboard.h"
|
||||
#include "CMenu.h"
|
||||
#include "CScrollView.h"
|
||||
#include "CProgress.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QObject>
|
||||
|
@ -57,6 +58,7 @@
|
|||
#include <QHash>
|
||||
#include <QAbstractScrollArea>
|
||||
#include <Q3ScrollView>
|
||||
#include <QProgressBar>
|
||||
|
||||
GB_CLASS CLASS_Control;
|
||||
GB_CLASS CLASS_Container;
|
||||
|
@ -312,6 +314,9 @@ void CWIDGET_destroy(CWIDGET *object)
|
|||
CWIDGET_set_flag(object, WF_DELETED);
|
||||
CWIDGET_set_visible(object, false);
|
||||
|
||||
if (qobject_cast<QProgressBar *>(object->widget))
|
||||
CPROGRESS_style_hack(object);
|
||||
|
||||
object->widget->deleteLater();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue