ATLAS Offline Software
Classes | Signals | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Slots | List of all members
VP1DockWidget Class Reference

#include <VP1DockWidget.h>

Inheritance diagram for VP1DockWidget:
Collaboration diagram for VP1DockWidget:

Classes

class  Imp
 

Signals

void wasSelected (VP1DockWidget *)
 

Public Member Functions

 VP1DockWidget (IVP1ChannelWidget *cw, VP1TabManager *tm)
 
virtual ~VP1DockWidget ()
 
void setSelected ()
 
void setUnselected ()
 
bool isSelected () const
 
IVP1ChannelWidgetchannelWidget () const
 
void ensureCWHasNoParent ()
 
void ensureCWHasParent ()
 

Static Public Member Functions

static QString highlightStyle ()
 

Protected Member Functions

void contextMenuEvent (QContextMenuEvent *event)
 
void resizeEvent (QResizeEvent *event)
 

Protected Attributes

Impm_d
 

Private Slots

void systemRefreshInfoChanged (QString sysrefreshing, int nsysOn, int nsysOnRefreshed)
 
void updateTitle ()
 

Detailed Description

Definition at line 24 of file VP1DockWidget.h.

Constructor & Destructor Documentation

◆ VP1DockWidget()

VP1DockWidget::VP1DockWidget ( IVP1ChannelWidget cw,
VP1TabManager tm 
)

Definition at line 127 of file VP1DockWidget.cxx.

128  : QDockWidget ( cw->unique_name(), 0 ), m_d(new Imp(this,cw,tm))
129 {
130 
131  setObjectName("VP1DockWidget:"+cw->name());//For storing/saving the layout of the dock widgets within the dock area.
132 
133  setFocusProxy(cw);
134 
135  setAllowedAreas(Qt::TopDockWidgetArea);
136  setFeatures(VP1DockWidget::DockWidgetMovable | VP1DockWidget::DockWidgetFloatable);
137 
138  m_d->selectedstylesheet="QFrame#VP1DockWidgetFrame { "+highlightStyle()+" } ";
139 
140  //Add frame, which will light up on selection:
141  m_d->frame = new QFrame(this);
142  m_d->frame->setObjectName("VP1DockWidgetFrame");
143  cw->setObjectName("IVP1ChannelWidget:"+cw->name());
144  ensureCWHasParent();//setup the cw in the frame
145 
146  //Figure out what margin our drawn frame imposes:
147  setSelected();
148  QMargins marg = m_d->frame->contentsMargins();
149  Q_ASSERT(marg.left()==marg.top()&&marg.left()==marg.right()&&marg.left()==marg.bottom()&&"Qt changed its margin behaviour for QFrame!!");
150  m_d->unselectedmargin=marg.left();
151 
152  //Channel starts unselected:
153  setUnselected();
154 
155  connect(cw,SIGNAL(uniqueNameChanged(QString)),this,SLOT(updateTitle()));
156  connect(cw,SIGNAL(systemRefreshInfoChanged(QString,int,int)),this,SLOT(systemRefreshInfoChanged(QString,int,int)));
157 
158  //Setup a watch for selections:
159  m_d->filteritem->init();
160 
161 }

◆ ~VP1DockWidget()

VP1DockWidget::~VP1DockWidget ( )
virtual

Definition at line 114 of file VP1DockWidget.cxx.

115 {
116  delete m_d->filteritem;
117  delete m_d; m_d=0;
118 }

Member Function Documentation

◆ channelWidget()

IVP1ChannelWidget * VP1DockWidget::channelWidget ( ) const

Definition at line 249 of file VP1DockWidget.cxx.

250 {
251  return m_d->channelwidget;
252 }

◆ contextMenuEvent()

void VP1DockWidget::contextMenuEvent ( QContextMenuEvent *  event)
protected

Definition at line 261 of file VP1DockWidget.cxx.

