代码拉取完成,页面将自动刷新
#include "CButtonBasedEditor.h"
#include <QHBoxLayout>
#include <QEvent>
CButtonBasedEditor::CButtonBasedEditor(QWidget *hostedEditor, QWidget *parent) :
QWidget(parent),
m_hostedEditor(hostedEditor)
{
QHBoxLayout* hbl = new QHBoxLayout();
hbl->setContentsMargins(0,0,0,0);
hbl->setSpacing(0);
setLayout(hbl);
hbl->addWidget(m_hostedEditor);
m_button = new QToolButton(this);
m_button->setText("...");
hbl->addWidget(m_button);
connect(m_button, SIGNAL(clicked()), this, SLOT(onEditButtonActivated()));
}
CButtonBasedEditor::~CButtonBasedEditor()
{
layout()->removeWidget(m_hostedEditor);
m_hostedEditor->setParent(NULL);
m_hostedEditor->hide();
}
void CButtonBasedEditor::enableButton(bool on)
{
m_button->setVisible(on);
}
bool CButtonBasedEditor::event(QEvent *e)
{
if (e->type() == QEvent::FocusIn)
{
m_hostedEditor->setFocus();
e->accept();
return true;
}
return QWidget::event(e);
}
void CButtonBasedEditor::showEvent(QShowEvent *e)
{
QWidget::showEvent(e);
m_hostedEditor->show();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。