Qt4-preview-feedback Archive, November 2005
Known issues with qt-x11-opensource-src-4.1.0-rc
Pages: Prev | 1 | 2 | Next
Message 1 in thread
Hi,
my program runs fine under 4.0. Today I tried 4.1 on Gentoo Linux AMD64
and the following harmless looking code segfaults:
_archiveMessage = new QMessageBox("name", tr("some text"),
QMessageBox::Information, QMessageBox::Cancel, QMessageBox::NoButton,
QMessageBox::NoButton);
int result = _archiveMessage->exec(); // <-- Here segfault.
Any ideas? I can provide a backtrace if necessary.
Guido
Message 2 in thread
Ok, it is _not_ the message box. It is a QProcess, with a behaviour I
don't understand.
I create a QProcess:
_process = new QProcess(this);
Connect the signals:
connect(_process, SIGNAL(finished(int)), this, SLOT(finished(int)));
And start the process with _process->start(...);
In the finished slot I did a delete(_process). This is what caused the
crash.
Worked in 4.0. Are I not supposed to do this in 4.1?
Guido
Message 3 in thread
Wednesday 23 November 2005 00:45 tarihinde, Guido Seifert ÅunlarÄ yazmÄÅtÄ:
> Ok, it is _not_ the message box. It is a QProcess, with a behaviour I
> don't understand.
>
> I create a QProcess:
> _process = new QProcess(this);
>
> Connect the signals:
> connect(_process, SIGNAL(finished(int)), this, SLOT(finished(int)));
>
> And start the process with _process->start(...);
>
> In the finished slot I did a delete(_process). This is what caused the
> crash.
>
> Worked in 4.0. Are I not supposed to do this in 4.1?
Maybe use deleteLater() ?
/ismail
Message 4 in thread
On Tuesday 22 November 2005 23:40, Ismail Donmez wrote:
> Wednesday 23 November 2005 00:45 tarihinde, Guido Seifert ÅunlarÄ yazmÄÅtÄ:
> > I create a QProcess:
> > _process = new QProcess(this);
> >
> > Connect the signals:
> > connect(_process, SIGNAL(finished(int)), this, SLOT(finished(int)));
> >
> > And start the process with _process->start(...);
> >
> > In the finished slot I did a delete(_process). This is what caused the
> > crash.
> >
> > Worked in 4.0. Are I not supposed to do this in 4.1?
>
> Maybe use deleteLater() ?
Yes, it's usually a good idea to call deleteLater() on objects in slots
rather than delete them directly. Deleting the object directly wasn't
guaranteed to work in 4.0, either.
David
Message 5 in thread
> > > Worked in 4.0. Are I not supposed to do this in 4.1?
> >
> > Maybe use deleteLater() ?
>
> Yes, it's usually a good idea to call deleteLater() on objects in slots
> rather than delete them directly. Deleting the object directly wasn't
> guaranteed to work in 4.0, either.
Thanks, I was not aware of that. Though if I think about it, I should
not be so surprised.
Guido
Message 6 in thread
David Boddie wrote:
> Yes, it's usually a good idea to call deleteLater() on objects in slots
> rather than delete them directly.
Please note that using deleteLater() is one of main sources for hard-to-find
crashes of applications.
In most cases, where it is used, an QObject has to be deleted while you are
inside one of its methods (maybe below a signals). So it is needed to delay
the deletion until the application has left the object. But the deletion is
only delayed until the next time events are processed. And this might be
sooner as intended, if there are explicite calls of processEvents (rare),
or when executing recursive event loops (often). Recursive event loops are
executed inside QDialog::exec, used f.e in file dialogs or all types of
message boxes.
In large applications it is hard to know, what is happening below the slots
that are connected to a signal. The worst problem of all are the error
boxes, because error situations often don't happen in tests and the crashs
will be found by the customers.
A possible improvement for this problem is to overload QApplication::notify
and to block processing of DeferredDelete events in recursive eventLoops
and to repost them, when the application comes back to the highest loop
level.
Adding something like this to Qt or finding another way of making the
deleteLater() concept more stable is one of my wishes for future releases.
Uwe
Message 7 in thread
On Wednesday 23 November 2005 18:30, Uwe Rathmann wrote:
> A possible improvement for this problem is to overload QApplication::notify
> and to block processing of DeferredDelete events in recursive eventLoops
> and to repost them, when the application comes back to the highest loop
> level.
>
> Adding something like this to Qt or finding another way of making the
> deleteLater() concept more stable is one of my wishes for future releases.
Can you put the items to be deleted on a list of to-be-deleted-items which
is processed by this routine the *next* time control passes through it?
--
[ signature omitted ]
Message 8 in thread
Dave Feustel wrote:
> Can you put the items to be deleted on a list of to-be-deleted-items which
> is processed by this routine the *next* time control passes through it?
You always return to the highest level:
class YourApplication: public QApplication
{
virtual bool notify ( QObject * receiver, QEvent * e )
{
static level = 0;
static QValueList< QGuardedPtr<QObject> > objectsToDelete;
if ( level > 0 )
{
if ( e->type() == QEvent::DeferredDelete )
{
objectToDelete += QGuardedPtr(receiver);
return true;
}
}
level++;
bool ok = QApplication::notify(receiver, e);
level--;
if ( level == 0 )
{
for ( int i = 0; i < objectsToDelete.count(); i++ )
delete objectsToDelete[i];
objectsToDelete.clear();
}
return ok;
}
};
Message 9 in thread
Hi I'm trying to use the QSplashscreen class in my app. My code just
look like the example in the assistant :
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPixmap pixmap(":/images/play3.png");
QSplashScreen *splash = new QSplashScreen(pixmap );
splash->show();
splash->showMessage("Loaded modules");
PlayerHollywood *window = new PlayerHollywood;
window->show();
splash->finish(window);
delete splash;
app.connect( &app, SIGNAL( lastWindowClosed() ), &app, SLOT( quit() ) );
return app.exec();
}
but no splash screen appears before my mainwindow. Is something wrong
with this code? Can someone help me to make my splash screen appear?
Elise
Message 10 in thread
Hello,
trying qt4.1.0rc i could not find out how to change the background
color of a label. The following code does not work:
QLabel* label = new QLabel;
label->setText("mops");
QPalette p(label->palette());
p.setColor(label->backgroundRole(), track->ccolor());
label->setPalette(p);
Looking at the calculator example the buttons also have only gray
backgrounds instead of different colors.
Is this a bug or is there something wrong with my qt installation?
/Werner
Message 11 in thread
Hi,
> Is this a bug or is there something wrong with my qt installation?
Is this Windows XP?
--
[ signature omitted ]
Message 12 in thread
On Thursday 24 November 2005 17:36, Dimitri wrote:
> Hi,
>
> > Is this a bug or is there something wrong with my qt installation?
>
> Is this Windows XP?
no, its the linux x11 version (running on linux 2.6.15)
/Werner
Message 13 in thread
Hi,
> QLabel* label = new QLabel;
> label->setText("mops");
> QPalette p(label->palette());
> p.setColor(label->backgroundRole(), track->ccolor());
> label->setPalette(p);
This happens with the plastique style only, not with the windows, cde or
motif styles. Try the '-style windows' option to check this.
I don't know whether this is by design, it rather looks like a bug to
me, I would suggest sending a bug report to Trolltech:
http://www.trolltech.com/forms/feedbackform.html
--
[ signature omitted ]
Message 14 in thread
On Thursday 24 November 2005 21:17, Dimitri wrote:
> Hi,
>
> > QLabel* label = new QLabel;
> > label->setText("mops");
> > QPalette p(label->palette());
> > p.setColor(label->backgroundRole(), track->ccolor());
> > label->setPalette(p);
>
> This happens with the plastique style only, not with the windows, cde or
> motif styles. Try the '-style windows' option to check this.
>
> I don't know whether this is by design, it rather looks like a bug to
> me, I would suggest sending a bug report to Trolltech:
> http://www.trolltech.com/forms/feedbackform.html
>
you are right, the calculator example shows the wrong behaviour only
with plastique style.
I experimented a little more and a simple test program works ok with
all styles:
#include <QApplication>
#include <QLabel>
#include <QMainWindow>
#include <QLayout>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QMainWindow mw;
QFrame* f = new QFrame;
QVBoxLayout* layout = new QVBoxLayout;
QLabel* l = new QLabel;
l->setFixedSize(100, 30);
l->setAlignment(Qt::AlignJustify);
QPalette p = l->palette();
p.setColor(QPalette::Window, Qt::yellow);
l->setPalette(p);
l->setText("Hallo World");
layout->addWidget(l);
mw.setCentralWidget(f);
mw.show();
return app.exec();
}
To make things worse my original program shows wrong behaviour with
all styles (i of course i could not find what makes the difference)
Anyway i did a bug report to trolltech.
/Werner
Message 15 in thread
I'm using this, it works on X11 in default style, I suppose it is
plastique.
May be the key is in calling setAutoFillBackground(true).
Fanda
lblSearchString = new QLabel(this);
QPalette palette;
palette.setColor(QPalette::Active, QPalette::Window, QColor(255, 255,
127));
lblSearchString->setPalette(palette);
lblSearchString->setFrameShape(QFrame::StyledPanel);
lblSearchString->setAutoFillBackground(true);
On Mon, 28 Nov 2005 11:52:08 +0100, Werner Schweer <ws@xxxxxx> wrote:
> On Thursday 24 November 2005 21:17, Dimitri wrote:
>> Hi,
>>
>> > QLabel* label = new QLabel;
>> > label->setText("mops");
>> > QPalette p(label->palette());
>> > p.setColor(label->backgroundRole(), track->ccolor());
>> > label->setPalette(p);
>>
>> This happens with the plastique style only, not with the windows, cde or
>> motif styles. Try the '-style windows' option to check this.
>>
>> I don't know whether this is by design, it rather looks like a bug to
>> me, I would suggest sending a bug report to Trolltech:
>> http://www.trolltech.com/forms/feedbackform.html
>>
> you are right, the calculator example shows the wrong behaviour only
> with plastique style.
> I experimented a little more and a simple test program works ok with
> all styles:
>
> #include <QApplication>
> #include <QLabel>
> #include <QMainWindow>
> #include <QLayout>
>
> int main(int argc, char* argv[])
> {
> QApplication app(argc, argv);
> QMainWindow mw;
>
> QFrame* f = new QFrame;
> QVBoxLayout* layout = new QVBoxLayout;
> QLabel* l = new QLabel;
> l->setFixedSize(100, 30);
> l->setAlignment(Qt::AlignJustify);
> QPalette p = l->palette();
> p.setColor(QPalette::Window, Qt::yellow);
> l->setPalette(p);
> l->setText("Hallo World");
> layout->addWidget(l);
>
> mw.setCentralWidget(f);
> mw.show();
> return app.exec();
> }
>
> To make things worse my original program shows wrong behaviour with
> all styles (i of course i could not find what makes the difference)
>
> Anyway i did a bug report to trolltech.
>
> /Werner
>
--
[ signature omitted ]
Pages: Prev | 1 | 2 | Next