Reputation: 5040
I have declared three slots in my mainwindow.h
and given their definitions in the implementation file. Here is the MainWindow class:
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
signals:
void nextImage(int direction);
private slots:
void updateImage(void);
void cameraControl(void);
void cameraStart(void);
private:
Ui::MainWindow *ui;
CMUCamera *camera;
ImageProcessing *process;
RenderImage *renderImage;
bool saveImgFlg;
QString path;
};
Going to mainwindow.ui, I have designed a menu bar for the user interface. There are three QActions, as shown in the figure below:
Then, I do the signal and slot editing. But the defined slots (udpateImage
, cameraStart
and cameraControl
) in the header file do not appear in the slot list, as shown in the figure below:
Are there any other steps I missed here or is there something I did wrong? It is also noted QMainWindow
, in the framework of which these slots should show up, I guess, is also not displayed in the list.
Upvotes: 7
Views: 2711
Reputation: 5040
I know why that happens. For adding those custom slots, in addition to defining them in header and implementation files, they also should be added in priori by right clicking the QMainWindow
, going to change signals and slots
and manually adding them in the slot panel. This way is simpler than to code signal&slots.
A similar question has been reported here: my slots don't appear in the signal slot editor
Upvotes: 8