Utils: Add "Layouting::HorizontalRule" LayoutItem

We have many horizontal separator lines in the UI, which are each time
repetitively created from a QFrame with some flags set. With the .ui
inlining, we will have more of these separators coming.

This change intoduces a Layouting::HorizontalRule LayoutItem and
replaces various existing QFarme separators with it.

Change-Id: I60bad89e2a2b777fbd2f9d0cf872af81e41dcfd7
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2022-08-26 23:18:00 +02:00
parent 4348960489
commit 912b016ab0
21 changed files with 56 additions and 111 deletions

View File

@@ -25,6 +25,7 @@
#include <utils/filepath.h>
#include <utils/fsengine/fileiconprovider.h>
#include <utils/hostosinfo.h>
#include <utils/layoutbuilder.h>
#include <utils/navigationtreeview.h>
#include <utils/qtcassert.h>
#include <utils/removefiledialog.h>
@@ -85,13 +86,6 @@ FolderNavigationWidgetFactory *FolderNavigationWidgetFactory::instance()
namespace Internal {
static QWidget *createHLine()
{
auto widget = new QFrame;
widget->setFrameStyle(QFrame::Plain | QFrame::HLine);
return widget;
}
// Call delayLayoutOnce to delay reporting the new heightForWidget by the double-click interval.
// Call setScrollBarOnce to set a scroll bar's value once during layouting (where heightForWidget
// is called).
@@ -318,7 +312,7 @@ FolderNavigationWidget::FolderNavigationWidget(QWidget *parent) : QWidget(parent
crumbLayout->setContentsMargins(4, 4, 4, 4);
crumbLayout->addWidget(m_crumbLabel);
crumbContainerLayout->addLayout(crumbLayout);
crumbContainerLayout->addWidget(createHLine());
crumbContainerLayout->addWidget(Layouting::createHr(this));
m_crumbLabel->setAlignment(Qt::AlignLeft | Qt::AlignTop);
auto layout = new QVBoxLayout();