Nominate our 2022 Qt Champions!

How to design a dialog that can be popped?

  • The dialog look likes the pix.
    alt text
    if you click the button,the dialog will be poped,if you click the button again , the dialog will draw back.
    alt text
    It's screenshot of a game,but the my question is the same of it. My programme request a dialog that's called "PTX" by me on the bottom-right of parent dialog,if user click a button that's always at the far left of the "PTX", the "PTX" will pop,if user click the button again,the "PTX" will draw back , and user only can look the button.

    There's a request, the speed of pop of the "PTX" must not be finish in a flash. It need to cost about 0.5 second to pop or draw back "PTX" so that the user can look the whole process carefully.

    I put a custom QDialog on the bottom-right of the parent dialog ,there is a QTimer on the custom QDialog,when user click the button,the QTimer will be triggered. the code look like this

    void PTX::goMaxSize()
        static int len = width();
        len += 10;

    it lead to two question,first,when size of dialog is changed,the dialog always change size on left and right both,so i need change the point of "PTX" after it's changes size. On the whole proess,the move of "PTX" looks boss say it looks like Brownian Movement on the Horizentel....
    second ,there are some pix on the "PTX",when "PTX" is popping or drawing back,user can look the pix is distorted carefully.

    Do you have any better idea?

  • Lifetime Qt Champion


    Your images are not accessible.

    What exactly are you using for your game ? Widgets ? The graphics view framework ?

Log in to reply