]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
Improvement of TableView Management, you can change jobs with arrows keys
authorribes <ribes>
Wed, 12 Oct 2011 08:51:31 +0000 (08:51 +0000)
committerribes <ribes>
Wed, 12 Oct 2011 08:51:31 +0000 (08:51 +0000)
src/genericgui/BL_GenericGui.cxx
src/genericgui/BL_GenericGui.hxx
src/genericgui/BL_JobTab.cxx
src/genericgui/BL_JobTab.hxx
src/genericgui/BL_JobsTable.cxx
src/genericgui/BL_JobsTable.hxx
src/genericgui/BL_QModelManager.cxx
src/genericgui/BL_QModelManager.hxx

index e8c34ff07a272848fd573bee0dc4fdba0f4740fb..187fcd445c84ddcf7bfa400faed4c52a3635cdad 100644 (file)
@@ -141,7 +141,8 @@ BL::GenericGui::createCentralWidget()
   // TableView -> X
   connect(_jobs_table, SIGNAL(clicked(QModelIndex)), _job_tab, SLOT(job_selected(QModelIndex)));
   connect(_jobs_table, SIGNAL(clicked(QModelIndex)), this, SLOT(job_selected(QModelIndex)));
-  connect(_jobs_table, SIGNAL(clicked(QModelIndex)), _model_manager, SLOT(job_selected(QModelIndex)));
+  connect(_jobs_table, SIGNAL(activated(QModelIndex)), this, SLOT(job_activated(QModelIndex)));
+  connect(_jobs_table, SIGNAL(activated(QModelIndex)), _job_tab, SLOT(job_activated(QModelIndex)));
   // Delete Job -> X
   connect(this, SIGNAL(job_deleted(QString)), _job_tab, SLOT(reset(QString)));
 }
@@ -306,6 +307,13 @@ BL::GenericGui::job_selected(const QModelIndex & index)
   updateButtonsStates();
 }
 
+void
+BL::GenericGui::job_activated(const QModelIndex & index)
+{
+  DEBTRACE("BL::GenericGui::job_activated slot");
+  job_selected(index);
+}
+
 void 
 BL::GenericGui::job_state_changed(const QString & name)
 {
index 9cfeceb1b93dace459e566d74512556d02de78c7..8b23023803a98e42f1c60a10f620f4fbc3f7fde5 100644 (file)
@@ -69,6 +69,7 @@ namespace BL
       void stop_job();
       void get_results_job();
       void job_selected(const QModelIndex & index);
+      void job_activated(const QModelIndex & index);
       void job_state_changed(const QString & name);
       void updateButtonsStates();
 
index 2f577eb5fadc6e9f757896d1e3cb0e742872de98..0d59f8e0ade094147bf7acc99155af2f44351097 100644 (file)
@@ -157,6 +157,13 @@ BL::JobTab::createJobFilesTab()
   insertTab(1, _files_tab, "Job Files");
 }
 
+void
+BL::JobTab::job_activated(const QModelIndex & index)
+{
+  DEBTRACE("BL::JobTab::job_activated slot");
+  job_selected(index);
+}
+
 void
 BL::JobTab::job_selected(const QModelIndex & index)
 {
index dae5332ade3ee96597d79ad5871419a70b0f1629..8d067f55fa5d538a87cc7490b238d67e123ef153 100644 (file)
@@ -41,6 +41,7 @@ namespace BL
 
     public slots:
       void job_selected(const QModelIndex & index);
+      void job_activated(const QModelIndex & index);
       void itemChanged(QStandardItem * item);
       void reset(QString job_name);
 
index e657e9f77b862eb39c6b95ca8e9ba20a956ea4a5..e611b49a4ffdf129c3aed9d7e530b7c8229d6955 100644 (file)
@@ -30,10 +30,12 @@ BL::JobsTable::JobsTable(QWidget *parent) : QTableView(parent)
   setShowGrid(false);
   setCornerButtonEnabled(false);
   setEditTriggers(QAbstractItemView::NoEditTriggers);
-  setSelectionBehavior(QAbstractItemView::SelectRows);
   setAlternatingRowColors(true);
   setSortingEnabled(true);
 
+  setSelectionBehavior(QAbstractItemView::SelectRows);
+  setSelectionMode(QAbstractItemView::ExtendedSelection);
+
   QHeaderView * header_view = verticalHeader();
   header_view->setClickable(false);
 }
@@ -42,3 +44,10 @@ BL::JobsTable::~JobsTable()
 {
   DEBTRACE("Destroying BL::JobsTable");
 }
+
+void
+BL::JobsTable::currentChanged(const QModelIndex & current, const QModelIndex & previous)
+{
+  DEBTRACE("BL::JobsTable currentChanged");
+  activated(current);
+}
index 16816fbd6e01d244161d2b1f35552289d12002fb..a62dd59eba8dba972ab9ba5d83b8c1c6febdd0cb 100644 (file)
@@ -35,6 +35,8 @@ namespace BL
     protected:
       QWidget* _parent;
 
+    protected slots:
+      void currentChanged(const QModelIndex & current, const QModelIndex & previous);
   };
 }
 
index f3b0ba05e60e4289c66b7341259194e500c265a0..88f1fd7c777a81dfb99ffc9861d8c28f2230d1c6 100644 (file)
@@ -134,25 +134,3 @@ BL::QModelManager::deleteJob(const QString & name)
   if (list.size() > 0)
     _model->removeRow(list[0]->row());
 }
-
-void
-BL::QModelManager::job_selected(const QModelIndex & index)
-{
-  DEBTRACE("BL::QModelManager::job_selected slot");
-  QStandardItem * item = _model->itemFromIndex(index);
-  int row = item->row();
-
-  // Algo un peu bourrin....
-  for (int i = 0; i < _model->rowCount(); i++)
-    for (int j = 0; j < _model->columnCount(); j++)
-    {
-      _model->item(i,j)->setBackground(QBrush(Qt::white));
-      _model->item(i,j)->setForeground(QBrush(Qt::black));
-    }
-
-  for (int j = 0; j < _model->columnCount(); j++)
-  {
-    _model->item(row,j)->setBackground(QBrush(Qt::darkBlue));
-    _model->item(row,j)->setForeground(QBrush(Qt::white));
-  }
-}
index 75ed8df9cdf856ae82cfbc7cb51d4f784e310bfb..72b2cf70d94cd2137d9248b51a34eccc0a26fbd5 100644 (file)
@@ -43,7 +43,6 @@ namespace BL{
     public slots:
       void new_job_added(const QString & name);
       void job_state_changed(const QString & name);
-      void job_selected(const QModelIndex & index);
     
     private:
       QStandardItemModel * _model;