TopicWidget::TopicWidget(QWidget *parent) : AbstractItemView(parent) { ui.setupUi(this); ui.topicEditButton->setIcon(SmallIcon("edit-rename")); ui.topicLineEdit->setLineWrapEnabled(true); ui.topicLineEdit->installEventFilter(this); connect(ui.topicLabel, SIGNAL(clickableActivated(Clickable)), SLOT(clickableActivated(Clickable))); connect(ui.topicLineEdit, SIGNAL(noTextEntered()), SLOT(on_topicLineEdit_textEntered())); UiSettings s("TopicWidget"); s.notify("DynamicResize", this, SLOT(updateResizeMode())); s.notify("ResizeOnHover", this, SLOT(updateResizeMode())); updateResizeMode(); UiStyleSettings fs("Fonts"); fs.notify("UseCustomTopicWidgetFont", this, SLOT(setUseCustomFont(QVariant))); fs.notify("TopicWidget", this, SLOT(setCustomFont(QVariant))); if (fs.value("UseCustomTopicWidgetFont", false).toBool()) setCustomFont(fs.value("TopicWidget", QFont())); _mouseEntered = false; _readonly = false; }
void StyledLabel::mousePressEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton) { Clickable click = _clickables.atCursorPos(posToCursor(event->posF())); if (click.isValid()) emit clickableActivated(click); } }