262 {
263  //Inside the frame, we use the normal behaviour:
264  if (m_d->frame->geometry().contains(event->pos())) {
265  QDockWidget::contextMenuEvent ( event );
266  return;
267  }
268  //Outside we show our contextmenu:
269 
270  //Construct menu:
271  QMenu menu(this);
272 // menu.addAction("Channel: "+m_d->channelwidget->unique_name())->setEnabled(false);
273 // menu.addSeparator();
274 
275  QAction* pFullScreenAction = menu.addAction("Show &full Screen");
276  menu.addSeparator();
277  QAction* pRemoveAction = menu.addAction("&Remove channel");
278  menu.addSeparator ();
279  QAction* pMoveChannelAction = menu.addAction("&Move to tab");
280 
281  QStringList tablist = m_d->tabmanager->tabList();
282  QMenu menu_movechan(this);
283  if (tablist.count()==1) {
284  menu_movechan.addAction("No other tabs available")->setEnabled(false);
285  } else {
286  QString thistab = m_d->tabmanager->channelToTab(m_d->channelwidget);
287  for (QString tab : tablist) {
288  if (tab!=thistab)
289  menu_movechan.addAction(tab)->setData("MOVECHAN");
290  }
291  }
292  pMoveChannelAction->setMenu(&menu_movechan);
293 
294  //Execute
295  QAction * selAct = menu.exec(event->globalPos());
296  //Act on selection:
297  if (!selAct)
298  return;
299  if (selAct==pFullScreenAction) {
301  return;
302  }
303  if (selAct==pRemoveAction) {
305  return;
306  }
307  if (selAct->data()=="MOVECHAN") {
309  return;
310  }
311  std::cout<<"ERROR in VP1DockWidget::contextMenuEvent!!!!!"<<std::endl;
312 
313 }

◆ ensureCWHasNoParent()

void VP1DockWidget::ensureCWHasNoParent ( )

Definition at line 164 of file VP1DockWidget.cxx.

165 {
166  if (!channelWidget()||!channelWidget()->parent())
167  return;
168  channelWidget()->setParent(0);
169  setWidget(0);
170  if (m_d->frame->layout()&&m_d->frame->layout()->indexOf(m_d->channelwidget)>=0) {
171  assert(m_d->vboxLayout);
172  m_d->vboxLayout->removeWidget(m_d->channelwidget);
173  }
174 }

◆ ensureCWHasParent()

void VP1DockWidget::ensureCWHasParent ( )

Definition at line 177 of file VP1DockWidget.cxx.

178 {
179  if (!channelWidget()||channelWidget()->parent())
180  return;
181  if (!m_d->frame->layout()) {
182  assert(!m_d->vboxLayout);
183  m_d->vboxLayout = new QVBoxLayout(0);
184  m_d->frame->setLayout(m_d->vboxLayout);
185  m_d->vboxLayout->setObjectName("vp1dock-frame-layout");
186  m_d->vboxLayout->setSpacing(0);
187  }
188  if (m_d->frame->layout()->indexOf(m_d->channelwidget)<0)
189  m_d->frame->layout()->addWidget(m_d->channelwidget);
190  channelWidget()->setParent(m_d->frame);
191  setWidget(m_d->frame);
192 }

◆ highlightStyle()

QString VP1DockWidget::highlightStyle ( )
static

Definition at line 121 of file VP1DockWidget.cxx.

122 {
123  return "background-color: rgba(0, 0, 255, 12%)";
124 }

◆ isSelected()

bool VP1DockWidget::isSelected ( ) const

Definition at line 255 of file VP1DockWidget.cxx.

256 {
257  return m_d->selected;
258 }

◆ resizeEvent()

void VP1DockWidget::resizeEvent ( QResizeEvent *  event)
protected

Definition at line 316 of file VP1DockWidget.cxx.

317 {
319  QDockWidget::resizeEvent(event);
320 }

◆ setSelected()

void VP1DockWidget::setSelected ( )

Definition at line 223 of file VP1DockWidget.cxx.

224 {
225  if (m_d->selected)
226  return;
227  m_d->selected=true;
228  m_d->frame->setStyleSheet(m_d->selectedstylesheet);
229  assert(m_d->vboxLayout);
230  m_d->vboxLayout->setMargin(0);
231  m_d->frame->setFrameShape(QFrame::StyledPanel);
232  updateTitle();
233 }

◆ setUnselected()

void VP1DockWidget::setUnselected ( )

Definition at line 236 of file VP1DockWidget.cxx.

237 {
238  if (!m_d->selected)
239  return;
240  m_d->selected=false;
241  m_d->frame->setStyleSheet("");
242  assert(m_d->vboxLayout);
243  m_d->vboxLayout->setMargin(m_d->unselectedmargin);
244  m_d->frame->setFrameShape(QFrame::NoFrame);
245  updateTitle();
246 }

◆ systemRefreshInfoChanged

void VP1DockWidget::systemRefreshInfoChanged ( QString  sysrefreshing,
int  nsysOn,
int  nsysOnRefreshed 
)
privateslot

Definition at line 195 of file VP1DockWidget.cxx.

196 {
197  assert(nsysOnRefreshed<=nsysOn);
198  if (nsysOn==nsysOnRefreshed) {
199  // assert(sysrefreshing.isEmpty());
200  m_d->title_refreshpart.clear();
201  updateTitle();
202  return;
203  }
204  assert(nsysOnRefreshed<nsysOn);
205  if (sysrefreshing.isEmpty()) {
206  m_d->title_refreshpart = " [Refreshed "+QString::number(nsysOnRefreshed)+"/"+QString::number(nsysOn)+"]";
207  } else {
208  m_d->title_refreshpart = " [Refreshing "+QString::number(nsysOnRefreshed+1)+"/"+QString::number(nsysOn)+": "+sysrefreshing+" ]";
209  }
210  updateTitle();
211 }

