Qt自定义插槽
Qt Custom Slots
为什么插槽Reset()不起作用?我想让"reset"按钮将边线的值重置为零。
class MySlider : public QSlider
{
public:
MySlider(Qt::Orientation orientation, QWidget *parent = 0) : QSlider(orientation parent){}
public slots:
void Reset()
{
this->setValue(0);
}
};
//it doesnt work when i try this
MySlider * Slider = new MySlider(Qt::Horizontal, this);
QPushButton *Reset = new QPushButton(tr("Reset"), this);
connect(Reset, SIGNAL(clicked()), Slider, SLOT(Reset()) );
尝试将Q_OBJECT
添加到类的私有部分。这将导致moc
创建信号和插槽工作所需的元数据。见http://doc.qt.io/archives/qt - 4.7 -/- qobject.html # Q_OBJECT
相关文章:
- 如何将点击的信号和插槽添加到qt中的自定义按钮中
- 信号槽自定义结构问题
- 类继承自QLabel,为什么不调用自定义插槽?
- 在 qt 控制台应用程序中未定义对 'vtable for myObj' 的引用 - 信号和插槽
- Qt-如何在不使用插槽的情况下检测自定义事件循环中的关闭窗口
- qt专用插槽moc未定义引用错误
- 将自定义参数传递到Qt/C++中的插槽
- 如何将信号值Changed从QLineEdit连接到Qt中的自定义插槽
- 将剪切、复制、粘贴快捷方式更改为Qt 5中的自定义槽
- 自定义插槽由qt4设计生成h文件
- Qt-有没有一种方法可以获得一个类中所有自定义插槽和信号的列表
- 我应该怎么做才能使用自定义类对象的 QVector 将信号发送到插槽
- Qt C++-自定义插槽
- Qt C++自定义插槽
- 动态创建自定义小部件的新实例并连接信号和插槽(Qt)
- 在c++中创建一个自定义槽,Qt5
- Qt自定义插槽
- 如何使用自定义Qt c++类型与QML插槽
- 传递自定义类来连接(信号和插槽)
- 在main.cpp中定义信号和插槽