1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- #include "VTextEdit.h"
- VTextEdit::VTextEdit(QWidget *parent, CONTROL_PROPERTY* pProperty)
- : QTextEdit(parent)
- , VControlObject(pProperty)
- {
- // 设置默认属性(初始化值或者外部传入值)
- QTextEdit::setText(m_Property.m_strText);
- QTextEdit::setToolTip(m_Property.m_strTip);
- this->setTextColor(m_Property.m_clrText);
- this->setBgColor(m_Property.m_clrBg);
- QTextEdit::setFont(m_Property.m_Font);
- QTextEdit::setEnabled(m_Property.m_bEnable);
- }
- VTextEdit::~VTextEdit()
- {
- }
- // 属性的实现函数
- void VTextEdit::setText(const QString& title)
- {
- qDebug() << m_Property.m_strText;
- if (this->m_Property.m_strText != title)
- {
- this->m_Property.m_strText = title;
- QTextEdit::setText(title);
- }
- }
- void VTextEdit::setTip(const QString& tip)
- {
- if (this->m_Property.m_strTip != tip)
- {
- this->m_Property.m_strTip = tip;
- QTextEdit::setToolTip(tip);
- }
- }
- void VTextEdit::setTextColor(const QColor& color)
- {
- QString qss = VControlObject::textColorQss(color);
- this->setStyleSheet(qss);
- }
- void VTextEdit::setBgColor(const QColor& color)
- {
- QString qss = VControlObject::bgColorQss(color);
- this->setStyleSheet(qss);
- }
- void VTextEdit::setFont(const QFont& font)
- {
- if (this->m_Property.m_Font != font)
- {
- this->m_Property.m_Font = font;
- QTextEdit::setFont(font);
- }
- }
- void VTextEdit::setEnable(const bool enable)
- {
- if (this->m_Property.m_bEnable != enable)
- {
- this->m_Property.m_bEnable = enable;
- QTextEdit::setEnabled(enable);
- }
- }
|