##// END OF EJS Templates
Add lambda in VIsualizationWidget to fix the bug of the corner widget button size...
perrinel -
r186:134da9ef870f
parent child
Show More
@@ -18,24 +18,36 VisualizationWidget::VisualizationWidget(QWidget *parent)
18 18 auto addTabViewButton = new QToolButton{ui->tabWidget};
19 19 addTabViewButton->setText(tr("Add View"));
20 20 addTabViewButton->setCursor(Qt::ArrowCursor);
21 addTabViewButton->setAutoRaise(true);
22 21 ui->tabWidget->setCornerWidget(addTabViewButton, Qt::TopRightCorner);
23 auto width = ui->tabWidget->cornerWidget()->width();
24 auto height = ui->tabWidget->cornerWidget()->height();
25 addTabViewButton->setMinimumHeight(height);
26 addTabViewButton->setMinimumWidth(width);
27 ui->tabWidget->setMinimumHeight(height);
28 ui->tabWidget->setMinimumWidth(width);
29
30 auto addTabView = [&]() {
22
23 auto enableMinimunCornerWidgetSize = [this](bool enable) {
24
25 auto tabViewCornerWidget = ui->tabWidget->cornerWidget();
26 auto width = enable ? tabViewCornerWidget->width() : 0;
27 auto height = enable ? tabViewCornerWidget->height() : 0;
28 tabViewCornerWidget->setMinimumHeight(height);
29 tabViewCornerWidget->setMinimumWidth(width);
30 ui->tabWidget->setMinimumHeight(height);
31 ui->tabWidget->setMinimumWidth(width);
32 };
33
34 auto addTabView = [this, enableMinimunCornerWidgetSize]() {
31 35 auto index = ui->tabWidget->addTab(new VisualizationTabWidget(ui->tabWidget),
32 36 QString("View %1").arg(ui->tabWidget->count() + 1));
37 if (ui->tabWidget->count() > 0) {
38 enableMinimunCornerWidgetSize(false);
39 }
33 40 qCInfo(LOG_VisualizationWidget()) << tr("add the tab of index %1").arg(index);
34 41 };
35 42
36 auto removeTabView = [&](int index) {
43 auto removeTabView = [this, enableMinimunCornerWidgetSize](int index) {
44 if (ui->tabWidget->count() == 1) {
45 enableMinimunCornerWidgetSize(true);
46 }
47
37 48 ui->tabWidget->removeTab(index);
38 49 qCInfo(LOG_VisualizationWidget()) << tr("remove the tab of index %1").arg(index);
50
39 51 };
40 52
41 53 ui->tabWidget->setTabsClosable(true);
@@ -14,14 +14,32
14 14 <string>Form</string>
15 15 </property>
16 16 <layout class="QVBoxLayout" name="verticalLayout_2">
17 <property name="spacing">
18 <number>3</number>
19 </property>
20 <property name="leftMargin">
21 <number>0</number>
22 </property>
23 <property name="topMargin">
24 <number>0</number>
25 </property>
26 <property name="rightMargin">
27 <number>0</number>
28 </property>
29 <property name="bottomMargin">
30 <number>0</number>
31 </property>
17 32 <item>
18 33 <widget class="QFrame" name="visualizationZoneFrame">
19 34 <property name="frameShape">
20 <enum>QFrame::StyledPanel</enum>
35 <enum>QFrame::Box</enum>
21 36 </property>
22 37 <property name="frameShadow">
23 38 <enum>QFrame::Raised</enum>
24 39 </property>
40 <property name="lineWidth">
41 <number>1</number>
42 </property>
25 43 <layout class="QVBoxLayout" name="verticalLayout"/>
26 44 </widget>
27 45 </item>
General Comments 0
You need to be logged in to leave comments. Login now