Doorcontrol1 is a QDialog in which I need to show that image and lines.
main.cpp
#include <QtGui/QApplication>
#include <QtCore>
#include "bifold.h"
int main(int argc, char *argv[])
{
BiFold w;
w.show();
return a.exec();
}
#include <QtGui/QApplication>
#include <QtCore>
#include "bifold.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
BiFold w;
w.show();
return a.exec();
}
To copy to clipboard, switch view to plain text mode
bifold.h
#ifndef BIFOLD_H
#define BIFOLD_H
#include <QMainWindow>
namespace Ui {
class BiFold;
}
class DoorControl1;
Q_OBJECT
public:
~BiFold();
DoorControl1 *ODoorControl1;
protected:
private:
Ui::BiFold *ui;
};
#endif // BIFOLD_H
#ifndef BIFOLD_H
#define BIFOLD_H
#include <QMainWindow>
namespace Ui {
class BiFold;
}
class DoorControl1;
class BiFold : public QMainWindow {
Q_OBJECT
public:
BiFold(QWidget *parent = 0);
~BiFold();
DoorControl1 *ODoorControl1;
protected:
void changeEvent(QEvent *e);
private:
Ui::BiFold *ui;
};
#endif // BIFOLD_H
To copy to clipboard, switch view to plain text mode
bifold.cpp
#include "bifold.h"
#include "ui_bifold.h"
#include "doorcontrol1.h"
#include <QMessageBox>
ui(new Ui::BiFold)
{
ui->setupUi(this);
removeToolBar(ui->mainToolBar); //Removes tool bar from main window
ODoorControl1 = new DoorControl1(this);
ODoorControl1->setWindowFlags( Qt::FramelessWindowHint );
}
BiFold::~BiFold()
{
delete ui;
}
void BiFold
::changeEvent(QEvent *e
) {
switch (e->type()) {
ui->retranslateUi(this);
break;
default:
break;
}
}
#include "bifold.h"
#include "ui_bifold.h"
#include "doorcontrol1.h"
#include <QMessageBox>
BiFold::BiFold(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::BiFold)
{
ui->setupUi(this);
removeToolBar(ui->mainToolBar); //Removes tool bar from main window
ODoorControl1 = new DoorControl1(this);
ODoorControl1->setWindowFlags( Qt::FramelessWindowHint );
}
BiFold::~BiFold()
{
delete ui;
}
void BiFold::changeEvent(QEvent *e)
{
QMainWindow::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
To copy to clipboard, switch view to plain text mode
doorcontrol1.h
#ifndef DOORCONTROL1_H
#define DOORCONTROL1_H
#include <QDialog>
namespace Ui {
class DoorControl1;
}
class DoorControl1
: public QDialog { Q_OBJECT
public:
~DoorControl1();
void DrawStuff();
protected:
private:
Ui::DoorControl1 *ui;
};
#endif // DOORCONTROL1_H
#ifndef DOORCONTROL1_H
#define DOORCONTROL1_H
#include <QDialog>
namespace Ui {
class DoorControl1;
}
class DoorControl1 : public QDialog {
Q_OBJECT
public:
DoorControl1(QWidget *parent = 0);
~DoorControl1();
void DrawStuff();
protected:
void changeEvent(QEvent *e);
void paintEvent(QPaintEvent *event);
private:
Ui::DoorControl1 *ui;
};
#endif // DOORCONTROL1_H
To copy to clipboard, switch view to plain text mode
doorcontrol1.cpp
#include <QtGui>
#include <QtCore>
#include <QMessageBox>
#include "doorcontrol1.h"
#include "ui_doorcontrol1.h"
DoorControl1
::DoorControl1(QWidget *parent
) : ui(new Ui::DoorControl1)
{
ui->setupUi(this);
DrawStuff();
}
DoorControl1::~DoorControl1()
{
delete ui;
}
void DoorControl1
::changeEvent(QEvent *e
) {
switch (e->type()) {
ui->retranslateUi(this);
break;
default:
break;
}
}
{
}
void DoorControl1::DrawStuff()
{
ui
->lbl_plane
->setGeometry
(QRect(100,
150,
611,
301));
pixmap.
load(QString::fromUtf8(":/BiFold/Images/Plane.PNG"));
ui->lbl_plane->resize(pixmap.size());
painter.setPen(Red);
painter.drawLine(250,300,500,300);
painter.end();
ui->lbl_plane->setPixmap(pixmap);
ui->lbl_plane->show();
}
#include <QtGui>
#include <QtCore>
#include <QMessageBox>
#include "doorcontrol1.h"
#include "ui_doorcontrol1.h"
DoorControl1::DoorControl1(QWidget *parent) :
QDialog(parent),
ui(new Ui::DoorControl1)
{
ui->setupUi(this);
DrawStuff();
}
DoorControl1::~DoorControl1()
{
delete ui;
}
void DoorControl1::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
default:
break;
}
}
void DoorControl1::paintEvent(QPaintEvent *event )
{
}
void DoorControl1::DrawStuff()
{
ui->lbl_plane->setGeometry(QRect(100,150,611,301));
QPixmap pixmap(500,500);
pixmap.load(QString::fromUtf8(":/BiFold/Images/Plane.PNG"));
QPainter painter(&pixmap);
ui->lbl_plane->resize(pixmap.size());
QPen Red((QColor::QColor(255,0,0)),1);
painter.setPen(Red);
painter.drawLine(250,300,500,300);
painter.end();
ui->lbl_plane->setPixmap(pixmap);
ui->lbl_plane->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks