From 825fc88c4025c56057528a6bf8e99abb4edd50ed Mon Sep 17 00:00:00 2001 From: David Rosca Date: Sun, 21 Jan 2018 16:47:38 +0100 Subject: [PATCH] BookmarksToolBarButton: Don't change height in sizeHint --- src/lib/bookmarks/bookmarkstoolbarbutton.cpp | 15 +++++++-------- src/lib/bookmarks/bookmarkstoolbarbutton.h | 7 +++---- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/lib/bookmarks/bookmarkstoolbarbutton.cpp b/src/lib/bookmarks/bookmarkstoolbarbutton.cpp index 8dcd27f34..06aca3413 100644 --- a/src/lib/bookmarks/bookmarkstoolbarbutton.cpp +++ b/src/lib/bookmarks/bookmarkstoolbarbutton.cpp @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2014 David Rosca +* Copyright (C) 2014-2018 David Rosca * * 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() diff --git a/src/lib/bookmarks/bookmarkstoolbarbutton.h b/src/lib/bookmarks/bookmarkstoolbarbutton.h index 05faf29ae..3de83c083 100644 --- a/src/lib/bookmarks/bookmarkstoolbarbutton.h +++ b/src/lib/bookmarks/bookmarkstoolbarbutton.h @@ -1,6 +1,6 @@ /* ============================================================ * Falkon - Qt web browser -* Copyright (C) 2014 David Rosca +* Copyright (C) 2014-2018 David Rosca * * 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();