qgridlayout

GridLayout+ScrollArea widget position after size change

五迷三道 提交于 2019-12-08 07:39:24
问题 I have a scrollArea with a gridlayout inside it, and i add QLabels to it with images. When the application starts it works fine and displays the labels correctly: Note: i calculate how many labels fit on the current layout space. If i maximize it works fine too: But when i hit restore something weird happens: You can see that only 6 labels are added (the same as in the first Screen shot) but here they are all positioned overlapping each other. This is the initialization code for the

QGridLayout, 3 panes, not expanding properly

自古美人都是妖i 提交于 2019-12-07 01:58:31
问题 I'm trying to layout a window (all in code) with a QGridLayout . I can add widgets to the layout and they display in my window, but I can't figure out how to resize them properly. Here's what I'd like [Leftmost][--------Center---------][Rightmost] Those are the 3 "panes" of my window (all three of them lists). The left and right ones should be of a static width and hug their respective sides, and the center should expand to fill the width as the window grows (or shrinks). Some code: // Create

QGridLayout, 3 panes, not expanding properly

社会主义新天地 提交于 2019-12-05 06:53:37
I'm trying to layout a window (all in code) with a QGridLayout . I can add widgets to the layout and they display in my window, but I can't figure out how to resize them properly. Here's what I'd like [Leftmost][--------Center---------][Rightmost] Those are the 3 "panes" of my window (all three of them lists). The left and right ones should be of a static width and hug their respective sides, and the center should expand to fill the width as the window grows (or shrinks). Some code: // Create the subviews, add them to a grid layout, and set the layout to the window. QTableView *list = new

How to arrange the items in QGridLayout as shown?

天涯浪子 提交于 2019-12-04 16:34:59
问题 ------------ ------ | | | 2 | | | | | | 1 | ------ | | ------ | | | 3 | ------------ ------ How to arrange the QGridLayout like above? I tried: QGridLayout *layout = new QGridLayout(); centralWidget->setLayout (layout); layout->addWidget (objOne, 0, 0); layout->addWidget (objTwo, 0, 1); layout->addWidget (objThree, 1, 1); but failed. 回答1: Check the addWidget documentation. You can provide the rowSpan and columnSpan QGridLayout *layout = new QGridLayout(); centralWidget->setLayout (layout);

How to arrange the items in QGridLayout as shown?

梦想的初衷 提交于 2019-12-03 10:35:15
------------ ------ | | | 2 | | | | | | 1 | ------ | | ------ | | | 3 | ------------ ------ How to arrange the QGridLayout like above? I tried: QGridLayout *layout = new QGridLayout(); centralWidget->setLayout (layout); layout->addWidget (objOne, 0, 0); layout->addWidget (objTwo, 0, 1); layout->addWidget (objThree, 1, 1); but failed. pnezis Check the addWidget documentation. You can provide the rowSpan and columnSpan QGridLayout *layout = new QGridLayout(); centralWidget->setLayout (layout); layout->addWidget (objOne, 0, 0, -1, 1); layout->addWidget (objTwo, 0, 1, 1, 1); layout->addWidget

pyside - how to delete widgets from gridLayout

孤街浪徒 提交于 2019-12-02 05:32:02
问题 I built a ui in QT Designer and then used pyside-uic turned it into a python file and have then written some code to edit it programmatically. In otherwords I have a pushbutton Add Row that when clicked will rename itself to Remove1 and create another pusbutton name it Add Row and add it to the layout. Code when clicking Add Row , changes the name and the signals/slots: self.pb_Row[-1].setText('Remove'+str(self.nRows)) self.pb_Row[-1].clicked.disconnect( self.addRow ) self.pb_Row[-1].clicked

pyside - how to delete widgets from gridLayout

别说谁变了你拦得住时间么 提交于 2019-12-02 01:39:40
I built a ui in QT Designer and then used pyside-uic turned it into a python file and have then written some code to edit it programmatically. In otherwords I have a pushbutton Add Row that when clicked will rename itself to Remove1 and create another pusbutton name it Add Row and add it to the layout. Code when clicking Add Row , changes the name and the signals/slots: self.pb_Row[-1].setText('Remove'+str(self.nRows)) self.pb_Row[-1].clicked.disconnect( self.addRow ) self.pb_Row[-1].clicked.connect( self.removeRow ) Code when clicking Remove , removes selected button: iRow = int(self.sender()

How does one fill a QGridLayout from top-left to right?

百般思念 提交于 2019-11-30 21:02:19
I would like to fill a QGridLayout with QWidgets . The QWidgets need to appear in a top-left to top-right fashion and proceed to fill the down downwards after each row is filled with QWidgets . An example of a similar and familiar GUI is how Apple sorts its apps on the iPhone or iPad's home screen. The apps go top-left to top-right and proceed to go downward after each row is filled. Right now, whenever I add elements, they take up the entirety of the screen and/or aren't added next to each other. This is example code of what I am doing m_gridLayout = new QGridLayout(this); this->setLayout(m

How does one fill a QGridLayout from top-left to right?

房东的猫 提交于 2019-11-30 04:48:18
问题 I would like to fill a QGridLayout with QWidgets . The QWidgets need to appear in a top-left to top-right fashion and proceed to fill the down downwards after each row is filled with QWidgets . An example of a similar and familiar GUI is how Apple sorts its apps on the iPhone or iPad's home screen. The apps go top-left to top-right and proceed to go downward after each row is filled. Right now, whenever I add elements, they take up the entirety of the screen and/or aren't added next to each

Qt Layout, resize to minimum after widget size changes

╄→尐↘猪︶ㄣ 提交于 2019-11-30 03:05:15
Basically I've got a QGridLayout with a few widgets in it. The important ones are 2 labels, which I use for drawing images to the screen. Well, if the user wants, he can change the resolution of the incoming images, thus, forcing the Labels to resize. Let's assume the initial size of the label is 320x240 . The user changes the VideoMode to 640x480 , the label and the entire GUI resizes perfectly. But when the user switches back to 320x240 , the label shrinks, but the Layout/Window does NOT. I've played around with sizePolicies and sizeHints , and resize(0,0) , but nothing did the trick. Could