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



  • 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



  • @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();
    


  • @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
        }
    
    


  • @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.



  • @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
    }
    
    

  • Moderators

    @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.



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



  • @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..... ~=.=~


  • Moderators

    Is the line edit read-only?



  • @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


Log in to reply
 

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