From 6c7226778805694256ee7b34427525be62e32e38 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 7 Dec 2016 22:01:58 +0800 Subject: [PATCH] add padding to QTreeWidgetItem and QListWidgetItem Signed-off-by: Le Tan --- src/resources/icons/current_tab.svg | 8 ++++++++ src/resources/vnote.qss | 16 +++++++++++++--- src/veditwindow.cpp | 10 +++++++--- src/vnote.qrc | 1 + 4 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 src/resources/icons/current_tab.svg diff --git a/src/resources/icons/current_tab.svg b/src/resources/icons/current_tab.svg new file mode 100644 index 00000000..b51f8169 --- /dev/null +++ b/src/resources/icons/current_tab.svg @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/resources/vnote.qss b/src/resources/vnote.qss index 9680ce11..cca43e10 100644 --- a/src/resources/vnote.qss +++ b/src/resources/vnote.qss @@ -1,14 +1,14 @@ -QPushButton[OnMainWindow="true"] { +QPushButton[FlatBtn="true"] { padding: 3px; border: none; background-color: transparent; } -QPushButton[OnMainWindow="true"]::menu-indicator { +QPushButton[FlatBtn="true"]::menu-indicator { image: none; } -QPushButton[OnMainWindow="true"]::hover { +QPushButton[FlatBtn="true"]::hover { background-color: @hover-color; } @@ -73,3 +73,13 @@ QComboBox#NotebookSelector QListWidget::item:hover { background-color: @hover-color; } /* End QComboBox#NotebookSelector */ + +QTreeWidget::item { + padding-top: 3px; + padding-bottom: 3px; +} + +QListWidget::item { + padding-top: 3px; + padding-bottom: 3px; +} diff --git a/src/veditwindow.cpp b/src/veditwindow.cpp index bcffa22f..88f286d2 100644 --- a/src/veditwindow.cpp +++ b/src/veditwindow.cpp @@ -44,7 +44,7 @@ void VEditWindow::setupCornerWidget() rightBtn = new QPushButton(QIcon(":/resources/icons/corner_menu.svg"), "", this); - rightBtn->setProperty("OnMainWindow", true); + rightBtn->setProperty("FlatBtn", true); QMenu *rightMenu = new QMenu(this); rightMenu->addAction(splitAct); rightMenu->addAction(removeSplitAct); @@ -59,7 +59,7 @@ void VEditWindow::setupCornerWidget() this, &VEditWindow::tabListJump); leftBtn = new QPushButton(QIcon(":/resources/icons/corner_tablist.svg"), "", this); - leftBtn->setProperty("OnMainWindow", true); + leftBtn->setProperty("FlatBtn", true); QMenu *leftMenu = new QMenu(this); leftBtn->setMenu(leftMenu); setCornerWidget(leftBtn, Qt::TopLeftCorner); @@ -384,14 +384,18 @@ void VEditWindow::updateTabListMenu() delete tmpAct; } + int curTab = currentIndex(); QTabBar *tabbar = tabBar(); int nrTab = tabbar->count(); for (int i = 0; i < nrTab; ++i) { VEditTab *editor = getTab(i); QPointer file = editor->getFile(); - QAction *action = new QAction(file->getName(), tabListAct); + QAction *action = new QAction(tabbar->tabText(i), tabListAct); action->setStatusTip(generateTooltip(file)); action->setData(QVariant::fromValue(file)); + if (i == curTab) { + action->setIcon(QIcon(":/resources/icons/current_tab.svg")); + } menu->addAction(action); } } diff --git a/src/vnote.qrc b/src/vnote.qrc index 8c146490..278338f6 100644 --- a/src/vnote.qrc +++ b/src/vnote.qrc @@ -70,5 +70,6 @@ resources/icons/dir_item.svg resources/icons/notebook_item.svg resources/icons/arrow_dropdown.svg + resources/icons/current_tab.svg