/** * Sets up the page. */ void ClassifierListPage::setupPage() { int margin = fontMetrics().height(); setMinimumSize(310, 330); //main layout contains our two group boxes, the list and the documentation QVBoxLayout* mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(10); setupListGroup(margin); mainLayout->addWidget(m_pItemListGB); setupDocumentationGroup(margin); mainLayout->addWidget(m_docGB); reloadItemListBox(); enableWidgets(false);//disable widgets until an att is chosen m_pOldListItem = 0; connect(m_pItemListLB, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this, SLOT(slotActivateItem(QListWidgetItem*))); connect(m_pItemListLB, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotDoubleClick(QListWidgetItem*))); connect(m_pItemListLB, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotRightButtonPressed(QPoint))); connect(m_doc, SIGNAL(sigObjectCreated(UMLObject*)), this, SLOT(slotListItemCreated(UMLObject*))); connect(m_pTopArrowB, SIGNAL(clicked()), this, SLOT(slotTopClicked())); connect(m_pUpArrowB, SIGNAL(clicked()), this, SLOT(slotUpClicked())); connect(m_pDownArrowB, SIGNAL(clicked()), this, SLOT(slotDownClicked())); connect(m_pBottomArrowB, SIGNAL(clicked()), this, SLOT(slotBottomClicked())); }
/** * Constructs an instance of AssocPage. * * @param parent The parent of the page * @param s The scene on which the UMLObject is being represented * @param o The UMLObject being represented */ ClassAssociationsPage::ClassAssociationsPage(QWidget *parent, UMLScene *s, UMLObject *o) : DialogPageBase(parent), m_pObject(o), m_pScene(s) { int margin = fontMetrics().height(); QHBoxLayout * mainLayout = new QHBoxLayout(this); mainLayout->setSpacing(10); m_pAssocGB = new QGroupBox(i18n("Associations"), this); mainLayout->addWidget(m_pAssocGB); QHBoxLayout * layout = new QHBoxLayout(m_pAssocGB); layout->setSpacing(10); layout->setMargin(margin); m_pAssocLW = new QListWidget(m_pAssocGB); m_pAssocLW->setContextMenuPolicy(Qt::CustomContextMenu); layout->addWidget(m_pAssocLW); setMinimumSize(310, 330); fillListBox(); connect(m_pAssocLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotDoubleClick(QListWidgetItem*))); connect(m_pAssocLW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotRightButtonPressed(QPoint))); }
/** * Standard destructor. */ ClassAssociationsPage::~ClassAssociationsPage() { disconnect(m_pAssocLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotDoubleClick(QListWidgetItem*))); disconnect(m_pAssocLW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotRightButtonPressed(QPoint))); }
/** * Sets up the page. */ void ActivityPage::setupPage() { int margin = fontMetrics().height(); QVBoxLayout * mainLayout = new QVBoxLayout(this); mainLayout->setSpacing(10); m_pActivityGB = new QGroupBox(i18n("Activities"), this); // vertical box layout for the activity lists, arrow buttons and the button box QVBoxLayout* listVBoxLayout = new QVBoxLayout(m_pActivityGB); listVBoxLayout->setMargin(margin); listVBoxLayout->setSpacing(10); //horizontal box contains the list box and the move up/down buttons QHBoxLayout* listHBoxLayout = new QHBoxLayout(); listHBoxLayout->setSpacing(10); listVBoxLayout->addItem(listHBoxLayout); m_pActivityLW = new QListWidget(m_pActivityGB); m_pActivityLW->setContextMenuPolicy(Qt::CustomContextMenu); listHBoxLayout->addWidget(m_pActivityLW); QVBoxLayout * buttonLayout = new QVBoxLayout(); listHBoxLayout->addItem(buttonLayout); m_pTopArrowB = new QToolButton(m_pActivityGB); m_pTopArrowB->setArrowType(Qt::UpArrow); m_pTopArrowB->setEnabled(false); m_pTopArrowB->setToolTip(i18n("Move selected item to the top")); buttonLayout->addWidget(m_pTopArrowB); m_pUpArrowB = new QToolButton(m_pActivityGB); m_pUpArrowB->setArrowType(Qt::UpArrow); m_pUpArrowB->setEnabled(false); m_pUpArrowB->setToolTip(i18n("Move selected item up")); buttonLayout->addWidget(m_pUpArrowB); m_pDownArrowB = new QToolButton(m_pActivityGB); m_pDownArrowB->setArrowType(Qt::DownArrow); m_pDownArrowB->setEnabled(false); m_pDownArrowB->setToolTip(i18n("Move selected item down")); buttonLayout->addWidget(m_pDownArrowB); m_pBottomArrowB = new QToolButton(m_pActivityGB); m_pBottomArrowB->setArrowType(Qt::DownArrow); m_pBottomArrowB->setEnabled(false); m_pBottomArrowB->setToolTip(i18n("Move selected item to the bottom")); buttonLayout->addWidget(m_pBottomArrowB); #if QT_VERSION >= 0x050000 QDialogButtonBox* buttonBox = new QDialogButtonBox(m_pActivityGB); QPushButton* newActivity = buttonBox->addButton(i18n("New Activity..."), QDialogButtonBox::ActionRole); connect(newActivity, SIGNAL(clicked()), this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), QDialogButtonBox::ActionRole); connect(m_pDeleteActivityButton, SIGNAL(clicked()), this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), QDialogButtonBox::ActionRole); connect(m_pRenameButton, SIGNAL(clicked()), this, SLOT(slotRename())); #else KDialogButtonBox* buttonBox = new KDialogButtonBox(m_pActivityGB); buttonBox->addButton(i18n("New Activity..."), KDialogButtonBox::ActionRole, this, SLOT(slotNewActivity())); m_pDeleteActivityButton = buttonBox->addButton(i18n("Delete"), KDialogButtonBox::ActionRole, this, SLOT(slotDelete())); m_pRenameButton = buttonBox->addButton(i18n("Rename"), KDialogButtonBox::ActionRole, this, SLOT(slotRename())); #endif listVBoxLayout->addWidget(buttonBox); mainLayout->addWidget(m_pActivityGB); //now fill activity list box QStringList list = m_pStateWidget->activities(); QStringList::ConstIterator end(list.end()); for(QStringList::ConstIterator it(list.begin()); it != end; ++it) { m_pActivityLW->addItem(*it); } //now setup the signals connect(m_pActivityLW, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(slotClicked(QListWidgetItem*))); connect(m_pActivityLW, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(slotRightButtonPressed(QPoint))); connect(m_pTopArrowB, SIGNAL(clicked()), this, SLOT(slotTopClicked())); connect(m_pUpArrowB, SIGNAL(clicked()), this, SLOT(slotUpClicked())); connect(m_pDownArrowB, SIGNAL(clicked()), this, SLOT(slotDownClicked())); connect(m_pBottomArrowB, SIGNAL(clicked()), this, SLOT(slotBottomClicked())); connect(m_pActivityLW, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(slotDoubleClicked(QListWidgetItem*))); enableWidgets(false); }