mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
TabManager: show add tab button on window item under mouse.
This commit is contained in:
parent
457d32ae82
commit
47e2c8c1f0
BIN
src/plugins/TabManager/data/addtab.png
Normal file
BIN
src/plugins/TabManager/data/addtab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 657 B |
|
@ -64,12 +64,13 @@ void TabManagerDelegate::paint(QPainter* painter, const QStyleOptionViewItem &op
|
|||
|
||||
// draw close button
|
||||
if (index.column() == 1) {
|
||||
if (index.parent().isValid() && opt.state & QStyle::State_MouseOver) {
|
||||
if (opt.state & QStyle::State_MouseOver) {
|
||||
static const int buttonSize = 16;
|
||||
static const QPixmap closeTabButton(":tabmanager/data/closetab.png");
|
||||
static const QPixmap addTabButton(":tabmanager/data/addtab.png");
|
||||
|
||||
const QRect rect(opt.rect.right() - buttonSize, (opt.rect.height() - buttonSize) / 2 + opt.rect.y(), buttonSize, buttonSize);
|
||||
painter->drawPixmap(style->visualRect(direction, opt.rect, rect), closeTabButton);
|
||||
painter->drawPixmap(style->visualRect(direction, opt.rect, rect), (index.parent().isValid() ? closeTabButton : addTabButton));
|
||||
}
|
||||
|
||||
painter->restore();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<file>data/tab-pinned.png</file>
|
||||
<file>data/side-by-side.png</file>
|
||||
<file>data/closetab.png</file>
|
||||
<file>data/addtab.png</file>
|
||||
<file>locale/ar_SA.qm</file>
|
||||
<file>locale/bg_BG.qm</file>
|
||||
<file>locale/ca_ES.qm</file>
|
||||
|
|
|
@ -222,8 +222,11 @@ void TabManagerWidget::onItemActivated(QTreeWidgetItem* item, int column)
|
|||
return;
|
||||
}
|
||||
|
||||
if (column == 1 && item->childCount() == 0 && tabWidget) {
|
||||
if (column == 1) {
|
||||
if (item->childCount() == 0 && tabWidget)
|
||||
mainWindow->tabWidget()->requestCloseTab(mainWindow->tabWidget()->indexOf(tabWidget));
|
||||
else if (item->childCount() > 0)
|
||||
QMetaObject::invokeMethod(mainWindow, "addTab");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user