1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 18:56:34 +01:00

BookmarksToolBarButton: Don't change height in sizeHint

This commit is contained in:
David Rosca 2018-01-21 16:47:38 +01:00
parent 76116f636c
commit 825fc88c40
2 changed files with 10 additions and 12 deletions

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2014-2018 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -92,7 +92,9 @@ QSize BookmarksToolbarButton::sizeHint() const
}
}
return QSize(qMin(width, MAX_WIDTH), preferredHeight());
QSize s = QPushButton::sizeHint();
s.setWidth(qMin(width, MAX_WIDTH));
return s;
}
QSize BookmarksToolbarButton::minimumSizeHint() const
@ -109,12 +111,9 @@ QSize BookmarksToolbarButton::minimumSizeHint() const
width += PADDING + 8;
}
return QSize(width, preferredHeight());
}
int BookmarksToolbarButton::preferredHeight() const
{
return fontMetrics().height() + PADDING * 2;
QSize s = QPushButton::minimumSizeHint();
s.setWidth(width);
return s;
}
void BookmarksToolbarButton::createMenu()

View File

@ -1,6 +1,6 @@
/* ============================================================
* Falkon - Qt web browser
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
* Copyright (C) 2014-2018 David Rosca <nowrep@gmail.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -42,9 +42,8 @@ public:
bool showOnlyText() const;
void setShowOnlyText(bool show);
QSize sizeHint() const;
QSize minimumSizeHint() const;
int preferredHeight() const;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
private slots:
void createMenu();