Initial Upload
This commit is contained in:
parent
f4e6c4723c
commit
b191076510
33
customSplashScreen.cpp
Normal file
33
customSplashScreen.cpp
Normal file
@ -0,0 +1,33 @@
|
||||
#include "customSplashScreen.h"
|
||||
|
||||
customSplashScreen::customSplashScreen(const QPixmap& pixmap)
|
||||
{
|
||||
QSplashScreen::setPixmap(pixmap);
|
||||
}
|
||||
|
||||
customSplashScreen::~customSplashScreen()
|
||||
{
|
||||
}
|
||||
|
||||
void customSplashScreen::drawContents(QPainter *painter)
|
||||
{
|
||||
QPixmap textPix = QSplashScreen::pixmap();
|
||||
painter->setPen(this->color);
|
||||
painter->drawText(this->rect, this->alignement, this->message);
|
||||
}
|
||||
|
||||
void customSplashScreen::showStatusMessage(const QString &message, const QColor &color)
|
||||
{
|
||||
this->message = message;
|
||||
this->color = color;
|
||||
this->showMessage(this->message, this->alignement, this->color);
|
||||
}
|
||||
|
||||
void customSplashScreen::setMessageRect(QRect rect, int alignement)
|
||||
{
|
||||
this->rect = rect;
|
||||
this->alignement = alignement;
|
||||
}
|
||||
|
||||
|
||||
|
22
customSplashScreen.h
Normal file
22
customSplashScreen.h
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef CUSTOMSPLASHSCREEN_H
|
||||
#define CUSTOMSPLASHSCREEN_H
|
||||
|
||||
#include <QSplashScreen>
|
||||
#include <QPainter>
|
||||
|
||||
class customSplashScreen : public QSplashScreen
|
||||
{
|
||||
public:
|
||||
customSplashScreen(const QPixmap& pixmap);
|
||||
~customSplashScreen();
|
||||
virtual void drawContents(QPainter *painter);
|
||||
void showStatusMessage(const QString &message, const QColor &color = Qt::black);
|
||||
void setMessageRect(QRect rect, int alignment = Qt::AlignLeft);
|
||||
private:
|
||||
QString message;
|
||||
int alignement;
|
||||
QColor color;
|
||||
QRect rect;
|
||||
};
|
||||
|
||||
#endif // CUSTOMSPLASHSCREEN_H
|
99
dialogshowpic.cpp
Normal file
99
dialogshowpic.cpp
Normal file
@ -0,0 +1,99 @@
|
||||
#include "dialogshowpic.h"
|
||||
#include "ui_dialogshowpic.h"
|
||||
|
||||
#include "qcustomplot.h"
|
||||
#include "mainwindow.h"
|
||||
#include "Toolkit.h"
|
||||
|
||||
DialogShowPic::DialogShowPic(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::DialogShowPic)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
setupShowGraph(ui->widget);
|
||||
}
|
||||
|
||||
int number=1;
|
||||
|
||||
void DialogShowPic::setupShowGraph(QCustomPlot *customPlot)
|
||||
{
|
||||
TMatrixF matrix = MainWindow::getTMatrix(number);
|
||||
// TMatrixF matrix(1,1);
|
||||
|
||||
QCPColorMap *colorMap = new QCPColorMap(customPlot->xAxis,customPlot->yAxis);
|
||||
customPlot->axisRect()->setupFullAxesBox(true);
|
||||
customPlot->xAxis->setLabel("x [pixel]");
|
||||
customPlot->yAxis->setLabel("y [pixel]");
|
||||
|
||||
//customPlot->addPlottable(colorMap);
|
||||
colorMap->data()->setSize(matrix.GetColUpb(), matrix.GetColUpb());
|
||||
colorMap->data()->setRange(QCPRange(0, matrix.GetColUpb()), QCPRange(0, matrix.GetColUpb()));
|
||||
|
||||
for (int x=0; x<matrix.GetColUpb(); ++x)
|
||||
for (int y=0; y<matrix.GetColUpb(); ++y)
|
||||
colorMap->data()->setCell(x, y, matrix(x,y));
|
||||
colorMap->setGradient(QCPColorGradient::gpJet);
|
||||
colorMap->rescaleDataRange(true);
|
||||
customPlot->rescaleAxes();
|
||||
colorMap->setDataRange(QCPRange(0,256));
|
||||
customPlot->replot();
|
||||
}
|
||||
|
||||
|
||||
DialogShowPic::~DialogShowPic()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void DialogShowPic::replotGraph()
|
||||
{
|
||||
TMatrixF matrix = MainWindow::getTMatrix(number);
|
||||
|
||||
ui->widget->clearPlottables();
|
||||
|
||||
ui->widget->xAxis->setRange(QCPRange(0, matrix.GetColUpb()));
|
||||
ui->widget->yAxis->setRange(QCPRange(0, matrix.GetColUpb()));
|
||||
QCPColorMap *colorMap = new QCPColorMap( ui->widget->xAxis, ui->widget->yAxis);
|
||||
|
||||
Int_t a = matrix.GetColUpb();
|
||||
Int_t b = matrix.GetNcols();
|
||||
//cout<<castIntToString(a)<<" "<<castIntToString(b)<<endl;
|
||||
// ui->widget->addPlottable(colorMap);
|
||||
|
||||
colorMap->data()->setSize(matrix.GetNcols(), matrix.GetNcols());
|
||||
colorMap->data()->setRange(QCPRange(0, matrix.GetColUpb()), QCPRange(0, matrix.GetColUpb()));
|
||||
|
||||
for (int x=0; x<matrix.GetColUpb(); ++x)
|
||||
for (int y=0; y<matrix.GetColUpb(); ++y)
|
||||
colorMap->data()->setCell(x, y, matrix(x,y));
|
||||
colorMap->setGradient(QCPColorGradient::gpCold);
|
||||
colorMap->rescaleDataRange(true);
|
||||
ui->widget->rescaleAxes();
|
||||
colorMap->setDataRange(QCPRange(0,256));
|
||||
ui->widget->replot();
|
||||
}
|
||||
|
||||
void DialogShowPic::on_pushButtonPlus_clicked()
|
||||
{
|
||||
number++;
|
||||
|
||||
int newInt = number+1;
|
||||
string numberString = castIntToString(newInt);
|
||||
ui->labelNo->setText(QString::fromStdString(numberString));
|
||||
replotGraph();
|
||||
}
|
||||
|
||||
void DialogShowPic::on_pushButtonMinus_clicked()
|
||||
{
|
||||
if (number>0)
|
||||
{
|
||||
number--;
|
||||
int newInt = number+1;
|
||||
string numberString = castIntToString(newInt);
|
||||
ui->labelNo->setText(QString::fromStdString(numberString));
|
||||
replotGraph();
|
||||
}
|
||||
}
|
||||
|
||||
|
32
dialogshowpic.h
Normal file
32
dialogshowpic.h
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef DIALOGSHOWPIC_H
|
||||
#define DIALOGSHOWPIC_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "qcustomplot.h"
|
||||
//#include "mainwindow.h"
|
||||
|
||||
namespace Ui {
|
||||
class DialogShowPic;
|
||||
}
|
||||
|
||||
class DialogShowPic : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogShowPic(QWidget *parent = 0);
|
||||
~DialogShowPic();
|
||||
|
||||
void setupShowGraph(QCustomPlot *customPlot);
|
||||
void replotGraph();
|
||||
|
||||
private slots:
|
||||
void on_pushButtonPlus_clicked();
|
||||
|
||||
void on_pushButtonMinus_clicked();
|
||||
|
||||
private:
|
||||
Ui::DialogShowPic *ui;
|
||||
};
|
||||
|
||||
#endif // DIALOGSHOWPIC_H
|
Loading…
Reference in New Issue
Block a user