+ Reply to Thread
Results 1 to 1 of 1

Thread: issue resizing QScrollArea pyqt5

  1. #1

    Default issue resizing QScrollArea pyqt5


    I would like to know if its possible to resize a scroll area to see all the label inside after the init of the window (on pyqt5)

    currently if there is a long label at the init the window, the scroll area will take the place it needed as I want.

    But if I click on a button, and it change the text of the label in the scroll area from a shor text to a very long text, then it will not change the size of the scroll area.

    Qt Code:
    1. def __init__(self, parent):
    2. super(PathConfiguration,self).__init__()
    3. self.initUI( parent )
    5. def initUI( self, parent ):
    6. self.button = QtWidgets.QPushButton(tr_(u"Set PATH"), parent)
    7. self.button.clicked.connect(self.do_it)
    9. self.scroll_area = QtWidgets.QScrollArea()
    10. self.scroll_area.setWidgetResizable(True)
    12. self.status = QtWidgets.QLabel()
    13. self.scroll_area.setWidget(self.status)
    14. self.scroll_area.setWidgetResizable(True)
    16. self.scroll_area.setToolTip(self.toolTip())
    18. hbox = QtWidgets.QHBoxLayout(parent)
    19. hbox.addWidget(self.button)
    20. hbox.addWidget(self.scroll_area)
    21. self.setLayout(hbox)
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. def do_it( self ):
    2. self.status.setText(message)
    To copy to clipboard, switch view to plain text mode 

    where message can be a very long message as a short one.

    so to be clear, at the init if the text is short it will take small place as I want, If it is long text it will be big as I want, so every thing is fine here.
    but when i click on the button to change the text, to go from a short text to a long text, the scroll area is not changing from short to big one.

    Do you have any idea or line of code i should put it in.

    See you
    Last edited by Bybuu; 13th October 2017 at 09:31.

+ Reply to Thread

Similar Threads

  1. Replies: 1
    Last Post: 12th December 2013, 16:08
  2. QVBoxLayout vs Qlabel - resizing issue
    By migel in forum Newbie
    Replies: 1
    Last Post: 11th July 2011, 00:08
  3. Resizing QTableView
    By gkarthick5 in forum Qt Programming
    Replies: 2
    Last Post: 7th July 2011, 07:20
  4. Replies: 3
    Last Post: 2nd March 2010, 20:58
  5. Resizing a Layout
    By vvbkumar in forum Qt Programming
    Replies: 2
    Last Post: 21st June 2006, 08:02


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts