-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gui: added scroll area to CollapsableMenuControlButton
- this fixes overlapping channels if there are too many Signed-off-by: Andrei Popa <[email protected]>
- Loading branch information
Showing
3 changed files
with
28 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ | |
#include <utils.h> | ||
#include <compositewidget.h> | ||
|
||
|
||
class QScrollArea; | ||
namespace scopy { | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,49 @@ | ||
#include <widgets/verticalchannelmanager.h> | ||
#include <QScrollArea> | ||
|
||
using namespace scopy; | ||
VerticalChannelManager::VerticalChannelManager(QWidget *parent) | ||
: QWidget(parent) | ||
{ | ||
lay = new QVBoxLayout(this); | ||
setLayout(lay); | ||
lay->setMargin(0); | ||
lay->setSpacing(6); | ||
spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
lay->addSpacerItem(spacer); | ||
lay->setSpacing(0); | ||
|
||
setLayout(lay); | ||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); | ||
|
||
spacer = new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Expanding); | ||
|
||
QWidget *m_container = new QWidget(this); | ||
m_contLayout = new QVBoxLayout(m_container); | ||
m_contLayout->addSpacerItem(spacer); | ||
m_contLayout->setMargin(0); | ||
m_contLayout->setSpacing(6); | ||
m_container->setLayout(m_contLayout); | ||
|
||
m_scrollArea = new QScrollArea(this); | ||
m_scrollArea->setWidget(m_container); | ||
m_scrollArea->setWidgetResizable(true); | ||
m_scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); | ||
m_scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); | ||
lay->addWidget(m_scrollArea); | ||
} | ||
|
||
VerticalChannelManager::~VerticalChannelManager() {} | ||
|
||
void VerticalChannelManager::add(QWidget *ch) | ||
{ | ||
int position = lay->indexOf(spacer); | ||
lay->insertWidget(position, ch); | ||
int position = m_contLayout->indexOf(spacer); | ||
m_contLayout->insertWidget(position, ch); | ||
ch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); | ||
} | ||
|
||
void VerticalChannelManager::addEnd(QWidget *ch) | ||
{ | ||
lay->addWidget(ch); | ||
m_contLayout->addWidget(ch); | ||
ch->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); | ||
} | ||
|
||
void VerticalChannelManager::remove(QWidget *ch) { lay->removeWidget(ch); } | ||
void VerticalChannelManager::remove(QWidget *ch) { m_contLayout->removeWidget(ch); } | ||
|
||
#include "moc_verticalchannelmanager.cpp" |