Important: Please read the Qt Code of Conduct -

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


  • @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;
        float tmpScale=gData->getScaleShow(tmpWidth,tmpHeight);
        float wformOpen=1357*tmpScale;
        float hformOpen=448*tmpScale;
        QString newFilePath="";

  • @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.
       // B Statement
       // C Statement. 
       // C Statement depends on the result of B Statement. 
       // C will use the value from A Statement.

  • Lifetime Qt Champion

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

  • Lifetime Qt Champion

    Is the line edit read-only?

  • @jsulm
    I add a button even as below.

    void Dialog::on_pushButton_clicked()
        SubView *QQ=new SubView(this);

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


    You can try this