void QgsCollapsibleGroupBox::checkToggled( bool chkd )
{
  mCollapseButton->setEnabled( true ); // always keep enabled
  // expand/collapse when toggled
  if ( chkd && isCollapsed() )
    setCollapsed( false );
  else if ( ! chkd && ! isCollapsed() )
    setCollapsed( true );
}
예제 #2
0
void QgsCollapsibleGroupBox::loadState()
{
  if ( !isEnabled() || ( !mSaveCollapsedState && !mSaveCheckedState ) )
    return;

  setUpdatesEnabled( false );

  QSettings settings;
  QString key = saveKey();
  QVariant val;
  if ( mSaveCheckedState )
  {
    val = settings.value( key + "/checked" );
    if ( ! val.isNull() )
      setChecked( val.toBool() );
  }
  if ( mSaveCollapsedState )
  {
    val = settings.value( key + "/collapsed" );
    if ( ! val.isNull() )
      setCollapsed( val.toBool() );
  }

  setUpdatesEnabled( true );
}
예제 #3
0
void
CQGroupBox::
mouseReleaseEvent(QMouseEvent *e)
{
  if (isCheckable()) {
    bool inside = checkRect_.contains(e->pos()) || titleRect_.contains(e->pos());

    if (inside) {
      setChecked(! isChecked());

      checkPress_ = false;

      emit clicked(isChecked());

      update();
    }
  }

  if (isCollapsible()) {
    bool inside = collapseRect_.contains(e->pos());

    if (inside) {
      setCollapsed(! isCollapsed());

      collapsePress_ = false;

      update();
    }
  }

  QWidget::mouseReleaseEvent(e);
}
예제 #4
0
void CollapsibleWidget::loadSettings(QSettings *pSettings)
{
    // Retrieve our collapsable state

    for (int i = 0, iMax = mHeaders.count(); i < iMax; ++i)
        setCollapsed(i, pSettings->value(SettingsCollapsed.arg(i), false).toBool());
}
bool SlicerChannelSelectorComponent::keyPressed (const KeyPress& key, Component* originatingComponent)
{
    // Collapse component by clicking "ESC" key either on component or in the TextEditor
    if ( (dynamic_cast<TextEditor*> (originatingComponent) != nullptr
            || originatingComponent == this)
        && key.isKeyCode (KeyPress::escapeKey))
    {
        setCollapsed (true);
    }

    return false;
}
void SlicerChannelSelectorComponent::buttonClicked (Button* buttonThatWasClicked)
{
    if (buttonThatWasClicked == m_showComponentButton)
    {
        setCollapsed (! m_isCollapsed);
    }
    else if (buttonThatWasClicked == m_selectChannelsButton)
    {
        m_controlsButtonListener->changeChannelsSelectionButtonClicked (this, buttonThatWasClicked, true);
    }
    else if (buttonThatWasClicked == m_deselectChannelsButton)
    {
        m_controlsButtonListener->changeChannelsSelectionButtonClicked (this, buttonThatWasClicked, false);
    }
}
예제 #7
0
void GuiPaneControl::onMouseUp(const GuiEvent &event)
{
   // Make sure we only get events we ought to be getting...
   if (! mActive)
      return;

   if(!mCollapsable)
      return;

   mouseUnlock();
   setUpdate();

   Point2I localClick = globalToLocalCoord(event.mousePoint);

   // If we're clicking in the header then resize
   if(localClick.y < mThumbSize.y && mDepressed)
      setCollapsed(!mCollapsed);
}
void QgsCollapsibleGroupBox::showEvent( QShowEvent * event )
{
  // initialise widget on first show event only
  if ( mShown )
  {
    event->accept();
    return;
  }

  // check if groupbox was set to flat in Designer or in code
  mInitFlat = isFlat();

  // find parent QScrollArea - this might not work in complex layouts - should we look deeper?
  if ( parent() && parent()->parent() )
    mParentScrollArea = dynamic_cast<QScrollArea*>( parent()->parent()->parent() );
  else
    mParentScrollArea = 0;
  if ( mParentScrollArea )
    QgsDebugMsg( "found a QScrollArea parent: " + mParentScrollArea->objectName() );
  else
    QgsDebugMsg( "did not find a QScrollArea parent" );

  loadState();

  updateStyle();

  // expand if needed - any calls to setCollapsed() before only set mCollapsed, but have UI effect
  if ( mCollapsed )
  {
    setCollapsed( mCollapsed );
  }
  else
  {
    // emit signal for connections using expanded state
    emit collapsedStateChanged( this );
  }
  // set mShown after first setCollapsed call or expanded groupboxes
  // will scroll scroll areas when first shown
  mShown = true;
  event->accept();
}
void QgsCollapsibleGroupBox::toggleCollapsed()
{
  setCollapsed( !mCollapsed );
}
예제 #10
0
파일: WPanel.C 프로젝트: NovaWova/wt
void WPanel::toggleCollapse()
{
  setCollapsed(!isCollapsed());
}