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 resize custom Qpushbutton at runtime ?
Forum Updated to NodeBB v4.3 + New Features

How to resize custom Qpushbutton at runtime ?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
14 Posts 3 Posters 2.6k Views
  • 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    How to increase width of custom Q push button at runtime ?

    jsulmJ 1 Reply Last reply
    0
    • jsulmJ jsulm

      @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

      yes by increasing or decreasing splitter the size of pushbutton get change .
      so what i have to do to resizing it

      I'm not sure why you want to resize the button manually if its size is managed by the splitter?
      If you want to do so, then add the button to a widget which is managed by the splitter, but do not put the button into a layout on this widget.

      Q Offline
      Q Offline
      Qt embedded developer
      wrote on last edited by
      #14

      @jsulm

      thanks for you suggestions. i have solved it by putting my two button on horizontal lay out and then i put this lay out on frame

      below i wrote part of code that help me to achieve answer of my question

      ui->pushButton_Save_2->hide();
      ui->pushButton_Save_2->setHidden(true);
      ui->pushButton_Save_2->setMinimumWidth(0);
      ui->pushButton_Exit_2->setText(sExit());
      ui->pushButton_Exit_2->setMinimumWidth(327);
      ui->pushButton_Exit_2->resize(327,74);
      ui->pushButton_Save_2->setText(sCalibrationSmall());
      ui->pushButton_Exit_2->show();

      1 Reply Last reply
      0
      • Q Qt embedded developer

        How to increase width of custom Q push button at runtime ?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #2

        @Qt-embedded-developer Easy to find in the documentation: https://doc.qt.io/qt-5/qwidget.html#size-prop ...

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

        Q 1 Reply Last reply
        1
        • jsulmJ jsulm

          @Qt-embedded-developer Easy to find in the documentation: https://doc.qt.io/qt-5/qwidget.html#size-prop ...

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by Qt embedded developer
          #3

          @jsulm
          means before resize custom q push button i have called resize() but it not resize my custom q push button because it custom generated .

          i want to know is it possible to resize custom qpushbutton.

          because by override qpushbutton it is possible but for custom qtreewidget it not works

          JonBJ 1 Reply Last reply
          0
          • Q Qt embedded developer

            @jsulm
            means before resize custom q push button i have called resize() but it not resize my custom q push button because it custom generated .

            i want to know is it possible to resize custom qpushbutton.

            because by override qpushbutton it is possible but for custom qtreewidget it not works

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by
            #4

            @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

            i want to know is it possible to resize custom qpushbutton.

            Yes.

            Q 1 Reply Last reply
            0
            • JonBJ JonB

              @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

              i want to know is it possible to resize custom qpushbutton.

              Yes.

              Q Offline
              Q Offline
              Qt embedded developer
              wrote on last edited by
              #5

              @JonB so with resize() what extra things i need to implement?

              jsulmJ 1 Reply Last reply
              0
              • Q Qt embedded developer

                @JonB so with resize() what extra things i need to implement?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

                so with resize() what extra things i need to implement?

                Please show how you are calling resize().
                Also: is your button in a layout?

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

                Q 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

                  so with resize() what extra things i need to implement?

                  Please show how you are calling resize().
                  Also: is your button in a layout?

                  Q Offline
                  Q Offline
                  Qt embedded developer
                  wrote on last edited by Qt embedded developer
                  #7

                  @jsulm ui->pushbutton->resize(280,74);

                  and no my push button is not on lay out . it is on splitter and splitter is on frame.

                  jsulmJ 1 Reply Last reply
                  0
                  • Q Qt embedded developer

                    @jsulm ui->pushbutton->resize(280,74);

                    and no my push button is not on lay out . it is on splitter and splitter is on frame.

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #8

                    @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

                    it is on splitter

                    So, you can change the size of the button if you move the splitter?

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

                    Q 1 Reply Last reply
                    0
                    • jsulmJ jsulm

                      @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

                      it is on splitter

                      So, you can change the size of the button if you move the splitter?

                      Q Offline
                      Q Offline
                      Qt embedded developer
                      wrote on last edited by
                      #9

                      @jsulm move means ii have to remove splitter or move its position

                      jsulmJ 1 Reply Last reply
                      0
                      • Q Qt embedded developer

                        @jsulm move means ii have to remove splitter or move its position

                        jsulmJ Offline
                        jsulmJ Offline
                        jsulm
                        Lifetime Qt Champion
                        wrote on last edited by
                        #10

                        @Qt-embedded-developer What I mean is: if you move the splitter using mouse - does your button change its size? If it does then it is in a layout (managed by splitter).

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

                        Q 2 Replies Last reply
                        0
                        • jsulmJ jsulm

                          @Qt-embedded-developer What I mean is: if you move the splitter using mouse - does your button change its size? If it does then it is in a layout (managed by splitter).

                          Q Offline
                          Q Offline
                          Qt embedded developer
                          wrote on last edited by
                          #11

                          @jsulm yes by increasing or decreasing splitter the size of pushbutton get change .

                          so what i have to do to resizing it

                          jsulmJ 1 Reply Last reply
                          0
                          • jsulmJ jsulm

                            @Qt-embedded-developer What I mean is: if you move the splitter using mouse - does your button change its size? If it does then it is in a layout (managed by splitter).

                            Q Offline
                            Q Offline
                            Qt embedded developer
                            wrote on last edited by
                            #12

                            @jsulm as you have replied if by moving splitter if qpushbutton moves then my pushbutton is on lay out. and so i can resize this pushbutton but my pushbutton is not get resize by writing

                            ui->pushbutton->resize(280,74);

                            1 Reply Last reply
                            0
                            • Q Qt embedded developer

                              @jsulm yes by increasing or decreasing splitter the size of pushbutton get change .

                              so what i have to do to resizing it

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on last edited by
                              #13

                              @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

                              yes by increasing or decreasing splitter the size of pushbutton get change .
                              so what i have to do to resizing it

                              I'm not sure why you want to resize the button manually if its size is managed by the splitter?
                              If you want to do so, then add the button to a widget which is managed by the splitter, but do not put the button into a layout on this widget.

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

                              Q 1 Reply Last reply
                              1
                              • jsulmJ jsulm

                                @Qt-embedded-developer said in How to resize custom Qpushbutton at runtime ?:

                                yes by increasing or decreasing splitter the size of pushbutton get change .
                                so what i have to do to resizing it

                                I'm not sure why you want to resize the button manually if its size is managed by the splitter?
                                If you want to do so, then add the button to a widget which is managed by the splitter, but do not put the button into a layout on this widget.

                                Q Offline
                                Q Offline
                                Qt embedded developer
                                wrote on last edited by
                                #14

                                @jsulm

                                thanks for you suggestions. i have solved it by putting my two button on horizontal lay out and then i put this lay out on frame

                                below i wrote part of code that help me to achieve answer of my question

                                ui->pushButton_Save_2->hide();
                                ui->pushButton_Save_2->setHidden(true);
                                ui->pushButton_Save_2->setMinimumWidth(0);
                                ui->pushButton_Exit_2->setText(sExit());
                                ui->pushButton_Exit_2->setMinimumWidth(327);
                                ui->pushButton_Exit_2->resize(327,74);
                                ui->pushButton_Save_2->setText(sCalibrationSmall());
                                ui->pushButton_Exit_2->show();

                                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