Add option to display tabs on the right and bottom (#3847)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
Daniel Sage
2022-07-23 10:09:12 -04:00
committed by GitHub
parent 3b9ac7456a
commit c58552781d
6 changed files with 322 additions and 74 deletions
+8 -3
View File
@@ -17,7 +17,7 @@ class NotebookButton;
class NotebookTab;
class SplitContainer;
enum NotebookTabDirection { Horizontal = 0, Vertical = 1 };
enum NotebookTabLocation { Top = 0, Left = 1, Right = 2, Bottom = 3 };
class Notebook : public BaseWidget
{
@@ -58,7 +58,7 @@ public:
void performLayout(bool animate = false);
void setTabDirection(NotebookTabDirection direction);
void setTabLocation(NotebookTabLocation location);
bool isNotebookLayoutLocked() const;
void setLockNotebookLayout(bool value);
@@ -86,12 +86,17 @@ protected:
}
private:
void resizeAddButton();
bool containsPage(QWidget *page);
Item &findItem(QWidget *page);
static bool containsChild(const QObject *obj, const QObject *child);
NotebookTab *getTabFromPage(QWidget *page);
// Returns the number of buttons in `customButtons_` that are visible
size_t visibleButtonCount() const;
QList<Item> items_;
QMenu menu_;
QWidget *selectedPage_ = nullptr;
@@ -104,7 +109,7 @@ private:
bool showAddButton_ = false;
int lineOffset_ = 20;
bool lockNotebookLayout_ = false;
NotebookTabDirection tabDirection_ = NotebookTabDirection::Horizontal;
NotebookTabLocation tabLocation_ = NotebookTabLocation::Top;
QAction *lockNotebookLayoutAction_;
};