MCPcopy Create free account
hub / github.com/KDE/labplot / SlidingPanelBottom

Method SlidingPanelBottom

src/frontend/worksheet/SlidingPanel.cpp:119–149  ·  view source on GitHub ↗

####################################################################################################

Source from the content-addressed store, hash-verified

117
118// ####################################################################################################
119SlidingPanelBottom::SlidingPanelBottom(const QRect& screenRect, WorksheetView* view, bool fixed, QWidget* parent)
120 : SlidingPanel(screenRect, SlidingPanel::Position::Bottom, parent)
121 , m_toolBar(new QToolBar(this))
122 , m_fixed(fixed) {
123 auto* layout = new QHBoxLayout();
124 layout->setContentsMargins(0, 0, 0, 0);
125 setLayout(layout);
126
127 view->fillCartesianPlotNavigationToolBar(m_toolBar, false /* disable cursor action */);
128
129 // add an action to pin/unpin the panel (to make it fixed or floating)
130 m_toolBar->addSeparator();
131 auto* pinAction = new QAction(QIcon::fromTheme(QStringLiteral("pin")), i18n("Pin the navigation panel"));
132 pinAction->setCheckable(true);
133 pinAction->setChecked(m_fixed);
134 connect(pinAction, &QAction::toggled, this, [=](bool toggled) {
135 m_fixed = toggled;
136 });
137 m_toolBar->addAction(pinAction);
138
139 layout->addWidget(m_toolBar);
140
141 QPalette pal(palette());
142 pal.setColor(QPalette::Window, Qt::lightGray);
143 setAutoFillBackground(true);
144 setPalette(pal);
145
146 move(screenRect.width() / 2 - m_toolBar->sizeHint().width() / 2, screenRect.bottom() - m_toolBar->sizeHint().height());
147 raise();
148 show();
149}
150
151bool SlidingPanelBottom::isFixed() const {
152 return m_fixed;

Callers

nothing calls this directly

Calls 7

showFunction · 0.85
addSeparatorMethod · 0.80
heightMethod · 0.80
setColorMethod · 0.45
widthMethod · 0.45
sizeHintMethod · 0.45

Tested by

no test coverage detected