1 Star 0 Fork 0

fuchaow/Property-Editor

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
CButtonBasedEditor.cpp 1.14 KB
一键复制 编辑 原始数据 按行查看 历史
Shujaat 提交于 2019-10-27 19:22 . Add files via upload
#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();
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/fuchaow/Property-Editor.git
git@gitee.com:fuchaow/Property-Editor.git
fuchaow
Property-Editor
Property-Editor
master

搜索帮助