Qt Slots Not Work

  1. Qt Slots Keyword
  2. Qt Public Slots
  3. Qt Signal And Slots
  4. Qt Connect Slot

Please verify that the update method is declared in your header, as a slot. Check that you didn't forget QOBJECT macro, you included required classes. The issue probably come from something you didn't show in your question. How Qt Signals and Slots Work - Part 2 - Qt5 New Syntax This is the sequel of my previous article explaining the implementation details of the signals and slots. In the Part 1, we have seen the general principle and how it works with the old syntax.

  • Status:Closed
  • Resolution: Done
  • Fix Version/s:5.9.0 Alpha
  • Labels:
  • Environment:

Consider the following code:

{code=title=mainwindow.cpp}

void MainWindow::testSlotA()
{
m_x++;
qDebug() << '?? PING' << m_x;
connect(this, &MainWindow::testSignal, this, [=](int x)

{ qDebug() << '!! PONG' << x; }

, Qt::UniqueConnection);

Qt Slots Keyword

emit testSignal(m_x);
}

Now if I call testSlotA 3 times it produces the following output:

This is wrong, using Qt::UniqueConnection the output should be:

Gerrit Reviews

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

Qt Public Slots

Votes:
2Vote for this issue
Watchers:
3Start watching this issue
Hide There is 1 closed Gerrit change
    Doc: add a note that UniqueConnection does not work for lambdas
    Gerrit Review:
  • Status:Reported
  • Resolution: Unresolved
  • Fix Version/s: None
  • Labels:
  • Environment:

There is a problem with ActiveQt (5.4.2), when trying to call a slot via the COM interface. The problem occurs, if the slot receives a parameter, which is an object pointer (simple datatypes as int work correctly) and if the code is enclosed in a namespace, and also when the name defined in a CoClassAlias definition differs from the class name.

See the attached example for more information. It contains a COM application (modified Qt example) and a VBS script. The application has two flags to enable/disable namespaces and aliases.

When both namespace and aliases are turned off, the VBS script works as expected and pops up a message box, indicating the slot DocumentList::addExistingDocument has been called. When enabling the namespace the following error message occurs, when invoking the script:

Microsoft VBScript runtime error: Object doesn't support this property or method: 'server.documents'

When additionally turning on the aliases, the error message changes to

Microsoft VBScript runtime error: Object doesn't support this property or method: 'docList.addExistingDocument'

Qt Slots Not Work

Steps to reproduce:

  • Do in-source build of test project
  • Run wscript test.vbs

Attachments

  1. qtbug47001_comapp_sample_repro.diff
    4 kB
  2. qtbug47001.zip
    4 kB
relates to

QTBUG-16466idc.exe ignores COM class namespace in methods arguments and return value.

  • Closed

Gerrit Reviews

Qt Signal And Slots

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

Qt Connect Slot

Votes:
0Vote for this issue
Watchers:
4Start watching this issue