◆ updateTitle

void VP1DockWidget::updateTitle ( )
privateslot

Definition at line 214 of file VP1DockWidget.cxx.

215 {
216  if (m_d->selected)
217  setWindowTitle(">>> "+m_d->channelwidget->unique_name()+m_d->title_refreshpart+" <<<");
218  else
219  setWindowTitle(m_d->channelwidget->unique_name()+m_d->title_refreshpart);
220 }

◆ wasSelected

void VP1DockWidget::wasSelected ( VP1DockWidget )
signal

Member Data Documentation

◆ m_d

Imp* VP1DockWidget::m_d
protected

Definition at line 55 of file VP1DockWidget.h.


The documentation for this class was generated from the following files:
VP1DockWidget::Imp::unselectedmargin
int unselectedmargin
Definition: VP1DockWidget.cxx:41
VP1DockWidget::highlightStyle
static QString highlightStyle()
Definition: VP1DockWidget.cxx:121
VP1DockWidget::Imp::selected
bool selected
Definition: VP1DockWidget.cxx:43
VP1DockWidget::m_d
Imp * m_d
Definition: VP1DockWidget.h:54
fillPileUpNoiseLumi.connect
string connect
Definition: fillPileUpNoiseLumi.py:70
python.TriggerConfig.menu
menu
Definition: TriggerConfig.py:842
IVP1ChannelWidget::dockResized
virtual void dockResized()
Definition: IVP1ChannelWidget.cxx:315
IVP1ChannelWidget::unique_name
const QString unique_name() const
Definition: IVP1ChannelWidget.cxx:175
menu
make the sidebar many part of the config
Definition: hcg.cxx:551
VP1DockWidget::updateTitle
void updateTitle()
Definition: VP1DockWidget.cxx:214
VP1TabManager::tabList
QStringList tabList()
Definition: VP1TabManager.cxx:539
event
POOL::TEvent event(POOL::TEvent::kClassAccess)
VP1DockWidget::Imp::tabmanager
VP1TabManager * tabmanager
Definition: VP1DockWidget.cxx:45
test_pyathena.parent
parent
Definition: test_pyathena.py:15
VP1DockWidget::Imp::filteritem
FilterItem * filteritem
Definition: VP1DockWidget.cxx:36
VP1TabManager::removeChannelAfterQueueEmpties
void removeChannelAfterQueueEmpties(const QString &)
Definition: VP1TabManager.cxx:1509
VP1DockWidget::setSelected
void setSelected()
Definition: VP1DockWidget.cxx:223
VP1DockWidget::setUnselected
void setUnselected()
Definition: VP1DockWidget.cxx:236
python.selection.number
number
Definition: selection.py:20
VP1TabManager::showChannelFullScreen
void showChannelFullScreen(IVP1ChannelWidget *)
Definition: VP1TabManager.cxx:358
VP1DockWidget::Imp::channelwidget
IVP1ChannelWidget * channelwidget
Definition: VP1DockWidget.cxx:40
VP1DockWidget::Imp::selectedstylesheet
QString selectedstylesheet
Definition: VP1DockWidget.cxx:42
VP1DockWidget::Imp::vboxLayout
QVBoxLayout * vboxLayout
Definition: VP1DockWidget.cxx:39
VP1DockWidget::Imp::title_refreshpart
QString title_refreshpart
Definition: VP1DockWidget.cxx:44
VP1DockWidget::channelWidget
IVP1ChannelWidget * channelWidget() const
Definition: VP1DockWidget.cxx:249
VP1DockWidget::Imp::frame
QFrame * frame
Definition: VP1DockWidget.cxx:38
IVP1ChannelWidget::name
const QString & name() const
Definition: IVP1ChannelWidget.cxx:180
VP1DockWidget::Imp::FilterItem::init
void init()
Definition: VP1DockWidget.cxx:54
VP1DockWidget::systemRefreshInfoChanged
void systemRefreshInfoChanged(QString sysrefreshing, int nsysOn, int nsysOnRefreshed)
Definition: VP1DockWidget.cxx:195
VP1DockWidget::ensureCWHasParent
void ensureCWHasParent()
Definition: VP1DockWidget.cxx:177
VP1TabManager::moveChannelToTab
void moveChannelToTab(QString channeluniquename, QString tabname)
Definition: VP1TabManager.cxx:683
VP1TabManager::channelToTab
QString channelToTab(IVP1ChannelWidget *)
Definition: VP1TabManager.cxx:1406