Home > Mobile >  Qt since defines a button, rewritten into the button, the mouse into the button to send information,
Qt since defines a button, rewritten into the button, the mouse into the button to send information,

Time:09-23

# include "widget. H"
# include "ui_widget. H"
#include
#include

Widgets: : widgets (QWidget * parent)
: QWidget (parent)
, the UI (new UI: : Widget)
{
The UI - & gt; SetupUi (this);

The connect (& amp; M, & amp; MyPushButton: : sendSignal, [=] () {
The UI - & gt; The label - & gt; Hide ();
//this - & gt; Hide ();
QDebug () & lt; & lt;" The received signal ";
});
}
Widgets: : ~ Widget ()
{
Delete the UI;
}
///////the above is the main window content
# include "mypushbutton. H"
#include

MyPushButton: : myPushButton (QWidget * parent) : QPushButton (parent)
{

}
//mouse into the event
Void myPushButton: : enterEvent (QEvent * event)
{
Emit sendSignal ();
}
//the above is my custom button
MyPushButton m;
Void sendSignal ();
The two is that h defined inside

CodePudding user response:

Title is too long, can not see the back of the problem

CodePudding user response:

The main window is not defined in the mypushbutton
  •  Tags:  
  • Qt
  • Related