qt make button unclickable?

closed account (Dy7SLyTq)
so im making an app for a friend and I need help with something. I am new to qt so bear with me. i want to make it so a button is only clickable if they check a radio box. otherwise it wont do anything. how would i write that?
Last edited on
closed account (Dy7SLyTq)
i tried that but got an error. here is my code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "Uploader.hpp"
#include "ui_Uploader.h"

#include <QFileDialog>
#include <QFile>
#include <QMessageBox>
#include <QTextStream>

Uploader::Uploader(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::Uploader)
{
    ui->setupUi(this);
    ButtonClickable = true;
}

Uploader::~Uploader()
{
    delete ui;
}

void Uploader::on_pushButton_clicked()
{
    QString fileName = QFileDialog::getOpenFileName(this, tr("Open Status List"), QString(),
            tr("Status List (*.txt *.sl *.status);;"));

    if (!fileName.isEmpty()) {
        QFile file(fileName);
        if (!file.open(QIODevice::ReadOnly)) {
            QMessageBox::critical(this, tr("Error"), tr("Could not open file"));
            return;
        }
        QTextStream in(&file);
        file.close();
    }
}

void Uploader::on_checkBox_clicked()
{
    ButtonClickable = !ButtonClickable;
    pushButton_2->setEnabled(ButtonClickable);
}


and my error:
/home/dtscode/Desktop/Uploader/Uploader/Uploader.cpp:41: error: 'class Uploader' has no member named 'pushButton_2'
closed account (Dy7SLyTq)
never mind i figured it out. i forgot to do ui->pushButton_2...
Topic archived. No new replies allowed.