diff options
author | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-03-15 12:10:36 (GMT) |
---|---|---|
committer | Miikka Heikkinen <miikka.heikkinen@digia.com> | 2010-03-16 08:35:42 (GMT) |
commit | ad20768753905dcec196fe0a8e35fb832c0f3256 (patch) | |
tree | 2c4608a54243e2e8f8a2187b36f36912f17ba9ea /demos | |
parent | 42a70e989ecaebaf5e044c611ae2e22bca1507e0 (diff) | |
download | Qt-ad20768753905dcec196fe0a8e35fb832c0f3256.zip Qt-ad20768753905dcec196fe0a8e35fb832c0f3256.tar.gz Qt-ad20768753905dcec196fe0a8e35fb832c0f3256.tar.bz2 |
Added close button to Anomaly demo browser
Part of QtP delta reduction effort, original task: QTTH-52
Reviewed-by: Janne Anttila
Diffstat (limited to 'demos')
-rw-r--r-- | demos/embedded/anomaly/src/BrowserView.cpp | 1 | ||||
-rw-r--r-- | demos/embedded/anomaly/src/ControlStrip.cpp | 15 | ||||
-rw-r--r-- | demos/embedded/anomaly/src/ControlStrip.h | 2 | ||||
-rw-r--r-- | demos/embedded/anomaly/src/anomaly.qrc | 1 | ||||
-rw-r--r-- | demos/embedded/anomaly/src/images/button-close.png | bin | 0 -> 1833 bytes |
5 files changed, 16 insertions, 3 deletions
diff --git a/demos/embedded/anomaly/src/BrowserView.cpp b/demos/embedded/anomaly/src/BrowserView.cpp index 0945b89..41318ad 100644 --- a/demos/embedded/anomaly/src/BrowserView.cpp +++ b/demos/embedded/anomaly/src/BrowserView.cpp @@ -82,6 +82,7 @@ void BrowserView::initialize() connect(m_controlStrip, SIGNAL(menuClicked()), SIGNAL(menuButtonClicked())); connect(m_controlStrip, SIGNAL(backClicked()), m_webView, SLOT(back())); connect(m_controlStrip, SIGNAL(forwardClicked()), m_webView, SLOT(forward())); + connect(m_controlStrip, SIGNAL(closeClicked()), qApp, SLOT(quit())); QPalette pal = m_webView->palette(); pal.setBrush(QPalette::Base, Qt::white); diff --git a/demos/embedded/anomaly/src/ControlStrip.cpp b/demos/embedded/anomaly/src/ControlStrip.cpp index 265d9a0..dc6d5c2 100644 --- a/demos/embedded/anomaly/src/ControlStrip.cpp +++ b/demos/embedded/anomaly/src/ControlStrip.cpp @@ -50,6 +50,7 @@ ControlStrip::ControlStrip(QWidget *parent) menuPixmap.load(":/images/edit-find.png"); backPixmap.load(":/images/go-previous.png"); forwardPixmap.load(":/images/go-next.png"); + closePixmap.load(":/images/button-close.png"); } QSize ControlStrip::sizeHint() const @@ -74,12 +75,18 @@ void ControlStrip::mousePressEvent(QMouseEvent *event) } if (x > width() - h) { - emit forwardClicked(); + emit closeClicked(); event->accept(); return; } if ((x < width() - 2 * h) && (x > width() - 3 * h)) { + emit forwardClicked(); + event->accept(); + return; + } + + if ((x < width() - 3 * h) && (x > width() - 5 * h)) { emit backClicked(); event->accept(); return; @@ -95,7 +102,9 @@ void ControlStrip::paintEvent(QPaintEvent *event) p.fillRect(event->rect(), QColor(32, 32, 32, 192)); p.setCompositionMode(QPainter::CompositionMode_SourceOver); p.drawPixmap(s, s, menuPixmap); - p.drawPixmap(width() - 3 * h + s, s, backPixmap); - p.drawPixmap(width() - h + s, s, forwardPixmap); + p.drawPixmap(width() - h + s, s, closePixmap); + p.drawPixmap(width() - 3 * h + s, s, forwardPixmap); + p.drawPixmap(width() - 5 * h + s, s, backPixmap); + p.end(); } diff --git a/demos/embedded/anomaly/src/ControlStrip.h b/demos/embedded/anomaly/src/ControlStrip.h index bbaea87..b6003a1 100644 --- a/demos/embedded/anomaly/src/ControlStrip.h +++ b/demos/embedded/anomaly/src/ControlStrip.h @@ -58,6 +58,7 @@ signals: void menuClicked(); void backClicked(); void forwardClicked(); + void closeClicked(); protected: void paintEvent(QPaintEvent *event); @@ -67,6 +68,7 @@ private: QPixmap menuPixmap; QPixmap backPixmap; QPixmap forwardPixmap; + QPixmap closePixmap; }; #endif // CONTROLSTRIP_H diff --git a/demos/embedded/anomaly/src/anomaly.qrc b/demos/embedded/anomaly/src/anomaly.qrc index 601a34e..d8ea630 100644 --- a/demos/embedded/anomaly/src/anomaly.qrc +++ b/demos/embedded/anomaly/src/anomaly.qrc @@ -5,5 +5,6 @@ <file>images/edit-find.png</file> <file>images/list-add.png</file> <file>images/list-remove.png</file> + <file>images/button-close.png</file> </qresource> </RCC> diff --git a/demos/embedded/anomaly/src/images/button-close.png b/demos/embedded/anomaly/src/images/button-close.png Binary files differnew file mode 100644 index 0000000..7a7b048 --- /dev/null +++ b/demos/embedded/anomaly/src/images/button-close.png |