myListControl = new QListWidget(myMainWidget);
aMainLay->addWidget(myListControl, 2, 0, 2, -1);
- aMainLay->setColumnStretch(1, 1);
+ aMainLay->setRowStretch(2, 1);
+ aMainLay->addWidget(new QLabel(myMainWidget));
+ aMainLay->setRowMinimumHeight(3, 20);
myMainWidget->setLayout(aMainLay);
-
//TODO: Move into the base class
myUseSubShapes = theData->getBooleanAttribute("use_subshapes", false);
//TODO_END
#include <XGUI_PropertyPanel.h>
#include <XGUI_Constants.h>
#include <ModuleBase_WidgetPoint2D.h>
+#include <ModuleBase_WidgetMultiSelector.h>
#include <QWidget>
#include <QVBoxLayout>
#include <QVBoxLayout>
#include <QEvent>
#include <QKeyEvent>
+#include <QLayoutItem>
#ifdef _DEBUG
#include <iostream>
myCustomWidget = new QWidget(aContent);
myMainLayout->addWidget(myCustomWidget);
- myMainLayout->addStretch(1);
+ setStretchEnabled(true);
}
XGUI_PropertyPanel::~XGUI_PropertyPanel()
myWidgets = theWidgets;
int aS = myWidgets.size();
if (theWidgets.empty()) return;
-
+ bool isEnableStretch = true;
QList<ModuleBase_ModelWidget*>::const_iterator anIt = theWidgets.begin(), aLast =
theWidgets.end();
for (; anIt != aLast; anIt++) {
connect(*anIt, SIGNAL(keyReleased(QKeyEvent*)), this, SIGNAL(keyReleased(QKeyEvent*)));
-
- connect(*anIt, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)), this,
- SLOT(activateNextWidget(ModuleBase_ModelWidget*)));
+ connect(*anIt, SIGNAL(focusOutWidget(ModuleBase_ModelWidget*)),
+ this, SLOT(activateNextWidget(ModuleBase_ModelWidget*)));
connect(*anIt, SIGNAL(focusInWidget(ModuleBase_ModelWidget*)),
- this, SLOT(activateWidget(ModuleBase_ModelWidget*)));
+ this, SLOT(activateWidget(ModuleBase_ModelWidget*)));
ModuleBase_WidgetPoint2D* aPointWidget = dynamic_cast<ModuleBase_WidgetPoint2D*>(*anIt);
- if (aPointWidget)
- connect(aPointWidget, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), this,
- SIGNAL(storedPoint2D(ObjectPtr, const std::string&)));
+ if (aPointWidget) {
+ connect(aPointWidget, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)),
+ this, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)));
+ }
+
+ if (!isEnableStretch) continue;
+ foreach(QWidget* eachWidget, (*anIt)->getControls()) {
+ QSizePolicy::Policy aVPolicy = eachWidget->sizePolicy().verticalPolicy();
+ if(aVPolicy == QSizePolicy::Expanding ||
+ aVPolicy == QSizePolicy::MinimumExpanding) {
+ isEnableStretch = false;
+ }
+ }
}
+ setStretchEnabled(isEnableStretch);
ModuleBase_ModelWidget* aLastWidget = theWidgets.last();
if (aLastWidget) {
QList<QWidget*> aControls = aLastWidget->getControls();
//}
}
+void XGUI_PropertyPanel::setStretchEnabled(bool isEnabled)
+{
+ if (myMainLayout->count() == 0)
+ return;
+ int aStretchIdx = myMainLayout->count() - 1;
+ bool hasStretch = myMainLayout->itemAt(aStretchIdx)->spacerItem() != NULL;
+ QLayoutItem* aChild;
+ if (isEnabled) {
+ if (!hasStretch) myMainLayout->addStretch(1);
+ } else if (hasStretch) {
+ aChild = myMainLayout->takeAt(aStretchIdx);
+ delete aChild;
+ }
+}
+
void XGUI_PropertyPanel::activateNextWidget()
{
activateNextWidget(myActiveWidget);