Skip to content
Snippets Groups Projects
Commit 2e078b61 authored by jpbl's avatar jpbl
Browse files

*** empty log message ***

parent 079cad67
Branches
No related tags found
No related merge requests found
...@@ -23,7 +23,6 @@ ...@@ -23,7 +23,6 @@
#include <QEvent> #include <QEvent>
#include <QMouseEvent> #include <QMouseEvent>
#include <QPixmap>
#include "JPushButton.hpp" #include "JPushButton.hpp"
...@@ -33,29 +32,26 @@ JPushButton::JPushButton(const QPixmap &released, ...@@ -33,29 +32,26 @@ JPushButton::JPushButton(const QPixmap &released,
Qt::WFlags flags) Qt::WFlags flags)
: QLabel(parent, flags) : QLabel(parent, flags)
{ {
mImages[0] = new QPixmap(released); mImages[0] = released;
mImages[1] = new QPixmap(pressed); mImages[1] = pressed;
release(); release();
} }
JPushButton::~JPushButton() JPushButton::~JPushButton()
{ {}
delete mImages[0];
delete mImages[1];
}
void void
JPushButton::release() JPushButton::release()
{ {
resize(mImages[0]->size()); resize(mImages[0].size());
setPixmap (*mImages[0]); setPixmap (mImages[0]);
} }
void void
JPushButton::press() JPushButton::press()
{ {
resize(mImages[1]->size()); resize(mImages[1].size());
setPixmap (*mImages[1]); setPixmap (mImages[1]);
} }
// Mouse button released // Mouse button released
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#define __J_PUSH_BUTTON_H__ #define __J_PUSH_BUTTON_H__
#include <QLabel> #include <QLabel>
#include <QPixmap>
/** /**
* This class Emulate a PushButton but takes two * This class Emulate a PushButton but takes two
...@@ -49,7 +50,7 @@ private: ...@@ -49,7 +50,7 @@ private:
private: private:
QPixmap* mImages[2]; QPixmap mImages[2];
protected: protected:
void mousePressEvent(QMouseEvent *); void mousePressEvent(QMouseEvent *);
...@@ -58,6 +59,7 @@ protected: ...@@ -58,6 +59,7 @@ protected:
signals: signals:
void clicked(void); void clicked(void);
}; };
#endif // defined(__J_PUSH_BUTTON_H__) #endif // defined(__J_PUSH_BUTTON_H__)
...@@ -13,8 +13,6 @@ SFLPhoneWindow::SFLPhoneWindow() ...@@ -13,8 +13,6 @@ SFLPhoneWindow::SFLPhoneWindow()
: QMainWindow(NULL, 0) : QMainWindow(NULL, 0)
// Qt::FramelessWindowHint) // Qt::FramelessWindowHint)
{ {
setAttribute(Qt::WA_DeleteOnClose);
QLabel *l = new QLabel(this); QLabel *l = new QLabel(this);
QPixmap main(":/images/main-img.png"); QPixmap main(":/images/main-img.png");
l->setPixmap(main); l->setPixmap(main);
...@@ -24,6 +22,11 @@ SFLPhoneWindow::SFLPhoneWindow() ...@@ -24,6 +22,11 @@ SFLPhoneWindow::SFLPhoneWindow()
initLineButtons(); initLineButtons();
} }
SFLPhoneWindow::~SFLPhoneWindow()
{
int i = 0;
i++;
}
void void
SFLPhoneWindow::initLineButtons() SFLPhoneWindow::initLineButtons()
...@@ -32,6 +35,7 @@ SFLPhoneWindow::initLineButtons() ...@@ -32,6 +35,7 @@ SFLPhoneWindow::initLineButtons()
int ypos = 151; int ypos = 151;
int offset = 31; int offset = 31;
for(int i = 0; i < NBLINES; i++) { for(int i = 0; i < NBLINES; i++) {
std::cout << i << std::endl;
JPushButton *line = new JPushButton(QPixmap(QString(":/images/line") + JPushButton *line = new JPushButton(QPixmap(QString(":/images/line") +
QString::number(i + 1) + QString::number(i + 1) +
"off-img.png"), "off-img.png"),
......
...@@ -8,6 +8,7 @@ class SFLPhoneWindow : public QMainWindow ...@@ -8,6 +8,7 @@ class SFLPhoneWindow : public QMainWindow
{ {
public: public:
SFLPhoneWindow(); SFLPhoneWindow();
~SFLPhoneWindow();
void initLineButtons(); void initLineButtons();
......
#ifndef SFLPHONE_GLOBAL_H
#define SFLPHONE_GLOBAL_H
#define PROGNAME "SFLPhone"
#define VERSION "0.4.2"
#endif
...@@ -6,10 +6,10 @@ TEMPLATE = app ...@@ -6,10 +6,10 @@ TEMPLATE = app
TARGET += TARGET +=
DEPENDPATH += . DEPENDPATH += .
INCLUDEPATH += . INCLUDEPATH += .
# Input # Input
HEADERS += JPushButton.hpp \ HEADERS += JPushButton.hpp \
SFLPhoneWindow.hpp SFLPhoneWindow.hpp \
globals.h
SOURCES += main.cpp \ SOURCES += main.cpp \
JPushButton.cpp \ JPushButton.cpp \
SFLPhoneWindow.cpp SFLPhoneWindow.cpp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment