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. Resizing the widget(listwidget)
Forum Updated to NodeBB v4.3 + New Features

Resizing the widget(listwidget)

Scheduled Pinned Locked Moved Solved General and Desktop
qtcreatorsizepolicyresizelistwidget
10 Posts 2 Posters 4.3k 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.
  • K Offline
    K Offline
    Kinesis
    wrote on 2 Aug 2018, 03:56 last edited by
    #1

    Hi there, I would like to resize my whole widget(listwidget and it contains other sub widgets) to get appropriate size(1366x768) when I click the maximize .And if I click the minimize it will go back to some limited size(like 640x480) . How can I fix that here is my current code.

     auto label = new QLabel();
        label->setMinimumHeight(30);
    
        auto listWidget = new QListWidget();
        listWidget->setMinimumSize(1366,768);
    
        auto listWidget_dirList = new QListWidget();
        // listWidget_dirList->setMinimumSize(150,100);
        listWidget_dirList->setMinimumWidth(150);
    
        auto listWidget_main = new QListWidget();
        listWidget_main->setFlow(QListView::LeftToRight);
        listWidget_main->setMinimumSize(1100,768);
        listWidget_main->setGridSize(QSize(360, 360));
        listWidget_main->setResizeMode(QListView::Adjust);
        listWidget_main->setViewMode(QListView::ListMode);
        listWidget_main->setWrapping(true);
    
        auto button = new QPushButton();
        button->setText("Load Dir");
        button->setMinimumHeight(30);
    
        auto    item = new QListWidgetItem("",listWidget);
        auto    widget = new QWidget;
        auto    vb = new QVBoxLayout;
        auto    vb1 = new QVBoxLayout;
        auto    hb = new QHBoxLayout;
    
        vb->addWidget(button);
        vb->addWidget(listWidget_dirList);
    
        vb1->addWidget(label);
        vb1->addWidget(listWidget_main);
    
        hb->addLayout(vb);
        hb->addLayout(vb1);
    
        widget->setLayout(hb);
        widget->setMinimumSize(1366,768);
        listWidget->setItemWidget(item,widget);
        listWidget->show();
    
    J 1 Reply Last reply 2 Aug 2018, 04:52
    0
    • K Kinesis
      2 Aug 2018, 03:56

      Hi there, I would like to resize my whole widget(listwidget and it contains other sub widgets) to get appropriate size(1366x768) when I click the maximize .And if I click the minimize it will go back to some limited size(like 640x480) . How can I fix that here is my current code.

       auto label = new QLabel();
          label->setMinimumHeight(30);
      
          auto listWidget = new QListWidget();
          listWidget->setMinimumSize(1366,768);
      
          auto listWidget_dirList = new QListWidget();
          // listWidget_dirList->setMinimumSize(150,100);
          listWidget_dirList->setMinimumWidth(150);
      
          auto listWidget_main = new QListWidget();
          listWidget_main->setFlow(QListView::LeftToRight);
          listWidget_main->setMinimumSize(1100,768);
          listWidget_main->setGridSize(QSize(360, 360));
          listWidget_main->setResizeMode(QListView::Adjust);
          listWidget_main->setViewMode(QListView::ListMode);
          listWidget_main->setWrapping(true);
      
          auto button = new QPushButton();
          button->setText("Load Dir");
          button->setMinimumHeight(30);
      
          auto    item = new QListWidgetItem("",listWidget);
          auto    widget = new QWidget;
          auto    vb = new QVBoxLayout;
          auto    vb1 = new QVBoxLayout;
          auto    hb = new QHBoxLayout;
      
          vb->addWidget(button);
          vb->addWidget(listWidget_dirList);
      
          vb1->addWidget(label);
          vb1->addWidget(listWidget_main);
      
          hb->addLayout(vb);
          hb->addLayout(vb1);
      
          widget->setLayout(hb);
          widget->setMinimumSize(1366,768);
          listWidget->setItemWidget(item,widget);
          listWidget->show();
      
      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 2 Aug 2018, 04:52 last edited by
      #2

      @Kinesis said in Resizing the widget(listwidget):

      listWidget->setMinimumSize(1366,768);

      Why? It should be resizeable, right?

      widget->setMinimumSize(1366,768);

      Again: why?

      Your "widget" isn't in any layout as far as I can see. And did you call widget->show() somewhere?

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

      K 1 Reply Last reply 2 Aug 2018, 06:24
      0
      • J jsulm
        2 Aug 2018, 04:52

        @Kinesis said in Resizing the widget(listwidget):

        listWidget->setMinimumSize(1366,768);

        Why? It should be resizeable, right?

        widget->setMinimumSize(1366,768);

        Again: why?

        Your "widget" isn't in any layout as far as I can see. And did you call widget->show() somewhere?

        K Offline
        K Offline
        Kinesis
        wrote on 2 Aug 2018, 06:24 last edited by
        #3

        @jsulm
        "Why? It should be resizeable, right?"
        Ans:: Yes it should be resizeable.So I just need to unable this resize function?

        "Your "widget" isn't in any layout as far as I can see. And did you call widget->show() somewhere?"
        Ans:: I add label , button , listwidget_dirlist and listwidget_main on listWidget . And I call listWidget->show();

        J 1 Reply Last reply 2 Aug 2018, 06:26
        0
        • K Kinesis
          2 Aug 2018, 06:24

          @jsulm
          "Why? It should be resizeable, right?"
          Ans:: Yes it should be resizeable.So I just need to unable this resize function?

          "Your "widget" isn't in any layout as far as I can see. And did you call widget->show() somewhere?"
          Ans:: I add label , button , listwidget_dirlist and listwidget_main on listWidget . And I call listWidget->show();

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 2 Aug 2018, 06:26 last edited by
          #4

          @Kinesis I don't think you need these setMinimumSize(1366,768).

          " I add label , button , listwidget_dirlist and listwidget_main on listWidget . And I call listWidget->show();" - I'm talking about "widget" variable, not listWidget.

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

          K 1 Reply Last reply 2 Aug 2018, 06:30
          0
          • J jsulm
            2 Aug 2018, 06:26

            @Kinesis I don't think you need these setMinimumSize(1366,768).

            " I add label , button , listwidget_dirlist and listwidget_main on listWidget . And I call listWidget->show();" - I'm talking about "widget" variable, not listWidget.

            K Offline
            K Offline
            Kinesis
            wrote on 2 Aug 2018, 06:30 last edited by
            #5

            @jsulm said in Resizing the widget(listwidget):

            I'm talking about "widget" variable, not listWidget.

            As you can see in the code I said variable "auto listWidget = new QListWidget" .

            J 1 Reply Last reply 2 Aug 2018, 06:36
            0
            • K Kinesis
              2 Aug 2018, 06:30

              @jsulm said in Resizing the widget(listwidget):

              I'm talking about "widget" variable, not listWidget.

              As you can see in the code I said variable "auto listWidget = new QListWidget" .

              J Offline
              J Offline
              jsulm
              Lifetime Qt Champion
              wrote on 2 Aug 2018, 06:36 last edited by
              #6

              @Kinesis

              auto    widget = new QWidget;
              

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

              K 1 Reply Last reply 2 Aug 2018, 06:53
              0
              • J jsulm
                2 Aug 2018, 06:36

                @Kinesis

                auto    widget = new QWidget;
                
                K Offline
                K Offline
                Kinesis
                wrote on 2 Aug 2018, 06:53 last edited by
                #7

                @jsulm
                Ahh ok. How can I resize the vertical box ? I want its width to be thinner that I can see slider bar . When I use 1366x768 the vertical box vb(variable) becomes wider and I can't see the slider which is at the right edge of my widget.

                J 1 Reply Last reply 2 Aug 2018, 07:07
                0
                • K Kinesis
                  2 Aug 2018, 06:53

                  @jsulm
                  Ahh ok. How can I resize the vertical box ? I want its width to be thinner that I can see slider bar . When I use 1366x768 the vertical box vb(variable) becomes wider and I can't see the slider which is at the right edge of my widget.

                  J Offline
                  J Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on 2 Aug 2018, 07:07 last edited by
                  #8

                  @Kinesis said in Resizing the widget(listwidget):

                  When I use 1366x768

                  Why do you set 1366x768?
                  If you're using layouts properly there is no need for that.
                  I already asked before: did you put widget in a layout?

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

                  K 2 Replies Last reply 2 Aug 2018, 07:15
                  0
                  • J jsulm
                    2 Aug 2018, 07:07

                    @Kinesis said in Resizing the widget(listwidget):

                    When I use 1366x768

                    Why do you set 1366x768?
                    If you're using layouts properly there is no need for that.
                    I already asked before: did you put widget in a layout?

                    K Offline
                    K Offline
                    Kinesis
                    wrote on 2 Aug 2018, 07:15 last edited by
                    #9
                    This post is deleted!
                    1 Reply Last reply
                    0
                    • J jsulm
                      2 Aug 2018, 07:07

                      @Kinesis said in Resizing the widget(listwidget):

                      When I use 1366x768

                      Why do you set 1366x768?
                      If you're using layouts properly there is no need for that.
                      I already asked before: did you put widget in a layout?

                      K Offline
                      K Offline
                      Kinesis
                      wrote on 2 Aug 2018, 08:57 last edited by
                      #10

                      @jsulm
                      I got this, thanks

                      1 Reply Last reply
                      0

                      1/10

                      2 Aug 2018, 03:56

                      • Login

                      • Login or register to search.
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • Users
                      • Groups
                      • Search
                      • Get Qt Extensions
                      • Unsolved