Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt How to send string between multiwindows

Qt How to send string between multiwindows

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 4 Posters 2.3k 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.
  • T Offline
    T Offline
    Tofu_panda
    wrote on last edited by
    #1

    thing is I have a three screen first is main screen second is password third is setting
    So I made pushbotton when click need password then setting page will come up
    So I don't know how to make the String which typed in setting screen to be sent to main page
    I dont want to use like MainWindow *mian = new MainWindow
    I hope it can keep the mainwindow

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by VRonin
      #2

      This question has now been asked 75891677409385038 times here.

      • If the dialog is modal call QDialog::exec from mainwindow and if it returns QDialog::Accepted use getters you create in the dialog to access the relevent information.
      • If the dialog is modless create a signal connected to a slot in the mainwindow and use its arguments to pass the data around

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      T 1 Reply Last reply
      2
      • VRoninV VRonin

        This question has now been asked 75891677409385038 times here.

        • If the dialog is modal call QDialog::exec from mainwindow and if it returns QDialog::Accepted use getters you create in the dialog to access the relevent information.
        • If the dialog is modless create a signal connected to a slot in the mainwindow and use its arguments to pass the data around
        T Offline
        T Offline
        Tofu_panda
        wrote on last edited by
        #3

        @VRonin Thanks for your reply I try the following code:

        connect(send,SIGNAL(sendData(QString)),this,SLOT(receiveData(QString)));

        and my emit is :
        void sending::on_pushButton_clicked()
        {
        QString data1= ui->lineEdit->text();
        emit(sendData("data1"));
        this->close();

        qDebug("clicked");
        

        }

        this is noting wrong in it but not work
        could you do me a favor to look at this ??

        VRoninV Taz742T 2 Replies Last reply
        0
        • T Tofu_panda

          @VRonin Thanks for your reply I try the following code:

          connect(send,SIGNAL(sendData(QString)),this,SLOT(receiveData(QString)));

          and my emit is :
          void sending::on_pushButton_clicked()
          {
          QString data1= ui->lineEdit->text();
          emit(sendData("data1"));
          this->close();

          qDebug("clicked");
          

          }

          this is noting wrong in it but not work
          could you do me a favor to look at this ??

          VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          @Tofu_panda said in Qt How to send string between multiwindows:

          this is noting wrong

          @Tofu_panda said in Qt How to send string between multiwindows:

          emit(sendData("data1"));

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          1 Reply Last reply
          2
          • T Offline
            T Offline
            Tofu_panda
            wrote on last edited by
            #5

            thanks for your reply I tried to use emit(sendData(data1));
            still not working

            1 Reply Last reply
            0
            • VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              Could you define "not working". does it crash? does it fail to compile? etc.
              Did you check your connect statement is correct? either by putting Q_ASSUME() around it or using Qt5 connect syntax?

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              1 Reply Last reply
              1
              • T Tofu_panda

                @VRonin Thanks for your reply I try the following code:

                connect(send,SIGNAL(sendData(QString)),this,SLOT(receiveData(QString)));

                and my emit is :
                void sending::on_pushButton_clicked()
                {
                QString data1= ui->lineEdit->text();
                emit(sendData("data1"));
                this->close();

                qDebug("clicked");
                

                }

                this is noting wrong in it but not work
                could you do me a favor to look at this ??

                Taz742T Offline
                Taz742T Offline
                Taz742
                wrote on last edited by
                #7

                @Tofu_panda
                pls show your full code

                Do what you want.

                1 Reply Last reply
                1
                • Vinod KuntojiV Offline
                  Vinod KuntojiV Offline
                  Vinod Kuntoji
                  wrote on last edited by
                  #8

                  @Tofu_panda ,

                  You should use,
                  emit sendData(data1);

                  C++, Qt, Qt Quick Developer,
                  PthinkS, Bangalore

                  1 Reply Last reply
                  1

                  • Login

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