mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 02:36:34 +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:
parent
e4c2194177
commit
bce5ef9a2e
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user