You are not logged in.

Dear visitor, welcome to KDE-Forum.org. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

ckult2

Unregistered

1

Saturday, September 4th 2004, 3:39pm

breaking the cycle

void SQ_GLWidget::keyPressEvent(QKeyEvent *e)
{
if(e->key() == Qt::Key_Space)
sqWStack->emitPreviousSelected(); // activate
}

// some time later we return back in SQ_GLWidget class:
void SQ_GLWidget::emitShowImage(const QString &file)
{
File = file;

sqGLView->setCaption(File);

QTimer::singleShot(1, this, SLOT(slotShowImage()));
}

slotShowImage() - is a big function with a big cycle. For example, user pressed Space, and then pressed once more. If slotShowImage() already running, it should be interrupted and new image should be displayed.


Very nice example doesn't work:

SQ_GLThread *t = new SQ_GLThread;

void SQ_GLWidget::emitShowImage(const QString &file)
{
File = file;

sqGLView->setCaption(File);

if(t->running())
{
t->stop();
t->wait()
}

t->start();
}
, because slotShowImage() uses OpenGL functions, and cann't be threaded.
Any ideas ??

anda_skoa

Professional

Posts: 1,273

Location: Graz, Austria

Occupation: Software Developer

  • Send private message

2

Saturday, September 4th 2004, 5:06pm

RE: breaking the cycle

Quoted

Originally posted by ckult2
, because slotShowImage() uses OpenGL functions, and cann't be threaded.


According to Trolltech it can be threaded:
http://doc.trolltech.com/qq/qq06-glimpsi…dglapplications

Cheers,
_
Qt/KDE Developer
Debian User

ckult2

Unregistered

3

Saturday, September 4th 2004, 8:41pm

It is _very_ unusable example :((