diff options
author | Tobias Markmann <tm@ayena.de> | 2014-11-25 14:07:29 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2014-12-14 14:44:00 (GMT) |
commit | b4a54583c4d575fe152122c21da616c3c942bbfd (patch) | |
tree | 7e558fd9cb75291f4d5eec90da9d8dd5650ceea2 /Swift/QtUI/Trellis/QtGridSelectionDialog.h | |
parent | 92672e17a52d0c86e693183627c8c6b8fa44fb86 (diff) | |
download | swift-b4a54583c4d575fe152122c21da616c3c942bbfd.zip swift-b4a54583c4d575fe152122c21da616c3c942bbfd.tar.bz2 |
Add support for new trellis layout for chat windows.
This includes dynamic customizable grid layouting of chat tabs including:
- arrengement of tabs via menu, keyboard shortcuts or drag'n'drop
- change of grid size via mouse or keyboard
- save/restore of grid size and positions of chats inside the grid
Test-Information:
Tested on OS X 10.9.8.
Change-Id: I43f94293a1c672971640c3000abfc6530f2ea7a8
Diffstat (limited to 'Swift/QtUI/Trellis/QtGridSelectionDialog.h')
-rw-r--r-- | Swift/QtUI/Trellis/QtGridSelectionDialog.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.h b/Swift/QtUI/Trellis/QtGridSelectionDialog.h new file mode 100644 index 0000000..430189a --- /dev/null +++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <QSize> +#include <QWidget> + +namespace Swift { + + class QtGridSelectionDialog : public QWidget { + Q_OBJECT + + Q_PROPERTY(QSize currentGridSize READ getCurrentGridSize WRITE setCurrentGridSize NOTIFY currentGridSizeChanged) + Q_PROPERTY(QSize minGridSize READ getMinGridSize WRITE setMinGridSize NOTIFY minGridSizeChanged) + Q_PROPERTY(QSize maxGridSize READ getMaxGridSize WRITE setMaxGridSize NOTIFY maxGridSizeChanged) + public: + explicit QtGridSelectionDialog(QWidget* parent = 0); + + virtual QSize sizeHint() const; + + void setCurrentGridSize(const QSize& size); + QSize getCurrentGridSize() const; + void setMinGridSize(const QSize& size); + QSize getMinGridSize() const; + void setMaxGridSize(const QSize& size); + QSize getMaxGridSize() const; + + signals: + void currentGridSizeChanged(QSize); + void minGridSizeChanged(QSize); + void maxGridSizeChanged(QSize); + + protected: + void keyReleaseEvent(QKeyEvent* event); + void mousePressEvent(QMouseEvent* event); + void mouseMoveEvent(QMouseEvent* event); + void paintEvent(QPaintEvent* event); + void showEvent(QShowEvent* event); + void hideEvent(QHideEvent* event); + void leaveEvent(QEvent *event); + + private: + int padding; + int horizontalMargin; + int verticalMargin; + + QSize frameSize; + + QSize currentGridSize; + QSize minGridSize; + QSize maxGridSize; + }; +} |