summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2015-05-19 15:13:01 (GMT)
committerKevin Smith <kevin.smith@isode.com>2015-05-26 14:00:33 (GMT)
commitb765cc5e92913aa25848f845e64c7c3bd808ff50 (patch)
tree41b5c62dcb985da67b563ace1f7e6bc188c8b73a
parentc5309aa039984bcae78333939475aa8e27df82d6 (diff)
downloadswift-b765cc5e92913aa25848f845e64c7c3bd808ff50.zip
swift-b765cc5e92913aa25848f845e64c7c3bd808ff50.tar.bz2
Add visual resize indicator in bottom right corner of QtGridSelectionDialog
Test-Information: Tested on Mac OS X 10.9.5 with Qt 5.4. Change-Id: I7581ae478fb347bb468b28997be963799b82b2cb
-rw-r--r--Swift/QtUI/Trellis/QtGridSelectionDialog.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
index 30248b0..3bcdfa0 100644
--- a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
+++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp
@@ -1,34 +1,33 @@
/*
- * Copyright (c) 2014 Isode Limited.
+ * Copyright (c) 2014-2015 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
#include <Swift/QtUI/Trellis/QtGridSelectionDialog.h>
-#include <QStyle>
#include <QPaintEvent>
#include <QPainter>
+#include <QStyle>
#include <QStyleOptionFrame>
#include <QStyleOptionMenuItem>
+#include <QStyleOptionSizeGrip>
namespace Swift {
-QtGridSelectionDialog::QtGridSelectionDialog(QWidget* parent) : QWidget(parent)
-{
+QtGridSelectionDialog::QtGridSelectionDialog(QWidget* parent) : QWidget(parent) {
frameSize = QSize(23,23) * 2;
maxGridSize = QSize(7,7);
minGridSize = QSize(1,1);
currentGridSize = QSize(1,1);
padding = 4;
setWindowFlags(Qt::Popup);
- horizontalMargin = style()->pixelMetric(QStyle::PM_MenuVMargin);
- verticalMargin = style()->pixelMetric(QStyle::PM_MenuVMargin);
setCursor(Qt::SizeAllCursor);
+ horizontalMargin = style()->pixelMetric(QStyle::PM_MenuVMargin) * 2;
+ verticalMargin = style()->pixelMetric(QStyle::PM_MenuVMargin) * 2;
}
-QSize QtGridSelectionDialog::sizeHint() const
-{
+QSize QtGridSelectionDialog::sizeHint() const {
// PM_MenuVMargin | frameSize | ( padding | frameSize ) * | PM_MenuVMargin
int width = horizontalMargin + frameSize.width() + (padding + frameSize.width()) * (currentGridSize.width() - 1) + horizontalMargin;
int height = verticalMargin + frameSize.height() + (padding + frameSize.height()) * (currentGridSize.height() - 1) + verticalMargin;
@@ -107,6 +106,11 @@ void QtGridSelectionDialog::paintEvent(QPaintEvent*) {
style()->drawControl(QStyle::CE_MenuItem, &option, &painter, 0);
}
}
+
+ QStyleOptionSizeGrip sizeGripOption;
+ sizeGripOption.init(this);
+ sizeGripOption.corner = Qt::BottomRightCorner;
+ style()->drawControl(QStyle::CE_SizeGrip, &sizeGripOption, &painter, this);
}
void QtGridSelectionDialog::showEvent(QShowEvent*) {