Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to get the property value form the widget created by ShowNormal() method
Forum Updated to NodeBB v4.3 + New Features

How to get the property value form the widget created by ShowNormal() method

Scheduled Pinned Locked Moved Mobile and Embedded
qt5.4creatorioswidget
10 Posts 3 Posters 4.4k Views 1 Watching
  • 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.
  • M Offline
    M Offline
    mkdh
    wrote on last edited by
    #1

    I want to show a widget which is special size in my screen.

    Hence, I can't use exec() in iOS. exec will let your widget maximized.

    It just can use ShowNormal. =.=

    But, how to get the property value form the widget created by ShowNormal() method

    R 1 Reply Last reply
    0
    • M mkdh

      I want to show a widget which is special size in my screen.

      Hence, I can't use exec() in iOS. exec will let your widget maximized.

      It just can use ShowNormal. =.=

      But, how to get the property value form the widget created by ShowNormal() method

      R Offline
      R Offline
      raf924
      wrote on last edited by
      #2

      @mkdh I'm not sure i get what you want but i'll try to help you anyway:
      overload the QWidget::resizeEvent(QResizeEvent*e) method so that when you call showNormal you can just get the size with

      e->size();
      
      M 1 Reply Last reply
      0
      • R raf924

        @mkdh I'm not sure i get what you want but i'll try to help you anyway:
        overload the QWidget::resizeEvent(QResizeEvent*e) method so that when you call showNormal you can just get the size with

        e->size();
        
        M Offline
        M Offline
        mkdh
        wrote on last edited by mkdh
        #3

        @raf924
        Does it possible to set the size and position for mydiaSaveSimple?

        It always show maxmun size when I exec() mydiaSaveSimple in my iOS.

            mydiaSaveSimple=new diaSaveSimple(this);
            float tmpWidth=wDesktop;
            float tmpHeight=hDesktop;
            
            if(wDesktop>hDesktop){
                tmpHeight=tmpWidth;
            }
            
            float tmpScale=gData->getScaleShow(tmpWidth,tmpHeight);
            float wformOpen=1357*tmpScale;
            float hformOpen=448*tmpScale;
            mydiaSaveSimple->setGeometry((wDesktop-wformOpen)/2
                                         ,(hDesktop-hformOpen)/2
                                         ,wformOpen
                                         ,hformOpen
                                         );
           
            QString newFilePath="";
            mydiaSaveSimple->setFocus();
            if(mydiaSaveSimple->exec()==QDialog::Accepted){
                //....omit
            }
        
        
        R 1 Reply Last reply
        0
        • M mkdh

          @raf924
          Does it possible to set the size and position for mydiaSaveSimple?

          It always show maxmun size when I exec() mydiaSaveSimple in my iOS.

              mydiaSaveSimple=new diaSaveSimple(this);
              float tmpWidth=wDesktop;
              float tmpHeight=hDesktop;
              
              if(wDesktop>hDesktop){
                  tmpHeight=tmpWidth;
              }
              
              float tmpScale=gData->getScaleShow(tmpWidth,tmpHeight);
              float wformOpen=1357*tmpScale;
              float hformOpen=448*tmpScale;
              mydiaSaveSimple->setGeometry((wDesktop-wformOpen)/2
                                           ,(hDesktop-hformOpen)/2
                                           ,wformOpen
                                           ,hformOpen
                                           );
             
              QString newFilePath="";
              mydiaSaveSimple->setFocus();
              if(mydiaSaveSimple->exec()==QDialog::Accepted){
                  //....omit
              }
          
          
          R Offline
          R Offline
          raf924
          wrote on last edited by
          #4

          @mkdh I just read that all windows and dialogs are show fullscreen on iOS when using the show method ( which is used by the exec method i guess) so what you have to do is show the dialog with showNormal and connect to the dialog's "accepted" signal.

          M 1 Reply Last reply
          0
          • R raf924

            @mkdh I just read that all windows and dialogs are show fullscreen on iOS when using the show method ( which is used by the exec method i guess) so what you have to do is show the dialog with showNormal and connect to the dialog's "accepted" signal.

            M Offline
            M Offline
            mkdh
            wrote on last edited by mkdh
            #5

            @raf924
            If I use showNormal method, than A, B and C Statement will be executed simultaneously.

            But C Statement depends on the result of B Statement.

            If I use exec() method, C Statement will be executed after getting the result of B Statement.

            How to deal this case?

            //Pseudo code:
            function QQ(){
               // A Statement.
               XXX
            
               // B Statement
               mydiaSaveSimple->showNormal();
            
               // C Statement. 
               // C Statement depends on the result of B Statement. 
               // C will use the value from A Statement.
               XXX
            }
            
            
            jsulmJ 1 Reply Last reply
            0
            • M mkdh

              @raf924
              If I use showNormal method, than A, B and C Statement will be executed simultaneously.

              But C Statement depends on the result of B Statement.

              If I use exec() method, C Statement will be executed after getting the result of B Statement.

              How to deal this case?

              //Pseudo code:
              function QQ(){
                 // A Statement.
                 XXX
              
                 // B Statement
                 mydiaSaveSimple->showNormal();
              
                 // C Statement. 
                 // C Statement depends on the result of B Statement. 
                 // C will use the value from A Statement.
                 XXX
              }
              
              
              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @mkdh If I understand it right showNormal() is a non-blocking call. You should implement a slot for accepted() and rejected() signals and move the C part to that slot. Then you connect this slot to the accepted()/rejected() signals of your dialog.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              R M 2 Replies Last reply
              0
              • jsulmJ jsulm

                @mkdh If I understand it right showNormal() is a non-blocking call. You should implement a slot for accepted() and rejected() signals and move the C part to that slot. Then you connect this slot to the accepted()/rejected() signals of your dialog.

                R Offline
                R Offline
                raf924
                wrote on last edited by
                #7

                @jsulm @mkdh that is exactly what i meant. I thought it was comprehensible, my bad.

                1 Reply Last reply
                0
                • jsulmJ jsulm

                  @mkdh If I understand it right showNormal() is a non-blocking call. You should implement a slot for accepted() and rejected() signals and move the C part to that slot. Then you connect this slot to the accepted()/rejected() signals of your dialog.

                  M Offline
                  M Offline
                  mkdh
                  wrote on last edited by mkdh
                  #8

                  @jsulm
                  Thanks.
                  By the way. I can't edit the QLineEdit on the mydiaSaveSimple in my iPad....
                  When I touch the QLineEdit in my iPad ,then there are no keyboard appear.
                  And, It the blank index disapper.....
                  Why..... ~=.=~

                  1 Reply Last reply
                  0
                  • jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Is the line edit read-only?

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      Is the line edit read-only?

                      M Offline
                      M Offline
                      mkdh
                      wrote on last edited by
                      #10

                      @jsulm
                      I add a button even as below.

                      void Dialog::on_pushButton_clicked()
                      {
                          SubView *QQ=new SubView(this);
                          QQ->setModal(true);
                          QQ->setEnabled(true);
                          QQ->showNormal();
                      }
                      

                      Then, I put a QEditline on the subview .
                      Of course, subview is a class inherited from the dialog.
                      This is a very simple code.

                      Or

                      You can try this
                      https://github.com/mkdh/QEditlineOnNewWidgetiOS

                      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