mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-03-17 15:49:59 +01:00
Terminal strip item font is editable
The font used in the terminal strip item can be edited trough the terminal strip layout editor widget
This commit is contained in:
@@ -16,10 +16,12 @@
|
||||
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "terminalstriplayoutpattern.h"
|
||||
#include "../../../utils/qetutils.h"
|
||||
#include <QDebug>
|
||||
|
||||
TerminalStripLayoutPattern::TerminalStripLayoutPattern()
|
||||
{
|
||||
m_font.setPixelSize(15);
|
||||
updateHeaderTextOption();
|
||||
updateTerminalsTextOption();
|
||||
}
|
||||
@@ -39,6 +41,15 @@ QTextOption TerminalStripLayoutPattern::headerTextOption() const {
|
||||
return m_header_text_option;
|
||||
}
|
||||
|
||||
QFont TerminalStripLayoutPattern::font() const {
|
||||
return m_font;
|
||||
}
|
||||
|
||||
void TerminalStripLayoutPattern::setFont(const QFont &font) {
|
||||
m_font = font;
|
||||
QETUtils::pixelSizedFont(m_font);
|
||||
}
|
||||
|
||||
void TerminalStripLayoutPattern::setTerminalsTextAlignment(const QVector<Qt::Alignment> &alignment)
|
||||
{
|
||||
m_terminals_text_alignment = alignment;
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#ifndef TERMINALSTRIPLAYOUTPATTERN_H
|
||||
#define TERMINALSTRIPLAYOUTPATTERN_H
|
||||
|
||||
#include <QFont>
|
||||
#include <QRect>
|
||||
#include <QSize>
|
||||
#include <QTextOption>
|
||||
@@ -52,6 +53,10 @@ class TerminalStripLayoutPattern
|
||||
//Spacer between the header and the terminals
|
||||
QRect m_spacer_rect{0, 50, 10, 90};
|
||||
|
||||
//Font
|
||||
QFont font() const;
|
||||
void setFont (const QFont &font);
|
||||
|
||||
//Terminals
|
||||
QVector<QRect> m_terminal_rect
|
||||
{
|
||||
@@ -90,7 +95,8 @@ class TerminalStripLayoutPattern
|
||||
void updateHeaderTextOption();
|
||||
void updateTerminalsTextOption();
|
||||
|
||||
private:
|
||||
private:
|
||||
QFont m_font;
|
||||
Qt::Alignment m_header_text_alignment{Qt::AlignCenter};
|
||||
QTextOption m_header_text_option;
|
||||
|
||||
|
||||
@@ -56,6 +56,8 @@ void TerminalStripDrawer::paint(QPainter *painter)
|
||||
auto brush_ = painter->brush();
|
||||
brush_.setColor(Qt::white);
|
||||
|
||||
painter->setFont(m_pattern->font());
|
||||
|
||||
painter->setPen(pen_);
|
||||
painter->setBrush(brush_);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user