add padding to QTreeWidgetItem and QListWidgetItem

Signed-off-by: Le Tan <tamlokveer@gmail.com>
This commit is contained in:
Le Tan 2016-12-07 22:01:58 +08:00
parent e32ee1fa90
commit 6c72267788
4 changed files with 29 additions and 6 deletions

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.2.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="512px" height="512px" viewBox="0 0 512 512" style="enable-background:new 0 0 512 512;" xml:space="preserve">
<path d="M184.7,413.1l2.1-1.8l156.5-136c5.3-4.6,8.6-11.5,8.6-19.2c0-7.7-3.4-14.6-8.6-19.2L187.1,101l-2.6-2.3
C182,97,179,96,175.8,96c-8.7,0-15.8,7.4-15.8,16.6h0v286.8h0c0,9.2,7.1,16.6,15.8,16.6C179.1,416,182.2,414.9,184.7,413.1z"/>
</svg>

After

Width:  |  Height:  |  Size: 725 B

View File

@ -1,14 +1,14 @@
QPushButton[OnMainWindow="true"] { QPushButton[FlatBtn="true"] {
padding: 3px; padding: 3px;
border: none; border: none;
background-color: transparent; background-color: transparent;
} }
QPushButton[OnMainWindow="true"]::menu-indicator { QPushButton[FlatBtn="true"]::menu-indicator {
image: none; image: none;
} }
QPushButton[OnMainWindow="true"]::hover { QPushButton[FlatBtn="true"]::hover {
background-color: @hover-color; background-color: @hover-color;
} }
@ -73,3 +73,13 @@ QComboBox#NotebookSelector QListWidget::item:hover {
background-color: @hover-color; background-color: @hover-color;
} }
/* End QComboBox#NotebookSelector */ /* End QComboBox#NotebookSelector */
QTreeWidget::item {
padding-top: 3px;
padding-bottom: 3px;
}
QListWidget::item {
padding-top: 3px;
padding-bottom: 3px;
}

View File

@ -44,7 +44,7 @@ void VEditWindow::setupCornerWidget()
rightBtn = new QPushButton(QIcon(":/resources/icons/corner_menu.svg"), rightBtn = new QPushButton(QIcon(":/resources/icons/corner_menu.svg"),
"", this); "", this);
rightBtn->setProperty("OnMainWindow", true); rightBtn->setProperty("FlatBtn", true);
QMenu *rightMenu = new QMenu(this); QMenu *rightMenu = new QMenu(this);
rightMenu->addAction(splitAct); rightMenu->addAction(splitAct);
rightMenu->addAction(removeSplitAct); rightMenu->addAction(removeSplitAct);
@ -59,7 +59,7 @@ void VEditWindow::setupCornerWidget()
this, &VEditWindow::tabListJump); this, &VEditWindow::tabListJump);
leftBtn = new QPushButton(QIcon(":/resources/icons/corner_tablist.svg"), leftBtn = new QPushButton(QIcon(":/resources/icons/corner_tablist.svg"),
"", this); "", this);
leftBtn->setProperty("OnMainWindow", true); leftBtn->setProperty("FlatBtn", true);
QMenu *leftMenu = new QMenu(this); QMenu *leftMenu = new QMenu(this);
leftBtn->setMenu(leftMenu); leftBtn->setMenu(leftMenu);
setCornerWidget(leftBtn, Qt::TopLeftCorner); setCornerWidget(leftBtn, Qt::TopLeftCorner);
@ -384,14 +384,18 @@ void VEditWindow::updateTabListMenu()
delete tmpAct; delete tmpAct;
} }
int curTab = currentIndex();
QTabBar *tabbar = tabBar(); QTabBar *tabbar = tabBar();
int nrTab = tabbar->count(); int nrTab = tabbar->count();
for (int i = 0; i < nrTab; ++i) { for (int i = 0; i < nrTab; ++i) {
VEditTab *editor = getTab(i); VEditTab *editor = getTab(i);
QPointer<VFile> file = editor->getFile(); QPointer<VFile> file = editor->getFile();
QAction *action = new QAction(file->getName(), tabListAct); QAction *action = new QAction(tabbar->tabText(i), tabListAct);
action->setStatusTip(generateTooltip(file)); action->setStatusTip(generateTooltip(file));
action->setData(QVariant::fromValue(file)); action->setData(QVariant::fromValue(file));
if (i == curTab) {
action->setIcon(QIcon(":/resources/icons/current_tab.svg"));
}
menu->addAction(action); menu->addAction(action);
} }
} }

View File

@ -70,5 +70,6 @@
<file>resources/icons/dir_item.svg</file> <file>resources/icons/dir_item.svg</file>
<file>resources/icons/notebook_item.svg</file> <file>resources/icons/notebook_item.svg</file>
<file>resources/icons/arrow_dropdown.svg</file> <file>resources/icons/arrow_dropdown.svg</file>
<file>resources/icons/current_tab.svg</file>
</qresource> </qresource>
</RCC> </RCC>