| |   |
| 37 | 37 | int main(int argc, char **argv) |
| 38 | 38 | { |
| 39 | 39 | QApplication app(argc, argv); |
| 40 | | app.setApplicationName("Example 2"); |
| 40 | app.setApplicationName("Player"); |
| 41 | 41 | |
| 42 | 42 | SIF::MainWindow mw; |
| 43 | 43 | mw.setWindowFlags(mw.windowFlags() | Qt::FramelessWindowHint); |
| 44 | 44 | QObject::connect(&mw, SIGNAL(titleClicked()), qApp, SLOT(aboutQt())); |
| 45 | 45 | |
| 46 | mw.addPage("View", new QGraphicsView); |
| 47 | |
| 48 | |
| 46 | 49 | SIF::View *view1 = new SIF::View; |
| 47 | | view1->addPage("Calendar", new QCalendarWidget); |
| 48 | | view1->addPage("Table", new QTableWidget(10, 10)); |
| 50 | view1->addPage("Collection", new QCalendarWidget); |
| 51 | view1->addPage("Information", new QTableWidget(10, 10)); |
| 49 | 52 | |
| 50 | | mw.addPage("Data", view1); |
| 53 | mw.addPage("Music", view1); |
| 51 | 54 | |
| 52 | 55 | |
| 53 | 56 | SIF::View *view2 = new SIF::View; |
| 54 | | view2->addPage("Editor", new QTextEdit("An editor")); |
| 55 | | view2->addPage("Dial", new QDial); |
| 57 | view2->addPage("Collection", new QTextEdit("An editor")); |
| 58 | view2->addPage("Information", new QDial); |
| 56 | 59 | |
| 57 | 60 | QGraphicsView *qgv = new QGraphicsView; |
| 58 | 61 | qgv->setRenderHints(QPainter::Antialiasing); |
| … | … | |
| 68 | 68 | view2->addPage("Graphics", qgv); |
| 69 | 69 | |
| 70 | 70 | |
| 71 | | mw.addPage("View", view2); |
| 71 | mw.addPage("Video", view2); |
| 72 | 72 | |
| 73 | 73 | |
| 74 | 74 | QObject::connect(mw.addButton("Quit"), SIGNAL(clicked()), &app, SLOT(closeAllWindows())); |
| toggle raw diff |
--- a/examples/frameless/main.cpp
+++ b/examples/frameless/main.cpp
@@ -37,22 +37,25 @@
int main(int argc, char **argv)
{
QApplication app(argc, argv);
- app.setApplicationName("Example 2");
+ app.setApplicationName("Player");
SIF::MainWindow mw;
mw.setWindowFlags(mw.windowFlags() | Qt::FramelessWindowHint);
QObject::connect(&mw, SIGNAL(titleClicked()), qApp, SLOT(aboutQt()));
+ mw.addPage("View", new QGraphicsView);
+
+
SIF::View *view1 = new SIF::View;
- view1->addPage("Calendar", new QCalendarWidget);
- view1->addPage("Table", new QTableWidget(10, 10));
+ view1->addPage("Collection", new QCalendarWidget);
+ view1->addPage("Information", new QTableWidget(10, 10));
- mw.addPage("Data", view1);
+ mw.addPage("Music", view1);
SIF::View *view2 = new SIF::View;
- view2->addPage("Editor", new QTextEdit("An editor"));
- view2->addPage("Dial", new QDial);
+ view2->addPage("Collection", new QTextEdit("An editor"));
+ view2->addPage("Information", new QDial);
QGraphicsView *qgv = new QGraphicsView;
qgv->setRenderHints(QPainter::Antialiasing);
@@ -65,7 +68,7 @@ int main(int argc, char **argv)
view2->addPage("Graphics", qgv);
- mw.addPage("View", view2);
+ mw.addPage("Video", view2);
QObject::connect(mw.addButton("Quit"), SIGNAL(clicked()), &app, SLOT(closeAllWindows())); |
| |   |
| 20 | 20 | |
| 21 | 21 | #include "footerwidget.h" |
| 22 | 22 | #include "headerwidget.h" |
| 23 | #include "buttonarea.h" |
| 24 | #include "aerobutton.h" |
| 23 | 25 | |
| 24 | 26 | #include "mainwindow.h" |
| 25 | 27 | |
| 26 | 28 | #include <QApplication> |
| 27 | 29 | #include <QMouseEvent> |
| 30 | #include <QHBoxLayout> |
| 28 | 31 | |
| 29 | 32 | namespace SIFPrivate { |
| 30 | 33 | |
| … | … | |
| 35 | 35 | : QWidget(parent), m_header(header), m_dragging(false) |
| 36 | 36 | { |
| 37 | 37 | setAutoFillBackground(true); |
| 38 | |
| 39 | m_buttonArea = new ButtonArea; |
| 40 | |
| 41 | QHBoxLayout *layout = new QHBoxLayout; |
| 42 | layout->addStretch(1); |
| 43 | layout->addWidget(m_buttonArea); |
| 44 | layout->addStretch(1); |
| 38 | 45 | } |
| 39 | 46 | |
| 40 | 47 | |
| … | … | |
| 57 | 57 | setPalette(palette); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | SIF::AeroButton *FooterWidget::addButton(const QString &title, const QIcon &icon) |
| 61 | { |
| 62 | SIF::AeroButton *button = m_buttonArea->addButton(title, icon); |
| 63 | button->setIconSize(QSize(22,22)); |
| 64 | |
| 65 | return button; |
| 66 | } |
| 67 | |
| 60 | 68 | void FooterWidget::resizeEvent(QResizeEvent *e) |
| 61 | 69 | { |
| 62 | 70 | QWidget::resizeEvent(e); |
| toggle raw diff |
--- a/src/sif/private/footerwidget.cpp
+++ b/src/sif/private/footerwidget.cpp
@@ -20,11 +20,14 @@
#include "footerwidget.h"
#include "headerwidget.h"
+#include "buttonarea.h"
+#include "aerobutton.h"
#include "mainwindow.h"
#include <QApplication>
#include <QMouseEvent>
+#include <QHBoxLayout>
namespace SIFPrivate {
@@ -32,6 +35,13 @@ FooterWidget::FooterWidget(HeaderWidget *header, QWidget *parent)
: QWidget(parent), m_header(header), m_dragging(false)
{
setAutoFillBackground(true);
+
+ m_buttonArea = new ButtonArea;
+
+ QHBoxLayout *layout = new QHBoxLayout;
+ layout->addStretch(1);
+ layout->addWidget(m_buttonArea);
+ layout->addStretch(1);
}
@@ -47,6 +57,14 @@ void FooterWidget::setBackground(const QBrush &background)
setPalette(palette);
}
+SIF::AeroButton *FooterWidget::addButton(const QString &title, const QIcon &icon)
+{
+ SIF::AeroButton *button = m_buttonArea->addButton(title, icon);
+ button->setIconSize(QSize(22,22));
+
+ return button;
+}
+
void FooterWidget::resizeEvent(QResizeEvent *e)
{
QWidget::resizeEvent(e); |
| |   |
| 21 | 21 | #define SIFPRIVATEFOOTERWIDGET_H |
| 22 | 22 | |
| 23 | 23 | #include <QWidget> |
| 24 | #include <QIcon> |
| 25 | |
| 26 | namespace SIF { |
| 27 | class AeroButton; |
| 28 | } |
| 24 | 29 | |
| 25 | 30 | namespace SIFPrivate { |
| 26 | 31 | class HeaderWidget; |
| 32 | class ButtonArea; |
| 27 | 33 | |
| 28 | 34 | /** |
| 29 | 35 | @author David Cuadrado <krawek@gmail.com> |
| … | … | |
| 43 | 43 | |
| 44 | 44 | void setBackground(const QBrush &background); |
| 45 | 45 | |
| 46 | SIF::AeroButton *addButton(const QString &title, const QIcon &icon = QIcon()); |
| 47 | |
| 46 | 48 | protected: |
| 47 | 49 | void resizeEvent(QResizeEvent *e); |
| 48 | 50 | virtual void mousePressEvent(QMouseEvent *e); |
| … | … | |
| 52 | 52 | virtual void mouseReleaseEvent(QMouseEvent *e); |
| 53 | 53 | |
| 54 | 54 | private: |
| 55 | ButtonArea *m_buttonArea; |
| 55 | 56 | HeaderWidget *m_header; |
| 56 | 57 | QPoint m_dragPosition; |
| 57 | 58 | bool m_dragging; |
| toggle raw diff |
--- a/src/sif/private/footerwidget.h
+++ b/src/sif/private/footerwidget.h
@@ -21,9 +21,15 @@
#define SIFPRIVATEFOOTERWIDGET_H
#include <QWidget>
+#include <QIcon>
+
+namespace SIF {
+ class AeroButton;
+}
namespace SIFPrivate {
class HeaderWidget;
+class ButtonArea;
/**
@author David Cuadrado <krawek@gmail.com>
@@ -37,6 +43,8 @@ class FooterWidget : public QWidget
void setBackground(const QBrush &background);
+ SIF::AeroButton *addButton(const QString &title, const QIcon &icon = QIcon());
+
protected:
void resizeEvent(QResizeEvent *e);
virtual void mousePressEvent(QMouseEvent *e);
@@ -44,6 +52,7 @@ class FooterWidget : public QWidget
virtual void mouseReleaseEvent(QMouseEvent *e);
private:
+ ButtonArea *m_buttonArea;
HeaderWidget *m_header;
QPoint m_dragPosition;
bool m_dragging; |