1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Circles: Fix crash when creating in category where it's not visible

This commit is contained in:
TheSpiritXIII 2015-06-19 08:01:50 -04:00 committed by tux3
parent 7f7ab9a1bc
commit 484a9ea87e
3 changed files with 18 additions and 1 deletions

View File

@ -378,8 +378,8 @@ void FriendListWidget::addCircleWidget(FriendWidget* friendWidget)
} }
Widget::getInstance()->searchCircle(circleWidget); Widget::getInstance()->searchCircle(circleWidget);
circleWidget->editName();
} }
circleWidget->editName();
} }
void FriendListWidget::removeCircleWidget(CircleWidget* widget) void FriendListWidget::removeCircleWidget(CircleWidget* widget)

View File

@ -46,8 +46,23 @@ CroppingLabel::CroppingLabel(QWidget* parent)
| Qt::ImhNoPredictiveText | Qt::ImhNoPredictiveText
| Qt::ImhPreferLatin); | Qt::ImhPreferLatin);
installEventFilter(this);
textEdit->installEventFilter(this);
connect(textEdit, &QLineEdit::editingFinished, this, &CroppingLabel::editingFinished); connect(textEdit, &QLineEdit::editingFinished, this, &CroppingLabel::editingFinished);
} }
#include <QDebug>
bool CroppingLabel::eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::FocusOut)
{
qDebug() << "Focus out changed!";
textEdit->clearFocus();
emit editingFinished();
return true;
}
return false;
}
void CroppingLabel::editBegin() void CroppingLabel::editBegin()
{ {

View File

@ -29,6 +29,7 @@ class CroppingLabel : public QLabel
Q_OBJECT Q_OBJECT
public: public:
explicit CroppingLabel(QWidget* parent = 0); explicit CroppingLabel(QWidget* parent = 0);
bool eventFilter(QObject *, QEvent *) override;
void editBegin(); void editBegin();
void setEditable(bool editable); void setEditable(bool editable);
@ -37,6 +38,7 @@ public:
void setText(const QString& text); void setText(const QString& text);
QString fullText(); ///< Returns the un-cropped text QString fullText(); ///< Returns the un-cropped text
public slots: public slots:
void minimizeMaximumWidth(); void minimizeMaximumWidth();