summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/QtVCardWidget/QtCloseButton.cpp')
-rw-r--r--Swift/QtUI/QtVCardWidget/QtCloseButton.cpp40
1 files changed, 23 insertions, 17 deletions
diff --git a/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp b/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp
index ebd62bc..da4f22f 100644
--- a/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp
+++ b/Swift/QtUI/QtVCardWidget/QtCloseButton.cpp
@@ -4,7 +4,13 @@
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
-#include "QtCloseButton.h"
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swift/QtUI/QtVCardWidget/QtCloseButton.h>
#include <QMouseEvent>
#include <QPainter>
@@ -18,28 +24,28 @@ QtCloseButton::QtCloseButton(QWidget *parent) : QAbstractButton(parent) {
}
QSize QtCloseButton::sizeHint() const {
- return QSize(style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, 0, 0), style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, 0, 0));
+ return QSize(style()->pixelMetric(QStyle::PM_TabCloseIndicatorWidth, nullptr, nullptr), style()->pixelMetric(QStyle::PM_TabCloseIndicatorHeight, nullptr, nullptr));
}
bool QtCloseButton::event(QEvent *e) {
- if (e->type() == QEvent::Enter || e->type() == QEvent::Leave) {
- update();
- }
- return QAbstractButton::event(e);
+ if (e->type() == QEvent::Enter || e->type() == QEvent::Leave) {
+ update();
+ }
+ return QAbstractButton::event(e);
}
void QtCloseButton::paintEvent(QPaintEvent *) {
- QPainter painter(this);
- painter.setRenderHint(QPainter::HighQualityAntialiasing);
- QStyleOption opt;
- opt.init(this);
- opt.state |= QStyle::State_AutoRaise;
- if (underMouse() && !isDown()) {
- opt.state |= QStyle::State_Raised;
- } else if (isDown()) {
- opt.state |= QStyle::State_Sunken;
- }
- style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &painter, this);
+ QPainter painter(this);
+ painter.setRenderHint(QPainter::HighQualityAntialiasing);
+ QStyleOption opt;
+ opt.init(this);
+ opt.state |= QStyle::State_AutoRaise;
+ if (underMouse() && !isDown()) {
+ opt.state |= QStyle::State_Raised;
+ } else if (isDown()) {
+ opt.state |= QStyle::State_Sunken;
+ }
+ style()->drawPrimitive(QStyle::PE_IndicatorTabClose, &opt, &painter, this);
}
}