Exemple #1
0
	monthly_care_plan(QWidget* parent):QWidget(parent){
		if (parent->objectName().isEmpty()){
			parent->setObjectName(QString::fromUtf8("monthly_care_plan"));
		}
		parent->resize(800, 480);
		
		QSplitter splitter(Qt::Horizontal);
		
		verticalLayoutWidget = new QWidget(parent);
		verticalLayoutWidget->setObjectName(QString::fromUtf8("verticalLayoutWidget"));
		verticalLayoutWidget->setGeometry(QRect(0, 0, 160, 480));
		verticalLayoutWidget->setMinimumSize(160,480);
		verticalLayout = new QVBoxLayout(verticalLayoutWidget);
		verticalLayout->setObjectName(QString::fromUtf8("verticalLayout"));
		verticalLayout->setContentsMargins(0, 0, 0, 0);
		care_plan_label = new QLabel(verticalLayoutWidget);
		care_plan_label->setObjectName(QString::fromUtf8("care_plan_label"));
		QFont font;
		font.setPointSize(14);
		care_plan_label->setFont(font);
		care_plan_label->setAlignment(Qt::AlignCenter);

		verticalLayout->addWidget(care_plan_label);

		human_list = new QListWidget(verticalLayoutWidget);
		human_list->setObjectName(QString::fromUtf8("human_list"));
		human_list->setMinimumSize(161,440);
		human_list->setMouseTracking(false);
		human_list->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);

		verticalLayout->addWidget(human_list);

		human_widget = new one_human(this);
		human_widget->setGeometry(161, 0, 800-160, 480);

		this->retranslateUi(parent);

		QMetaObject::connectSlotsByName(parent);
		this->setMinimumSize(300,480);
	}
QDockWidget *TikzCommandInserter::getDockWidget(QWidget *parent)
{
	QDockWidget *tikzDock = new QDockWidget(parent);
	tikzDock->setObjectName("CommandsDock");
	tikzDock->setAllowedAreas(Qt::AllDockWidgetAreas);
	tikzDock->setFeatures(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable);
	tikzDock->setWindowTitle(m_tikzSections.title);
	tikzDock->setWhatsThis(tr("<p>This is a list of TikZ "
	                          "commands.  You can insert these commands in your code by "
	                          "clicking on them.  You can obtain more commands by "
	                          "changing the category in the combo box.</p>"));

	QAction *focusTikzDockAction = new QAction(parent);
	focusTikzDockAction->setShortcut(QKeySequence(tr("Alt+I")));
	tikzDock->addAction(focusTikzDockAction);
	connect(focusTikzDockAction, SIGNAL(triggered()), tikzDock, SLOT(setFocus()));

	QLabel *commandsComboLabel = new QLabel(tr("Category:"));
	ComboBox *commandsCombo = new ComboBox;
	commandsCombo->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
	QStackedWidget *commandsStack = new QStackedWidget;
	connect(commandsCombo, SIGNAL(currentIndexChanged(int)), commandsStack, SLOT(setCurrentIndex(int)));

	QListWidget *tikzListWidget = new QListWidget;
	addListWidgetItems(tikzListWidget, m_tikzSections, false); // don't add children
	tikzListWidget->setMouseTracking(true);
	connect(tikzListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
	connect(tikzListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
	connect(tikzListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
//	connect(tikzListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
	commandsCombo->addItem(tr("General"));
	commandsStack->addWidget(tikzListWidget);

	for (int i = 0; i < m_tikzSections.children.size(); ++i)
	{
		QListWidget *tikzListWidget = new QListWidget;
		addListWidgetItems(tikzListWidget, m_tikzSections.children.at(i));
		tikzListWidget->setMouseTracking(true);
		connect(tikzListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
		connect(tikzListWidget, SIGNAL(itemEntered(QListWidgetItem*)), this, SLOT(setListStatusTip(QListWidgetItem*)));
		connect(tikzListWidget, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));
//		connect(tikzListWidget, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(insertTag(QListWidgetItem*)));

		QString comboItemText = m_tikzSections.children.at(i).title;
		commandsCombo->addItem(comboItemText.remove('&'));
		commandsStack->addWidget(tikzListWidget);
	}

	QGridLayout *tikzLayout = new QGridLayout;
	tikzLayout->addWidget(commandsComboLabel, 0, 0);
	tikzLayout->addWidget(commandsCombo, 0, 1);
	tikzLayout->addWidget(commandsStack, 1, 0, 1, 2);
	tikzLayout->setMargin(5);

	TikzCommandWidget *tikzWidget = new TikzCommandWidget;
	tikzWidget->setLayout(tikzLayout);
	tikzDock->setWidget(tikzWidget);
	tikzDock->setFocusProxy(commandsCombo);

	return tikzDock;
}