1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

ComboTabBar: Implement sizeHint for CloseButton

CloseButton code is now identical to original QTabBar CloseButton.
Should help with #2328
This commit is contained in:
David Rosca 2018-02-16 11:46:46 +01:00
parent e4c2194177
commit bce5ef9a2e
No known key found for this signature in database
GPG Key ID: EBC3FC294452C6D8
2 changed files with 15 additions and 4 deletions

View File

@ -1816,6 +1816,15 @@ CloseButton::CloseButton(QWidget* parent)
setObjectName("combotabbar_tabs_close_button");
setFocusPolicy(Qt::NoFocus);
setCursor(Qt::ArrowCursor);
resize(sizeHint());
}
QSize CloseButton::sizeHint() const
{
ensurePolished();
int width = style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, this);
int height = style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, this);
return QSize(width, height);
}
void CloseButton::enterEvent(QEvent* event)

View File

@ -361,10 +361,12 @@ class CloseButton : public QAbstractButton
Q_OBJECT
public:
CloseButton(QWidget* parent = 0);
CloseButton(QWidget *parent = nullptr);
void enterEvent(QEvent* event);
void leaveEvent(QEvent* event);
void paintEvent(QPaintEvent* event);
QSize sizeHint() const override;
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
void paintEvent(QPaintEvent *event) override;
};
#endif // COMBOTABBAR_H