Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to change size of QWidget by connect(button...)
Qt 6.11 is out! See what's new in the release blog

How to change size of QWidget by connect(button...)

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.7k Views 1 Watching
  • 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.
  • F Offline
    F Offline
    freelife
    wrote on last edited by
    #1

    Please help with two problems.
    1)I need to connect one of buttons of this class with changing size of myWindow by consts. (for exaplme setSize(x*y) ).

    @class MyWindow : public QWidget, public Ui::MyWindow
    {
    Q_OBJECT
    //...
    }
    @
    2) And how I can prevent to user to change the size?
    @layout()->setSizeConstraint(QLayout::SetFixedSize);@
    is't work. It crashes the program:
    @
    Runs MyWindow.exe ....
    The program terminated unexpectedly.
    MyWindow.exe exited with code -1073741819
    @

    1 Reply Last reply
    0
    • B Offline
      B Offline
      beemaster
      wrote on last edited by
      #2

      "QWidget::setFixedSize":http://qt-project.org/doc/qt-4.8/qwidget.html#setFixedSize-2

      1 Reply Last reply
      0
      • F Offline
        F Offline
        freelife
        wrote on last edited by
        #3

        Ok, but I need to connect it. That's method, not slot. Sorry for quations like this I have not perfect English.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          freelife
          wrote on last edited by
          #4

          @void MyWindow::sizeBigger()
          {
          this->setFixedSize(477, 250);
          groupBox_3->show();
          }
          void MyWindow::sizeSmoller()
          {
          this->setFixedSize(477, 180);
          groupBox_3 -> hide();
          }
          @
          Is work, thank you! But, after sizeSmoller all groupBoxes become Black.
          groupBox_3 - lowest groupBox.
          !http://i.imgur.com/iRz9Egdl.jpg(Problem)!

          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