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

*** empty log message ***

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