Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Qt widget to qml

Qt widget to qml

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 417 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JerwinprabuJ Offline
    JerwinprabuJ Offline
    Jerwinprabu
    wrote on last edited by
    #1

    First time, I have created a qt widget for my project. Button, signal and slot, thread everything working properly also I have taken output.

    Dialog.h

    #include <QDialog>
    
    namespace Ui {
    class Dialog;
    }
    
    class Dialog : public QDialog
    {
        Q_OBJECT
    
    public:
        explicit Dialog(QWidget *parent = 0);
        ~Dialog();
    
    private:
        Ui::Dialog *ui;
    
    public slots:
    
        void startThread();
        void stopThread();
    
    private slots:
    
        void on_Autonomous_Mode_2_clicked();
        void on_Manual_Mode_2_clicked();
    };
    
    #endif // DIALOG_H
    

    dialog.cpp

    #include "dialog.h"
    #include "ui_dialog.h"
    
    using namespace std;
    
    Dialog::Dialog(QWidget *parent) :
        QDialog(parent),
        ui(new Ui::Dialog)
    {
        ui->setupUi(this);
    
        cout<<" signal and slot"<<endl;
    
        startThreadflag = false;
        stopThreadflag = true;
    }
    
    Dialog::~Dialog()
    {
        delete ui;
    }
    
    void Dialog::on_Autonomous_Mode_2_clicked()
    {
        this->ui->Start_2->setEnabled(true);
        this->ui->Stop_2->setEnabled(true); 
    }
    
    void Dialog::on_Manual_Mode_2_clicked()
    { 
        this->ui->Start_2->setEnabled(false);
        this->ui->Stop_2->setEnabled(false);
    }
    
    void  Dialog:: startThread(){
    
        if(!startThreadflag){
    
        this->ui->Start_2->setEnabled(false);
        this->ui-> Stop_2->setEnabled(true);
    
        }
    }
    
    void Dialog::on_Start_2_clicked()
    {
        startThread();
    }
    
    void Dialog:: stopThread(){
    
        if(!stopThreadflag){
    
            this->ui->Start_2->setEnabled(true);
            this->ui->Stop_2->setEnabled(false);
        }
    }
    
    void Dialog::on_Stop_2_clicked()
    {
        stopThread();
    }
    

    For creating dashboard purpose I have developed same ui in qml, signal and slot everything connected when I press the button signal and slot connected. But I don't know how to connect the label button, set enabled.

        this->ui->Start_2->setEnabled(true);
        this->ui->Stop_2->setEnabled(false);
    
    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved