Skip to content

Commit

Permalink
Logic Analyzer: Display a scroll bar for the channel manager.
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandra Trifan <[email protected]>
  • Loading branch information
AlexandraTrifan authored and claudiupop committed Apr 3, 2018
1 parent a1e140c commit 8491bcf
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 117 deletions.
25 changes: 23 additions & 2 deletions src/la_channel_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1439,9 +1439,13 @@ LogicAnalyzerChannelManagerUI::LogicAnalyzerChannelManagerUI(QWidget *parent,
showHighlight(false);
chm->highlightChannel(chm->get_channel_group(0));
showHighlight(true);
ui->leftScrollArea->verticalScrollBar()->setValue(0);
ui->scrollAreaWidgetContents->installEventFilter(this);
ui->scrollAreaWidgetContents_2->installEventFilter(this);
eventFilterGuard = new MouseWheelWidgetGuard(this);
Q_EMIT(widthChanged(geometry().width()));
chmRangeChanged(ui->scrollArea->verticalScrollBar()->minimum(),
ui->scrollArea->verticalScrollBar()->maximum());
}

std::vector<std::string> LogicAnalyzerChannelManagerUI::getTriggerMapping()
Expand Down Expand Up @@ -1976,9 +1980,22 @@ void LogicAnalyzerChannelManagerUI::update_ui()
ui->scrollArea->setMaximumWidth(managerHeaderWidget->sizeHint().width());
main_win->view_->viewport()->setDivisionCount(10);
connect(ui->scrollArea->verticalScrollBar(), SIGNAL(valueChanged(int)),
this, SLOT(chmScrollChanged(int)));
this, SLOT(chmScrollChanged(int)));
connect(ui->scrollArea->verticalScrollBar(), SIGNAL(rangeChanged(int,int)),
this, SLOT(chmRangeChanged(int,int)));
this, SLOT(chmRangeChanged(int,int)));

connect(ui->scrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
[=](int val) {
if (val != ui->leftScrollArea->verticalScrollBar()->value()) {
ui->leftScrollArea->verticalScrollBar()->setValue(val);
}
});
connect(ui->leftScrollArea->verticalScrollBar(), &QScrollBar::valueChanged,
[=](int val) {
if (val != ui->scrollArea->verticalScrollBar()->value()) {
ui->scrollArea->verticalScrollBar()->setValue(val);
}
});
la->get_channel_groups_api();

if(!eventFilterGuard)
Expand All @@ -2003,6 +2020,8 @@ void LogicAnalyzerChannelManagerUI::chmRangeChanged(int min, int max)
{
main_win->view_->verticalScrollBar()->setMinimum(min);
main_win->view_->verticalScrollBar()->setMaximum(max);
ui->leftScrollArea->verticalScrollBar()->setMinimum(min);
ui->leftScrollArea->verticalScrollBar()->setMaximum(max);
}

void LogicAnalyzerChannelManagerUI::triggerUpdateUi()
Expand Down Expand Up @@ -2603,6 +2622,8 @@ void LogicAnalyzerChannelManagerUI::set_pv_decoder(LogicAnalyzerChannelGroupUI
void LogicAnalyzerChannelManagerUI::resizeEvent(QResizeEvent *event)
{
Q_EMIT(widthChanged(geometry().width()));
chmRangeChanged(ui->scrollArea->verticalScrollBar()->minimum(),
ui->scrollArea->verticalScrollBar()->maximum());
}

void LogicAnalyzerChannelManagerUI::setHoverWidget(QWidget *hover)
Expand Down
301 changes: 186 additions & 115 deletions ui/la_channel_manager.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,40 +39,63 @@
<number>0</number>
</property>
<item>
<widget class="QWidget" name="headerWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="topMargin">
<number>0</number>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{\n\n font-family: ArialMT;\n font-size: 16px;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n color: rgba(255,255,255,140)\n}</string>
</property>
<layout class="QHBoxLayout" name="headerWidgetLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QWidget" name="headerWidget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{\n\n font-family: ArialMT;\n font-size: 16px;\n font-weight: normal;\n font-style: normal;\n text-align: left;\n color: rgba(255,255,255,140)\n}</string>
</property>
<layout class="QHBoxLayout" name="headerWidgetLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line">
Expand All @@ -89,93 +112,141 @@
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
<layout class="QHBoxLayout" name="scrollLayout">
<property name="spacing">
<number>5</number>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
<property name="topMargin">
<number>0</number>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>76</width>
<height>335</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
<item>
<widget class="QScrollArea" name="leftScrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>10</width>
<height>16777215</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_2">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>16</width>
<height>314</height>
</rect>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarAlwaysOff</enum>
</property>
<property name="sizeAdjustPolicy">
<enum>QAbstractScrollArea::AdjustToContents</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>85</width>
<height>335</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
<property name="leftMargin">
<number>0</number>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>335</height>
</size>
<property name="topMargin">
<number>0</number>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>335</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
Expand Down

0 comments on commit 8491bcf

Please sign in to comment.