diff options
Diffstat (limited to 'Swift/QtUI/Trellis/QtDynamicGridLayout.h')
-rw-r--r-- | Swift/QtUI/Trellis/QtDynamicGridLayout.h | 98 |
1 files changed, 50 insertions, 48 deletions
diff --git a/Swift/QtUI/Trellis/QtDynamicGridLayout.h b/Swift/QtUI/Trellis/QtDynamicGridLayout.h index ed8a9fc..682ae41 100644 --- a/Swift/QtUI/Trellis/QtDynamicGridLayout.h +++ b/Swift/QtUI/Trellis/QtDynamicGridLayout.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2015 Isode Limited. + * Copyright (c) 2014-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -14,67 +14,69 @@ #include <QWidget> namespace Swift { - class QtTabbable; - class QtTabWidget; + class QtTabbable; + class QtTabWidget; - class QtDynamicGridLayout : public QWidget { - Q_OBJECT - public: - explicit QtDynamicGridLayout(QWidget* parent = 0, bool enableDND = false); - virtual ~QtDynamicGridLayout(); + class QtDynamicGridLayout : public QWidget { + Q_OBJECT + public: + explicit QtDynamicGridLayout(QWidget* parent = nullptr, bool enableDND = false); + virtual ~QtDynamicGridLayout(); - QSize getDimension() const; + QSize getDimension() const; - // emulate QtTabWidget API - int addTab(QtTabbable* tab, const QString& title); - void removeTab(int index); - int count() const; + // emulate QtTabWidget API + int addTab(QtTabbable* tab, const QString& title); + void removeTab(int index); + int count() const; - QWidget* widget(int index) const; - QWidget* currentWidget() const; - void setCurrentWidget(QWidget* widget); + QWidget* widget(int index) const; + QWidget* currentWidget() const; + void setCurrentWidget(QWidget* widget); - QtTabWidget* indexToTabWidget(int index, int& tabIndex); + QtTabWidget* indexToTabWidget(int index, int& tabIndex); - int indexOf(const QWidget* widget) const; - int currentIndex() const; - void setCurrentIndex(int index); + int indexOf(const QWidget* widget) const; + int currentIndex() const; + void setCurrentIndex(int index); - bool isDNDEnabled() const; + bool isDNDEnabled() const; - QHash<QString, QPoint> getTabPositions() const; - void setTabPositions(const QHash<QString, QPoint> positions); + QHash<QString, QPoint> getTabPositions() const; + void setTabPositions(const QHash<QString, QPoint> positions); - bool eventFilter(QObject* object, QEvent* event); + bool eventFilter(QObject* object, QEvent* event); - signals: - void tabCloseRequested(int index); - void onCurrentIndexChanged(int newIndex); + signals: + void tabCloseRequested(int index); + void onCurrentIndexChanged(int newIndex); - public slots: - void setDimensions(const QSize& dim); + public slots: + void setDimensions(const QSize& dim); - // Tab Management - void moveCurrentTabRight(); - void moveCurrentTabLeft(); - void moveCurrentTabToNextGroup(); - void moveCurrentTabToPreviousGroup(); + // Tab Management + void moveCurrentTabRight(); + void moveCurrentTabLeft(); + void moveCurrentTabToNextGroup(); + void moveCurrentTabToPreviousGroup(); - void updateTabPositions(); + void updateTabPositions(); - private slots: - void handleTabCloseRequested(int index); - void handleTabCurrentChanged(int index); - void handleApplicationFocusChanged(QWidget* oldFocus, QWidget* newFocus); + private slots: + void handleTabCloseRequested(int index); + void handleTabCurrentChanged(int index); + void handleApplicationFocusChanged(QWidget* oldFocus, QWidget* newFocus); - private: - void moveTab(QtTabWidget* tabWidget, int oldIndex, int newIndex); - QtTabWidget* createDNDTabWidget(QWidget* parent); + private: + void moveTab(QtTabWidget* tabWidget, int oldIndex, int newIndex); + QtTabWidget* createDNDTabWidget(QWidget* parent); + void updateEmphasiseFocusOnTabs(); - private: - QGridLayout *gridLayout_; - bool dndEnabled_; - QHash<QString, QPoint> tabPositions_; - QtTabbable* movingTab_; - }; + private: + QGridLayout *gridLayout_; + bool dndEnabled_; + QHash<QString, QPoint> tabPositions_; + QtTabbable* movingTab_; + bool resizing_ = false; + }; } |