本文整理汇总了C++中QCalendarWidget::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QCalendarWidget::setSizePolicy方法的具体用法?C++ QCalendarWidget::setSizePolicy怎么用?C++ QCalendarWidget::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QCalendarWidget
的用法示例。
在下文中一共展示了QCalendarWidget::setSizePolicy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QMainWindow
//.........这里部分代码省略.........
showAction->setStatusTip(tr("Show Preformance"));
showAction->setCheckable(false);
showAction->setChecked(false);
group2->addAction(showAction);
bar2->addAction(showAction);
// =================== Reset action
QAction *resetAction = new QAction("Reset", bar2);
resetAction->setIcon(QIcon(":/res/reset.png"));
resetAction->setToolTip(tr("Reset"));
resetAction->setStatusTip(tr("Reset"));
resetAction->setCheckable(false);
resetAction->setChecked(false);
group2->addAction(resetAction);
bar2->addAction(resetAction);
// Status bar
QLabel *statusMsg = new QLabel;
statusBar()->addWidget(statusMsg);
paintWidget = new PaintWidget(this);
gridLayout = new QGridLayout(this);
gridLayout->addWidget(paintWidget, 0, 0, 1, 1);
// paintWidget->resize(100, 100);
// paintWidget->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setCentralWidget(paintWidget);
// Dock widget 1
//设置主窗体的第一个QDockWidget
QDockWidget *preferenceDockWidget = new QDockWidget(this);
//设置第一个QDockWidget的窗口名称
preferenceDockWidget->setWindowTitle(tr("Preference"));
//设置第一个QDockWidget的可停靠区域,全部可停靠
preferenceDockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
preferenceDockWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//设置第一个QDockWidget内的控件并设置该控件的属性
preferenceWidget = new PreferenceWidget(this);
QCalendarWidget *calendar = new QCalendarWidget;
calendar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
calendar->setGridVisible(true);
//将QCalendarWidget控件设置成QDockWidget的主控件 使其能随窗口大小改变而改变
preferenceDockWidget->setWidget(preferenceWidget);
//向主窗体中添加第一个QDockWidget控件 第一个参数表示初始显示的位置 第二个参数是要添加的QDockWidget控件
this->addDockWidget(Qt::RightDockWidgetArea, preferenceDockWidget);
// Dock widget 2
QDockWidget *performanceDockWidget = new QDockWidget(this);
//设置第一个QDockWidget的窗口名称
performanceDockWidget->setWindowTitle(tr("Performance"));
//设置第一个QDockWidget的可停靠区域,全部可停靠
performanceDockWidget->setAllowedAreas(Qt::AllDockWidgetAreas);
performanceDockWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
//设置第一个QDockWidget内的控件并设置该控件的属性
performanceWidget = new PerformanceWidget(this);
//将QCalendarWidget控件设置成QDockWidget的主控件 使其能随窗口大小改变而改变
performanceDockWidget->setWidget(performanceWidget);
//向主窗体中添加第一个QDockWidget控件 第一个参数表示初始显示的位置 第二个参数是要添加的QDockWidget控件
this->addDockWidget(Qt::RightDockWidgetArea, performanceDockWidget);
connect(drawLineAction, SIGNAL(triggered()), this, SLOT(drawLineActionTriggered()));
connect(drawRectAction, SIGNAL(triggered()), this, SLOT(drawRectActionTriggered()));
connect(drawCircleAction, SIGNAL(triggered()), this, SLOT(drawCircleActionTriggered()));
connect(drawStartCircleAction, SIGNAL(triggered()), this, SLOT(drawStartCircleActionTriggered()));
connect(drawGoalCircleAction, SIGNAL(triggered()), this, SLOT(drawGoalCircleActionTriggered()));
connect(this, SIGNAL(changeCurrentShape(Shape::Code)), paintWidget, SLOT(setCurrentShape(Shape::Code)));
connect(saveAction, SIGNAL(triggered()), this, SLOT(saveActionTriggered()));
connect(loadAction, SIGNAL(triggered()), this, SLOT(loadActionTriggered()));
connect(startAction, SIGNAL(triggered()), this, SLOT(startActionTriggered()));
connect(showAction, SIGNAL(triggered()), this, SLOT(stopActionTriggered()));
connect(resetAction, SIGNAL(triggered()), this, SLOT(resetActionTriggered()));
// when received the signal from the perference widget then send to pain widget
connect(preferenceWidget, SIGNAL(rrtTextChangedSignal(QString)), paintWidget, SLOT(rrtTextChangedSlot(QString)));
connect(this, SIGNAL(startSimulationSignal()), paintWidget, SLOT(startSimulationSlot()));
connect(this, SIGNAL(stopSimulationSignal()), paintWidget, SLOT(stopSimulationSlot()));
connect(this, SIGNAL(resetSimulationSignal()), paintWidget, SLOT(resetSimulationSlot()));
// connect the iteration to the display panel
// connect(paintWidget->getMyRRT(),SIGNAL(currentIterationChanged(int)),preferenceWidget,SLOT(currentIterationChangedSlot(int)));
connect(paintWidget,SIGNAL(currentIteration(int)),performanceWidget,SLOT(currentIterationChangedSlot(int)));
connect(paintWidget,SIGNAL(currentNodeCount(int)),performanceWidget,SLOT(currentNodecountChangedSlot(int)));
connect(paintWidget,SIGNAL(currentPathLength(int)),performanceWidget,SLOT(currentPathLengthChangedSlot(int)));
}