单击另一个按钮qtcreator后启用按钮

发布于 2025-01-23 04:14:12 字数 1147 浏览 0 评论 0原文

我想启用对两个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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文