plasma: remove redundant Plasma::ItemStatus::NeedsAttentionStatus

is used by the panel view to force-activated applet windows but since it is
done on mouse press the window should become active anyway (unless there is
something like focus stealing prevention getting in the way)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-19 23:33:32 +03:00
parent 7ce4310781
commit aa8fa5abaf
9 changed files with 1 additions and 127 deletions

View file

@ -192,8 +192,7 @@ enum ItemStatus {
UnknownStatus = 0, /**< The status is unknown **/
PassiveStatus = 1, /**< The Item is passive **/
ActiveStatus = 2, /**< The Item is active **/
NeedsAttentionStatus = 3, /**< The Item needs attention **/
AcceptingInputStatus = 4 /**< The Item is accepting input **/
NeedsAttentionStatus = 3 /**< The Item needs attention **/
};
Q_ENUMS(ItemStatus)

View file

@ -108,18 +108,6 @@ void ComboBox::clear()
void ComboBox::focusOutEvent(QFocusEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::UnknownStatus);
}
if (nativeWidget()->isEditable()) {
QEvent closeEvent(QEvent::CloseSoftwareInputPanel);
if (qApp) {
@ -140,22 +128,6 @@ void ComboBox::changeEvent(QEvent *event)
QGraphicsProxyWidget::changeEvent(event);
}
void ComboBox::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::AcceptingInputStatus);
}
QGraphicsProxyWidget::mousePressEvent(event);
}
int ComboBox::count() const
{
return nativeWidget()->count();

View file

@ -115,7 +115,6 @@ Q_SIGNALS:
protected:
void focusOutEvent(QFocusEvent *event);
void changeEvent(QEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
private:
ComboBoxPrivate * const d;

View file

@ -130,22 +130,6 @@ void LineEdit::changeEvent(QEvent *event)
QGraphicsProxyWidget::changeEvent(event);
}
void LineEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::AcceptingInputStatus);
}
QGraphicsProxyWidget::mousePressEvent(event);
}
void LineEdit::focusInEvent(QFocusEvent *event)
{
QGraphicsProxyWidget::focusInEvent(event);
@ -153,24 +137,10 @@ void LineEdit::focusInEvent(QFocusEvent *event)
// as of Qt 4.7, apparently we have a bug here in QGraphicsProxyWidget
nativeWidget()->setFocus(event->reason());
}
emit focusChanged(true);
}
void LineEdit::focusOutEvent(QFocusEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::UnknownStatus);
}
if (qApp) {
if (QGraphicsView *view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {
if (view->scene() && view->scene() == scene()) {
@ -181,8 +151,6 @@ void LineEdit::focusOutEvent(QFocusEvent *event)
}
QGraphicsProxyWidget::focusOutEvent(event);
emit focusChanged(false);
}
} // namespace Plasma

View file

@ -100,7 +100,6 @@ public:
protected:
void changeEvent(QEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void focusInEvent(QFocusEvent *event);
void focusOutEvent(QFocusEvent *event);
@ -114,11 +113,6 @@ Q_SIGNALS:
* @since 4.4
*/
void textChanged(const QString &text);
/**
* Emitted when the widget receives or loses focus
* @since 4.7
*/
void focusChanged(bool focused);
private:
Q_PRIVATE_SLOT(d, void setPalette())

View file

@ -115,36 +115,8 @@ void SpinBox::changeEvent(QEvent *event)
QGraphicsProxyWidget::changeEvent(event);
}
void SpinBox::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::AcceptingInputStatus);
}
QGraphicsProxyWidget::mousePressEvent(event);
}
void SpinBox::focusOutEvent(QFocusEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::UnknownStatus);
}
QEvent closeEvent(QEvent::CloseSoftwareInputPanel);
if (qApp) {
if (QGraphicsView *view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {

View file

@ -70,7 +70,6 @@ public:
protected:
void changeEvent(QEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void focusOutEvent(QFocusEvent *event);
public Q_SLOTS:

View file

@ -126,36 +126,8 @@ void TextEdit::changeEvent(QEvent *event)
QGraphicsProxyWidget::changeEvent(event);
}
void TextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::AcceptingInputStatus);
}
QGraphicsProxyWidget::mousePressEvent(event);
}
void TextEdit::focusOutEvent(QFocusEvent *event)
{
QGraphicsWidget *widget = parentWidget();
Plasma::Applet *applet = qobject_cast<Plasma::Applet *>(widget);
while (!applet && widget) {
widget = widget->parentWidget();
applet = qobject_cast<Plasma::Applet *>(widget);
}
if (applet) {
applet->setStatus(Plasma::UnknownStatus);
}
QEvent closeEvent(QEvent::CloseSoftwareInputPanel);
if (qApp) {
if (QGraphicsView *view = qobject_cast<QGraphicsView*>(qApp->focusWidget())) {

View file

@ -96,7 +96,6 @@ Q_SIGNALS:
protected:
void changeEvent(QEvent *event);
void contextMenuEvent(QGraphicsSceneContextMenuEvent *event);
void mousePressEvent(QGraphicsSceneMouseEvent *event);
void focusOutEvent(QFocusEvent *event);
private: