How to accept dynamic inputs in qt..?



  • Hi in Linux if we give command SU it asks for password and if we enter right password it login's to super user,in the similar fashion how can i do this through Qt application

    What classes to be used,is it possible to do so ..?


  • Qt Champions 2016

    Hi
    Normally the app will ask user to do so.
    No one will input their root password to an app.
    so the normal use case would to ask user to run the app as
    sudo <appname>



  • @mrjj

    I think you have not understood my question

    #include "widget.h"
    #include "ui_widget.h"
    
    Widget::Widget(QWidget *parent) :
        QWidget(parent),
        ui(new Ui::Widget)
    {
        ui->setupUi(this);
        ui->lineEdit->hide();
    }
    
    Widget::~Widget()
    {
        delete ui;
    }
    
    void Widget::on_pushButton_clicked()
    {
        system("su");
        ui->lineEdit->show();
        ui->lineEdit->setPlaceholderText("Enter Password");
        
    }
    

    How can i pass the user entered password or where should i send the password to successfully login to super user..?

    I hope you have understood now


  • Qt Champions 2016

    Ok. I dont know how you call su from inside program.
    Its not how it normally work.

    But you can use sudo if added to /etc/sudoers

    Alternatively find out to call the linux api for su.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.