#include <QWidget>
#include<QVBoxLayout>
#include<QPushButton>
{
Q_OBJECT
public:
explicit Widget
(QWidget *parent
= 0);
~Widget();
public slots:
void buttonAClicked();
void buttonBClicked();
private:
int buttonA,buttonB;
};
#include <QWidget>
#include<QVBoxLayout>
#include<QPushButton>
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget(QWidget *parent = 0);
~Widget();
public slots:
void buttonAClicked();
void buttonBClicked();
private:
int buttonA,buttonB;
QWidget *widget;
QVBoxLayout *verticalLayout;
QPushButton *pushButton;
QPushButton *pushButton_2;
QPushButton *pushButton_3;
};
To copy to clipboard, switch view to plain text mode
#include "widget.h"
#include<QApplication>
{
buttonA=0;
buttonB=0;
this->resize(102, 116);
widget
->setObjectName
(QString::fromUtf8("widget"));
widget
->setGeometry
(QRect(10,
10,
77,
83));
verticalLayout->setSpacing(6);
verticalLayout->setContentsMargins(11, 11, 11, 11);
verticalLayout
->setObjectName
(QString::fromUtf8("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
pushButton
->setObjectName
(QString::fromUtf8("pushButton"));
verticalLayout->addWidget(pushButton);
pushButton_2
->setObjectName
(QString::fromUtf8("pushButton_2"));
verticalLayout->addWidget(pushButton_2);
pushButton_3
->setObjectName
(QString::fromUtf8("pushButton_3"));
pushButton_3->setEnabled(false);
verticalLayout->addWidget(pushButton_3);
connect(pushButton,SIGNAL(clicked()),this,SLOT(buttonAClicked()));
connect(pushButton_2,SIGNAL(clicked()),this,SLOT(buttonBClicked()));
}
void Widget::buttonAClicked()
{
buttonA=1;
if(buttonB==1)
{
pushButton_3->setEnabled(true);
}
}
void Widget::buttonBClicked()
{
buttonB=1;
if(buttonA==1)
{
pushButton_3->setEnabled(true);
}
}
Widget::~Widget()
{
}
#include "widget.h"
#include<QApplication>
Widget::Widget(QWidget *parent) :
QWidget(parent)
{
buttonA=0;
buttonB=0;
this->resize(102, 116);
this->setWindowTitle(QApplication::translate("Widget", "Widget", 0, QApplication::UnicodeUTF8));
widget = new QWidget(this);
widget->setObjectName(QString::fromUtf8("widget"));
widget->setGeometry(QRect(10, 10, 77, 83));
verticalLayout = new QVBoxLayout(widget);
verticalLayout->setSpacing(6);
verticalLayout->setContentsMargins(11, 11, 11, 11);
verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
verticalLayout->setContentsMargins(0, 0, 0, 0);
pushButton = new QPushButton(widget);
pushButton->setObjectName(QString::fromUtf8("pushButton"));
pushButton->setText(QApplication::translate("Widget", "Button 1", 0, QApplication::UnicodeUTF8));
verticalLayout->addWidget(pushButton);
pushButton_2 = new QPushButton(widget);
pushButton_2->setObjectName(QString::fromUtf8("pushButton_2"));
pushButton_2->setText(QApplication::translate("Widget", "Button 2", 0, QApplication::UnicodeUTF8));
verticalLayout->addWidget(pushButton_2);
pushButton_3 = new QPushButton(widget);
pushButton_3->setObjectName(QString::fromUtf8("pushButton_3"));
pushButton_3->setEnabled(false);
pushButton_3->setText(QApplication::translate("Widget", "Button 3", 0, QApplication::UnicodeUTF8));
verticalLayout->addWidget(pushButton_3);
connect(pushButton,SIGNAL(clicked()),this,SLOT(buttonAClicked()));
connect(pushButton_2,SIGNAL(clicked()),this,SLOT(buttonBClicked()));
}
void Widget::buttonAClicked()
{
buttonA=1;
if(buttonB==1)
{
pushButton_3->setEnabled(true);
}
}
void Widget::buttonBClicked()
{
buttonB=1;
if(buttonA==1)
{
pushButton_3->setEnabled(true);
}
}
Widget::~Widget()
{
}
To copy to clipboard, switch view to plain text mode
#include <QtGui/QApplication>
#include "widget.h"
int main(int argc, char *argv[])
{
Widget w;
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include "widget.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks