gpt4 book ai didi

c++ - 关于 SIGNAL/SLOT qt4 的问题

转载 作者:太空宇宙 更新时间:2023-11-04 13:46:32 26 4
gpt4 key购买 nike

我创建了一个 GUI,它涉及从一个 ComboBox (evaluation_box) 中选择主题,从而将与该特定主题相关的所有主题加载到另一个 ComboBox (sequence_combo_box) .

SIGNAL/SLOT使用的代码如下

  connect(ui_.evaluation_box, SIGNAL(currentIndexChanged(QString)), ui_.sequence_combo_box, SLOT(readSequenceFile(char *,char *,struct dirent *)));   

但是,这样做时我收到以下错误消息:

Object::connect: No such slot QComboBox::readSequenceFile(char *,char *,struct dirent *)
Object::connect: (sender name: 'evaluation_box')
Object::connect: (receiver name: 'sequence_combo_box')

头文件包括以下内容:

#ifndef rqt_get_sequence_feeder__GetSequenceFeeder_H
#define rqt_get_sequence_feeder__GetSequenceFeeder_H

#include <rqt_gui_cpp/plugin.h>

#include <ui_get_sequence_feeder.h>
#include <dirent.h>
#include <image_transport/image_transport.h>
#include <sensor_msgs/Image.h>
#include <opencv2/core/core.hpp>
#include <QImage>
#include <QList>
#include <QMutex>
#include <QString>
#include <QSize>
#include <QWidget>
#include <vector>

namespace rqt_get_sequence_feeder {

class GetSequenceFeeder
: public rqt_gui_cpp::Plugin
{

Q_OBJECT
public:
GetSequenceFeeder();

protected slots:
virtual void onFrameChanged(int);
virtual void readSequenceFile(char *folder,char *sequence,struct dirent *select);
.
.
.
protected:
Ui::GetSequenceFeederWidget ui_;

};
}

.cpp如下:

using namespace std;
namespace rqt_get_sequence_feeder {

GetSequenceFeeder::GetSequenceFeeder()
: rqt_gui_cpp::Plugin()
, widget_(0)
{
setObjectName("GetSequenceFeeder");
}


void GetSequenceFeeder::initPlugin(qt_gui_cpp::PluginContext& context)
{
connect(ui_.evaluation_box, SIGNAL(currentIndexChanged(QString)),ui_.sequence_combo_box, SLOT(readSequenceFile(char *,char *,struct dirent *)));
.
.
.
}

void GetSequenceFeeder::readSequenceFile(char *folder ,char *sequenceFile,struct dirent *select)
{
.
.
.
}

我有函数 readSequenceFile(char *folder,char *sequence,struct dirent *select); 在头文件中声明为 protected slots: 我也试过声明它作为 public slot:,没有用。我不明白我做错了什么。

最佳答案

根据你的错误信息,你的 ui_.sequence_combo_box 是一个 QComboBox ,显然 QComboBox 没有名为读取序列文件
ui_.sequence_combo_box 应该是类继承QComboBox

关于c++ - 关于 SIGNAL/SLOT qt4 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25641367/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com