####################################################################################################
| 117 | |
| 118 | // #################################################################################################### |
| 119 | SlidingPanelBottom::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 | |
| 151 | bool SlidingPanelBottom::isFixed() const { |
| 152 | return m_fixed; |
nothing calls this directly
no test coverage detected