ChinaUnix.net
相关文章推荐:

inside qt signal slot

信号和槽是qt编程的一个重要部分。这个机制可以在对象之间彼此并不了解的情况下将它们的行为联系起来。在前几个例子中,我们已经连接了信号和槽,声明了控件自己的信号和槽,并实现了槽函数,发送了自己的信号。现在来更深入了解这个机制。 槽和普通的c++成员函数很像。它们可以是虚函数(virtual),也可被重载(overload),可以是公有的(public),保护的(protective),也可是私有的(private),它们可以象任何c++成员函数...

by toy0808 - Linux文档专区 - 2009-09-15 17:28:02 阅读(858) 回复(0)

相关讨论

qtsignal/slot机制原理 signal/slot在底层会使用三种方式传递消息。参见QObject::connect()方法: bool QObject::connect ( const QObject * sender, const char * signal, const QObject * receiver, const char * method, qt::ConnectionType type = qt::AutoCompatConnection ) 最后一个参数是就是传递消息的方式了,有四个取值: qt::DirectConnection When emitted, the signal is immediately delivered to the slot. 假设...

by sky_flying - Linux文档专区 - 2009-03-12 13:45:16 阅读(993) 回复(0)

好像boost也有,讲讲这个也行。

by prolj - C/C++ - 2009-10-27 14:17:06 阅读(1701) 回复(4)

2. signal/slot     signal/slot机制是qt最具特色的特性。signal/slot巧妙的简单的实现了面向对象编程中经常使用的观察者模式(observer,或称为消息预定模式)。同时也封装了callback机制,一定程度上保证了callback函数的类型安全。  从实现上来看,signal/slot需要QMetaObject和moc编译器的支持。signalslot实际上是两种类函数,分别需要在类函数声明前面加signals和slots两个宏。  以QButton的一个...

by dragonscroll - Linux文档专区 - 2009-02-24 00:38:15 阅读(765) 回复(0)

比如子进程为signal,父进程为slot,子进程处理事情发生状态变化时通知父进程,怎么做到? 谢谢

by john.daker - C/C++ - 2008-11-16 21:29:55 阅读(8071) 回复(5)

dlg::dlg( QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ) { ... table = new qtable( this, "table" ); ... comb = new QComBox( this, "comb" ); comb->insertItem("1"); comb->insertItem("2"); comb->insertItem("3"); table->setCellWidget( 0,0,comb ); connect( combo, signal( activated(int index) ), this,slot( ...

by huosports - GUI编程 - 2006-06-06 12:17:27 阅读(3427) 回复(3)

怎么写才能实现点击按钮然后退出程序呢?? [code] >>>import sys >>>from Pyqt4 import qtCore, qtGui >>>app=qtGui.QApplication(sys.argv) >>>win = qtGui.QPushButton("Hello Word",None) >>>win.connect(win,qtCore.signal("clicked()"),win,qtCore.slot("close()")) >>>win.show() >>>app.exec_() [/code] 这个时候点击屏幕按钮就可以退出了 [code] #!/usr/bin/env python import sys from Pyqt4 import qtCore, qtGui cl...

by kai0200 - Python - 2006-08-14 16:58:38 阅读(5011) 回复(3)

You can't call qt functions from Unix signal handlers. The standard POSIX rule applies: You can only call async-signal-safe functions from signal handlers. See signal Actions for the complete list of functions you can call from Unix signal handlers. But don't despair, there is a way to use Unix signal handlers with qt. The strategy is to have your Unix signal handler do something that will even...

by wxju168 - Linux文档专区 - 2009-06-04 20:47:13 阅读(697) 回复(0)

注:在几处发表同样的主题,希望通过讨论,接收到大家提出各种建议或意见,抛砖引玉。 在ANSI C下设计和实现简便通用的signal-slot机制 ——一种平台相关但易于移植的,lambda表达式风格的,经由抵抗编译器而得的方案 最近在ARM平台下做一些开发,考虑到这个场合下的风气,入乡随俗,使用的语言是C而不是一向偏好的C++。因为面向对象等一些设计在C中同样可以达到,基本上对自己的习惯不会有太大的影响。唯一感到不太方便...

by TiGEr.zZ - C/C++ - 2013-08-22 15:51:17 阅读(28629) 回复(37)

signal函数的使用 signal系统函数调用提供了一种最简单的范例。然而,由于C原形声明的缘故使它看起来比实际复杂。signal函数将一个给定的函数和一个特定的信号联系。这里是FreeBSD中的定义(和一个typedef一起): 引用: typedef void (*sig_t) (int); sig_t signal(int sig, sig_t func); 第一个参数是目标信号。func参数是一个指针,指向某个处理该信号的函数。这个处理信号函数带有一个int型参数,并应返回void。signal函数...

by thrinity - Linux文档专区 - 2009-11-05 10:40:49 阅读(818) 回复(0)

ANSI C 定义文件. 而各个信号量存在于. 通过 man kill, man signal, man signaction, man 7 signal 可获得相关signal帮助. kill [-signum] pid 向pid进程发送一个signum信号.不带signum时默认发送15信号量TERM. 可通过signal(int, (void* )fun) 捕捉相应的信号量. 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u3/101003/showart_2033687.html

by yulinlin12345 - Linux文档专区 - 2009-08-21 14:17:03 阅读(829) 回复(0)