mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 21:34:12 +02:00
9738345b45
Affichage > "Garder les en-têtes visibles" adds a bar along the top and the left of the diagram view that repeats the folio's column numbers and row letters, aligned with the cells at any zoom, so they stay in sight when the folio's own headers are scrolled away. Off by default; the choice is stored as diagrameditor/cell_rulers. The bars are CellRuler widgets in the view's margins (setViewportMargins), not scene items, so printing and PDF/PNG/DXF export never see them, and they paint with the application palette outside of the dark-palette inversion. They keep a constant thickness; when cells get narrower than their labels, only every 2nd, 5th, 10th... label is written. A bar is hidden when the folio hides that header. Showing or hiding them keeps the centre of the view where it was. The labels come from BorderCellLabels, now also used by BorderTitleBlock::draw(), so the bars and the border cannot disagree. PNG export of all 133 folios of the examples is pixel-identical to master, with border-columns_0 true and false. Known limits: changing border-columns_0 repaints the bars at the next scroll or zoom; the menu toggle updates the views of its own editor window only, like the grid toggle. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01G2d2Zi8BfrYRPX88zhaoFG
55 lines
1.6 KiB
C++
55 lines
1.6 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef CELLRULER_H
|
|
#define CELLRULER_H
|
|
|
|
#include <QWidget>
|
|
|
|
class DiagramView;
|
|
|
|
/**
|
|
@brief The CellRuler class
|
|
A bar along the top or the left edge of a DiagramView that repeats the
|
|
column numbers or the row letters of the folio border, aligned with the
|
|
cells at any zoom, so they stay in sight however far the view is
|
|
scrolled. It sits in the view's margins, outside of the scene: printing
|
|
and exporting are unaffected.
|
|
*/
|
|
class CellRuler : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
CellRuler(Qt::Orientation orientation, DiagramView *view);
|
|
|
|
int thickness() const;
|
|
void setLeadingSpace(int space);
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *event) override;
|
|
|
|
private:
|
|
Qt::Orientation m_orientation;
|
|
DiagramView *m_view;
|
|
/// Pixels before the viewport starts, left empty: the corner the
|
|
/// side ruler fills when both rulers are shown.
|
|
int m_leading_space = 0;
|
|
};
|
|
|
|
#endif // CELLRULER_H
|