Hey!
I'm trying to connect the buttons on my form to the some slots that I have created in my subclassed form. Basically I'm not sure that the connection is happening to make the actions I need to happen...happen.
Right now it just changes a pixmap from one image to another. Both images are present...but nothing appears to happen here's my code.
Here's the class containing the UI form
#ifndef DECKSIMULATOR_H
#define DECKSIMULATOR_H
#include <QtGui/QMainWindow>
#include "ui_simulator.h"
{
Q_OBJECT
public:
~DeckSimulator();
private:
Ui::MainWindow ui;
private slots:
void startpump_TP();
void stoppump_TP();
void startpump_DP();
void stoppump_DP();
void startpump_ACP();
void stoppump_ACP();
void startpump_RP();
void stoppump_RP();
};
#endif
#ifndef DECKSIMULATOR_H
#define DECKSIMULATOR_H
#include <QtGui/QMainWindow>
#include "ui_simulator.h"
class DeckSimulator : public QMainWindow
{
Q_OBJECT
public:
DeckSimulator(QMainWindow *parent = 0);
~DeckSimulator();
private:
Ui::MainWindow ui;
private slots:
void startpump_TP();
void stoppump_TP();
void startpump_DP();
void stoppump_DP();
void startpump_ACP();
void stoppump_ACP();
void startpump_RP();
void stoppump_RP();
};
#endif
To copy to clipboard, switch view to plain text mode
here's the cpp
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <QtGui>
#include <QtDebug>
#include "simulator.h"
{
// Setup the GUI
ui.setupUi(this);
// Connect to GUI signals
connect(ui.btnStart_TP, SIGNAL(clicked()), this, SLOT(startpump_TP()));
connect(ui.btnStop_TP, SIGNAL(clicked()), this, SLOT(stoppump_TP()));
}
// Destructor
DeckSimulator::~DeckSimulator()
{
}
void DeckSimulator::startpump_TP()
{
ui.pixTransferPump->setText("Hello");
ui.pixTransferPump->setPixmap(pixmap);
}
void DeckSimulator::stoppump_TP()
{
ui.pixTransferPump->setText("Goodbye");
ui.pixTransferPump->setPixmap(pixmap);
}
void DeckSimulator::startpump_DP()
{
}
void DeckSimulator::stoppump_DP()
{
}
void DeckSimulator::startpump_ACP()
{
}
void DeckSimulator::stoppump_ACP()
{
}
void DeckSimulator::startpump_RP()
{
}
void DeckSimulator::stoppump_RP()
{
}
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <QtGui>
#include <QtDebug>
#include "simulator.h"
DeckSimulator::DeckSimulator(QMainWindow *parent)
: QMainWindow(parent)
{
// Setup the GUI
ui.setupUi(this);
// Connect to GUI signals
connect(ui.btnStart_TP, SIGNAL(clicked()), this, SLOT(startpump_TP()));
connect(ui.btnStop_TP, SIGNAL(clicked()), this, SLOT(stoppump_TP()));
}
// Destructor
DeckSimulator::~DeckSimulator()
{
}
void DeckSimulator::startpump_TP()
{
ui.pixTransferPump->setText("Hello");
QPixmap pixmap(QString::fromUtf8("pump_start_image_100.png"));
ui.pixTransferPump->setPixmap(pixmap);
}
void DeckSimulator::stoppump_TP()
{
ui.pixTransferPump->setText("Goodbye");
QPixmap pixmap(QString::fromUtf8("pump_stop_image_100.png"));
ui.pixTransferPump->setPixmap(pixmap);
}
void DeckSimulator::startpump_DP()
{
}
void DeckSimulator::stoppump_DP()
{
}
void DeckSimulator::startpump_ACP()
{
}
void DeckSimulator::stoppump_ACP()
{
}
void DeckSimulator::startpump_RP()
{
}
void DeckSimulator::stoppump_RP()
{
}
To copy to clipboard, switch view to plain text mode
I've tried setting the text to change...but nothing happens...I've tried the images...nothing happens.
I'm out of ideas!
Bookmarks