Qt Signal Slot Infinite Loop



Slot

  1. Qt Signal Slot Infinite Looper
  2. Qt Signal Slot Infinite Loop Maker
  3. Qt Signal Slot Infinite Loop Tool
  4. Qt Signal Slot Infinite Loop Tutorial
  • Status:Closed
  • Resolution: Cannot Reproduce
  • Fix Version/s:5.0.2
  • Labels:
  • Environment:

I have a QWebView that opens a local web page on my computer, and everything works perfectly in Qt4.8. (It also works with a browser). But after porting the software to Qt5.0.2 (and making the change from QWebView to QtWebKitWidgets/QWebView, the program appears to hang, then crashes with the following output:

QIODevice::read: maxSize argument exceeds QByteArray size limit.
terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc

How to incorporate Qt Designer, Slots and Signals? Post by visionok » Wed Oct 28, 2020 9:38 am I managed to cobble together a macro that will read values from a selected spreadsheet and create multiple PartDesign bodies from it. @ The signal is connected to the setValue slot of a QLabel, so nothing really time consuming. The problem is that sometimes someLongProcessing returns immediately, causing the loop to emit a lot of signals. My ram usage then increases a lot and the software crashes. I can't call processEvents because I'm not in the main thread. The QT documentation lists the possible signals for each widget, for example for edit boxes, in the “Signals” chapter. Here we are assigning the recalc function to the textEdited event, which is fired every time the text in the editbox is updated by the user.

Here’s the code:

HelpManager::HelpManager(QObject *parent) :
QObject(parent)

{ view = new QWebView(); connect (view, SIGNAL(loadStarted()), SLOT(loadIsStarted())); connect (view, SIGNAL(loadProgress(int)), SLOT(loadInProgress(int))); connect (view, SIGNAL(loadFinished(bool)), SLOT(loadIsFinisehd(bool))); view->load(QUrl('../Help/IDTNVMeMgr-web/index.html')); view->setWindowTitle('IDTVMeMgr Help Information'); view->show(); }

void HelpManager::loadIsStarted()

{ qDebug() << 'loadIsStarted'; }

void HelpManager::loadInProgress(int progress)

{ qDebug() << 'loadInProgress, progress =' << progress; }

void HelpManager::loadIsFinisehd(bool isOk)

{ qDebug() << 'loadIsFinshed, status = ' << isOk; }Infinite

Here is the successful output using Qt4.8

loadIsStarted
loadInProgress, progress = 10
loadInProgress, progress = 10
loadInProgress, progress = 27
loadInProgress, progress = 29
loadInProgress, progress = 32
loadInProgress, progress = 36
loadInProgress, progress = 36
loadInProgress, progress = 36
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 100
loadIsFinshed, status = true

Attachments

Gerrit Reviews

Qt Signal Slot Infinite Looper

No reviews matched the request. Check your Options in the drop-down menu of this sections header.
Assignee:
Michael Bruning
Reporter:
Robert Felten
Votes:
0Vote for this issue
Watchers:
3Start watching this issue
  • Status:Closed
  • Resolution: Cannot Reproduce
  • Fix Version/s:5.0.2
  • Labels:
  • Environment:
Infinite

I have a QWebView that opens a local web page on my computer, and everything works perfectly in Qt4.8. (It also works with a browser). But after porting the software to Qt5.0.2 (and making the change from QWebView to QtWebKitWidgets/QWebView, the program appears to hang, then crashes with the following output:

Infinite

QIODevice::read: maxSize argument exceeds QByteArray size limit.
terminate called after throwing an instance of ‘std::bad_alloc’
what(): std::bad_alloc

Here’s the code:

Qt Signal Slot Infinite Loop

HelpManager::HelpManager(QObject *parent) :
QObject(parent)

{ view = new QWebView(); connect (view, SIGNAL(loadStarted()), SLOT(loadIsStarted())); connect (view, SIGNAL(loadProgress(int)), SLOT(loadInProgress(int))); connect (view, SIGNAL(loadFinished(bool)), SLOT(loadIsFinisehd(bool))); view->load(QUrl('../Help/IDTNVMeMgr-web/index.html')); view->setWindowTitle('IDTVMeMgr Help Information'); view->show(); }

void HelpManager::loadIsStarted()

{ qDebug() << 'loadIsStarted'; }

void HelpManager::loadInProgress(int progress)

{ qDebug() << 'loadInProgress, progress =' << progress; }

void HelpManager::loadIsFinisehd(bool isOk)

{ qDebug() << 'loadIsFinshed, status = ' << isOk; }

Here is the successful output using Qt4.8

Qt Signal Slot Infinite Loop Maker

loadIsStarted
loadInProgress, progress = 10
loadInProgress, progress = 10
loadInProgress, progress = 27
loadInProgress, progress = 29
loadInProgress, progress = 32
loadInProgress, progress = 36
loadInProgress, progress = 36
loadInProgress, progress = 36
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 90
loadInProgress, progress = 100
loadIsFinshed, status = true

Attachments

Gerrit Reviews

Qt Signal Slot Infinite Loop Tool

No reviews matched the request. Check your Options in the drop-down menu of this sections header.

Qt Signal Slot Infinite Loop Tutorial

Assignee:
Michael Bruning
Reporter:
Robert Felten
Votes:
0Vote for this issue
Watchers:
3Start watching this issue