Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Label alignment in composer #12928

Closed
qgib opened this issue Jul 6, 2010 · 3 comments
Closed

Label alignment in composer #12928

qgib opened this issue Jul 6, 2010 · 3 comments

Comments

@qgib
Copy link
Contributor

qgib commented Jul 6, 2010

Author Name: Médéric RIBREUX (Médéric RIBREUX)
Original Redmine Issue: 2868

Assignee: Marco Hugentobler


One new feature that would be good is the support of label alignment in the composer.

When you have created a label, you can't align it to the right or to the middle of the "label bloc". By default it is only aligned on the left side.

Furthermore, the upper and lower alignment could also be implemented (perhaps on a second time).


@qgib
Copy link
Contributor Author

qgib commented Jul 11, 2010

Author Name: Médéric RIBREUX (Médéric RIBREUX)


I tried to code this enhancement. The attachement is a png file which shows what could be a centered (horizontally) label in the composer.

After looking into the code, the source files that need to be modified are in src/core/composer:

*** qgscomposerlabel.cpp (alignment attributes)
*** qgscomposeritem.cpp (effective printing)

For the moment here is how I implement it:

** the QPainter->drawText (QT native) already deals with vertical and horizontal alignment.
** all we have to do is to pass the good args
** I have add a halign and a valign attributes in [[QgsComposerLabel]] class in order to deals with horizontal and vertical alignements
** those attributes are "text" formatted as I think that it is important to specify rather "center", "left or "right" (human readable in the qpt file) instead of the OR value from the mix of QT::AlignHCenter, QT::AlignLeft or QT::AlignRight values. This is only my point of view and it can be changed to the constant values OR number (easier to implement in the code cause you don't have to convert Strings to QT::Alignxxxx values).
** I have add a new [[QgsComposerItem]]::drawText function which uses alignements args

My next operation is a GUI implementation of this...

I will post a patch as soon as possible !

@qgib
Copy link
Contributor Author

qgib commented Jul 12, 2010

Author Name: Médéric RIBREUX (Médéric RIBREUX)


Here is a patch with my implementation.

What has been done:
*** You can verticaly and horizontaly align labels text.
*** GUI controls are implemented too (needs to be translated).
*** Alignment attributes can be written/read in/from qpt files.

What needs to be done:
*** A composer guru should evaluate the patch
*** the translation files need to be regenerated (with update_ts_files.sh script)
*** commit... or more fixes !

@qgib
Copy link
Contributor Author

qgib commented Jul 19, 2010

Author Name: Marco Hugentobler (@mhugent)


Applied in f05eefd (SVN r13939) with modifications. Thanks, medspx!


  • resolution was configured as fixed
  • status_id was changed from Open to Closed

@qgib qgib added this to the Version 1.6.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant