Skip to content

Commit

Permalink
Added checkbox connect. Refs #9112.
Browse files Browse the repository at this point in the history
  • Loading branch information
jawrainey committed Mar 11, 2014
1 parent 760aee5 commit aa51ead
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Expand Up @@ -24,6 +24,10 @@ namespace MantidQt
/// Initialise the layout
virtual void initLayout();

private slots:
/// Checks the checkbox of the list item selected.
void checkSelectedFacility(QListWidgetItem*item);

protected:
/// The form generated by QT Designer.
Ui::CatalogSelector m_uiForm;
Expand Down
12 changes: 10 additions & 2 deletions Code/Mantid/MantidQt/MantidWidgets/src/CatalogSelector.cpp
Expand Up @@ -2,7 +2,6 @@
#include "MantidAPI/CatalogManager.h"

#include <QDesktopWidget>
#include <QListWidgetItem>

namespace MantidQt
{
Expand Down Expand Up @@ -61,15 +60,24 @@ namespace MantidQt
{
m_uiForm.setupUi(this);

connect(m_uiForm.updateBtn,SIGNAL(clicked()),this,SLOT(close()));
connect(m_uiForm.cancelBtn,SIGNAL(clicked()),this,SLOT(close()));

// Check/un-check the checkbox when an item is clicked or selected.
connect(m_uiForm.selectedCatalogs,SIGNAL(itemClicked(QListWidgetItem*)),this,SLOT(checkSelectedFacility(QListWidgetItem*)));

// Centre the GUI on screen.
this->setGeometry(QStyle::alignedRect(Qt::LeftToRight,Qt::AlignCenter,
this->window()->size(),QDesktopWidget().availableGeometry()));
}

/**
*
* SLOT: Checks the checkbox of the list item selected.
*/
void CatalogSelector::checkSelectedFacility(QListWidgetItem* item)
{
if (item->isSelected()) item->setCheckState(Qt::Checked);
if (!item->isSelected()) item->setCheckState(Qt::Unchecked);
}

} // namespace MantidWidgets
Expand Down

0 comments on commit aa51ead

Please sign in to comment.