Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How to programmatically resize QProgressDialog

    General and Desktop
    4
    7
    2467
    Loading More Posts
    • 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.
    • X
      xalam last edited by

      I create QProgressDialog but from parent window but I would like the default size to be be little bigger than what it comes up with. How can I change that?

      @ progress = (QSharedPointer<QProgressDialog>) new QProgressDialog("Creating files...", "Cancel", 1, numFiles, this, Qt::Dialog) ;
      progress->setAutoClose( false );
      progress->setMinimumDuration(0);
      progress->setWindowModality(Qt::WindowModal);
      progress->setModal( true );
      progress->setAutoReset( false );@

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        @
        progress->resize(progress->size() + QSize(20. 20));
        @

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • X
          xalam last edited by

          That somehow doesn't compile! I had to do the following along similar lines as you did but I don't know why your line doesn't compile:

          @ QSize size = progress->size(); //+ QSize(20. 20);
          size.setWidth( size.width() + 180);
          progress->resize( size );@

          1 Reply Last reply Reply Quote 0
          • SGaist
            SGaist Lifetime Qt Champion last edited by

            Hi,

            What error did you got ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply Reply Quote 0
            • E
              euchkatzl last edited by

              The problem is the point in the QSize constructor.

              Try using comma instead:
              @progress->resize(progress->size() + QSize(20, 20));@

              1 Reply Last reply Reply Quote 0
              • sierdzio
                sierdzio Moderators last edited by

                [quote author="euchkatzl" date="1424342793"]The problem is the point in the QSize constructor.[/quote]

                Oops, indeed, a typo. My bad.

                (Z(:^

                1 Reply Last reply Reply Quote 0
                • X
                  xalam last edited by

                  Yes that was it! I just copy/pasted it and didn't realize it should be comma but that fixed it.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post