This repository has been archived by the owner on Dec 14, 2021. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feature: add close tabs to the right, #822 #875
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b56d18d
first try to implement closeTabs toRight.
AlvoDa d193aaa
removed .kdev4
AlvoDa 62126f5
signals and slots mechanisms for closeTabstoRight now done correct.
AlvoDa 245431d
feature: add option to close tabs to the right on right-click context…
AlvoDa f6e28d6
indentation, whitespaces etc.
AlvoDa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
#include "QtTabBar.h" | ||
#include <QtContextMenu.h> | ||
#include <QtGraphicsView.h> | ||
#include <logging.h> | ||
#include <QContextMenuEvent> | ||
|
||
QtTabBar::QtTabBar(QWidget* parent): QTabBar(parent) | ||
{ | ||
|
@@ -19,3 +23,22 @@ QSize QtTabBar::minimumTabSizeHint(int index) const | |
{ | ||
return QSize(45, QTabBar::minimumTabSizeHint(index).height()); | ||
} | ||
|
||
void QtTabBar::contextMenuEvent(QContextMenuEvent* event) | ||
{ | ||
QtContextMenu menu(event, this); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Your whole implementation uses the wrong indentation. Please change everything to |
||
QAction * m_closeTabsToRight = new QAction("Close tabs to the right", this); | ||
menu.addAction(m_closeTabsToRight); | ||
|
||
connect(m_closeTabsToRight, &QAction::triggered, this, [&]() | ||
{ | ||
// We dont want to close tabs right of the current active tab. | ||
// No, our intend is to close tabs right of the currently hovered tab. | ||
auto tabNum = tabAt(event->pos()); | ||
LOG_INFO("Handling closeTabs... emitting signal to close tabs right of tab nr. " + std::to_string(tabNum)); | ||
emit signalCloseTabsToRight(tabNum); | ||
}); | ||
|
||
menu.show(); | ||
return; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -76,6 +76,7 @@ private slots: | |
|
||
void legendClicked(); | ||
|
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove this change. |
||
private: | ||
bool moves() const; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please follow convention:
For Qt headers we don't add '.h' e.g.
#include <QContextMenuEvent>
For own headers we use double quotations e.g.
#include "QtContextMenu.h"
Qt headers are placed above own headers (see other files)