I might not understood you right, you need a button that will hide itself when clicked?
#ifndef SOUNDBUTTON_H
#define SOUNDBUTTON_H
#include <QPushButton>
{
Q_OBJECT // also don't forget Q_OBJECT macro when declare signals and slots in a class
public:
public slots: // declare the slots of your class
void SoundButtonHide(); //declare a slot that will hide the object,
};
#endif // SOUNDBUTTON_H
// the cpp file
#include "soundbutton.h"
#include <stdio.h>
SoundButton
::SoundButton(QWidget *parent
){
printf("test me"); //doesn't output but not related to the problem //this doesn't have where to print, because you are not making a console application
connect(this, SIGNAL(clicked()), this, SLOT(SoundButtonHide())); //connect the clicked signal with the slot that will hide the button, are you sure that you need the button to hide itself?
}
void SoundButton::SoundButtonHide(){
this->setVisible(false);
}
#ifndef SOUNDBUTTON_H
#define SOUNDBUTTON_H
#include <QPushButton>
class SoundButton : public QPushButton
{
Q_OBJECT // also don't forget Q_OBJECT macro when declare signals and slots in a class
public:
SoundButton(QWidget *parent = 0);
public slots: // declare the slots of your class
void SoundButtonHide(); //declare a slot that will hide the object,
};
#endif // SOUNDBUTTON_H
// the cpp file
#include "soundbutton.h"
#include <stdio.h>
SoundButton::SoundButton(QWidget *parent)
: QPushButton(parent)
{
printf("test me"); //doesn't output but not related to the problem //this doesn't have where to print, because you are not making a console application
connect(this, SIGNAL(clicked()), this, SLOT(SoundButtonHide())); //connect the clicked signal with the slot that will hide the button, are you sure that you need the button to hide itself?
}
void SoundButton::SoundButtonHide(){
this->setVisible(false);
}
To copy to clipboard, switch view to plain text mode
Bookmarks