Changeset - 6acb6d6f037c
[Not reviewed]
default
0 5 0
Hasan Yavuz ÖZDERYA - 7 years ago 2018-06-24 18:05:10
hy@ozderya.net
add buttons to quickly hide/show all channels
5 files changed with 41 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/channelinfomodel.cpp
Show inline comments
 
@@ -326,12 +326,12 @@ void ChannelInfoModel::resetColors()
 
    endResetModel();
 
}
 

	
 
void ChannelInfoModel::resetVisibility()
 
void ChannelInfoModel::resetVisibility(bool visible)
 
{
 
    beginResetModel();
 
    for (unsigned ci = 0; (int) ci < infos.length(); ci++)
 
    {
 
        infos[ci].visibility = true;
 
        infos[ci].visibility = visible;
 
    }
 
    endResetModel();
 
}
src/channelinfomodel.h
Show inline comments
 
@@ -69,7 +69,7 @@ public slots:
 
    /// reset all channel colors
 
    void resetColors();
 
    /// reset visibility
 
    void resetVisibility();
 
    void resetVisibility(bool visible);
 

	
 
private:
 
    struct ChannelInfo
src/plotcontrolpanel.cpp
Show inline comments
 
/*
 
  Copyright © 2017 Hasan Yavuz Özderya
 
  Copyright © 2018 Hasan Yavuz Özderya
 

	
 
  This file is part of serialplot.
 

	
 
@@ -47,6 +47,7 @@ PlotControlPanel::PlotControlPanel(QWidg
 
    resetNamesAct(tr("Reset Names"), this),
 
    resetColorsAct(tr("Reset Colors"), this),
 
    showAllAct(tr("Show All"), this),
 
    hideAllAct(tr("Hide All"), this),
 
    resetMenu(tr("Reset Menu"), this)
 
{
 
    ui->setupUi(this);
 
@@ -138,12 +139,17 @@ PlotControlPanel::PlotControlPanel(QWidg
 
    ui->colorSelector->setDisplayMode(color_widgets::ColorPreview::AllAlpha);
 
    ui->colorSelector->setDisabled(true);
 

	
 
    // reset button
 
    // reset buttons
 
    resetAct.setToolTip(tr("Reset channel names and colors"));
 
    resetMenu.addAction(&resetNamesAct);
 
    resetMenu.addAction(&resetColorsAct);
 
    resetMenu.addAction(&showAllAct);
 
    resetAct.setMenu(&resetMenu);
 
    ui->tbReset->setDefaultAction(&resetAct);
 

	
 
    showAllAct.setToolTip(tr("Show all channels"));
 
    hideAllAct.setToolTip(tr("Hide all channels"));
 
    ui->tbShowAll->setDefaultAction(&showAllAct);
 
    ui->tbHideAll->setDefaultAction(&hideAllAct);
 
}
 

	
 
PlotControlPanel::~PlotControlPanel()
 
@@ -395,7 +401,8 @@ void PlotControlPanel::setChannelInfoMod
 
    connect(&resetAct, &QAction::triggered, model, &ChannelInfoModel::resetInfos);
 
    connect(&resetNamesAct, &QAction::triggered, model, &ChannelInfoModel::resetNames);
 
    connect(&resetColorsAct, &QAction::triggered, model, &ChannelInfoModel::resetColors);
 
    connect(&showAllAct, &QAction::triggered, model, &ChannelInfoModel::resetVisibility);
 
    connect(&showAllAct, &QAction::triggered, [model]{model->resetVisibility(true);});
 
    connect(&hideAllAct, &QAction::triggered, [model]{model->resetVisibility(false);});
 
}
 

	
 
void PlotControlPanel::saveSettings(QSettings* settings)
src/plotcontrolpanel.h
Show inline comments
 
/*
 
  Copyright © 2017 Hasan Yavuz Özderya
 
  Copyright © 2018 Hasan Yavuz Özderya
 

	
 
  This file is part of serialplot.
 

	
 
@@ -70,7 +70,7 @@ private:
 
    /// User can disable this setting in the checkbox
 
    bool warnNumOfSamples;
 

	
 
    QAction resetAct, resetNamesAct, resetColorsAct, showAllAct;
 
    QAction resetAct, resetNamesAct, resetColorsAct, showAllAct, hideAllAct;
 
    QMenu resetMenu;
 

	
 
    /// Show a confirmation dialog before setting #samples to a big value
src/plotcontrolpanel.ui
Show inline comments
 
@@ -6,7 +6,7 @@
 
   <rect>
 
    <x>0</x>
 
    <y>0</y>
 
    <width>706</width>
 
    <width>704</width>
 
    <height>195</height>
 
   </rect>
 
  </property>
 
@@ -62,6 +62,9 @@
 
      </item>
 
      <item>
 
       <layout class="QHBoxLayout" name="horizontalLayout_2">
 
        <property name="spacing">
 
         <number>3</number>
 
        </property>
 
        <property name="sizeConstraint">
 
         <enum>QLayout::SetMaximumSize</enum>
 
        </property>
 
@@ -95,12 +98,32 @@
 
          <property name="sizeHint" stdset="0">
 
           <size>
 
            <width>1</width>
 
            <height>20</height>
 
            <height>1</height>
 
           </size>
 
          </property>
 
         </spacer>
 
        </item>
 
        <item>
 
         <widget class="QToolButton" name="tbShowAll">
 
          <property name="toolTip">
 
           <string>Show all channels</string>
 
          </property>
 
          <property name="text">
 
           <string>Show All</string>
 
          </property>
 
         </widget>
 
        </item>
 
        <item>
 
         <widget class="QToolButton" name="tbHideAll">
 
          <property name="toolTip">
 
           <string>Hide all channels</string>
 
          </property>
 
          <property name="text">
 
           <string>Hide All</string>
 
          </property>
 
         </widget>
 
        </item>
 
        <item>
 
         <widget class="QToolButton" name="tbReset">
 
          <property name="text">
 
           <string>Reset</string>
0 comments (0 inline, 0 general)