返回介绍

QSignalMapper Class

发布于 2019-10-04 15:02:36 字数 3157 浏览 1133 评论 0 收藏 0

The QSignalMapper class bundles signals from identifiable senders. More...

#include <qsignalmapper.h>

Inherits QObject.

List of all member functions.

Public Members

  • QSignalMapper ( QObject*parent, constchar*name = 0 )
  • ~QSignalMapper ()
  • virtual void setMapping ( constQObject*sender, intidentifier )
  • virtual void setMapping ( constQObject*sender, constQString&identifier )
  • void removeMappings ( constQObject*sender )

Public Slots

  • void map ()

Signals

  • void mapped ( int )
  • void mapped ( const QString & )

Detailed Description

The QSignalMapper class bundles signals from identifiable senders.

This class collects a set of parameterless signals, and re-emits them with integer or string parameters corresponding to the object that sent the signal.

See also Input/Output and Networking.


Member Function Documentation

QSignalMapper::QSignalMapper ( QObject*parent, constchar*name = 0 )

Constructs a QSignalMapper called name, with parent parent. Like all QObjects, it will be deleted when the parent is deleted.

QSignalMapper::~QSignalMapper ()

Destroys the QSignalMapper.

void QSignalMapper::map () [slot]

This slot emits signals based on which object sends signals to it.

Examples: i18n/main.cpp and themes/themes.cpp.

void QSignalMapper::mapped ( int ) [signal]

This signal is emitted when map() is signaled from an object that has an integer mapping set.

See also setMapping().

Examples: i18n/main.cpp and themes/themes.cpp.

void QSignalMapper::mapped ( constQString& ) [signal]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

This signal is emitted when map() is signaled from an object that has a string mapping set.

See also setMapping().

void QSignalMapper::removeMappings ( constQObject*sender )

Removes all mappings for sender. This is done automatically when mapped objects are destroyed.

void QSignalMapper::setMapping ( constQObject*sender, intidentifier ) [virtual]

Adds a mapping so that when map() is signaled from the given sender, the signal mapped(identifier) is emitted.

There may be at most one integer identifier for each object.

Examples: i18n/main.cpp and themes/themes.cpp.

void QSignalMapper::setMapping ( constQObject*sender, constQString&identifier ) [virtual]

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Adds a mapping so that when map() is signaled from the given sender, the signal mapper(identifier) is emitted.

There may be at most one string identifier for each object, and it may not be null.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文