Problem with QSplitter - won't resize widgets? [Fixed]
-
I'm trying to get QSplitter to work with a simple aggregate widget, created as follows:
@ // Assemble small area for tree view and etc.
QWidget* leftWidget = new QWidget();
QVBoxLayout* leftLayout = new QVBoxLayout();
leftWidget->setLayout(leftLayout);
leftLayout->addWidget(StepsTreeView);@However, the created widget doesn't occupy the space the splitter allows it to:
!http://img809.imageshack.us/img809/6623/resultsj.png(Widget not occupying space afforded it.)!
Any ideas?
-
How about setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)
-
[quote author="mkoskim" date="1319747300"]How about setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum)
http://doc.qt.nokia.com/stable/qwidget.html#sizePolicy-prop[/quote]
Tried the following:
@
// Assemble small area for tree view and etc.
QWidget* leftWidget = new QWidget();
QVBoxLayout* leftLayout = new QVBoxLayout();
leftWidget->setLayout(leftLayout);
leftWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Minimum);
leftLayout->addWidget(StepsTreeView);@Same result.
-
Hmmh, I looked your picture, but I can't see the splitter bar, so I could know which of the widgets do not resize. In your picture, it seems that both widgets (treeview and notebook) are happy with their sizes.
I search for these kind of problems by changing item's background colors e.g yellow (setStyleSheet("background-color: yellow;");), and watch what widget/layout does not resize.
Furthermore, it would be nice to see the code with QSplitter, too.
-
[quote author="mkoskim" date="1319748058"]Hmmh, I looked your picture, but I can't see the splitter bar, so I could know which of the widgets do not resize. In your picture, it seems that both widgets (treeview and notebook) are happy with their sizes.
I search for these kind of problems by changing item's background colors e.g yellow (setStyleSheet("background-color: yellow;");), and watch what widget/layout does not resize.
Furthermore, it would be nice to see the code with QSplitter, too.[/quote]
Here's the code to setup the splitter:
@QSplitter* tableSplitter = new QSplitter();@
And here's the code where I place widgets in the splitter:
@ // Assemble the splitter.
tableSplitter->addWidget(leftWidget);
tableSplitter->addWidget(EditWidget);@I've highlighted in the image where the wasted space is. The splitter bar is the the right of that.
-
The code should work. Can you provide a complete, compilable test case that we can look into?
-
[quote author="Volker" date="1319753171"]The code should work. Can you provide a complete, compilable test case that we can look into?[/quote]
Okay, I'll put one together later today.
-
Aaaargh, just found out one of my team members added a QSizePolicy::Fixed in the wrong spot ><.
1/8