单击另一个按钮qtcreator后启用按钮
我想启用对两个Qpushbutton的访问,这些QPUSHBUTTON在我单击另一个不同类中的另一个Qpushbutton之后,在同一类中。这可能吗?我尝试了很多事情,没有任何功能。
我的代码如下:
在classe1.h中:
public slots:
valider_push_button_is_pushed();
protected:
QPushButton* valider_push_button;
在class1.cpp中:
void Class1::valider_push_button_is_pushed()
{if (valider_push_button->isEnabled()) {close();}}
QObject::connect(this->valider_push_button, SIGNAL(CLICKED(bool)),
this, SLOT(valider_push_button_is_pushed()));
in class2.h:
public slots: void valider_push_button_parametrage_is_pushed();
protected: QPushButton* Button1; QPushButton* Button2;
in class2.cpp: in class2.cpp:
Class2::void valider_push_button_parametrage_is_pushed()
{Button1->setEnabled(true); Button2->setEnabled(true);}
QObject::connect(class1::valider_push_button, SIGNAL(clicked(bool)),
this, SLOT(valider_push_button_parametrage_is_pushed()));
I want to enable the access to two QPushButton which are in the same class after i've clicked on another QPushButton which is in a different class. Is this possible ? I have tried many things none haved functionned.
My code is as follows:
in Classe1.h:
public slots:
valider_push_button_is_pushed();
protected:
QPushButton* valider_push_button;
in Class1.cpp:
void Class1::valider_push_button_is_pushed()
{if (valider_push_button->isEnabled()) {close();}}
QObject::connect(this->valider_push_button, SIGNAL(CLICKED(bool)),
this, SLOT(valider_push_button_is_pushed()));
in Class2.h :
public slots: void valider_push_button_parametrage_is_pushed();
protected: QPushButton* Button1; QPushButton* Button2;
in Class2.cpp :
Class2::void valider_push_button_parametrage_is_pushed()
{Button1->setEnabled(true); Button2->setEnabled(true);}
QObject::connect(class1::valider_push_button, SIGNAL(clicked(bool)),
this, SLOT(valider_push_button_parametrage_is_pushed()));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论