mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-14 20:33:05 +02:00
Added zoom-related menus.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/branches/0.3@1417 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
parent
c560a61610
commit
dd2801f784
@ -114,6 +114,10 @@ void QETTitleBlockTemplateEditor::initActions() {
|
|||||||
save_ = new QAction(QET::Icons::DocumentSave, tr("&Enregistrer", "menu entry"), this);
|
save_ = new QAction(QET::Icons::DocumentSave, tr("&Enregistrer", "menu entry"), this);
|
||||||
save_as_ = new QAction(QET::Icons::DocumentSave, tr("Enregistrer sous", "menu entry"), this);
|
save_as_ = new QAction(QET::Icons::DocumentSave, tr("Enregistrer sous", "menu entry"), this);
|
||||||
quit_ = new QAction(QET::Icons::ApplicationExit, tr("&Quitter", "menu entry"), this);
|
quit_ = new QAction(QET::Icons::ApplicationExit, tr("&Quitter", "menu entry"), this);
|
||||||
|
zoom_in_ = new QAction(QET::Icons::ZoomIn, tr("Zoom avant", "menu entry"), this);
|
||||||
|
zoom_out_ = new QAction(QET::Icons::ZoomOut, tr("Zoom arri\350re", "menu entry"), this);
|
||||||
|
zoom_fit_ = new QAction(QET::Icons::ZoomFitBest, tr("Zoom adapt\351", "menu entry"), this);
|
||||||
|
zoom_reset_ = new QAction(QET::Icons::ZoomOriginal, tr("Pas de zoom", "menu entry"), this);
|
||||||
configure_ = new QAction(QET::Icons::Configure, tr("&Configurer QElectroTech", "menu entry"), this);
|
configure_ = new QAction(QET::Icons::Configure, tr("&Configurer QElectroTech", "menu entry"), this);
|
||||||
about_qet_ = new QAction(QET::Icons::QETLogo, tr("\300 &propos de QElectroTech", "menu entry"), this);
|
about_qet_ = new QAction(QET::Icons::QETLogo, tr("\300 &propos de QElectroTech", "menu entry"), this);
|
||||||
about_qt_ = new QAction(QET::Icons::QtLogo, tr("\300 propos de &Qt", "menu entry"), this);
|
about_qt_ = new QAction(QET::Icons::QtLogo, tr("\300 propos de &Qt", "menu entry"), this);
|
||||||
@ -124,6 +128,10 @@ void QETTitleBlockTemplateEditor::initActions() {
|
|||||||
quit_ -> setShortcut(QKeySequence(tr("Ctrl+Q", "shortcut to quit")));
|
quit_ -> setShortcut(QKeySequence(tr("Ctrl+Q", "shortcut to quit")));
|
||||||
merge_cells_ -> setShortcut(QKeySequence(tr("Ctrl+K", "shortcut to merge cells")));
|
merge_cells_ -> setShortcut(QKeySequence(tr("Ctrl+K", "shortcut to merge cells")));
|
||||||
split_cell_ -> setShortcut(QKeySequence(tr("Ctrl+J", "shortcut to split merged cell")));
|
split_cell_ -> setShortcut(QKeySequence(tr("Ctrl+J", "shortcut to split merged cell")));
|
||||||
|
zoom_in_ -> setShortcut(QKeySequence::ZoomIn);
|
||||||
|
zoom_out_ -> setShortcut(QKeySequence::ZoomOut);
|
||||||
|
zoom_fit_ -> setShortcut(QKeySequence(tr("Ctrl+9", "shortcut to enable fit zoom")));
|
||||||
|
zoom_reset_ -> setShortcut(QKeySequence(tr("Ctrl+0", "shortcut to reset zoom")));
|
||||||
|
|
||||||
configure_ -> setStatusTip(tr("Permet de r\351gler diff\351rents param\350tres de QElectroTech", "status bar tip"));
|
configure_ -> setStatusTip(tr("Permet de r\351gler diff\351rents param\350tres de QElectroTech", "status bar tip"));
|
||||||
about_qet_ -> setStatusTip(tr("Affiche des informations sur QElectroTech", "status bar tip"));
|
about_qet_ -> setStatusTip(tr("Affiche des informations sur QElectroTech", "status bar tip"));
|
||||||
@ -132,6 +140,10 @@ void QETTitleBlockTemplateEditor::initActions() {
|
|||||||
connect(save_, SIGNAL(triggered()), this, SLOT(save()));
|
connect(save_, SIGNAL(triggered()), this, SLOT(save()));
|
||||||
connect(save_as_, SIGNAL(triggered()), this, SLOT(saveAs()));
|
connect(save_as_, SIGNAL(triggered()), this, SLOT(saveAs()));
|
||||||
connect(quit_, SIGNAL(triggered()), this, SLOT(quit()));
|
connect(quit_, SIGNAL(triggered()), this, SLOT(quit()));
|
||||||
|
connect(zoom_in_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomIn()));
|
||||||
|
connect(zoom_out_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomOut()));
|
||||||
|
connect(zoom_fit_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomFit()));
|
||||||
|
connect(zoom_reset_, SIGNAL(triggered()), template_edition_area_view_, SLOT(zoomReset()));
|
||||||
connect(configure_, SIGNAL(triggered()), qet_app, SLOT(configureQET()));
|
connect(configure_, SIGNAL(triggered()), qet_app, SLOT(configureQET()));
|
||||||
connect(about_qet_, SIGNAL(triggered()), qet_app, SLOT(aboutQET()));
|
connect(about_qet_, SIGNAL(triggered()), qet_app, SLOT(aboutQET()));
|
||||||
connect(about_qt_, SIGNAL(triggered()), qet_app, SLOT(aboutQt()));
|
connect(about_qt_, SIGNAL(triggered()), qet_app, SLOT(aboutQt()));
|
||||||
@ -145,12 +157,14 @@ void QETTitleBlockTemplateEditor::initActions() {
|
|||||||
void QETTitleBlockTemplateEditor::initMenus() {
|
void QETTitleBlockTemplateEditor::initMenus() {
|
||||||
file_menu_ = new QMenu(tr("&Fichier", "menu title"), this);
|
file_menu_ = new QMenu(tr("&Fichier", "menu title"), this);
|
||||||
edit_menu_ = new QMenu(tr("&\311dition", "menu title"), this);
|
edit_menu_ = new QMenu(tr("&\311dition", "menu title"), this);
|
||||||
|
display_menu_ = new QMenu(tr("Afficha&ge", "menu title"), this);
|
||||||
config_menu_ = new QMenu(tr("&Configuration", "menu title"), this);
|
config_menu_ = new QMenu(tr("&Configuration", "menu title"), this);
|
||||||
help_menu_ = new QMenu(tr("&Aide", "menu title"), this);
|
help_menu_ = new QMenu(tr("&Aide", "menu title"), this);
|
||||||
|
|
||||||
file_menu_ -> setTearOffEnabled(true);
|
file_menu_ -> setTearOffEnabled(true);
|
||||||
edit_menu_ -> setTearOffEnabled(true);
|
edit_menu_ -> setTearOffEnabled(true);
|
||||||
config_menu_ -> setTearOffEnabled(true);
|
config_menu_ -> setTearOffEnabled(true);
|
||||||
|
display_menu_ -> setTearOffEnabled(true);
|
||||||
help_menu_ -> setTearOffEnabled(true);
|
help_menu_ -> setTearOffEnabled(true);
|
||||||
|
|
||||||
file_menu_ -> addAction(save_);
|
file_menu_ -> addAction(save_);
|
||||||
@ -161,6 +175,11 @@ void QETTitleBlockTemplateEditor::initMenus() {
|
|||||||
edit_menu_ -> addAction(merge_cells_);
|
edit_menu_ -> addAction(merge_cells_);
|
||||||
edit_menu_ -> addAction(split_cell_);
|
edit_menu_ -> addAction(split_cell_);
|
||||||
|
|
||||||
|
display_menu_ -> addAction(zoom_in_);
|
||||||
|
display_menu_ -> addAction(zoom_out_);
|
||||||
|
display_menu_ -> addAction(zoom_fit_);
|
||||||
|
display_menu_ -> addAction(zoom_reset_);
|
||||||
|
|
||||||
config_menu_ -> addAction(configure_);
|
config_menu_ -> addAction(configure_);
|
||||||
|
|
||||||
help_menu_ -> addAction(about_qet_);
|
help_menu_ -> addAction(about_qet_);
|
||||||
@ -168,6 +187,7 @@ void QETTitleBlockTemplateEditor::initMenus() {
|
|||||||
|
|
||||||
menuBar() -> addMenu(file_menu_);
|
menuBar() -> addMenu(file_menu_);
|
||||||
menuBar() -> addMenu(edit_menu_);
|
menuBar() -> addMenu(edit_menu_);
|
||||||
|
menuBar() -> addMenu(display_menu_);
|
||||||
menuBar() -> addMenu(config_menu_);
|
menuBar() -> addMenu(config_menu_);
|
||||||
menuBar() -> addMenu(help_menu_);
|
menuBar() -> addMenu(help_menu_);
|
||||||
}
|
}
|
||||||
|
@ -47,9 +47,10 @@ class QETTitleBlockTemplateEditor : public QMainWindow {
|
|||||||
/// is the template read-only?
|
/// is the template read-only?
|
||||||
bool read_only;
|
bool read_only;
|
||||||
/// menus TODO
|
/// menus TODO
|
||||||
QMenu *file_menu_, *edit_menu_,/* *paste_from_menu_, *display_menu_, *tools_menu_,*/ *config_menu_, *help_menu_;
|
QMenu *file_menu_, *edit_menu_,/* *paste_from_menu_, */*display_menu_,/* *tools_menu_,*/ *config_menu_, *help_menu_;
|
||||||
/// actions
|
/// actions
|
||||||
QAction *save_, *save_as_, *quit_, *configure_, *about_qt_, *about_qet_, *merge_cells_, *split_cell_;
|
QAction *save_, *save_as_, *quit_, *configure_, *about_qt_, *about_qet_, *merge_cells_, *split_cell_;
|
||||||
|
QAction *zoom_in_, *zoom_out_, *zoom_fit_, *zoom_reset_;
|
||||||
/// Parent project of the currently edited template
|
/// Parent project of the currently edited template
|
||||||
QETProject *parent_project_;
|
QETProject *parent_project_;
|
||||||
/// Name of the currently edited template
|
/// Name of the currently edited template
|
||||||
|
@ -27,6 +27,11 @@
|
|||||||
#define ROW_OFFSET 2
|
#define ROW_OFFSET 2
|
||||||
#define COL_OFFSET 1
|
#define COL_OFFSET 1
|
||||||
#define DEFAULT_PREVIEW_WIDTH 600
|
#define DEFAULT_PREVIEW_WIDTH 600
|
||||||
|
#define DEFAULT_PREVIEW_HELPER_CELL_HEIGHT 15
|
||||||
|
#define DEFAULT_COLS_HELPER_CELLS_HEIGHT 15
|
||||||
|
#define DEFAULT_ROWS_HELPER_CELLS_WIDTH 50
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Constructor
|
Constructor
|
||||||
@ -39,7 +44,8 @@ TitleBlockTemplateView::TitleBlockTemplateView(QWidget *parent) :
|
|||||||
form_(0),
|
form_(0),
|
||||||
preview_width_(DEFAULT_PREVIEW_WIDTH),
|
preview_width_(DEFAULT_PREVIEW_WIDTH),
|
||||||
apply_columns_widths_count_(0),
|
apply_columns_widths_count_(0),
|
||||||
apply_rows_heights_count_(0)
|
apply_rows_heights_count_(0),
|
||||||
|
first_activation_(true)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -54,7 +60,8 @@ TitleBlockTemplateView::TitleBlockTemplateView(QGraphicsScene *scene, QWidget *p
|
|||||||
tbgrid_(0),
|
tbgrid_(0),
|
||||||
preview_width_(DEFAULT_PREVIEW_WIDTH),
|
preview_width_(DEFAULT_PREVIEW_WIDTH),
|
||||||
apply_columns_widths_count_(0),
|
apply_columns_widths_count_(0),
|
||||||
apply_rows_heights_count_(0)
|
apply_rows_heights_count_(0),
|
||||||
|
first_activation_(true)
|
||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
@ -71,6 +78,7 @@ TitleBlockTemplateView::~TitleBlockTemplateView() {
|
|||||||
*/
|
*/
|
||||||
void TitleBlockTemplateView::setTitleBlockTemplate(TitleBlockTemplate *tbtemplate) {
|
void TitleBlockTemplateView::setTitleBlockTemplate(TitleBlockTemplate *tbtemplate) {
|
||||||
loadTemplate(tbtemplate);
|
loadTemplate(tbtemplate);
|
||||||
|
zoomFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -104,6 +112,22 @@ void TitleBlockTemplateView::zoomOut() {
|
|||||||
scale(zoom_factor, zoom_factor);
|
scale(zoom_factor, zoom_factor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Fit the rendered title block template in this view.
|
||||||
|
*/
|
||||||
|
void TitleBlockTemplateView::zoomFit() {
|
||||||
|
adjustSceneRect();
|
||||||
|
fitInView(scene() -> sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
Reset the zoom level.
|
||||||
|
*/
|
||||||
|
void TitleBlockTemplateView::zoomReset() {
|
||||||
|
adjustSceneRect();
|
||||||
|
resetMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Add a column right before the last index selected when calling the context
|
Add a column right before the last index selected when calling the context
|
||||||
menu.
|
menu.
|
||||||
@ -285,6 +309,39 @@ TitleBlockTemplateCellsSet TitleBlockTemplateView::cells(const QRectF &rect) con
|
|||||||
return(makeCellsSetFromGraphicsItems(items));
|
return(makeCellsSetFromGraphicsItems(items));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return the current size of the rendered title block template
|
||||||
|
*/
|
||||||
|
QSizeF TitleBlockTemplateView::templateSize() const {
|
||||||
|
return(QSizeF(templateWidth(), templateHeight()));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return the current width of the rendered title block template
|
||||||
|
*/
|
||||||
|
qreal TitleBlockTemplateView::templateWidth() const {
|
||||||
|
if (!tbtemplate_) return(0);
|
||||||
|
|
||||||
|
qreal width = DEFAULT_ROWS_HELPER_CELLS_WIDTH;
|
||||||
|
// the rendered width may exceed the initially planned preview width
|
||||||
|
width += qMax<int>(preview_width_, tbtemplate_ -> width(preview_width_));
|
||||||
|
|
||||||
|
return(width);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return the current height of the rendered title block template
|
||||||
|
*/
|
||||||
|
qreal TitleBlockTemplateView::templateHeight() const {
|
||||||
|
if (!tbtemplate_) return(0);
|
||||||
|
|
||||||
|
qreal height = DEFAULT_PREVIEW_HELPER_CELL_HEIGHT;
|
||||||
|
height += DEFAULT_COLS_HELPER_CELLS_HEIGHT;
|
||||||
|
height += tbtemplate_ -> height();
|
||||||
|
|
||||||
|
return(height);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Handles mouse wheel-related actions
|
Handles mouse wheel-related actions
|
||||||
@param e QWheelEvent describing the wheel event
|
@param e QWheelEvent describing the wheel event
|
||||||
@ -333,6 +390,7 @@ void TitleBlockTemplateView::init() {
|
|||||||
connect(delete_row_, SIGNAL(triggered()), this, SLOT(deleteRow()));
|
connect(delete_row_, SIGNAL(triggered()), this, SLOT(deleteRow()));
|
||||||
connect(change_preview_width_, SIGNAL(triggered()), this, SLOT(changePreviewWidth()));
|
connect(change_preview_width_, SIGNAL(triggered()), this, SLOT(changePreviewWidth()));
|
||||||
|
|
||||||
|
setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
|
||||||
setBackgroundBrush(QBrush(QColor(248, 255, 160)));
|
setBackgroundBrush(QBrush(QColor(248, 255, 160)));
|
||||||
|
|
||||||
connect(scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
|
connect(scene(), SIGNAL(selectionChanged()), this, SLOT(selectionChanged()));
|
||||||
@ -345,7 +403,7 @@ void TitleBlockTemplateView::init() {
|
|||||||
*/
|
*/
|
||||||
void TitleBlockTemplateView::applyColumnsWidths(bool animate) {
|
void TitleBlockTemplateView::applyColumnsWidths(bool animate) {
|
||||||
// the first column is dedicated to helper cells showing the rows height
|
// the first column is dedicated to helper cells showing the rows height
|
||||||
tbgrid_ -> setColumnFixedWidth(0, 50);
|
tbgrid_ -> setColumnFixedWidth(0, DEFAULT_ROWS_HELPER_CELLS_WIDTH);
|
||||||
tbgrid_ -> setColumnSpacing(0, 0);
|
tbgrid_ -> setColumnSpacing(0, 0);
|
||||||
|
|
||||||
// we apply the other columns width based on the title block template data
|
// we apply the other columns width based on the title block template data
|
||||||
@ -406,14 +464,11 @@ void TitleBlockTemplateView::applyColumnsWidths(bool animate) {
|
|||||||
*/
|
*/
|
||||||
void TitleBlockTemplateView::applyRowsHeights(bool animate) {
|
void TitleBlockTemplateView::applyRowsHeights(bool animate) {
|
||||||
// the first row is dedicated to a helper cell showing the total width
|
// the first row is dedicated to a helper cell showing the total width
|
||||||
tbgrid_ -> setRowFixedHeight(0, 15);
|
tbgrid_ -> setRowFixedHeight(0, DEFAULT_PREVIEW_HELPER_CELL_HEIGHT);
|
||||||
tbgrid_ -> setRowSpacing(0, 0);
|
tbgrid_ -> setRowSpacing(0, 0);
|
||||||
// the second row is dedicated to helper cells showing the columns width
|
// the second row is dedicated to helper cells showing the columns width
|
||||||
tbgrid_ -> setRowFixedHeight(1, 15);
|
tbgrid_ -> setRowFixedHeight(1, DEFAULT_COLS_HELPER_CELLS_HEIGHT);
|
||||||
tbgrid_ -> setRowSpacing(1, 0);
|
tbgrid_ -> setRowSpacing(1, 0);
|
||||||
// the first column is dedicated to helper cells showing the rows height
|
|
||||||
tbgrid_ -> setColumnFixedWidth(0, 45);
|
|
||||||
tbgrid_ -> setColumnSpacing(0, 0);
|
|
||||||
|
|
||||||
QList<int> heights = tbtemplate_ -> rowsHeights();
|
QList<int> heights = tbtemplate_ -> rowsHeights();
|
||||||
for (int i = 0 ; i < heights.count() ; ++ i) {
|
for (int i = 0 ; i < heights.count() ; ++ i) {
|
||||||
@ -581,6 +636,17 @@ void TitleBlockTemplateView::fillWithEmptyCells() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@param event Object describing the received event
|
||||||
|
*/
|
||||||
|
bool TitleBlockTemplateView::event(QEvent *event) {
|
||||||
|
if (first_activation_ && event -> type() == QEvent::WindowActivate) {
|
||||||
|
QTimer::singleShot(250, this, SLOT(zoomFit()));
|
||||||
|
first_activation_ = false;
|
||||||
|
}
|
||||||
|
return(QGraphicsView::event(event));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Load the \a tbt title block template.
|
Load the \a tbt title block template.
|
||||||
If a different template was previously loaded, it is deleted.
|
If a different template was previously loaded, it is deleted.
|
||||||
@ -763,11 +829,11 @@ void TitleBlockTemplateView::updateLastContextMenuCell(HelperCell *last_context_
|
|||||||
Adjusts the bounding rect of the scene.
|
Adjusts the bounding rect of the scene.
|
||||||
*/
|
*/
|
||||||
void TitleBlockTemplateView::adjustSceneRect() {
|
void TitleBlockTemplateView::adjustSceneRect() {
|
||||||
QRectF old_scene_rect = sceneRect();
|
QRectF old_scene_rect = scene() -> sceneRect();
|
||||||
|
|
||||||
// rectangle including everything on the scene
|
// rectangle including everything on the scene
|
||||||
QRectF bounding_rect = scene() -> itemsBoundingRect();
|
QRectF bounding_rect(QPointF(0, 0), templateSize());
|
||||||
setSceneRect(bounding_rect);
|
scene() -> setSceneRect(bounding_rect);
|
||||||
|
|
||||||
// met a jour la scene
|
// met a jour la scene
|
||||||
scene() -> update(old_scene_rect.united(bounding_rect));
|
scene() -> update(old_scene_rect.united(bounding_rect));
|
||||||
|
@ -46,12 +46,17 @@ class TitleBlockTemplateView : public QGraphicsView {
|
|||||||
virtual QList<TitleBlockCell *> selectedCells() const;
|
virtual QList<TitleBlockCell *> selectedCells() const;
|
||||||
virtual TitleBlockTemplateCellsSet selectedCellsSet() const;
|
virtual TitleBlockTemplateCellsSet selectedCellsSet() const;
|
||||||
virtual TitleBlockTemplateCellsSet cells(const QRectF &) const;
|
virtual TitleBlockTemplateCellsSet cells(const QRectF &) const;
|
||||||
|
virtual QSizeF templateSize() const;
|
||||||
|
virtual qreal templateWidth() const;
|
||||||
|
virtual qreal templateHeight() const;
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setTitleBlockTemplate(TitleBlockTemplate *);
|
void setTitleBlockTemplate(TitleBlockTemplate *);
|
||||||
void selectionChanged();
|
void selectionChanged();
|
||||||
void zoomIn();
|
void zoomIn();
|
||||||
void zoomOut();
|
void zoomOut();
|
||||||
|
void zoomFit();
|
||||||
|
void zoomReset();
|
||||||
void addColumnBefore();
|
void addColumnBefore();
|
||||||
void addRowBefore();
|
void addRowBefore();
|
||||||
void addColumnAfter();
|
void addColumnAfter();
|
||||||
@ -82,6 +87,7 @@ class TitleBlockTemplateView : public QGraphicsView {
|
|||||||
virtual void wheelEvent(QWheelEvent *);
|
virtual void wheelEvent(QWheelEvent *);
|
||||||
virtual qreal zoomFactor() const;
|
virtual qreal zoomFactor() const;
|
||||||
virtual void fillWithEmptyCells();
|
virtual void fillWithEmptyCells();
|
||||||
|
virtual bool event(QEvent *);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void selectedCellsChanged(QList<TitleBlockCell *>);
|
void selectedCellsChanged(QList<TitleBlockCell *>);
|
||||||
@ -118,5 +124,6 @@ class TitleBlockTemplateView : public QGraphicsView {
|
|||||||
HelperCell *last_context_menu_cell_;
|
HelperCell *last_context_menu_cell_;
|
||||||
int apply_columns_widths_count_;
|
int apply_columns_widths_count_;
|
||||||
int apply_rows_heights_count_;
|
int apply_rows_heights_count_;
|
||||||
|
bool first_activation_; ///< Boolean used to detect the first display of this widget
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -665,7 +665,7 @@ QString TitleBlockTemplate::name() const {
|
|||||||
*/
|
*/
|
||||||
int TitleBlockTemplate::rowDimension(int i) {
|
int TitleBlockTemplate::rowDimension(int i) {
|
||||||
int index = (i == -1) ? rows_heights_.count() - 1 : i;
|
int index = (i == -1) ? rows_heights_.count() - 1 : i;
|
||||||
if (index >= 0 || index < rows_heights_.count()) {
|
if (index >= 0 && index < rows_heights_.count()) {
|
||||||
return(rows_heights_.at(index));
|
return(rows_heights_.at(index));
|
||||||
}
|
}
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -689,7 +689,7 @@ void TitleBlockTemplate::setRowDimension(int i, const TitleBlockDimension &dimen
|
|||||||
*/
|
*/
|
||||||
TitleBlockDimension TitleBlockTemplate::columnDimension(int i) {
|
TitleBlockDimension TitleBlockTemplate::columnDimension(int i) {
|
||||||
int index = (i == -1) ? columns_width_.count() - 1 : i;
|
int index = (i == -1) ? columns_width_.count() - 1 : i;
|
||||||
if (index >= 0 || index < columns_width_.count()) {
|
if (index >= 0 && index < columns_width_.count()) {
|
||||||
return(columns_width_.at(index));
|
return(columns_width_.at(index));
|
||||||
}
|
}
|
||||||
return(TitleBlockDimension(-1));
|
return(TitleBlockDimension(-1));
|
||||||
@ -764,6 +764,18 @@ QList<int> TitleBlockTemplate::rowsHeights() const {
|
|||||||
return(rows_heights_);
|
return(rows_heights_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
@return the total effective width of this template
|
||||||
|
@param total_width The total width initially planned for the rendering
|
||||||
|
*/
|
||||||
|
int TitleBlockTemplate::width(int total_width) {
|
||||||
|
int width = 0;
|
||||||
|
foreach (int col_width, columnsWidth(total_width)) {
|
||||||
|
width += col_width;
|
||||||
|
}
|
||||||
|
return(width);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@return the total height of this template
|
@return the total height of this template
|
||||||
*/
|
*/
|
||||||
|
@ -58,6 +58,7 @@ class TitleBlockTemplate : public QObject {
|
|||||||
int rowsCount() const;
|
int rowsCount() const;
|
||||||
QList<int> columnsWidth(int) const;
|
QList<int> columnsWidth(int) const;
|
||||||
QList<int> rowsHeights() const;
|
QList<int> rowsHeights() const;
|
||||||
|
int width(int);
|
||||||
int height() const;
|
int height() const;
|
||||||
|
|
||||||
bool moveRow(int, int);
|
bool moveRow(int, int);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user