Skip to content

Commit

Permalink
feat: [mainwindow] optimized ui of mainWindow
Browse files Browse the repository at this point in the history
reduce width of separator between docks

Log: as title
  • Loading branch information
LiHua000 committed Nov 21, 2024
1 parent 0fc225d commit 4882bb7
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/plugins/core/uicontroller/controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ void Controller::initNavigationBar()
d->navigationToolBar->hide();

vLayout->addWidget(d->navigationBar);
vLayout->setContentsMargins(0, 0, 2, 0);
vLayout->setContentsMargins(0, 0, 1, 0);
}

void Controller::initContextWidget()
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/core/uicontroller/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ MainWindow::MainWindow(QWidget *parent)
setWindowIcon(QIcon::fromTheme("ide"));
setAttribute(Qt::WA_DeleteOnClose);

setStyle(new CustomStyle());
addTopToolBar();
setContextMenuPolicy(Qt::NoContextMenu); //donot show left toolbar`s contextmenu
//setStyleSheet("QMainWindow::separator { width: 2px; margin: 0px; padding: 0px; }");

setCorner(Qt::Corner::BottomLeftCorner, Qt::DockWidgetArea::LeftDockWidgetArea);
setCorner(Qt::Corner::TopLeftCorner, Qt::DockWidgetArea::LeftDockWidgetArea);
Expand Down
14 changes: 14 additions & 0 deletions src/plugins/core/uicontroller/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,27 @@
#include <DMainWindow>
#include <DMenu>
#include <DDockWidget>
#include <DStyle>

#include <QObject>
#include <QWidgetList>
#include <QMap>
#include <QString>

DWIDGET_USE_NAMESPACE

class CustomStyle : public DStyle
{
public:
explicit CustomStyle() : DStyle() { }
int pixelMetric(QStyle::PixelMetric m, const QStyleOption *opt = nullptr, const QWidget *widget = nullptr) const override
{
if (m == PM_DockWidgetSeparatorExtent)
return 2;
return DStyle::pixelMetric(m, opt, widget);
}
};

using dpfservice::Position;
class MainWindowPrivate;
class MainWindow : public DMainWindow
Expand Down
1 change: 1 addition & 0 deletions src/plugins/project/mainframe/projecttree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ProjectTree::ProjectTree(QWidget *parent)
{
setLineWidth(0);
setContentsMargins(0, 0, 0, 0);
setFrameShape(QFrame::NoFrame);
DStyle::setFrameRadius(this, 0);
setIconSize(QSize(16, 16));

Expand Down
1 change: 1 addition & 0 deletions src/plugins/symbol/mainframe/symboltreeview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ SymbolTreeView::SymbolTreeView(DWidget *parent)
: DTreeView(parent), d(new SymbolTreeViewPrivate(this))
{
setLineWidth(0);
setFrameShape(QFrame::NoFrame);

d->model = new SymbolModel();
DTreeView::setModel(d->model);
Expand Down

0 comments on commit 4882bb7

Please sign in to comment.